Skip to content

Commit d8e3505

Browse files
committed
Migrate usage of archivesBaseName
1 parent d2396a9 commit d8e3505

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

app/build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import com.android.build.api.variant.FilterConfiguration
2+
import org.gradle.kotlin.dsl.androidComponents
13
import java.net.URL
24
import java.nio.file.Files
35
import java.nio.file.StandardCopyOption
@@ -8,6 +10,21 @@ plugins {
810
id("com.android.application")
911
}
1012

13+
androidComponents {
14+
onVariants(selector().withBuildType("release")) { variant ->
15+
variant.outputs.forEach { output ->
16+
// TODO: https://github.com/android/gradle-recipes/blob/cbe7c7dea2a3f5b1764756f24bf453d1235c80e2/listenToArtifacts/README.md
17+
with(output as com.android.build.api.variant.impl.VariantOutputImpl) {
18+
val abiName = output.filters
19+
.find { it.filterType == FilterConfiguration.FilterType.ABI }
20+
?.identifier ?: "universal"
21+
val newApkName = "cmfa-${versionName.get()}-meta-${abiName}-${variant.buildType}.apk"
22+
outputFileName = newApkName
23+
}
24+
}
25+
}
26+
}
27+
1128
dependencies {
1229
compileOnly(project(":hideapi"))
1330

build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ subprojects {
7777

7878
if (!isApp) {
7979
consumerProguardFiles("consumer-rules.pro")
80-
} else {
81-
setProperty("archivesBaseName", "cmfa-$versionName")
8280
}
8381
}
8482

0 commit comments

Comments
 (0)