diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-07-29 15:24:31 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 09:54:31 +0000 |
commit | 403bb383b5caa23bbb14f4e59e2727ae70ed2283 (patch) | |
tree | 889bff20fed7f8c3dbaab2d00cd7e8186cb27058 /buildSrc | |
parent | 1172c3734fe68fed9d16c93175a5b1940f103b69 (diff) |
Upgrade to AGP 7.0.0 (#1474)
Diffstat (limited to 'buildSrc')
-rw-r--r-- | buildSrc/build.gradle.kts | 4 | ||||
-rw-r--r-- | buildSrc/src/main/java/BaseProjectConfig.kt | 28 | ||||
-rw-r--r-- | buildSrc/src/main/java/SlimTests.kt | 12 |
3 files changed, 25 insertions, 19 deletions
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 07c89e3f..2239861b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -41,9 +41,9 @@ gradlePlugin { } dependencies { - implementation("com.android.tools.build:gradle:4.2.2") + implementation("com.android.tools.build:gradle:7.0.0") implementation("com.diffplug.spotless:spotless-plugin-gradle:5.14.2") - implementation("com.google.dagger:hilt-android-gradle-plugin:2.38") + implementation("com.google.dagger:hilt-android-gradle-plugin:2.38.1") implementation("com.squareup.okhttp3:okhttp:4.9.0") implementation("com.vanniktech:gradle-maven-publish-plugin:0.17.0") implementation("com.vdurmont:semver4j:3.1.0") diff --git a/buildSrc/src/main/java/BaseProjectConfig.kt b/buildSrc/src/main/java/BaseProjectConfig.kt index e4dfa7e4..f3a33713 100644 --- a/buildSrc/src/main/java/BaseProjectConfig.kt +++ b/buildSrc/src/main/java/BaseProjectConfig.kt @@ -81,16 +81,22 @@ internal fun BaseAppModuleExtension.configureAndroidApplicationOptions(project: buildConfig = true } - flavorDimensions(FlavorDimensions.FREE) + flavorDimensions.add(FlavorDimensions.FREE) productFlavors { - create(ProductFlavors.FREE) {} - create(ProductFlavors.NON_FREE) {} + register(ProductFlavors.FREE) {} + register(ProductFlavors.NON_FREE) {} } buildTypes { named(BuildType.RELEASE.name) { isMinifyEnabled = !minifySwitch.isPresent - setProguardFiles(listOf("proguard-android-optimize.txt", "proguard-rules.pro")) + setProguardFiles( + listOf( + "proguard-android-optimize.txt", + "proguard-rules.pro", + "proguard-rules-missing-classes.pro", + ) + ) buildConfigField("boolean", "ENABLE_DEBUG_FEATURES", "${project.isSnapshot()}") } named(BuildType.DEBUG.name) { @@ -105,11 +111,11 @@ internal fun BaseAppModuleExtension.configureAndroidApplicationOptions(project: /** Apply baseline configurations for all Android projects (Application and Library). */ @Suppress("UnstableApiUsage") internal fun TestedExtension.configureCommonAndroidOptions() { - compileSdkVersion(30) + setCompileSdkVersion(30) defaultConfig { - minSdkVersion(23) - targetSdkVersion(29) + minSdk = 23 + targetSdk = 29 } sourceSets { @@ -118,10 +124,10 @@ internal fun TestedExtension.configureCommonAndroidOptions() { } packagingOptions { - exclude("**/*.version") - exclude("**/*.txt") - exclude("**/*.kotlin_module") - exclude("**/plugin.properties") + resources.excludes.add("**/*.version") + resources.excludes.add("**/*.txt") + resources.excludes.add("**/*.kotlin_module") + resources.excludes.add("**/plugin.properties") } compileOptions { diff --git a/buildSrc/src/main/java/SlimTests.kt b/buildSrc/src/main/java/SlimTests.kt index 65e9c618..e06c7c8c 100644 --- a/buildSrc/src/main/java/SlimTests.kt +++ b/buildSrc/src/main/java/SlimTests.kt @@ -3,8 +3,8 @@ * SPDX-License-Identifier: GPL-3.0-only */ -import com.android.build.api.extension.ApplicationAndroidComponentsExtension -import com.android.build.api.extension.LibraryAndroidComponentsExtension +import com.android.build.api.variant.ApplicationAndroidComponentsExtension +import com.android.build.api.variant.LibraryAndroidComponentsExtension import org.gradle.api.Project import org.gradle.kotlin.dsl.findByType import org.gradle.language.nativeplatform.internal.BuildType @@ -21,15 +21,15 @@ internal fun Project.configureSlimTests() { if (providers.gradleProperty(SLIM_TESTS_PROPERTY).forUseAtConfigurationTime().isPresent) { // disable unit test tasks on the release build type for Android Library projects extensions.findByType<LibraryAndroidComponentsExtension>()?.run { - beforeUnitTests(selector().withBuildType(BuildType.RELEASE.name)) { it.enabled = false } + beforeVariants(selector().withBuildType(BuildType.RELEASE.name)) { it.enableUnitTest = false } } // disable unit test tasks on the release build type and free flavor for Android Application // projects. extensions.findByType<ApplicationAndroidComponentsExtension>()?.run { - beforeUnitTests(selector().withBuildType(BuildType.RELEASE.name)) { it.enabled = false } - beforeUnitTests(selector().withFlavor(FlavorDimensions.FREE to ProductFlavors.NON_FREE)) { - it.enabled = false + beforeVariants(selector().withBuildType(BuildType.RELEASE.name)) { it.enableUnitTest = false } + beforeVariants(selector().withFlavor(FlavorDimensions.FREE to ProductFlavors.NON_FREE)) { + it.enableUnitTest = false } } } |