From a3fb3032d220e067c7ea287de1fabd732f0bcd27 Mon Sep 17 00:00:00 2001 From: Jolanda Verhoef Date: Wed, 24 Aug 2022 17:42:21 +0100 Subject: [PATCH] Only use gradle.properties to read warningsAsErrors --- .github/ci-gradle.properties | 6 +++--- .../com/google/samples/apps/nowinandroid/KotlinAndroid.kt | 8 ++------ 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/ci-gradle.properties b/.github/ci-gradle.properties index 1cd5c8496..bd989705d 100644 --- a/.github/ci-gradle.properties +++ b/.github/ci-gradle.properties @@ -23,6 +23,6 @@ kotlin.compiler.execution.strategy=in-process # Controls KotlinOptions.allWarningsAsErrors. # This value used in CI and is currently set to false. -# If you want to treat warnings as errors locally, set this property -# in local.properties. -warningsAsErrors="false" +# If you want to treat warnings as errors locally, set this property to true +# in your ~/.gradle/gradle.properties file. +warningsAsErrors=false diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt index 9df96c5cb..a0320f2a0 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt @@ -49,13 +49,9 @@ internal fun Project.configureKotlinAndroid( kotlinOptions { // Treat all Kotlin warnings as errors (disabled by default) - // Override locally using local.properties - val localOverrideWarningsAsErrors = gradleLocalProperties(rootDir) - .getProperty("warningsAsErrors")?.toBoolean() - // Set on CI through gradle.properties + // Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties val warningsAsErrors: String? by project - // Prefer local.properties, gradle.properties, or default to false when both are null - allWarningsAsErrors = localOverrideWarningsAsErrors ?: warningsAsErrors.toBoolean() + allWarningsAsErrors = warningsAsErrors.toBoolean() freeCompilerArgs = freeCompilerArgs + listOf( "-opt-in=kotlin.RequiresOptIn",