我希望能够定义变体特定变量。
flavor1{
variable = "thistask"
}
flavor2{
variable = "thattask"
}
然后当我执行它时
./ gradlew aFlavor1
我希望能够将变量读作" thistask"。
我怎样才能做到这一点? 我怎么知道当前正在运行哪个变体任务?
答案 0 :(得分:0)
你的意思是:
$ cat build.gradle
task kobaLory << {
def variable = "thistask"
println "variable = " + variable
}
task loryKoba << {
def variable = "thattask"
println "variable = " + variable
}
输出
$ /cygdrive/c/gradle-1.6/bin/gradle kobaLory loryKob a
:kobaLory
variable = thistask
:loryKoba
variable = thattask
BUILD SUCCESSFUL
Total time: 4.25 secs
$