Fix bundle collection task (#2122)

This commit is contained in:
Harsh Shandilya 2022-09-11 01:38:05 +05:30 committed by GitHub
parent c289b01a86
commit 85a4c027e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View file

@ -35,7 +35,7 @@ jobs:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with: with:
arguments: collectFreeReleaseApks collectNonFreeReleaseApks -PsentryUploadMappings arguments: collectFreeReleaseApks collectNonFreeReleaseApks collectFreeReleaseBundle collectNonFreeReleaseBundle -PsentryUploadMappings
gradle-home-cache-cleanup: true gradle-home-cache-cleanup: true
- name: Clean secrets - name: Clean secrets

View file

@ -4,7 +4,7 @@ import app.passwordstore.gradle.artifacts.CollectApksTask
import app.passwordstore.gradle.artifacts.CollectBundleTask import app.passwordstore.gradle.artifacts.CollectBundleTask
import com.android.build.api.artifact.SingleArtifact import com.android.build.api.artifact.SingleArtifact
import com.android.build.api.variant.ApplicationAndroidComponentsExtension 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.Plugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType import org.gradle.kotlin.dsl.getByType
@ -15,7 +15,6 @@ class RenameArtifactsPlugin : Plugin<Project> {
override fun apply(project: Project) { override fun apply(project: Project) {
project.pluginManager.withPlugin("com.android.application") { project.pluginManager.withPlugin("com.android.application") {
val android = project.extensions.getByType<BaseAppModuleExtension>()
project.extensions.getByType<ApplicationAndroidComponentsExtension>().run { project.extensions.getByType<ApplicationAndroidComponentsExtension>().run {
onVariants { variant -> onVariants { variant ->
project.tasks.register<CollectApksTask>("collect${variant.name.capitalize()}Apks") { project.tasks.register<CollectApksTask>("collect${variant.name.capitalize()}Apks") {
@ -25,8 +24,12 @@ class RenameArtifactsPlugin : Plugin<Project> {
outputDirectory.set(project.layout.projectDirectory.dir("outputs")) outputDirectory.set(project.layout.projectDirectory.dir("outputs"))
} }
project.tasks.register<CollectBundleTask>("collect${variant.name.capitalize()}Bundle") { project.tasks.register<CollectBundleTask>("collect${variant.name.capitalize()}Bundle") {
val mainOutput =
variant.outputs.single {
it.outputType == VariantOutputConfiguration.OutputType.SINGLE
}
variantName.set(variant.name) variantName.set(variant.name)
versionName.set(android.defaultConfig.versionName) versionName.set(mainOutput.versionName)
bundleFile.set(variant.artifacts.get(SingleArtifact.BUNDLE)) bundleFile.set(variant.artifacts.get(SingleArtifact.BUNDLE))
outputDirectory.set(project.layout.projectDirectory.dir("outputs")) outputDirectory.set(project.layout.projectDirectory.dir("outputs"))
} }