diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2022-09-11 01:38:05 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 20:08:05 +0000 |
commit | 85a4c027e4a54bd326272bf6e5a75afd01fda36d (patch) | |
tree | 7ca36c1f0f0d7d14a2d58c2646a277d4c8af94c7 /build-logic/android-plugins/src/main | |
parent | c289b01a86f695b111431997b896ec33533480b5 (diff) |
Fix bundle collection task (#2122)
Diffstat (limited to 'build-logic/android-plugins/src/main')
-rw-r--r-- | build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/RenameArtifactsPlugin.kt | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/RenameArtifactsPlugin.kt b/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/RenameArtifactsPlugin.kt index 04eb57e3..6807b6ef 100644 --- a/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/RenameArtifactsPlugin.kt +++ b/build-logic/android-plugins/src/main/kotlin/app/passwordstore/gradle/RenameArtifactsPlugin.kt @@ -4,7 +4,7 @@ import app.passwordstore.gradle.artifacts.CollectApksTask import app.passwordstore.gradle.artifacts.CollectBundleTask import com.android.build.api.artifact.SingleArtifact import com.android.build.api.variant.ApplicationAndroidComponentsExtension -import com.android.build.gradle.internal.dsl.BaseAppModuleExtension +import com.android.build.api.variant.VariantOutputConfiguration import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.getByType @@ -15,7 +15,6 @@ class RenameArtifactsPlugin : Plugin<Project> { override fun apply(project: Project) { project.pluginManager.withPlugin("com.android.application") { - val android = project.extensions.getByType<BaseAppModuleExtension>() project.extensions.getByType<ApplicationAndroidComponentsExtension>().run { onVariants { variant -> project.tasks.register<CollectApksTask>("collect${variant.name.capitalize()}Apks") { @@ -25,8 +24,12 @@ class RenameArtifactsPlugin : Plugin<Project> { outputDirectory.set(project.layout.projectDirectory.dir("outputs")) } project.tasks.register<CollectBundleTask>("collect${variant.name.capitalize()}Bundle") { + val mainOutput = + variant.outputs.single { + it.outputType == VariantOutputConfiguration.OutputType.SINGLE + } variantName.set(variant.name) - versionName.set(android.defaultConfig.versionName) + versionName.set(mainOutput.versionName) bundleFile.set(variant.artifacts.get(SingleArtifact.BUNDLE)) outputDirectory.set(project.layout.projectDirectory.dir("outputs")) } |