diff --git a/KeepAnnotationsSample/README.md b/KeepAnnotationsSample/README.md index b8e2a754..3d2ea169 100644 --- a/KeepAnnotationsSample/README.md +++ b/KeepAnnotationsSample/README.md @@ -34,12 +34,12 @@ plugins { * Register a new task that can generate the artifact with keep rules. ```kotlin -val outputJar = project.tasks.named("jar").flatMap { task -> - task.archiveFile +val jarTask = project.tasks.named("jar") +val outputJar = jarTask.flatMap { it.archiveFile } +val outputFile = jarTask.flatMap { it.archiveFileName }.map { fileName -> + "keep${fileName.uppercaseFirstChar()}" } -val outputFile = outputJar.map { file -> "keep${file.asFile.name.uppercaseFirstChar()}" } - // Register the JAR transform for extracting keep rules. val artifactTask = annotationKeep.registerJavaArchiveTransform( taskName = "keepRulesJar", @@ -54,7 +54,7 @@ val artifactTask = annotationKeep.registerJavaArchiveTransform( // Register the new artifact. project.configurations.configureEach { if (name == "apiElements" || name == "runtimeElements") { - outgoing.artifact(artifactTask) + outgoing.artifact(artifactTask.flatMap { it.outputJar }) } } ``` diff --git a/KeepAnnotationsSample/app/build.gradle.kts b/KeepAnnotationsSample/app/build.gradle.kts index b04a94a6..f0eea7f9 100644 --- a/KeepAnnotationsSample/app/build.gradle.kts +++ b/KeepAnnotationsSample/app/build.gradle.kts @@ -50,7 +50,6 @@ dependencies { implementation(libs.androidx.core.ktx) implementation(libs.androidx.lifecycle.runtime.ktx) testImplementation(libs.junit) - androidTestImplementation(libs.androidx.compose.ui.test.junit4) androidTestImplementation(libs.androidx.espresso.core) androidTestImplementation(libs.androidx.junit) debugImplementation(libs.androidx.compose.ui.test.manifest) diff --git a/KeepAnnotationsSample/gradle/libs.versions.toml b/KeepAnnotationsSample/gradle/libs.versions.toml index c093282d..677868ca 100644 --- a/KeepAnnotationsSample/gradle/libs.versions.toml +++ b/KeepAnnotationsSample/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -agp = "9.5.0-alpha04" +agp = "9.5.0-alpha05" annotationKeep = "1.0.0-SNAPSHOT" coreKtx = "1.19.0" junit = "4.13.2" @@ -9,8 +9,8 @@ lifecycleRuntimeKtx = "2.11.0" activityCompose = "1.13.0" kotlin = "2.4.20" composeBom = "2026.08.00" -appcompat = "1.6.1" -material = "1.10.0" +appcompat = "1.8.0" +material = "1.14.0" jetbrainsKotlinJvm = "2.4.20" [libraries] diff --git a/KeepAnnotationsSample/java-library/build.gradle.kts b/KeepAnnotationsSample/java-library/build.gradle.kts index e0338ce8..ff3adb8c 100644 --- a/KeepAnnotationsSample/java-library/build.gradle.kts +++ b/KeepAnnotationsSample/java-library/build.gradle.kts @@ -11,12 +11,12 @@ java { targetCompatibility = JavaVersion.VERSION_11 } -val outputJar = project.tasks.named("jar").flatMap { task -> - task.archiveFile +val jarTask = project.tasks.named("jar") +val outputJar = jarTask.flatMap { it.archiveFile } +val outputFile = jarTask.flatMap { it.archiveFileName }.map { fileName -> + "keep${fileName.uppercaseFirstChar()}" } -val outputFile = outputJar.map { file -> "keep${file.asFile.name.uppercaseFirstChar()}" } - // Register the JAR transform for extracting keep rules. val artifactTask = annotationKeep.registerJavaArchiveTransform( taskName = "keepRulesJar", @@ -27,7 +27,7 @@ val artifactTask = annotationKeep.registerJavaArchiveTransform( // Register the new artifact. project.configurations.configureEach { if (name == "apiElements" || name == "runtimeElements") { - outgoing.artifact(artifactTask) + outgoing.artifact(artifactTask.flatMap { it.outputJar }) } }