|
|
|
@ -16,10 +16,8 @@
|
|
|
|
|
|
|
|
|
|
package com.google.samples.apps.nowinandroid
|
|
|
|
|
|
|
|
|
|
import com.android.SdkConstants
|
|
|
|
|
import com.android.build.api.artifact.SingleArtifact
|
|
|
|
|
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
|
|
|
|
|
import com.android.build.gradle.BaseExtension
|
|
|
|
|
import com.google.common.truth.Truth.assertWithMessage
|
|
|
|
|
import org.gradle.api.DefaultTask
|
|
|
|
|
import org.gradle.api.Project
|
|
|
|
@ -110,7 +108,6 @@ private fun String.capitalized() = replaceFirstChar {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun Project.configureBadgingTasks(
|
|
|
|
|
baseExtension: BaseExtension,
|
|
|
|
|
componentsExtension: ApplicationAndroidComponentsExtension,
|
|
|
|
|
) {
|
|
|
|
|
// Registers a callback to be called, when a new variant is configured
|
|
|
|
@ -122,14 +119,8 @@ fun Project.configureBadgingTasks(
|
|
|
|
|
tasks.register<GenerateBadgingTask>(generateBadgingTaskName) {
|
|
|
|
|
apk = variant.artifacts.get(SingleArtifact.APK_FROM_BUNDLE)
|
|
|
|
|
aapt2Executable.set(
|
|
|
|
|
// TODO: Replace with `sdkComponents.aapt2` when it's available in AGP
|
|
|
|
|
// https://issuetracker.google.com/issues/376815836
|
|
|
|
|
componentsExtension.sdkComponents.sdkDirectory.map { directory ->
|
|
|
|
|
directory.file(
|
|
|
|
|
"${SdkConstants.FD_BUILD_TOOLS}/" +
|
|
|
|
|
"${baseExtension.buildToolsVersion}/" +
|
|
|
|
|
SdkConstants.FN_AAPT2,
|
|
|
|
|
)
|
|
|
|
|
componentsExtension.sdkComponents.aapt2.flatMap { aapt2 ->
|
|
|
|
|
aapt2.executable
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
badging = project.layout.buildDirectory.file(
|
|
|
|
|