Browse Source

Ensure that build directory exists before writing

This commit ensures that the build directory exists before writing the
build scan URL to it. This is useful when the `clean` task is executed
and the build folder is gone by the time the execution is done.

See gh-22490
pull/25006/head
Brian Clozel 5 years ago
parent
commit
95f76af19c
  1. 9
      settings.gradle

9
settings.gradle

@ -50,10 +50,13 @@ settings.gradle.projectsLoaded { @@ -50,10 +50,13 @@ settings.gradle.projectsLoaded {
if (settings.gradle.rootProject.hasProperty('customJavaSourceVersion')) {
value("Custom Java Source Version", settings.gradle.rootProject.getProperty('customJavaSourceVersion'))
}
settings.gradle.rootProject.getBuildDir().mkdirs()
new File(settings.gradle.rootProject.getBuildDir(), "build-scan-uri.txt").text = "(build scan not generated)"
File buildDir = settings.gradle.rootProject.getBuildDir()
buildDir.mkdirs()
new File(buildDir, "build-scan-uri.txt").text = "(build scan not generated)"
buildScanPublished { scan ->
new File(settings.gradle.rootProject.getBuildDir(), "build-scan-uri.txt").text = "${scan.buildScanUri}\n"
if (buildDir.exists()) {
new File(buildDir, "build-scan-uri.txt").text = "${scan.buildScanUri}\n"
}
}
}
}

Loading…
Cancel
Save