Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Commit

Permalink
Configure android extensions in BasePlugin types
Browse files Browse the repository at this point in the history
  • Loading branch information
Goooler authored and chrisbanes committed Sep 17, 2022
1 parent 5a6dd41 commit cd8854f
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import app.tivi.buildsrc.DependencyUpdates
import app.tivi.buildsrc.ReleaseType
import com.android.build.gradle.BasePlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand Down Expand Up @@ -98,14 +99,18 @@ subprojects {
plugins.withId(rootProject.libs.plugins.kotlin.kapt.get().pluginId) {
kapt.correctErrorTypes = true
}
plugins.withId(rootProject.libs.plugins.android.library.get().pluginId) {
setupAndroid(project)
}
plugins.withId(rootProject.libs.plugins.android.test.get().pluginId) {
setupAndroid(project)
}
plugins.withId(rootProject.libs.plugins.android.application.get().pluginId) {
setupAndroid(project)
plugins.withType(BasePlugin).configureEach {
project.android {
compileSdk libs.versions.compileSdk.get() as int
defaultConfig {
minSdk libs.versions.minSdk.get() as int
targetSdk libs.versions.targetSdk.get() as int
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
}
}

Expand All @@ -129,17 +134,3 @@ Object propOrDef(String propertyName, Object defaultValue) {
def propertyValue = project.properties[propertyName]
return propertyValue != null ? propertyValue : defaultValue
}

def setupAndroid(Project project) {
project.android {
compileSdk libs.versions.compileSdk.get() as int
defaultConfig {
minSdk libs.versions.minSdk.get() as int
targetSdk libs.versions.targetSdk.get() as int
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
}

0 comments on commit cd8854f

Please sign in to comment.