aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2022-06-12 16:31:42 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2022-06-12 16:31:42 +0530
commit68cf22fb75e72d373bd103bbd7993cd1bd9923e8 (patch)
treed268464dafa8eb9afd22d392e7e9e0460ad1dad8
parente07b239360e18de8aaf47d1772a17ed404ed83c9 (diff)
build-logic: rewrite version overrides to edit the version catalog
-rw-r--r--.github/workflows/shadow_job.yml3
-rw-r--r--build-logic/android-plugins/build.gradle.kts14
-rw-r--r--build-logic/kotlin-plugins/build.gradle.kts14
-rw-r--r--build-logic/settings.gradle.kts14
-rw-r--r--gradle/libs.versions.toml4
5 files changed, 17 insertions, 32 deletions
diff --git a/.github/workflows/shadow_job.yml b/.github/workflows/shadow_job.yml
index 547baff2..cb7e164b 100644
--- a/.github/workflows/shadow_job.yml
+++ b/.github/workflows/shadow_job.yml
@@ -42,6 +42,7 @@ jobs:
- name: Run checks
uses: gradle/gradle-build-action@v2.2.0
env:
- GRADLE_VERSION_OVERRIDE_com_android_tools_build_gradle: ${{ matrix.agp-version }}
+ DEP_OVERRIDE: true
+ DEP_OVERRIDE_agp: ${{ matrix.agp-version }}
with:
arguments: check
diff --git a/build-logic/android-plugins/build.gradle.kts b/build-logic/android-plugins/build.gradle.kts
index 95fb1e2f..ae6121b0 100644
--- a/build-logic/android-plugins/build.gradle.kts
+++ b/build-logic/android-plugins/build.gradle.kts
@@ -59,17 +59,3 @@ dependencies {
implementation(libs.build.semver)
implementation(libs.build.sentry)
}
-
-configurations.all {
- resolutionStrategy.eachDependency {
- val overrideName =
- "GRADLE_VERSION_OVERRIDE_${requested.group.replace('.', '_')}_${requested.name}"
- val overridenVersion = System.getenv(overrideName)
- if (!overridenVersion.isNullOrEmpty()) {
- project.logger.lifecycle(
- "Overriding dependency ${requested.group}:${requested.name} to version $overridenVersion"
- )
- useVersion(overridenVersion)
- }
- }
-}
diff --git a/build-logic/kotlin-plugins/build.gradle.kts b/build-logic/kotlin-plugins/build.gradle.kts
index 71230f52..bfd54dc0 100644
--- a/build-logic/kotlin-plugins/build.gradle.kts
+++ b/build-logic/kotlin-plugins/build.gradle.kts
@@ -59,17 +59,3 @@ dependencies {
implementation(libs.build.kotlin)
implementation(libs.build.spotless)
}
-
-configurations.all {
- resolutionStrategy.eachDependency {
- val overrideName =
- "GRADLE_VERSION_OVERRIDE_${requested.group.replace('.', '_')}_${requested.name}"
- val overridenVersion = System.getenv(overrideName)
- if (!overridenVersion.isNullOrEmpty()) {
- project.logger.lifecycle(
- "Overriding dependency ${requested.group}:${requested.name} to version $overridenVersion"
- )
- useVersion(overridenVersion)
- }
- }
-}
diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts
index 2e9d12b3..be6946c3 100644
--- a/build-logic/settings.gradle.kts
+++ b/build-logic/settings.gradle.kts
@@ -27,7 +27,19 @@ dependencyResolutionManagement {
}
mavenCentral()
}
- versionCatalogs { create("libs") { from(files("../gradle/libs.versions.toml")) } }
+ versionCatalogs {
+ maybeCreate("libs").apply {
+ from(files("../gradle/libs.versions.toml"))
+ if (System.getenv("DEP_OVERRIDE") == "true") {
+ val overrides = System.getenv().filterKeys { it.startsWith("DEP_OVERRIDE_") }
+ for ((key, value) in overrides) {
+ val catalogKey = key.removePrefix("DEP_OVERRIDE_").toLowerCase()
+ println("Overriding $catalogKey with $value")
+ version(catalogKey, value)
+ }
+ }
+ }
+ }
}
include("android-plugins")
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 7ec394ff..f2039d6b 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,5 +1,5 @@
-# Centralized versions for dependencies that share versions
[versions]
+agp = "7.2.1"
androidx_activity = "1.5.0-rc01"
compose = "1.2.0-alpha08"
coroutines = "1.6.2"
@@ -38,7 +38,7 @@ androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.
aps-sublimeFuzzy = "com.github.android-password-store:sublime-fuzzy:2.2.0"
aps-zxingAndroidEmbedded = "com.github.android-password-store:zxing-android-embedded:4.2.1"
-build-agp = "com.android.tools.build:gradle:7.2.1"
+build-agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
build-binarycompat = "org.jetbrains.kotlinx:binary-compatibility-validator:0.10.0"
build-download = "de.undercouch:gradle-download-task:5.1.0"
build-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }