-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
104 lines (82 loc) · 3.33 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import com.android.build.gradle.BaseExtension
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.1" apply false
id("com.android.library") version "8.1.1" apply false
kotlin("android") version "1.9.0" apply false
kotlin("kapt") version "1.9.10" apply false
kotlin("plugin.serialization") version "1.9.0" apply false
kotlin("jvm") version "1.9.0" apply false
}
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.2.1")
}
}
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
/*
The following block reduces duplicate codes. Defines common properties that all Android modules
need under their corresponding gradle file.
*/
subprojects {
afterEvaluate {
if (hasProperty("android")) {
configure<BaseExtension> {
compileSdkVersion(Configs.compileSdk)
defaultConfig {
minSdk = Configs.minSdk
targetSdk = Configs.targetSdk
versionCode = Configs.versionCode
versionName = Configs.versionName
testInstrumentationRunner = Configs.testInstrumentationRunner
}
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = Configs.sourceCompatibility
targetCompatibility = Configs.targetCompatibility
}
dataBinding.enable = true
dependencies {
add("implementation", Dependencies.core_ktx)
add("implementation", Dependencies.fragment_ktx)
add("implementation", Dependencies.appcompat)
add("implementation", Dependencies.material)
add("implementation", Dependencies.constrainlayout)
add("implementation", Dependencies.Arch.viewModel)
add("implementation", Dependencies.Arch.liveData)
add("testImplementation", Dependencies.junit)
add("androidTestImplementation", Dependencies.ext_junit)
add("androidTestImplementation", Dependencies.espresso)
add("implementation", Dependencies.Koin.android)
add("implementation", Dependencies.timber)
add("implementation", Dependencies.cardView)
}
buildFeatures.buildConfig = true
val gradleProperty = project.property("API_KEY")
val API_KEY = if (gradleProperty is String) gradleProperty else ""
buildTypes.forEach { it.buildConfigField("String", "API_KEY", API_KEY) }
}
}
}
}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}