我有以下内容build.gradle
:
def shouldExecute = { taskName ->
def propertyName = "${taskName}.dryrun"
!project.hasProperty(propertyName) || project[propertyName] != 'true'
}
gradle.taskGraph.useFilter({ task ->
println("*********************** ${task.name}: ${shouldExecute(task.name)}")
shouldExecute(task.name)
} as Spec)
但是当我运行时gradlew -Ptest.dryrun=true clean build
,我看不到的输出println
并且test
任务仍在执行。为什么不useFilter
工作?