原文地址 Configuring the project using an external build script
You can configure the current project using an external build script. All of the Gradle build language is available in the external script. You can even apply other scripts from the external script.
Configuring the project using an external build script build.gradle
apply from: 'other.gradle'
other.gradle
println "configuring $project"
task hello << {
println 'hello from other script'
}
Output of gradle -q hello
configuring root project 'configureProjectUsingScript' hello from other script