File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,12 +34,12 @@ plugins {
3434* Register a new task that can generate the artifact with keep rules.
3535
3636``` kotlin
37- val outputJar = project.tasks.named< org.gradle.jvm.tasks.Jar > (" jar" ).flatMap { task ->
38- task.archiveFile
37+ val jarTask = project.tasks.named< org.gradle.jvm.tasks.Jar > (" jar" )
38+ val outputJar = jarTask.flatMap { it.archiveFile }
39+ val outputFile = jarTask.flatMap { it.archiveFileName }.map { fileName ->
40+ " keep${fileName.uppercaseFirstChar()} "
3941}
4042
41- val outputFile = outputJar.map { file -> " keep${file.asFile.name.uppercaseFirstChar()} " }
42-
4343// Register the JAR transform for extracting keep rules.
4444val artifactTask = annotationKeep.registerJavaArchiveTransform(
4545 taskName = " keepRulesJar" ,
@@ -54,7 +54,7 @@ val artifactTask = annotationKeep.registerJavaArchiveTransform(
5454// Register the new artifact.
5555project.configurations.configureEach {
5656 if (name == " apiElements" || name == " runtimeElements" ) {
57- outgoing.artifact(artifactTask)
57+ outgoing.artifact(artifactTask.flatMap { it.outputJar } )
5858 }
5959}
6060```
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ dependencies {
5050 implementation(libs.androidx.core.ktx)
5151 implementation(libs.androidx.lifecycle.runtime.ktx)
5252 testImplementation(libs.junit)
53- androidTestImplementation(libs.androidx.compose.ui.test.junit4)
5453 androidTestImplementation(libs.androidx.espresso.core)
5554 androidTestImplementation(libs.androidx.junit)
5655 debugImplementation(libs.androidx.compose.ui.test.manifest)
Original file line number Diff line number Diff line change 11[versions ]
2- agp = " 9.5.0-alpha04 "
2+ agp = " 9.5.0-alpha05 "
33annotationKeep = " 1.0.0-SNAPSHOT"
44coreKtx = " 1.19.0"
55junit = " 4.13.2"
@@ -9,8 +9,8 @@ lifecycleRuntimeKtx = "2.11.0"
99activityCompose = " 1.13.0"
1010kotlin = " 2.4.20"
1111composeBom = " 2026.08.00"
12- appcompat = " 1.6.1 "
13- material = " 1.10 .0"
12+ appcompat = " 1.8.0 "
13+ material = " 1.14 .0"
1414jetbrainsKotlinJvm = " 2.4.20"
1515
1616[libraries ]
Original file line number Diff line number Diff line change @@ -11,12 +11,12 @@ java {
1111 targetCompatibility = JavaVersion .VERSION_11
1212}
1313
14- val outputJar = project.tasks.named< org.gradle.jvm.tasks.Jar > (" jar" ).flatMap { task ->
15- task.archiveFile
14+ val jarTask = project.tasks.named< org.gradle.jvm.tasks.Jar > (" jar" )
15+ val outputJar = jarTask.flatMap { it.archiveFile }
16+ val outputFile = jarTask.flatMap { it.archiveFileName }.map { fileName ->
17+ " keep${fileName.uppercaseFirstChar()} "
1618}
1719
18- val outputFile = outputJar.map { file -> " keep${file.asFile.name.uppercaseFirstChar()} " }
19-
2020// Register the JAR transform for extracting keep rules.
2121val artifactTask = annotationKeep.registerJavaArchiveTransform(
2222 taskName = " keepRulesJar" ,
@@ -27,7 +27,7 @@ val artifactTask = annotationKeep.registerJavaArchiveTransform(
2727// Register the new artifact.
2828project.configurations.configureEach {
2929 if (name == " apiElements" || name == " runtimeElements" ) {
30- outgoing.artifact(artifactTask)
30+ outgoing.artifact(artifactTask.flatMap { it.outputJar } )
3131 }
3232}
3333
You can’t perform that action at this time.
0 commit comments