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

Commit

Permalink
Tidy up plugin/task configurations (#322)
Browse files Browse the repository at this point in the history
Follow up 50d9bd8 & 1d5a91f.
  • Loading branch information
Goooler authored Jan 19, 2023
1 parent 65585b3 commit 7b75a25
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import com.android.build.gradle.BaseExtension
import com.android.build.gradle.BasePlugin
import com.android.build.gradle.LibraryPlugin
import com.google.devtools.ksp.gradle.KspExtension
import com.google.devtools.ksp.gradle.KspGradleSubplugin
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
alias(libs.plugins.android.application) apply false
Expand Down Expand Up @@ -35,19 +36,27 @@ allprojects {
if (displayName.contains(":biz:") || name.startsWith("common")) setupCommon() else setupBase()
}
}
plugins.withId(rootProject.libs.plugins.ksp.get().pluginId) {
plugins.withType<KspGradleSubplugin>().configureEach {
configure<KspExtension> {
arg("room.incremental", "true")
}
}
// Configure Java to use our chosen language level. Kotlin will automatically pick this up.
// See https://kotlinlang.org/docs/gradle-configure-project.html#gradle-java-toolchains-support
plugins.withType<JavaBasePlugin>().configureEach {
extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
}

tasks.withType<KotlinCompile> {
kotlinOptions {
allWarningsAsErrors = true
jvmTarget = JavaVersion.VERSION_17.toString()
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
allWarningsAsErrors.set(true)
}
}
tasks.withType<Test> {
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}
tasks.withType<ValidatePlugins>().configureEach {
Expand Down Expand Up @@ -102,9 +111,10 @@ fun <T : BaseExtension> Project.setupBase(block: T.() -> Unit) {
sourceSets.configureEach {
java.srcDirs("src/$name/kotlin")
}
// Can remove this once https://issuetracker.google.com/issues/260059413 is fixed.
compileOptions {
targetCompatibility(JavaVersion.VERSION_17)
sourceCompatibility(JavaVersion.VERSION_17)
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
packagingOptions.resources.excludes += setOf(
"**/*.proto",
Expand Down

0 comments on commit 7b75a25

Please sign in to comment.