-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
107 lines (92 loc) · 3.01 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
105
106
107
// Top-level build file where you can add configuration options common to all sub-projects/modules.
import com.android.build.gradle.BaseExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
mavenLocal()
google()
jcenter()
mavenCentral()
}
dependencies {
classpath(Depends.Gradle.getGradlePlugin())
classpath(Depends.Kotlin.getKotlin())
classpath(Depends.Kotlin.getKotlinExtensions())
classpath(Depends.Plugins.CLASS_PATH_HILT)
}
}
plugins {
id(Depends.Plugins.HILT) version Versions.HILT_PLUGIN apply false
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven { url = uri("https://jitpack.io") }
}
androidCompile()
}
fun Project.androidCompile() {
// We want to implement this code only for specific modules
if (Modules.modules.map {
val a = it.split(":")
val b = a[a.size - 1]
b
}.contains(name).not()) return
val isApplication = if (":$name" == Modules.app) {
apply(plugin = "com.android.application")
true
} else {
apply(plugin = "com.android.library")
false
}
apply(plugin = "kotlin-parcelize")
apply(plugin = "kotlin-android")
apply(plugin = "kotlin-kapt")
configure<BaseExtension> {
compileSdkVersion(Versions.COMPILE_SKD_VERSION)
buildToolsVersion(Versions.BUILD_TOOLS_VERSION)
defaultConfig {
if (isApplication)
applicationId(Versions.APPLICATION_ID)
minSdkVersion(Versions.MIN_SDK_VERSION)
targetSdkVersion(Versions.TARGET_SDK_VERION)
versionCode(Versions.VERSION_CODE)
versionName(Versions.VERSION_NAME)
testInstrumentationRunner(Depends.Test.ANDROID_JUNIT_RUNNER)
}
buildTypes {
getByName("release") {
minifyEnabled(false)
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
sourceSets {
getByName("androidTest").java.srcDirs("src/androidTest/java")
}
packagingOptions {
exclude("META-INF/DEPENDENCIES")
exclude("META-INF/LICENSE")
exclude("META-INF/LICENSE.txt")
exclude("META-INF/license.txt")
exclude("META-INF/NOTICE")
exclude("META-INF/NOTICE.txt")
exclude("META-INF/notice.txt")
exclude("META-INF/ASL2.0")
exclude("META-INF/*")
exclude("META-INF/*.kotlin_module")
exclude("META-INF/gradle/incremental.annotation.processors")
}
}
}