forked from NeoApplications/Neo-Launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
370 lines (324 loc) · 12.6 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
import com.android.build.gradle.internal.tasks.factory.dependsOn
import java.text.SimpleDateFormat
import java.util.Date
import java.util.TimeZone
buildscript {
dependencies {
classpath("com.android.tools.build:gradle:8.4.0")
}
}
val vAccompanist = "0.34.0"
val vActivity = "1.9.0"
val vAlwan = "1.0.1"
val vCoil = "2.6.0"
val vComposeBOM = "2024.05.00"
val vComposeCompiler = "1.5.13"
val vConstraintLayout = "2.1.4"
val vCoordinatorLayout = "1.2.0"
val vCore = "1.13.1"
val vCoroutines = "1.8.0"
val vDynamicanimation = "1.1.0-alpha03"
val vDSP = "1.1.1"
val vFuzzywuzzy = "1.4.0"
val vHokoBlur = "1.5.2"
val vJUnit = "4.13.2"
val vJUnit5 = "5.9.2"
val vKotlin = "1.9.23"
val vKSP = "1.0.20"
val vLifecycle = "2.7.0"
val vLifecycleExt = "2.2.0"
val vMaterial = "1.12.0"
val vNavigation = "2.7.7"
val vOkhttp = "5.0.0-alpha.14"
val vOWM = "2.1.0"
val vPersianDate = "1.7.1"
val vPalette = "1.0.0"
val vPrefs = "1.2.1"
val vProtobuf = "3.25.3"
val vReorderable = "2.0.0"
val vRoom = "2.6.1"
val vRV = "1.3.2"
val vResBypass = "2.2"
val vSerialization = "1.6.3"
val vSlice = "1.1.0-alpha02"
plugins {
id("com.android.application").version("8.4.0")
kotlin("android").version("1.9.23")
kotlin("plugin.parcelize").version("1.9.23")
kotlin("plugin.serialization").version("1.9.23")
id("com.google.devtools.ksp").version("1.9.23-1.0.20")
id("com.google.protobuf").version("0.9.4")
}
allprojects {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
}
}
}
val prebuiltsDir: String = "prebuilts/"
android {
namespace = "com.android.launcher3"
compileSdk = 34
val name = "1.0.0-alpha02"
val code = 1002
defaultConfig {
minSdk = 26
targetSdk = 33
applicationId = "com.saggitt.omega"
versionName = name
versionCode = code
buildConfigField("String", "BUILD_DATE", "\"${getBuildDate()}\"")
buildConfigField("boolean", "ENABLE_AUTO_INSTALLS_LAYOUT", "false")
buildConfigField("boolean", "IS_DEBUG_DEVICE", "false")
buildConfigField("boolean", "IS_STUDIO_BUILD", "false")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
javaCompileOptions {
annotationProcessorOptions {
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.incremental", "true")
}
}
}
}
applicationVariants.all {
val variant = this
outputs.all {
(this as com.android.build.gradle.internal.api.BaseVariantOutputImpl).outputFileName =
"NeoLauncher_v${variant.versionName}_build_${variant.versionCode}.apk"
}
variant.resValue(
"string",
"launcher_component",
"${variant.applicationId}/com.saggitt.omega.OmegaLauncher"
)
}
buildTypes {
named("debug") {
isMinifyEnabled = false
applicationIdSuffix = ".alpha"
signingConfig = signingConfigs.getByName("debug")
}
create("neo") {
isMinifyEnabled = false
applicationIdSuffix = ".neo"
}
named("release") {
isMinifyEnabled = false
setProguardFiles(listOf("proguard-android-optimize.txt", "proguard.flags"))
}
}
signingConfigs {
getByName("debug") {
storeFile = file("debug.keystore")
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
create("primary") {
storeFile = file("debug.keystore")
storePassword = "android"
keyAlias = "androiddebugkey"
keyPassword = "android"
}
}
buildFeatures {
buildConfig = true
compose = true
dataBinding = true
aidl = true
}
composeOptions {
kotlinCompilerExtensionVersion = vComposeCompiler
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = compileOptions.sourceCompatibility.toString()
}
}
packaging {
jniLibs {
pickFirsts += listOf("**/libeasyBypass.so")
}
resources.excludes.add("META-INF/LICENSE.md")
resources.excludes.add("META-INF/LICENSE-notice.md")
resources.excludes.add("META-INF/versions/9/previous-compilation-data.bin") // TODO remove when issue is fixed (https://github.com/Kotlin/kotlinx.coroutines/issues/3668)
}
flavorDimensionList.clear()
flavorDimensionList.addAll(listOf("app", "custom"))
productFlavors {
create("aosp") {
dimension = "app"
applicationId = "com.saggitt.omega"
testApplicationId = "com.android.launcher3.tests"
}
create("omega") {
dimension = "custom"
}
}
sourceSets {
named("main") {
res.srcDirs(listOf("res"))
java.srcDirs(listOf("src", "src_plugins", "src_ui_overrides"))
assets.srcDirs(listOf("assets"))
manifest.srcFile("AndroidManifest-common.xml")
}
/*
named("androidTest") {
res.srcDirs(listOf("tests/res"))
java.srcDirs(listOf("tests/src", "tests/tapl"))
manifest.srcFile("tests/AndroidManifest-common.xml")
}
named("androidTestDebug") {
java.srcDirs("tests/src_common")
manifest.srcFile("tests/AndroidManifest.xml")
}*/
named("aosp") {
java.srcDirs(listOf("src_flags", "src_shortcuts_overrides"))
}
named("omega") {
res.srcDirs(listOf("Omega/res"))
java.srcDirs(listOf("Omega/src", "Omega/src_overrides"))
aidl.srcDirs(listOf("Omega/aidl"))
manifest.srcFile("Omega/AndroidManifest.xml")
}
protobuf {
// Configure the protoc executable
protoc {
artifact = "com.google.protobuf:protoc:$vProtobuf"
}
generateProtoTasks {
all().forEach { task ->
task.builtins {
create("java") {
option("lite")
}
}
}
}
}
}
lint {
abortOnError = false
checkReleaseBuilds = false
disable += listOf("MissingTranslation", "ExtraTranslation")
}
}
dependencies {
implementation(project(":iconloaderlib"))
implementation(project(":animationlib"))
implementation(project(":smartspace"))
implementation(kotlin("stdlib", vKotlin))
//UI
implementation("androidx.core:core-ktx:$vCore")
implementation("androidx.constraintlayout:constraintlayout:$vConstraintLayout")
implementation("androidx.coordinatorlayout:coordinatorlayout:$vCoordinatorLayout")
implementation("androidx.dynamicanimation:dynamicanimation:$vDynamicanimation")
implementation("androidx.palette:palette-ktx:$vPalette")
implementation("androidx.preference:preference-ktx:$vPrefs")
implementation("androidx.recyclerview:recyclerview:$vRV")
implementation("com.google.android.material:material:$vMaterial")
implementation("androidx.datastore:datastore-preferences:$vDSP")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:$vLifecycle")
implementation("androidx.lifecycle:lifecycle-extensions:$vLifecycleExt")
implementation("androidx.lifecycle:lifecycle-common-java8:$vLifecycle")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$vLifecycle")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$vLifecycle")
implementation("androidx.slice:slice-core:$vSlice")
//Libs
implementation("com.google.protobuf:protobuf-javalite:$vProtobuf")
implementation("com.github.ChickenHook:RestrictionBypass:$vResBypass")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$vCoroutines")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$vSerialization")
implementation("com.squareup.okhttp3:okhttp:$vOkhttp")
implementation("com.github.samanzamani:PersianDate:$vPersianDate")
implementation("com.github.KwabenBerko:OpenWeatherMap-Android-Library:$vOWM") {
exclude("com.android.support", "support-compat")
exclude("com.android.support", "appcompat-v7")
}
implementation("com.raedapps:alwan:$vAlwan")
implementation("io.github.hokofly:hoko-blur:$vHokoBlur")
implementation("me.xdrop:fuzzywuzzy:$vFuzzywuzzy")
//Compose
implementation("androidx.activity:activity-compose:$vActivity")
implementation("androidx.compose.compiler:compiler:$vComposeCompiler")
api(platform("androidx.compose:compose-bom:$vComposeBOM"))
implementation("androidx.compose.runtime:runtime")
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-tooling")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.foundation:foundation")
implementation("androidx.compose.material3:material3")
implementation("com.google.accompanist:accompanist-insets-ui:$vAccompanist")
implementation("com.google.accompanist:accompanist-systemuicontroller:$vAccompanist")
implementation("com.google.accompanist:accompanist-drawablepainter:$vAccompanist")
implementation("androidx.navigation:navigation-compose:$vNavigation")
implementation("io.coil-kt:coil-compose:$vCoil")
implementation("sh.calvin.reorderable:reorderable:$vReorderable")
//Room
implementation("androidx.room:room-runtime:$vRoom")
implementation("androidx.room:room-ktx:$vRoom")
ksp("androidx.room:room-compiler:$vRoom")
// Jars
implementation(fileTree(baseDir = "${prebuiltsDir}/libs").include("SystemUI-statsd-14.jar"))
implementation(fileTree(baseDir = "${prebuiltsDir}/libs").include("WindowManager-Shell-14.jar"))
protobuf(files("protos/"))
protobuf(files("protos_overrides/"))
//Test
testImplementation("junit:junit:$vJUnit")
implementation("junit:junit:$vJUnit")
androidTestImplementation("org.junit.jupiter:junit-jupiter:$vJUnit5")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test:runner:1.5.2")
androidTestImplementation("androidx.test:rules:1.5.0")
androidTestImplementation("androidx.test.uiautomator:uiautomator:2.3.0")
androidTestImplementation("com.google.truth:truth:1.1.5")
androidTestImplementation("org.mockito:mockito-core:5.0.0")
androidTestImplementation("com.google.dexmaker:dexmaker:1.2")
androidTestImplementation("com.google.dexmaker:dexmaker-mockito:1.2")
androidTestImplementation("androidx.annotation:annotation:1.7.1")
androidTestImplementation("com.android.support.test:runner:1.0.2")
androidTestImplementation("com.android.support.test:rules:1.0.2")
androidTestImplementation("com.android.support.test.uiautomator:uiautomator-v18:2.1.3")
}
// 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("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_ANDROID_LOCALES",
langsListString
)
}
tasks.preBuild.dependsOn("detectAndroidLocals")
@SuppressWarnings(
"UnnecessaryQualifiedReference",
"SpellCheckingInspection",
"GroovyUnusedDeclaration"
)
// Returns the build date in a RFC3339 compatible format. TZ is always converted to UTC
fun getBuildDate(): String {
val RFC3339_LIKE = SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
RFC3339_LIKE.timeZone = TimeZone.getTimeZone("UTC")
return RFC3339_LIKE.format(Date())
}