From c09244245d2d826d55cef64743c3721ad03d8d1b Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Tue, 10 Feb 2026 09:17:33 +0100 Subject: [PATCH 1/7] Add support for AGP 9.0.0 --- .java-version | 1 - README.md | 4 ++-- build.gradle.kts | 9 +++++---- buildSrc/src/main/kotlin/Dependencies.kt | 4 +++- gradle/wrapper/gradle-wrapper.properties | 2 +- manifestcheck/build.gradle.kts | 10 +++++----- .../config/TaskConfiguratorFactory.kt | 15 ++------------- ...ultiVariantPermissionCheckIntegrationTest.kt | 2 +- ...ngleVariantPermissionCheckIntegrationTest.kt | 2 +- .../testutil/AndroidProjectExtension.kt | 8 ++++---- .../permissioncheck/testutil/TestVersions.kt | 13 ++----------- plugin-core/build.gradle.kts | 7 +++++++ sample/app/build.gradle.kts | 17 +++++++++-------- sample/app/src/main/AndroidManifest.xml | 3 +-- sample/library/build.gradle.kts | 10 +++++----- sample/library/src/main/AndroidManifest.xml | 3 +-- 16 files changed, 49 insertions(+), 61 deletions(-) delete mode 100644 .java-version diff --git a/.java-version b/.java-version deleted file mode 100644 index 2dbc24b..0000000 --- a/.java-version +++ /dev/null @@ -1 +0,0 @@ -11.0 diff --git a/README.md b/README.md index c19b366..e22566e 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ To add the PermissionCheck plugin to your project, you have to add this block of ```groovy plugins { - id "com.telefonica.manifestcheck" version "1.0.2" + id "com.telefonica.manifestcheck" version "1.0.3" } ``` @@ -57,7 +57,7 @@ buildscript { } } dependencies { - classpath "com.telefonica:manifestcheck:1.0.2" + classpath "com.telefonica:manifestcheck:1.0.3" } } ``` diff --git a/build.gradle.kts b/build.gradle.kts index c49f908..1c2b3b1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.kotlin.dsl.embeddedKotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.dsl.JvmTarget buildscript { repositories { @@ -9,7 +10,7 @@ buildscript { mavenLocal() } dependencies { - classpath("com.android.tools.build:gradle:7.0.0") + classpath("com.android.tools.build:gradle:9.0.0") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$embeddedKotlinVersion") // classpath("com.telefonica:manifestcheck:+") // Uncomment to use the sample @@ -30,9 +31,9 @@ subprojects { } tasks.withType().configureEach { - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs = listOf("-Xopt-in=kotlin.ExperimentalStdlibApi") + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + freeCompilerArgs.add("-Xopt-in=kotlin.ExperimentalStdlibApi") } } diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 9e61a26..7440a34 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,9 +1,11 @@ object Versions { // See https://mvnrepository.com - const val JUNIT_5 = "5.7.1" + const val JUNIT_5 = "5.13.4" + const val JUNIT_PLATFORM_LAUNCHER ="1.7.1" } object Dependencies { const val JUNIT_5_ENGINE = "org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT_5}" const val JUNIT_5_API = "org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT_5}" const val JUNIT_5_PARAMS = "org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT_5}" + const val JUNIT_PLATFORM_LAUNCHER = "org.junit.platform:junit-platform-launcher:${Versions.JUNIT_PLATFORM_LAUNCHER}" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a0f7639..7b0b78c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/manifestcheck/build.gradle.kts b/manifestcheck/build.gradle.kts index 60a32fc..28893e9 100644 --- a/manifestcheck/build.gradle.kts +++ b/manifestcheck/build.gradle.kts @@ -6,18 +6,19 @@ plugins { } group = "com.telefonica" -version = "1.0.2" // Also update the version in the README +version = "1.0.3" // Also update the version in the README val uber: Configuration by configurations.creating dependencies { compileOnly(gradleKotlinDsl()) - compileOnly("com.android.tools.build:gradle:7.0.0") + compileOnly("com.android.tools.build:gradle:9.0.0") uber(project(":plugin-configurator-v1")) uber(project(":plugin-core")) testRuntimeOnly(Dependencies.JUNIT_5_ENGINE) + testRuntimeOnly(Dependencies.JUNIT_PLATFORM_LAUNCHER) testImplementation(Dependencies.JUNIT_5_API) testImplementation(Dependencies.JUNIT_5_PARAMS) testImplementation(gradleKotlinDsl()) @@ -29,10 +30,12 @@ configurations { // Publish all modules as part of a single uber plugin JAR tasks.withType().configureEach { + dependsOn(":plugin-configurator-v1:jar", ":plugin-core:jar") from(uber.asSequence().filter { it.startsWith(rootDir) }.map { zipTree(it) }.asIterable()) } tasks.withType().configureEach { + useJUnitPlatform() dependsOn("publishToMavenLocal") } @@ -45,9 +48,6 @@ gradlePlugin { implementationClass = "io.github.simonschiller.permissioncheck.PermissionCheckPlugin" } } -} -pluginBundle { website = "https://github.com/Telefonica/android-permissioncheck" vcsUrl = "https://github.com/Telefonica/android-permissioncheck" - tags = listOf("manifestcheck", "permissions") } diff --git a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt b/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt index 72fae18..61abaed 100644 --- a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt +++ b/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt @@ -1,20 +1,9 @@ package io.github.simonschiller.permissioncheck.config -import org.gradle.util.VersionNumber - /** Factory that produces different [TaskConfigurator]s to maintain backwards compatibility to older AGP versions. */ internal object TaskConfiguratorFactory { - fun getTaskConfigurator(): TaskConfigurator { - val version = VersionNumber.parse(getAndroidGradlePluginVersion()) - return when { - else -> TaskConfiguratorV1() - } - } - - private fun getAndroidGradlePluginVersion(): String { - val version = Class.forName("com.android.Version") - val field = version.getField("ANDROID_GRADLE_PLUGIN_VERSION") - return field.get(null) as String + // For AGP 7.0.0+ (including 9.0.0), always use V1 + return TaskConfiguratorV1() } } diff --git a/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/MultiVariantPermissionCheckIntegrationTest.kt b/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/MultiVariantPermissionCheckIntegrationTest.kt index f8fa0b5..7627358 100644 --- a/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/MultiVariantPermissionCheckIntegrationTest.kt +++ b/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/MultiVariantPermissionCheckIntegrationTest.kt @@ -298,7 +298,7 @@ class MultiVariantPermissionCheckIntegrationTest { assertEquals(TaskOutcome.UP_TO_DATE, buildResult.tasks.outcomeOf("checkPermissions")) val manifestFile = androidProject.appDir.resolve("src").resolve("main").resolve("AndroidManifest.xml") - manifestFile.writeText(manifestFile.readText().replace("simonschiller", "johndoe")) // Trigger change + manifestFile.writeText(manifestFile.readText().replace("\n\n + diff --git a/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/testutil/TestVersions.kt b/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/testutil/TestVersions.kt index 077dd33..7dde024 100644 --- a/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/testutil/TestVersions.kt +++ b/manifestcheck/src/test/kotlin/io/github/simonschiller/permissioncheck/testutil/TestVersions.kt @@ -1,6 +1,5 @@ package io.github.simonschiller.permissioncheck.testutil -import org.gradle.util.VersionNumber import org.junit.jupiter.api.extension.ExtensionContext import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.ArgumentsProvider @@ -11,29 +10,21 @@ class TestVersions : ArgumentsProvider { override fun provideArguments(context: ExtensionContext): Stream { val arguments = AGP_VERSIONS.flatMap { agpVersion -> GRADLE_VERSIONS - .filter { gradleVersion -> VersionNumber.parse(agpVersion).baseVersion isCompatibleWith VersionNumber.parse(gradleVersion).baseVersion } .map { gradleVersion -> Arguments.of(gradleVersion, agpVersion) } } return arguments.stream() } - // Checks if a AGP version (receiver) is compatible with a certain version of Gradle - private infix fun VersionNumber.isCompatibleWith(gradleVersion: VersionNumber) = when { - this >= VersionNumber.parse("7.0.0") -> gradleVersion >= VersionNumber.parse("7.0") - else -> false - } - companion object { // See https://gradle.org/releases private val GRADLE_VERSIONS = listOf( - "7.4.2", - "7.2", + "9.1.0", ) // See https://developer.android.com/studio/releases/gradle-plugin private val AGP_VERSIONS = listOf( - "7.0.0", + "9.0.0", ) val LATEST_GRADLE_VERSION = GRADLE_VERSIONS.first() diff --git a/plugin-core/build.gradle.kts b/plugin-core/build.gradle.kts index 8056d25..695c3d6 100644 --- a/plugin-core/build.gradle.kts +++ b/plugin-core/build.gradle.kts @@ -2,10 +2,17 @@ plugins { kotlin("jvm") } +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + dependencies { compileOnly(gradleKotlinDsl()) + compileOnly("com.android.tools.build:gradle:9.0.0") testRuntimeOnly(Dependencies.JUNIT_5_ENGINE) + testRuntimeOnly(Dependencies.JUNIT_PLATFORM_LAUNCHER) testImplementation(Dependencies.JUNIT_5_API) testImplementation(gradleKotlinDsl()) } diff --git a/sample/app/build.gradle.kts b/sample/app/build.gradle.kts index da4c9da..76d3cab 100644 --- a/sample/app/build.gradle.kts +++ b/sample/app/build.gradle.kts @@ -4,16 +4,17 @@ plugins { } android { - compileSdkVersion(33) + namespace = "com.telefonica.sampleapp" // Update to your actual package name + compileSdk = 36 - defaultConfig { - minSdkVersion(23) - targetSdkVersion(33) - } + defaultConfig { + minSdk = 24 + targetSdk = 36 + } - lintOptions { - checkOnly("") // Disable all Lint checks - } + lint { + abortOnError = false + } } dependencies { diff --git a/sample/app/src/main/AndroidManifest.xml b/sample/app/src/main/AndroidManifest.xml index f9b3697..9f2f1d6 100644 --- a/sample/app/src/main/AndroidManifest.xml +++ b/sample/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/sample/library/build.gradle.kts b/sample/library/build.gradle.kts index 3d9009d..ef39876 100644 --- a/sample/library/build.gradle.kts +++ b/sample/library/build.gradle.kts @@ -3,14 +3,14 @@ plugins { } android { - compileSdkVersion(30) + namespace = "com.telefonica.samplelibrary" // Update to your actual package name + compileSdk = 36 defaultConfig { - minSdkVersion(21) - targetSdkVersion(30) + minSdk = 24 } - lintOptions { - checkOnly("") // Disable all Lint checks + lint { + abortOnError = false } } diff --git a/sample/library/src/main/AndroidManifest.xml b/sample/library/src/main/AndroidManifest.xml index c962a7f..e81352a 100644 --- a/sample/library/src/main/AndroidManifest.xml +++ b/sample/library/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + From 31379fb3e93622100bbf907fe7614e05e3029f79 Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Tue, 10 Feb 2026 09:27:31 +0100 Subject: [PATCH 2/7] Update github actions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea3376f..2579b1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Cache Gradle dependencies - uses: actions/cache@v2 + uses: actions/cache@v5 with: path: | ~/.gradle/caches From 7f456be8668f6cd18c4b86afa685f56c20f7d126 Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Tue, 10 Feb 2026 09:43:17 +0100 Subject: [PATCH 3/7] Update version number --- README.md | 4 ++-- manifestcheck/build.gradle.kts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e22566e..b5cdc2b 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ To add the PermissionCheck plugin to your project, you have to add this block of ```groovy plugins { - id "com.telefonica.manifestcheck" version "1.0.3" + id "com.telefonica.manifestcheck" version "1.1.0" } ``` @@ -57,7 +57,7 @@ buildscript { } } dependencies { - classpath "com.telefonica:manifestcheck:1.0.3" + classpath "com.telefonica:manifestcheck:1.1.0" } } ``` diff --git a/manifestcheck/build.gradle.kts b/manifestcheck/build.gradle.kts index 28893e9..849fb9f 100644 --- a/manifestcheck/build.gradle.kts +++ b/manifestcheck/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "com.telefonica" -version = "1.0.3" // Also update the version in the README +version = "1.1.0" // Also update the version in the README val uber: Configuration by configurations.creating From c3c1f01b0569f2257f1facc34c44855d739c806b Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Tue, 10 Feb 2026 09:52:38 +0100 Subject: [PATCH 4/7] Update KDoc --- .../permissioncheck/config/TaskConfiguratorFactory.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt b/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt index 61abaed..7ef8568 100644 --- a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt +++ b/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt @@ -1,9 +1,13 @@ package io.github.simonschiller.permissioncheck.config -/** Factory that produces different [TaskConfigurator]s to maintain backwards compatibility to older AGP versions. */ +/** + * Factory that produces a [TaskConfigurator]. + * + * It returns [TaskConfiguratorV1], as only V1 is supported for AGP 7.0.0+ (including 9.0.0). + */ internal object TaskConfiguratorFactory { fun getTaskConfigurator(): TaskConfigurator { - // For AGP 7.0.0+ (including 9.0.0), always use V1 + // Always use V1 for AGP 7.0.0+ (including 9.0.0) return TaskConfiguratorV1() } } From a8b660124dd9047f993aadcc6def876dd0c80340 Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Tue, 10 Feb 2026 09:54:32 +0100 Subject: [PATCH 5/7] Update buildSrc/src/main/kotlin/Dependencies.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 7440a34..bcf1784 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,6 +1,6 @@ object Versions { // See https://mvnrepository.com const val JUNIT_5 = "5.13.4" - const val JUNIT_PLATFORM_LAUNCHER ="1.7.1" + const val JUNIT_PLATFORM_LAUNCHER = "1.7.1" } object Dependencies { From 0c098d3efc96571630cfff4a0ce64b125f9d68be Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Tue, 10 Feb 2026 09:56:41 +0100 Subject: [PATCH 6/7] Update junit-platform-launcher version (copilot suggestion) --- buildSrc/src/main/kotlin/Dependencies.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index bcf1784..f924f92 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -1,6 +1,6 @@ object Versions { // See https://mvnrepository.com const val JUNIT_5 = "5.13.4" - const val JUNIT_PLATFORM_LAUNCHER = "1.7.1" + const val JUNIT_PLATFORM_LAUNCHER = "1.13.4" } object Dependencies { From 04a06f9ab13ae9d6480d50c191cd0bc67b1e292b Mon Sep 17 00:00:00 2001 From: Jose Rubio Date: Tue, 10 Feb 2026 10:59:02 +0100 Subject: [PATCH 7/7] Remove TaskConfiguratorFactory --- .../permissioncheck/PermissionCheckPlugin.kt | 5 ++--- .../config/TaskConfiguratorFactory.kt | 13 ------------- 2 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt diff --git a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/PermissionCheckPlugin.kt b/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/PermissionCheckPlugin.kt index 50c56cc..c1091a4 100644 --- a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/PermissionCheckPlugin.kt +++ b/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/PermissionCheckPlugin.kt @@ -1,10 +1,9 @@ package io.github.simonschiller.permissioncheck import com.android.build.gradle.AppPlugin -import io.github.simonschiller.permissioncheck.config.TaskConfiguratorFactory +import io.github.simonschiller.permissioncheck.config.TaskConfiguratorV1 import org.gradle.api.Plugin import org.gradle.api.Project -import java.util.* class PermissionCheckPlugin : Plugin { private lateinit var extension: PermissionCheckExtension @@ -18,7 +17,7 @@ class PermissionCheckPlugin : Plugin { return@configureEach // Only applicable to app modules } - val taskConfigurator = TaskConfiguratorFactory.getTaskConfigurator() + val taskConfigurator = TaskConfiguratorV1() taskConfigurator.configureTasks(project, extension) } } diff --git a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt b/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt deleted file mode 100644 index 7ef8568..0000000 --- a/manifestcheck/src/main/kotlin/io/github/simonschiller/permissioncheck/config/TaskConfiguratorFactory.kt +++ /dev/null @@ -1,13 +0,0 @@ -package io.github.simonschiller.permissioncheck.config - -/** - * Factory that produces a [TaskConfigurator]. - * - * It returns [TaskConfiguratorV1], as only V1 is supported for AGP 7.0.0+ (including 9.0.0). - */ -internal object TaskConfiguratorFactory { - fun getTaskConfigurator(): TaskConfigurator { - // Always use V1 for AGP 7.0.0+ (including 9.0.0) - return TaskConfiguratorV1() - } -}