-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathbuild.gradle.kts
168 lines (136 loc) · 5.34 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
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
168
/*
* This file is part of Seeneva Android Reader
* Copyright (C) 2021-2023 Sergei Solodovnikov
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import com.android.build.gradle.BaseExtension
import extension.loadProperties
import extension.requireEnvOrProperty
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version Version.KOTLIN
kotlin("plugin.serialization") version Version.KOTLIN
kotlin("android") version Version.KOTLIN apply false
id(Plugin.KSP) version PluginVersion.KSP apply false
// https://docs.gradle.org/current/userguide/kotlin_dsl.html#sec:plugins_resolution_strategy
id(Plugin.ANDROID_APPLICATION) version PluginVersion.ANDROID apply false
id(Plugin.ANDROID_LIBRARY) version PluginVersion.ANDROID apply false
}
allprojects {
// we will use ViewPager2, so remove ViewPager dependency globally
configurations.configureEach {
exclude(group = "androidx.viewpager")
}
}
subprojects {
apply {
if (isAppLayer) {
plugin(Plugin.ANDROID_APPLICATION)
} else {
plugin(Plugin.ANDROID_LIBRARY)
}
plugin("org.jetbrains.kotlin.android")
plugin("org.jetbrains.kotlin.plugin.serialization")
}
configure<BaseExtension> {
ndkVersion = "21.4.7075529"
buildToolsVersion = "33.0.2"
compileSdkVersion(33)
defaultConfig {
minSdk = 16
targetSdk = 33
loadProperties(rootDir.resolve("seeneva.properties")).also { seenevaProperties ->
versionCode = requireEnvOrProperty(
extension.ENV_VERSION_CODE,
extension.PROP_VERSION_CODE,
seenevaProperties
).toInt()
versionName = requireEnvOrProperty(
extension.ENV_VERSION_NAME,
extension.PROP_VERSION_NAME,
seenevaProperties
)
}
vectorDrawables.useSupportLibrary = true
multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
sourceSets.all {
java.srcDir("src/$name/kotlin")
}
// needed to build tests
packagingOptions {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
lintOptions {
// Translations can miss some strings especially after Weblate pull request
// Lets consider this as a warning to finish 'lintRelease' Gradle task
// Update defaultConfig.resConfigs to add new supported translations
warning("MissingTranslation")
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "17"
}
}
dependencies {
// some Java 8 features
// https://developer.android.com/studio/write/java8-support-table
"coreLibraryDesugaring"(Deps.ANDROID_JAVA8_DESUGAR)
implementation(Deps.KOTLINX_SERIALIZATION_JSON)
implementation(Deps.KOTLINX_COROUTINES_ANDROID)
implementation(Deps.ANDROIDX_ANNOTATIONS)
implementation(Deps.ANDROIDX_CORE_KTX)
//implementation(Deps.KOIN_ANDROID)
implementation(Deps.KOIN_ANDROIDX_SCOPE)
implementation(Deps.TINYLOG_API)
implementation(Deps.TINYLOG_IMPL)
if (name != "common") {
implementation(project(":common"))
}
testImplementation(TestDeps.KOTLINX_COROUTINES_TEST)
testImplementation(Deps.KOTLINX_COROUTINES_CORE)
testImplementation(kotlin("test-junit", Version.KOTLIN))
testImplementation(TestDeps.ANDROIDX_TEST_JUNIT_KTX)
testImplementation(TestDeps.MOCKK)
testImplementation(TestDeps.KLUENT) {
exclude("com.nhaarman.mockitokotlin2")
}
testImplementation(TestDeps.KOIN_TEST) {
exclude("org.mockito")
}
"androidTestImplementation"(TestDeps.KOTLIN_FAKER)
"androidTestImplementation"(TestDeps.KOIN_TEST)
"androidTestImplementation"(TestDeps.KLUENT) {
exclude("com.nhaarman.mockitokotlin2")
}
"androidTestImplementation"(TestDeps.ANDROIDX_TEST_RUNNER)
"androidTestImplementation"(TestDeps.ANDROIDX_TEST_JUNIT_KTX)
"androidTestImplementation"(TestDeps.KOTLINX_COROUTINES_TEST)
"androidTestImplementation"(kotlin("test-junit", Version.KOTLIN))
}
}
val Project.isAppLayer: Boolean
get() = name == "app"
val Project.isDataLayer: Boolean
get() = name == "data"