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
This commit is contained in:
parent
7bd524e9d7
commit
95f76af19c
|
|
@ -50,10 +50,13 @@ settings.gradle.projectsLoaded {
|
||||||
if (settings.gradle.rootProject.hasProperty('customJavaSourceVersion')) {
|
if (settings.gradle.rootProject.hasProperty('customJavaSourceVersion')) {
|
||||||
value("Custom Java Source Version", settings.gradle.rootProject.getProperty('customJavaSourceVersion'))
|
value("Custom Java Source Version", settings.gradle.rootProject.getProperty('customJavaSourceVersion'))
|
||||||
}
|
}
|
||||||
settings.gradle.rootProject.getBuildDir().mkdirs()
|
File buildDir = settings.gradle.rootProject.getBuildDir()
|
||||||
new File(settings.gradle.rootProject.getBuildDir(), "build-scan-uri.txt").text = "(build scan not generated)"
|
buildDir.mkdirs()
|
||||||
|
new File(buildDir, "build-scan-uri.txt").text = "(build scan not generated)"
|
||||||
buildScanPublished { scan ->
|
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…
Reference in New Issue