Skip to content

Commit

Permalink
Try updating to fix main more (#142)
Browse files Browse the repository at this point in the history
* Update to fix main

* Update toolchain for libraries to 21
  • Loading branch information
alexvanyo authored May 9, 2024
1 parent f6d3b93 commit 1550a19
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 34 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {

subprojects {
pluginManager.withPlugin("java") {
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(20)) } }
configure<JavaPluginExtension> { toolchain { languageVersion.set(JavaLanguageVersion.of(21)) } }

tasks.withType<JavaCompile>().configureEach { options.release.set(11) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

package com.slack.keeper

import com.android.build.api.artifact.Artifacts
import com.android.build.api.artifact.ScopedArtifact
import com.android.build.api.artifact.impl.ArtifactsImpl
import com.android.build.api.component.analytics.AnalyticsEnabledArtifacts
import com.android.build.api.variant.AndroidTest
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.api.variant.ApplicationVariant
Expand All @@ -29,7 +26,6 @@ import com.android.build.api.variant.ScopedArtifacts
import com.android.build.gradle.AppExtension
import com.android.build.gradle.internal.publishing.AndroidArtifacts
import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactType
import com.android.build.gradle.internal.scope.InternalArtifactType
import com.android.build.gradle.internal.tasks.L8DexDesugarLibTask
import com.android.build.gradle.internal.tasks.R8Task
import java.io.File
Expand Down Expand Up @@ -295,34 +291,11 @@ public class KeeperPlugin : Plugin<Project> {
configureR8Task(appVariant.name) {
logger.debug("$TAG: Patching task '$name' with inferred androidTest proguard rules")
configurationFiles.from(prop)
configurationFiles.from(
project.provider { testVariant.runtimeConfiguration.proguardFiles() }
)
configurationFiles.from(testVariant.proguardFiles)
}

val disableTestProguardFiles = project.hasProperty("keeper.disableTestProguardFiles")

if (!disableTestProguardFiles) {
// We offer an option to disable this because the FILTERED_PROGUARD_RULES doesn't
// propagate
// task dependencies and breaks in Gradle 8.
afterEvaluate {
val testProguardFiles =
project.provider { testVariant.runtimeConfiguration.proguardFiles() }
val testProguardFile =
(testVariant.artifacts.unwrap()).get(InternalArtifactType.GENERATED_PROGUARD_FILE)
configureR8Task(appVariant.name) {
logger.debug("$TAG: Patching task '$name' with test-specific proguard rules")
configurationFiles.from(testProguardFiles)
configurationFiles.from(testProguardFile)
}
}
}
}
}

private fun Artifacts.unwrap(): ArtifactsImpl {
return when (this) {
is ArtifactsImpl -> this
is AnalyticsEnabledArtifacts -> delegate.unwrap()
else -> error("Unrecognized artifacts type $javaClass")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ internal sealed class SourceFile(val name: String) {

data class KotlinSourceFile(val fileSpec: FileSpec) :
SourceFile(fileSpec.members.filterIsInstance<TypeSpec>().first().name!!) {
override fun writeTo(file: File) = fileSpec.writeTo(file)
override fun writeTo(file: File) {
fileSpec.writeTo(file)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ internal class KeeperFunctionalTest {

// Assert we correctly generated rules
val generatedRules =
projectDir.generatedChild("externalStagingAndroidTest/inferredKeepRules.pro")
projectDir.generatedChild("ExternalStagingAndroidTest/inferredKeepRules.pro")
assertThat(generatedRules.readText().trim())
.isEqualTo(
EXPECTED_TRACE_REFERENCES_CONFIG.map { indentRules(it.key, it.value) }.joinToString("\n")
Expand Down

0 comments on commit 1550a19

Please sign in to comment.