Gradleファイル内でタスクの依存関係のリストを取得して、onlyIf
それらに句を追加したいと思います(タスク依存関係のブランチをオフにすることができます-Gradleで無効なタスクの依存関係の実行をスキップすることに関連していますか?) . これはどのように行うことができますか?
例えば:
def shouldPublish = {
def propertyName = 'publish.dryrun'
!project.hasProperty(propertyName) || project[propertyName] != 'true'
}
subprojects {
publish {
onlyIf shouldPublish
// the following doesn't work;the gist is that publish's dependencies should be turned off, too
dependencies {
onlyIf shouldPublish
}
}
}
次に、コマンドラインで次のことができます。
gradlew -Ppublish.dryrun=true publish