-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
213 lines (183 loc) · 7.23 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
import com.android.build.gradle.internal.tasks.factory.dependsOn
val accompanistVersion = "0.31.5-beta"
val composeVersion = "1.6.0-alpha01"
val composeCompilerVersion = "1.4.8"
val koinVersion = "3.4.2"
val koinKspVersion = "1.2.2"
val material3Version = "1.2.0-alpha03"
val navigationVersion = "2.7.0-beta02"
val okhttpVersion = "5.0.0-alpha.11"
val moshiVersion = "1.15.0"
val roomVersion = "2.6.0-alpha02"
val coroutinesVersion = "1.7.2"
plugins {
id("com.android.application") version ("8.0.2")
kotlin("android") version ("1.8.22")
kotlin("plugin.serialization") version ("1.8.22")
id("com.google.devtools.ksp") version ("1.8.22-1.0.11")
}
android {
namespace = "com.machiav3lli.fdroid"
compileSdk = 34
defaultConfig {
applicationId = "com.machiav3lli.fdroid"
minSdk = 24
targetSdk = 33
versionCode = 1004
versionName = "1.0.0-alpha05"
buildConfigField("String", "KEY_API_EXODUS", "\"81f30e4903bde25023857719e71c94829a41e6a5\"")
javaCompileOptions {
annotationProcessorOptions {
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.incremental", "true")
arg("room.generateKotlin", "true")
}
}
}
}
sourceSets.forEach { source ->
val javaDir = source.java.srcDirs.find { it.name == "java" }
source.java {
srcDir(File(javaDir?.parentFile, "kotlin"))
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = compileOptions.sourceCompatibility.toString()
freeCompilerArgs = listOf("-Xjvm-default=compatibility")
//freeCompilerArgs = listOf("-Xjvm-default=all|all-compatibility")
}
buildFeatures {
buildConfig = true
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = composeCompilerVersion
}
applicationVariants.all { variant ->
variant.outputs.all {
(this as com.android.build.gradle.internal.api.BaseVariantOutputImpl).outputFileName =
"Neo_Store_${variant.name}_${variant.versionName}.apk"
}
true
}
buildTypes {
named("debug") {
isMinifyEnabled = false
isShrinkResources = false
applicationIdSuffix = ".debug"
resValue("string", "application_name", "Neo Store-Debug")
}
create("neo") {
isMinifyEnabled = false
isShrinkResources = false
applicationIdSuffix = ".neo"
resValue("string", "application_name", "Neo Store-beta")
}
named("release") {
isMinifyEnabled = true
isShrinkResources = true
resValue("string", "application_name", "Neo Store")
}
all {
isCrunchPngs = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard.pro"
)
}
}
packaging {
jniLibs {
excludes += listOf("/okhttp3/internal/publicsuffix/*")
}
resources {
excludes += listOf(
"/DebugProbesKt.bin",
"/kotlin/**.kotlin_builtins",
"/kotlin/**.kotlin_metadata",
"/META-INF/**.kotlin_module",
"/META-INF/**.pro",
"/META-INF/**.version",
"/okhttp3/internal/publicsuffix/*"
)
}
}
lint {
disable += "InvalidVectorPath"
warning += "InvalidPackage"
}
}
dependencies {
// Core
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22")
implementation("com.google.devtools.ksp:symbol-processing-api:1.8.22-1.0.11")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.work:work-runtime-ktx:2.8.1")
// Material3
implementation("com.google.android.material:material:1.9.0")
// Coil
implementation("io.coil-kt:coil:2.4.0")
implementation("io.coil-kt:coil-compose:2.4.0")
// Koin
implementation("io.insert-koin:koin-android:$koinVersion")
implementation("io.insert-koin:koin-androidx-workmanager:$koinVersion")
implementation("io.insert-koin:koin-annotations:$koinKspVersion")
ksp("io.insert-koin:koin-ksp-compiler:$koinKspVersion")
// Ktor
implementation("io.ktor:ktor-client-core:2.3.2")
implementation("io.ktor:ktor-client-okhttp:2.3.2")
// OkHttps
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
// LibSu
implementation("com.github.topjohnwu.libsu:core:5.0.5")
// JSON
implementation("com.fasterxml.jackson.core:jackson-core:2.15.2")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.1")
// Markdown
implementation("org.jetbrains:markdown:0.4.1")
implementation("de.charlex.compose:html-text:1.4.1")
// Storage
implementation("com.anggrayudi:storage:1.5.5")
// Coroutines / Lifecycle
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
// Room
implementation("androidx.room:room-runtime:$roomVersion")
implementation("androidx.room:room-ktx:$roomVersion")
ksp("androidx.room:room-compiler:$roomVersion")
// Compose
implementation("androidx.compose.runtime:runtime:$composeVersion")
implementation("androidx.compose.ui:ui:$composeVersion")
implementation("androidx.compose.foundation:foundation:$composeVersion")
implementation("androidx.compose.runtime:runtime-livedata:$composeVersion")
implementation("androidx.compose.material3:material3:$material3Version")
implementation("androidx.compose.animation:animation:$composeVersion")
implementation("androidx.navigation:navigation-compose:$navigationVersion")
implementation("com.google.accompanist:accompanist-permissions:$accompanistVersion")
debugImplementation("androidx.compose.ui:ui-tooling:$composeVersion")
debugImplementation("androidx.compose.ui:ui-tooling-preview:$composeVersion")
}
// using a task as a preBuild dependency instead of a function that takes some time insures that it runs
task("detectAndroidLocals") {
val langsList: MutableSet<String> = HashSet()
// in /res are (almost) all languages that have a translated string is saved. this is safer and saves some time
fileTree("src/main/res").visit {
if (this.file.path.endsWith("strings.xml")
&& this.file.canonicalFile.readText().contains("<string")
) {
var languageCode = this.file.parentFile.name.replace("values-", "")
languageCode = if (languageCode == "values") "en" else languageCode
langsList.add(languageCode)
}
}
val langsListString = "{${langsList.joinToString(",") { "\"${it}\"" }}}"
android.defaultConfig.buildConfigField("String[]", "DETECTED_LOCALES", langsListString)
}
tasks.preBuild.dependsOn("detectAndroidLocals")