-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle.kts
68 lines (57 loc) · 1.63 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import com.android.build.gradle.BaseExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
gradlePluginPortal()
google()
}
dependencies {
classpath(libs.androidGradle)
classpath(libs.kotlinGradle)
classpath(libs.anvilGradle)
classpath(libs.mavenPublishGradle)
}
}
subprojects {
afterEvaluate {
tasks.withType<KotlinCompile> {
configureTask()
}
extensions.findByType<BaseExtension>()?.apply {
configureExtension()
}
}
}
fun KotlinCompile.configureTask() {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
val compilerArgs = mutableListOf(
"-Xassertions=jvm",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=com.squareup.anvil.annotations.ExperimentalAnvilApi",
)
if (project.name != "sample") compilerArgs += "-Xexplicit-api=strict"
freeCompilerArgs = freeCompilerArgs + compilerArgs
}
}
fun BaseExtension.configureExtension() {
compileSdkVersion(34)
defaultConfig {
minSdk = 21
targetSdk = 33
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
}
apiValidation {
ignoredProjects.addAll(listOf("sample", "whetstone-compiler"))
}
tasks.register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory)
}