|
|
@ -20,8 +20,8 @@ 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.BaseExtension
|
|
|
|
import com.android.build.gradle.BaseExtension
|
|
|
|
import com.android.SdkConstants
|
|
|
|
import com.android.SdkConstants
|
|
|
|
|
|
|
|
import com.google.common.truth.Truth.assertWithMessage
|
|
|
|
import org.gradle.api.DefaultTask
|
|
|
|
import org.gradle.api.DefaultTask
|
|
|
|
import org.gradle.api.GradleException
|
|
|
|
|
|
|
|
import org.gradle.api.Project
|
|
|
|
import org.gradle.api.Project
|
|
|
|
import org.gradle.api.file.DirectoryProperty
|
|
|
|
import org.gradle.api.file.DirectoryProperty
|
|
|
|
import org.gradle.api.file.RegularFileProperty
|
|
|
|
import org.gradle.api.file.RegularFileProperty
|
|
|
@ -40,7 +40,6 @@ import org.gradle.kotlin.dsl.register
|
|
|
|
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
|
|
|
import org.gradle.language.base.plugins.LifecycleBasePlugin
|
|
|
|
import org.gradle.process.ExecOperations
|
|
|
|
import org.gradle.process.ExecOperations
|
|
|
|
import java.io.File
|
|
|
|
import java.io.File
|
|
|
|
import java.nio.file.Files
|
|
|
|
|
|
|
|
import javax.inject.Inject
|
|
|
|
import javax.inject.Inject
|
|
|
|
|
|
|
|
|
|
|
|
@CacheableTask
|
|
|
|
@CacheableTask
|
|
|
@ -98,17 +97,12 @@ abstract class CheckBadgingTask : DefaultTask() {
|
|
|
|
|
|
|
|
|
|
|
|
@TaskAction
|
|
|
|
@TaskAction
|
|
|
|
fun taskAction() {
|
|
|
|
fun taskAction() {
|
|
|
|
if (
|
|
|
|
assertWithMessage(
|
|
|
|
Files.mismatch(
|
|
|
|
|
|
|
|
goldenBadging.get().asFile.toPath(),
|
|
|
|
|
|
|
|
generatedBadging.get().asFile.toPath(),
|
|
|
|
|
|
|
|
) != -1L
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
throw GradleException(
|
|
|
|
|
|
|
|
"Generated badging is different from golden badging! " +
|
|
|
|
"Generated badging is different from golden badging! " +
|
|
|
|
"If this change is intended, run ./gradlew ${updateBadgingTaskName.get()}",
|
|
|
|
"If this change is intended, run ./gradlew ${updateBadgingTaskName.get()}",
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
.that(generatedBadging.get().asFile.readText())
|
|
|
|
|
|
|
|
.isEqualTo(goldenBadging.get().asFile.readText())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|