summaryrefslogtreecommitdiff
path: root/buildSrc/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'buildSrc/src/main/java')
-rw-r--r--buildSrc/src/main/java/BaseProjectConfig.kt28
-rw-r--r--buildSrc/src/main/java/SlimTests.kt12
2 files changed, 23 insertions, 17 deletions
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
}
}
}