我正在写gradle中的几个任务,我有一个奇怪的错误.
task buildProduction() {
description 'Build the production version of the app (creates the yaml file)'
copyAndReplaceYaml("Production")
}
task buildStaging() {
description 'Build the staging version of the app (creates the yaml file)'
copyAndReplaceYaml("Staging")
}
Run Code Online (Sandbox Code Playgroud)
当我运行buildStaging时,它工作正常,但是当我运行buildProduction时,就像我正在运行buildStaging.
如果我切换文件中方法的位置buildProduction
工作而不是buildStaging
.
知道为什么会这样吗?
您正在执行副本作为任务配置的一部分,无论命令是什么,执行任务之前都会执行该任务.您需要将两个任务的代码更改为
task buildStaging {
description 'Build the staging version of the app (creates the yaml file)'
}
buildStaging << {
copyAndReplaceYaml("Staging")
}
Run Code Online (Sandbox Code Playgroud)
要么
task buildStaging {
description 'Build the staging version of the app (creates the yaml file)'
doLast {
copyAndReplaceYaml("Staging")
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
266 次 |
最近记录: |