Skip to content

Commit

Permalink
Add build.docker property
Browse files Browse the repository at this point in the history
  • Loading branch information
jasontedor committed Dec 5, 2018
1 parent 0c2e6ff commit b20be22
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ class BuildPlugin implements Plugin<Project> {
*
* If either of these fail, we fail the build.
*/
final boolean buildDocker
final String buildDockerProperty = System.getProperty("build.docker")
if (buildDockerProperty == null || buildDockerProperty == "true") {
buildDocker = true
} else if (buildDockerProperty == "false") {
buildDocker = false
} else {
throw new IllegalArgumentException(
"expected build.docker to be unset or one of \"true\" or \"false\" but was [" + buildDockerProperty + "]")
}
rootProject.rootProject.ext.buildDocker = buildDocker
rootProject.rootProject.ext.requiresDocker = []
rootProject.gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
// check if the Docker binary exists and record its path
Expand Down Expand Up @@ -299,7 +310,13 @@ class BuildPlugin implements Plugin<Project> {
}
}
}
rootProject.requiresDocker.add(task)
if (rootProject.buildDocker) {
rootProject.requiresDocker.add(task)
} else {
// do not overwrite an existing onlyIf closure
final Closure onlyIf = task.onlyIf
task.onlyIf { onlyIf && false }
}
}

private static String findCompilerJavaHome() {
Expand Down

0 comments on commit b20be22

Please sign in to comment.