Make :localSettings always available, even if it's a noop on subsequent runs. (#2190)

This commit is contained in:
Dawid Weiss 2021-01-08 20:26:35 +01:00 committed by GitHub
parent a7391fb73e
commit 5b734fb94a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 6 deletions

View File

@ -21,12 +21,13 @@
def hasDefaults = rootProject.file("gradle.properties").exists()
// If we don't have the defaults yet, create them.
if (!hasDefaults) {
configure(rootProject) {
task localSettings() {
doFirst {
configure(rootProject) {
task localSettings() {
doFirst {
// If we don't have the defaults yet, create them.
if (hasDefaults) {
logger.lifecycle("Local settings already exist, skipping generation.")
} else {
// Approximate a common-sense default for running gradle/tests with parallel
// workers: half the count of available cpus but not more than 12.
def cpus = Runtime.runtime.availableProcessors()
@ -62,7 +63,9 @@ if (!hasDefaults) {
}
}
}
}
if (!hasDefaults) {
// Make all tasks depend on local setup to make sure it'll run.
allprojects {
tasks.all { task ->