-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
168 lines (143 loc) · 6.07 KB
/
build.gradle
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
repositories {
google()
}
dependencies {
classpath Tools.androidGradlePlugin
classpath KotlinDeps.gradlePlugin
classpath KotlinDeps.serializer
}
}
plugins {
id 'com.diffplug.spotless' version '6.0.0'
}
def composableModules = ['app', 'auth', 'loading', 'common', 'menu', 'controls', 'lookup', 'settings']
allprojects {
repositories {
google()
mavenCentral()
}
}
subprojects {
apply plugin: 'com.diffplug.spotless'
spotless {
kotlin {
target '**/*.kt'
targetExclude("$buildDir/**/*.kt")
targetExclude('bin/**/*.kt')
ktlint(Versions.ktLint)
licenseHeaderFile rootProject.file('spotless/copyright.kt')
}
}
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
// Treat all Kotlin warnings as errors (disabled by default)
allWarningsAsErrors = project.hasProperty("warningsAsErrors") ? project.warningsAsErrors : false
jvmTarget = JavaVersion.VERSION_1_8.toString()
// Use experimental APIs
freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn'
}
}
// androidx.test and hilt are forcing JUnit, 4.12. This forces them to use 4.13
configurations.configureEach {
resolutionStrategy {
force Deps.test.junit
}
}
// to avoid all the repetitions you can use this "subprojcts.afterEvaluate"
afterEvaluate { project ->
if (project.hasProperty("android")) {
android {
defaultConfig {
compileSdk Versions.compileSdk
versionCode Releases.versionCode
versionName Releases.versionName
minSdkVersion Versions.minSdk
targetSdkVersion Versions.targetSdk
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
packagingOptions {
// Multiple dependency bring these files in. Exclude them to enable
// our test APK to build (has no effect on our AARs)
excludes += "/META-INF/AL2.0"
excludes += "/META-INF/LGPL2.1"
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
if (composableModules.contains(name.toLowerCase())) {
buildFeatures {
compose true
// Disable unused AGP features
buildConfig false
aidl false
renderScript false
resValues false
shaders false
}
composeOptions {
kotlinCompilerExtensionVersion '1.1.0-rc02' // For Kotlin 1.6.10. Revert with rc03
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation KotlinDeps.stdlib
implementation AndroidDeps.ktx
implementation Deps.koin.android
implementation Deps.coroutines.core
}
if (composableModules.contains(name.toLowerCase())) {
dependencies {
implementation AndroidDeps.appCompat
implementation Deps.koin.compose
implementation Deps.compose.ui
implementation Deps.compose.activity
implementation Deps.compose.navigation
implementation Deps.compose.runtime
implementation Deps.compose.runtimeLivedata
implementation Deps.compose.foundation
implementation Deps.compose.material
implementation Deps.compose.icons
implementation Deps.compose.material3
implementation Deps.compose.layout
implementation Deps.compose.animation
implementation Deps.compose.tooling
implementation Deps.compose.viewModel
androidTestImplementation(Deps.compose.uiTest) {
exclude group : "androidx.core", module : "core-ktx"
exclude group : "androidx.fragment", module : "fragment"
exclude group : "androidx.customview", module : "customview"
exclude group : "androidx.activity", module : "activity"
exclude group : "androidx.lifecycle", module : "lifecycle-runtime"
}
androidTestImplementation(Deps.compose.junit4) {
exclude group : "androidx.core", module : "core-ktx"
exclude group : "androidx.fragment", module : "fragment"
exclude group : "androidx.customview", module : "customview"
exclude group : "androidx.activity", module : "activity"
exclude group : "androidx.lifecycle", module : "lifecycle-runtime"
}
androidTestImplementation(Deps.compose.manifest)
}
}
}
}
}