您也可以使用其他的構(gòu)建腳本配置任意的對象.
例子: 14.5.使用別的腳本配置配置對象
build.gradle
task config << {
def pos = new java.text.FieldPosition(10)
// 使用另一個腳本
apply from: 'other.gradle', to: pos
println pos.beginIndex
println pos.endIndex
}
other.gradle
beginIndex = 1
endIndex = 5
使用 gradle -q configure 輸出
> gradle -q configure
1
5