Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ plugins {
alias(libs.plugins.nowinandroid.android.application.jacoco)
alias(libs.plugins.nowinandroid.android.application.firebase)
alias(libs.plugins.nowinandroid.hilt)
alias(libs.plugins.google.osslicenses)
alias(libs.plugins.baselineprofile)
alias(libs.plugins.roborazzi)
alias(libs.plugins.kotlin.serialization)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
apply(plugin = "nowinandroid.android.lint")
apply(plugin = "com.dropbox.dependency-guard")

// Apply Google's OSS Licenses plugin only on CI to avoid breaking configuration cache on local builds
// https://github.com/google/play-services-plugins/issues/246
if (providers.gradleProperty("CI").isPresent) apply(plugin = "com.google.android.gms.oss-licenses-plugin")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While this change correctly intends to apply the OSS licenses plugin only on CI, the use of providers.gradleProperty("CI").isPresent is unfortunately not compatible with Gradle's configuration cache.

According to the Gradle documentation, Provider.isPresent() should not be used. The configuration cache engine cannot track the reason for a property's absence, which prevents it from safely reusing a cached configuration. This will likely cause the configuration cache to be disabled on every local build, negating the benefit of this PR.

A more configuration-cache-friendly approach is to move the conditional logic outside of the build script. For example, you could use a separate init script on your CI server to apply the plugin.

  1. Remove this conditional logic from AndroidApplicationConventionPlugin.kt.
  2. Create an init script, e.g., scripts/ci.gradle.kts:
    // scripts/ci.gradle.kts
    allprojects {
        plugins.withId("com.android.application") {
            apply(plugin = "com.google.android.gms.oss-licenses-plugin")
        }
    }
  3. In your CI configuration, apply this script when running Gradle:
    ./gradlew build --init-script scripts/ci.gradle.kts

This approach keeps the main build logic clean and cacheable, while isolating the CI-specific configuration.


extensions.configure<ApplicationExtension> {
configureKotlinAndroid(this)
defaultConfig.targetSdk = 36
Expand Down
Loading