From 9bb17c71f86cc3258050c4da3b19f16316157e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Fri, 3 Jan 2025 12:45:20 +0000 Subject: [PATCH 01/11] Rename versions.json to JSON5 --- build.gradle.kts | 8 +++++--- src/main/groovy/org/gradle/android/Versions.groovy | 4 +++- src/main/resources/{versions.json => versions.json5} | 0 3 files changed, 8 insertions(+), 4 deletions(-) rename src/main/resources/{versions.json => versions.json5} (100%) diff --git a/build.gradle.kts b/build.gradle.kts index cd71d019..c7a94866 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionProfile.FAST import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionProfile.STANDARD import groovy.json.JsonSlurper +import groovy.json.JsonParserType // Upgrade transitive dependencies in plugin classpath buildscript { @@ -258,7 +259,8 @@ fun releaseNotes(): Provider { @Suppress("UNCHECKED_CAST") fun getSupportedVersions(): Map> { - val versionFile = providers.fileContents(layout.projectDirectory.file("src/main/resources/versions.json")) - return (JsonSlurper() - .parse(versionFile.asBytes.get()) as Map>>).getValue("supportedVersions") + val versionFile = providers.fileContents(layout.projectDirectory.file("src/main/resources/versions.json5")) + val slurper = JsonSlurper().setType(JsonParserType.LAX) + val json = slurper.parse(versionFile.asBytes.get()) as Map>> + return json.getValue("supportedVersions") } diff --git a/src/main/groovy/org/gradle/android/Versions.groovy b/src/main/groovy/org/gradle/android/Versions.groovy index c60e26f5..bd23c8c5 100644 --- a/src/main/groovy/org/gradle/android/Versions.groovy +++ b/src/main/groovy/org/gradle/android/Versions.groovy @@ -5,6 +5,7 @@ import com.google.common.collect.ImmutableMultimap import com.google.common.collect.ImmutableSortedSet import com.google.common.collect.Multimap import groovy.json.JsonSlurper +import groovy.json.JsonParserType import groovy.transform.CompileStatic import groovy.transform.TypeCheckingMode import org.gradle.util.GradleVersion @@ -17,7 +18,8 @@ class Versions { static final VersionNumber CURRENT_ANDROID_VERSION static { - def versions = new JsonSlurper().parse(AndroidCacheFixPlugin.classLoader.getResource("versions.json")) + def slurper = new JsonSlurper().setType(JsonParserType.LAX) + def versions = slurper.parse(AndroidCacheFixPlugin.classLoader.getResource("versions.json5")) def builder = ImmutableMultimap.builder() versions.supportedVersions.each { String androidVersion, List gradleVersions -> diff --git a/src/main/resources/versions.json b/src/main/resources/versions.json5 similarity index 100% rename from src/main/resources/versions.json rename to src/main/resources/versions.json5 From 9324cbf37bac6002418e725bcbe4a0a8f8caaa7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Fri, 3 Jan 2025 13:06:23 +0000 Subject: [PATCH 02/11] Configure Renovate --- .github/renovate.json5 | 26 ++++++++++++++++++++++++++ src/main/resources/versions.json5 | 3 +++ 2 files changed, 29 insertions(+) create mode 100644 .github/renovate.json5 diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 00000000..b7a03199 --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,26 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended" + ], + "enabledManagers": ["regex"], + "customManagers": [ + { + // See https://docs.renovatebot.com/modules/manager/regex/ + customType: "regex", + fileMatch: [ + "src/main/resources/versions\\.json5", + ], + matchStrings: [ + "(?:#|\/\/) renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?\\S+?))?\\s+?\"(?\\S+?)\"", + ], + versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", + }, + ], + "packageRules": [ + { + "matchDepNames": ["com.android.tools.build:gradle"], + "registryUrls": ["https://dl.google.com/dl/android/maven2/"], + }, + ], +} diff --git a/src/main/resources/versions.json5 b/src/main/resources/versions.json5 index 63897cbe..046dd691 100644 --- a/src/main/resources/versions.json5 +++ b/src/main/resources/versions.json5 @@ -1,11 +1,14 @@ { "supportedVersions": { + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.9.0-alpha04": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.8.0-beta01": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.7.2": [ "8.12" ], From 0f8af4e2b4aeb400e9ff8d6c1c204bf57e072d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Fri, 3 Jan 2025 17:27:14 +0000 Subject: [PATCH 03/11] Remove patch number from WorkaroundTest (cherry picked from commit 86474cd14f8ea7a4eef7d7705bc8b15f0cb9dd2d) --- .../org/gradle/android/WorkaroundTest.groovy | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/test/groovy/org/gradle/android/WorkaroundTest.groovy b/src/test/groovy/org/gradle/android/WorkaroundTest.groovy index e6766081..fe3de77a 100644 --- a/src/test/groovy/org/gradle/android/WorkaroundTest.groovy +++ b/src/test/groovy/org/gradle/android/WorkaroundTest.groovy @@ -11,21 +11,21 @@ class WorkaroundTest extends Specification { expect: workarounds.collect { it.class.simpleName.replaceAll(/Workaround/, "") }.sort() == expectedWorkarounds.sort() where: - androidVersion | expectedWorkarounds - "8.9.0-alpha04" | ['JdkImage'] - "8.8.0-beta01" | ['JdkImage'] - "8.7.2" | ['JdkImage'] - "8.6.1" | ['JdkImage'] - "8.5.2" | ['JdkImage'] - "8.4.2" | ['JdkImage'] - "8.3.2" | ['MergeSourceSetFolders', 'JdkImage'] - "8.2.2" | ['MergeSourceSetFolders', 'JdkImage', 'PackageForUnitTest'] - "8.1.4" | ['MergeSourceSetFolders', 'JdkImage', 'PackageForUnitTest'] - "8.0.2" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] - "7.4.2" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] - "7.3.1" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] - "7.2.2" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] - "7.1.3" | ['BundleLibraryClasses', 'CompileLibraryResources', 'DataBindingMergeDependencyArtifacts', 'LibraryJniLibs', 'MergeNativeLibs', 'MergeSourceSetFolders', 'StripDebugSymbols', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] - "7.0.4" | ['BundleLibraryClasses', 'CompileLibraryResources', 'DataBindingMergeDependencyArtifacts', 'LibraryJniLibs', 'MergeNativeLibs', 'MergeSourceSetFolders', 'StripDebugSymbols', 'ZipMergingTask', 'PackageForUnitTest'] + androidVersion | expectedWorkarounds + "8.9" | ['JdkImage'] + "8.8" | ['JdkImage'] + "8.7" | ['JdkImage'] + "8.6" | ['JdkImage'] + "8.5" | ['JdkImage'] + "8.4" | ['JdkImage'] + "8.3" | ['MergeSourceSetFolders', 'JdkImage'] + "8.2" | ['MergeSourceSetFolders', 'JdkImage', 'PackageForUnitTest'] + "8.1" | ['MergeSourceSetFolders', 'JdkImage', 'PackageForUnitTest'] + "8.0" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] + "7.4" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] + "7.3" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] + "7.2" | ['MergeSourceSetFolders', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] + "7.1" | ['BundleLibraryClasses', 'CompileLibraryResources', 'DataBindingMergeDependencyArtifacts', 'LibraryJniLibs', 'MergeNativeLibs', 'MergeSourceSetFolders', 'StripDebugSymbols', 'ZipMergingTask', 'JdkImage', 'PackageForUnitTest'] + "7.0" | ['BundleLibraryClasses', 'CompileLibraryResources', 'DataBindingMergeDependencyArtifacts', 'LibraryJniLibs', 'MergeNativeLibs', 'MergeSourceSetFolders', 'StripDebugSymbols', 'ZipMergingTask', 'PackageForUnitTest'] } } From 6d1cc7925e53ba5a7dafa334a4d7a6f4b3c8576e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Fri, 3 Jan 2025 18:07:26 +0000 Subject: [PATCH 04/11] Remove patch number from CrossVersionOutcomeAndRelocationTest (cherry picked from commit 994168bcd78831577933c111b9cc1c1dee5cba3b) --- .../gradle/android/CrossVersionOutcomeAndRelocationTest.groovy | 3 ++- .../{7.0.4_outcomes.json => 7.0_outcomes.json} | 0 .../{7.1.3_outcomes.json => 7.1_outcomes.json} | 0 .../{7.2.2_outcomes.json => 7.2_outcomes.json} | 0 .../{7.3.1_outcomes.json => 7.3_outcomes.json} | 0 .../{7.4.2_outcomes.json => 7.4_outcomes.json} | 0 .../{8.0.2_outcomes.json => 8.0_outcomes.json} | 0 .../{8.1.4_outcomes.json => 8.1_outcomes.json} | 0 .../{8.2.2_outcomes.json => 8.2_outcomes.json} | 0 .../{8.3.2_outcomes.json => 8.3_outcomes.json} | 0 .../{8.4.2_outcomes.json => 8.4_outcomes.json} | 0 .../{8.5.2_outcomes.json => 8.5_outcomes.json} | 0 .../{8.6.1_outcomes.json => 8.6_outcomes.json} | 0 .../{8.7.2_outcomes.json => 8.7_outcomes.json} | 0 .../{8.8.0-beta01_outcomes.json => 8.8_outcomes.json} | 0 .../{8.9.0-alpha04_outcomes.json => 8.9_outcomes.json} | 0 16 files changed, 2 insertions(+), 1 deletion(-) rename src/test/resources/expectedOutcomes/{7.0.4_outcomes.json => 7.0_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{7.1.3_outcomes.json => 7.1_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{7.2.2_outcomes.json => 7.2_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{7.3.1_outcomes.json => 7.3_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{7.4.2_outcomes.json => 7.4_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.0.2_outcomes.json => 8.0_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.1.4_outcomes.json => 8.1_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.2.2_outcomes.json => 8.2_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.3.2_outcomes.json => 8.3_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.4.2_outcomes.json => 8.4_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.5.2_outcomes.json => 8.5_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.6.1_outcomes.json => 8.6_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.7.2_outcomes.json => 8.7_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.8.0-beta01_outcomes.json => 8.8_outcomes.json} (100%) rename src/test/resources/expectedOutcomes/{8.9.0-alpha04_outcomes.json => 8.9_outcomes.json} (100%) diff --git a/src/test/groovy/org/gradle/android/CrossVersionOutcomeAndRelocationTest.groovy b/src/test/groovy/org/gradle/android/CrossVersionOutcomeAndRelocationTest.groovy index 8f8fbc23..47e6c00f 100644 --- a/src/test/groovy/org/gradle/android/CrossVersionOutcomeAndRelocationTest.groovy +++ b/src/test/groovy/org/gradle/android/CrossVersionOutcomeAndRelocationTest.groovy @@ -135,7 +135,8 @@ class CrossVersionOutcomeAndRelocationTest extends AbstractTest { private static ExpectedResults expectedResults(VersionNumber androidVersion, VersionNumber kotlinVersion) { def builder = new ExpectedOutcomeBuilder() - def outcomesResource = CrossVersionOutcomeAndRelocationTest.classLoader.getResource("expectedOutcomes/${androidVersion}_outcomes.json") + def path = "expectedOutcomes/${androidVersion.major}.${androidVersion.minor}_outcomes.json" + def outcomesResource = CrossVersionOutcomeAndRelocationTest.classLoader.getResource(path) if (outcomesResource == null) { throw new IllegalStateException("Could not find expectedOutcomes/${androidVersion}_outcomes.json - make sure an outcomes file exists for this version!") diff --git a/src/test/resources/expectedOutcomes/7.0.4_outcomes.json b/src/test/resources/expectedOutcomes/7.0_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/7.0.4_outcomes.json rename to src/test/resources/expectedOutcomes/7.0_outcomes.json diff --git a/src/test/resources/expectedOutcomes/7.1.3_outcomes.json b/src/test/resources/expectedOutcomes/7.1_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/7.1.3_outcomes.json rename to src/test/resources/expectedOutcomes/7.1_outcomes.json diff --git a/src/test/resources/expectedOutcomes/7.2.2_outcomes.json b/src/test/resources/expectedOutcomes/7.2_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/7.2.2_outcomes.json rename to src/test/resources/expectedOutcomes/7.2_outcomes.json diff --git a/src/test/resources/expectedOutcomes/7.3.1_outcomes.json b/src/test/resources/expectedOutcomes/7.3_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/7.3.1_outcomes.json rename to src/test/resources/expectedOutcomes/7.3_outcomes.json diff --git a/src/test/resources/expectedOutcomes/7.4.2_outcomes.json b/src/test/resources/expectedOutcomes/7.4_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/7.4.2_outcomes.json rename to src/test/resources/expectedOutcomes/7.4_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.0.2_outcomes.json b/src/test/resources/expectedOutcomes/8.0_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.0.2_outcomes.json rename to src/test/resources/expectedOutcomes/8.0_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.1.4_outcomes.json b/src/test/resources/expectedOutcomes/8.1_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.1.4_outcomes.json rename to src/test/resources/expectedOutcomes/8.1_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.2.2_outcomes.json b/src/test/resources/expectedOutcomes/8.2_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.2.2_outcomes.json rename to src/test/resources/expectedOutcomes/8.2_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.3.2_outcomes.json b/src/test/resources/expectedOutcomes/8.3_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.3.2_outcomes.json rename to src/test/resources/expectedOutcomes/8.3_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.4.2_outcomes.json b/src/test/resources/expectedOutcomes/8.4_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.4.2_outcomes.json rename to src/test/resources/expectedOutcomes/8.4_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.5.2_outcomes.json b/src/test/resources/expectedOutcomes/8.5_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.5.2_outcomes.json rename to src/test/resources/expectedOutcomes/8.5_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.6.1_outcomes.json b/src/test/resources/expectedOutcomes/8.6_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.6.1_outcomes.json rename to src/test/resources/expectedOutcomes/8.6_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.7.2_outcomes.json b/src/test/resources/expectedOutcomes/8.7_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.7.2_outcomes.json rename to src/test/resources/expectedOutcomes/8.7_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.8.0-beta01_outcomes.json b/src/test/resources/expectedOutcomes/8.8_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.8.0-beta01_outcomes.json rename to src/test/resources/expectedOutcomes/8.8_outcomes.json diff --git a/src/test/resources/expectedOutcomes/8.9.0-alpha04_outcomes.json b/src/test/resources/expectedOutcomes/8.9_outcomes.json similarity index 100% rename from src/test/resources/expectedOutcomes/8.9.0-alpha04_outcomes.json rename to src/test/resources/expectedOutcomes/8.9_outcomes.json From c0e81fd2608e0cb1611b13e1cb4c1cab91ac459f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Fri, 3 Jan 2025 16:17:33 +0000 Subject: [PATCH 05/11] Have Renovate bump older minors (cherry picked from commit d82c4d7103211d524d4cb4ff8dbb6311ee354ab1) --- .github/renovate.json5 | 7 +++++++ src/main/resources/versions.json5 | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index b7a03199..b5368b27 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -22,5 +22,12 @@ "matchDepNames": ["com.android.tools.build:gradle"], "registryUrls": ["https://dl.google.com/dl/android/maven2/"], }, + { + // In versions.json5, suggest only patches + "matchDepNames": ["com.android.tools.build:gradle"], + "matchUpdateTypes": ["major", "minor"], + "matchFileNames": ["src/main/resources/versions\\.json5"], + "enabled": false, + }, ], } diff --git a/src/main/resources/versions.json5 b/src/main/resources/versions.json5 index 046dd691..7f5d7cff 100644 --- a/src/main/resources/versions.json5 +++ b/src/main/resources/versions.json5 @@ -12,42 +12,54 @@ "8.7.2": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.6.1": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.5.2": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.4.2": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.3.2": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.2.2": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.1.4": [ "8.12" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "8.0.2": [ "8.0.2" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "7.4.2": [ "7.6.2" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "7.3.1": [ "7.4.2", "7.6.2" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "7.2.2": [ "7.3.3", "7.6.2" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "7.1.3": [ "7.2", "7.6.2" ], + // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven "7.0.4": [ "7.0.2", "7.6.2" From ce497191e4b61413da20428c05c22ac983185361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Fri, 3 Jan 2025 18:45:11 +0000 Subject: [PATCH 06/11] Add build-time check about newer AGP minors --- .github/renovate.json5 | 6 +++++- build.gradle.kts | 11 +++++++++-- gradle.properties | 3 +++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index b5368b27..cf473aad 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -10,9 +10,13 @@ customType: "regex", fileMatch: [ "src/main/resources/versions\\.json5", + "gradle\\.properties", ], matchStrings: [ - "(?:#|\/\/) renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?\\S+?))?\\s+?\"(?\\S+?)\"", + // Matches versions in JSON: the first double-quoted string below the comment line, e.g. "1.0.0" + "\/\/ renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?\\S+?))?\\s+?\"(?\\S+?)\"", + // Matches versions in properties: the value of the first property below the comment line, e.g. anyProperty=1.0.0 + "# renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?\\S+?))?\\s+?\\S+?=(?\\S+?)(?:\\s|$)", ], versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", }, diff --git a/build.gradle.kts b/build.gradle.kts index c7a94866..6de09420 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -163,7 +163,14 @@ tasks.test { } } -getSupportedVersions().keys.forEach { androidVersion -> +val latestVersion = providers.gradleProperty("org.gradle.android.latestKnownAgpVersion") +val supportedVersions = readSupportedVersions() + +check(latestVersion.get() in supportedVersions) { + "The project must be updated to support AGP $latestVersion. Please add it to supported versions." +} + +supportedVersions.keys.forEach { androidVersion -> val versionSpecificTest = tasks.register(androidTestTaskName(androidVersion)) { description = "Runs the multi-version tests for AGP $androidVersion" group = "verification" @@ -258,7 +265,7 @@ fun releaseNotes(): Provider { } @Suppress("UNCHECKED_CAST") -fun getSupportedVersions(): Map> { +fun readSupportedVersions(): Map> { val versionFile = providers.fileContents(layout.projectDirectory.file("src/main/resources/versions.json5")) val slurper = JsonSlurper().setType(JsonParserType.LAX) val json = slurper.parse(versionFile.asBytes.get()) as Map>> diff --git a/gradle.properties b/gradle.properties index c32a211a..23ba8087 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,3 +5,6 @@ org.gradle.jvmargs=-Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 org.gradle.kotlin.dsl.allWarningsAsErrors=true systemProp.pts.enabled=true + +# renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven +org.gradle.android.latestKnownAgpVersion=8.9.0-alpha04 From 3844d7aac92065a5526d60afd909df0ba70f06ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Mon, 6 Jan 2025 12:37:20 +0000 Subject: [PATCH 07/11] Simplify Renovate regex config --- .github/renovate.json5 | 23 ++++++++++++----------- gradle.properties | 2 +- src/main/resources/versions.json5 | 30 +++++++++++++++--------------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index cf473aad..002ef0a6 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -3,31 +3,32 @@ "extends": [ "config:recommended" ], + // See https://docs.renovatebot.com/modules/manager/regex/ + // Dependabot is used for all other updates. "enabledManagers": ["regex"], "customManagers": [ { - // See https://docs.renovatebot.com/modules/manager/regex/ + // Matches AGP versions annotated with a "renovate: AGP version" comment customType: "regex", fileMatch: [ "src/main/resources/versions\\.json5", "gradle\\.properties", ], matchStrings: [ - // Matches versions in JSON: the first double-quoted string below the comment line, e.g. "1.0.0" - "\/\/ renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?\\S+?))?\\s+?\"(?\\S+?)\"", - // Matches versions in properties: the value of the first property below the comment line, e.g. anyProperty=1.0.0 - "# renovate: datasource=(?.*?) depName=(?.*?)( versioning=(?\\S+?))?\\s+?\\S+?=(?\\S+?)(?:\\s|$)", + // For JSON: the first double-quoted string below the comment line, e.g. "1.0.0" + "\/\/ renovate: AGP version\\s+?\"(?\\S+?)\"", + // For properties: the value of the first property below the comment line, e.g. anyProperty=1.0.0 + "# renovate: AGP version\\s+?\\S+?=(?\\S+?)(?:\\s|$)", ], - versioningTemplate: "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}", + "datasourceTemplate": "maven", + "versioningTemplate": "maven", + "depNameTemplate": "com.android.tools.build:gradle", + "registryUrlTemplate": "https://dl.google.com/dl/android/maven2/", }, ], "packageRules": [ { - "matchDepNames": ["com.android.tools.build:gradle"], - "registryUrls": ["https://dl.google.com/dl/android/maven2/"], - }, - { - // In versions.json5, suggest only patches + // In versions.json5, disable bumps of major/minor, which should be added as new properties "matchDepNames": ["com.android.tools.build:gradle"], "matchUpdateTypes": ["major", "minor"], "matchFileNames": ["src/main/resources/versions\\.json5"], diff --git a/gradle.properties b/gradle.properties index 23ba8087..b2a6c14b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,5 +6,5 @@ org.gradle.kotlin.dsl.allWarningsAsErrors=true systemProp.pts.enabled=true -# renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven +# renovate: AGP version org.gradle.android.latestKnownAgpVersion=8.9.0-alpha04 diff --git a/src/main/resources/versions.json5 b/src/main/resources/versions.json5 index 7f5d7cff..2a91682f 100644 --- a/src/main/resources/versions.json5 +++ b/src/main/resources/versions.json5 @@ -1,65 +1,65 @@ { "supportedVersions": { - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.9.0-alpha04": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.8.0-beta01": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.7.2": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.6.1": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.5.2": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.4.2": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.3.2": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.2.2": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.1.4": [ "8.12" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "8.0.2": [ "8.0.2" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "7.4.2": [ "7.6.2" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "7.3.1": [ "7.4.2", "7.6.2" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "7.2.2": [ "7.3.3", "7.6.2" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "7.1.3": [ "7.2", "7.6.2" ], - // renovate: datasource=maven depName=com.android.tools.build:gradle versioning=maven + // renovate: AGP version "7.0.4": [ "7.0.2", "7.6.2" From 222a1f85d6686e6fab0a669d0c9940b247ea8f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Mon, 6 Jan 2025 13:50:29 +0000 Subject: [PATCH 08/11] Attempt #3 to have Renovate update older minors to new patches --- .github/renovate.json5 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 002ef0a6..56e2c716 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -26,6 +26,8 @@ "registryUrlTemplate": "https://dl.google.com/dl/android/maven2/", }, ], + // Look for patches to older minors despite a newer minor being available + "separateMinorPatch": true, "packageRules": [ { // In versions.json5, disable bumps of major/minor, which should be added as new properties From 36964bf490c9ed27db4b4f8f928f3da1a0ea5409 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Mon, 6 Jan 2025 13:55:02 +0000 Subject: [PATCH 09/11] Improve Renovate config Allow unlimited PRs Group changes to versions.json5 Improve renovate.json5 comments --- .github/renovate.json5 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 56e2c716..a18091cc 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -3,6 +3,9 @@ "extends": [ "config:recommended" ], + // Allow unlimited PRs + "prConcurrentLimit": 0, + "prHourlyLimit": 0, // See https://docs.renovatebot.com/modules/manager/regex/ // Dependabot is used for all other updates. "enabledManagers": ["regex"], @@ -26,7 +29,8 @@ "registryUrlTemplate": "https://dl.google.com/dl/android/maven2/", }, ], - // Look for patches to older minors despite a newer minor being available + // Ensure patches to older minors are opened, even if a newer minor is available + // In versions.json5, means older minors will still be checked for a newer patch "separateMinorPatch": true, "packageRules": [ { @@ -36,5 +40,10 @@ "matchFileNames": ["src/main/resources/versions\\.json5"], "enabled": false, }, + { + // Group changes to versions.json5 + "matchFileNames": ["src/main/resources/versions\\.json5"], + "groupName": "supportedVersions", + }, ], } From ddb6e486c070c97eacc80ef1a51070f4fa827a74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Wed, 8 Jan 2025 16:12:16 +0000 Subject: [PATCH 10/11] Add dv.json5 preset --- .github/renovate.json5 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index a18091cc..d6d606bf 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,7 +1,8 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": [ - "config:recommended" + "config:recommended", + "github>gradle/renovate-agent//presets/dv.json5", ], // Allow unlimited PRs "prConcurrentLimit": 0, From 80444469ec078b7fd4f58bee935049abf51111dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20de=20Aguiar=20F=C3=A9o?= Date: Wed, 8 Jan 2025 16:22:45 +0000 Subject: [PATCH 11/11] Remove values already set in agent config --- .github/renovate.json5 | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index d6d606bf..d2b109d9 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -4,9 +4,6 @@ "config:recommended", "github>gradle/renovate-agent//presets/dv.json5", ], - // Allow unlimited PRs - "prConcurrentLimit": 0, - "prHourlyLimit": 0, // See https://docs.renovatebot.com/modules/manager/regex/ // Dependabot is used for all other updates. "enabledManagers": ["regex"],