-
Notifications
You must be signed in to change notification settings - Fork 104
/
Copy pathbuild.gradle.kts
214 lines (190 loc) · 6.74 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
214
import com.android.build.gradle.internal.tasks.factory.dependsOn
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.ksp)
}
android {
namespace = "com.machiav3lli.fdroid"
compileSdk = 35
defaultConfig {
applicationId = "com.machiav3lli.fdroid"
minSdk = 24
targetSdk = 34
versionCode = 1021
versionName = "1.0.6-beta01"
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 = JavaVersion.VERSION_17.toString()
freeCompilerArgs = listOf("-Xjvm-default=all-compatibility")
}
buildFeatures {
buildConfig = true
compose = true
}
applicationVariants.all {
val variant = this
outputs.all {
(this as com.android.build.gradle.internal.api.BaseVariantOutputImpl).outputFileName =
"Neo_Store_${variant.versionName}_${variant.buildType.name}.apk"
}
}
buildTypes {
debug {
isMinifyEnabled = false
isShrinkResources = false
applicationIdSuffix = ".debug"
resValue("string", "application_name", "Neo Store - Debug")
}
register("neo") {
isMinifyEnabled = false
isShrinkResources = false
applicationIdSuffix = ".neo"
resValue("string", "application_name", "Neo Store")
}
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", // comment out to enable layout inspector
"/okhttp3/internal/publicsuffix/*"
)
}
}
lint {
disable += "InvalidVectorPath"
warning += "InvalidPackage"
}
dependenciesInfo {
// Avoid Google-signed dependency metadata in builds
includeInApk = false
includeInBundle = false
}
}
dependencies {
// Core
implementation(libs.kotlin.stdlib)
implementation(libs.ksp)
implementation(libs.preference)
implementation(libs.activity.compose)
implementation(libs.collections.immutable)
//debugImplementation(libs.leakcanary)
// use the new WorkInfo.stopReason (report stopReason), setNextScheduleTimeOverride (Precise scheduling), Configuration.Builder.setContentUriTriggerWorkersLimit (limit for content uri workers)
implementation(libs.work.runtime)
implementation(libs.biometric)
implementation(libs.material)
// Coil, Ktor, Okhttp, Zxing
api(platform(libs.coil.bom))
implementation(libs.coil)
implementation(libs.coil.ktor)
implementation(libs.coil.okhttp)
implementation(libs.coil.compose)
implementation(libs.zxing.core)
implementation(libs.ktor.core)
implementation(libs.ktor.okhttp)
implementation(libs.ktor.logging)
implementation(libs.okhttp)
implementation(libs.okhttp.logging)
// Koin
api(platform(libs.koin.bom))
implementation(libs.koin.core)
implementation(libs.koin.android)
implementation(libs.koin.workmanager)
implementation(libs.koin.compose)
implementation(libs.koin.startup)
implementation(libs.koin.annotations)
ksp(libs.koin.compiler)
// JSON, Markdown, LibSu
implementation(libs.libsu.core)
implementation(libs.jackson.core)
implementation(libs.serialization.json)
implementation(libs.markdown)
implementation(libs.compose.markdown)
// Storage
implementation(libs.simple.storage)
// Coroutines / Lifecycle
implementation(libs.lifecycle)
implementation(libs.coroutines.core)
implementation(libs.coroutines.android)
// Room
implementation(libs.room.runtime)
implementation(libs.room.ktx)
ksp(libs.room.compiler)
// Compose
api(platform(libs.compose.bom))
implementation(libs.compose.runtime)
implementation(libs.compose.ui)
implementation(libs.compose.foundation)
implementation(libs.compose.material3)
implementation(libs.compose.material3.navigationsuite)
implementation(libs.compose.adaptive)
implementation(libs.compose.adaptive.layout)
implementation(libs.compose.adaptive.navigation)
implementation(libs.compose.animation)
implementation(libs.compose.navigation)
implementation(libs.accompanist.permissions)
debugImplementation(libs.compose.ui.tooling)
debugImplementation(libs.compose.ui.tooling.preview)
}
// 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
languageCode?.let {
langsList.add(languageCode)
}
}
}
val langsListString = "{${langsList.sorted().joinToString(",") { "\"${it}\"" }}}"
android.defaultConfig.buildConfigField("String[]", "DETECTED_LOCALES", langsListString)
}
tasks.preBuild.dependsOn("detectAndroidLocals")