forked from Goooler/LawnchairRelease
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
433 lines (377 loc) · 15.6 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
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
import app.cash.licensee.LicenseeTask
import com.android.build.gradle.api.AndroidBasePlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'com.android.application' version "8.5.2"
id 'com.android.library' version "8.5.2" apply false
id 'com.android.test' version '8.5.2' apply false
id 'androidx.baselineprofile' version '1.3.0'
id 'org.jetbrains.kotlin.android' version "2.0.20"
id 'org.jetbrains.kotlin.plugin.compose' version "2.0.20"
id 'org.jetbrains.kotlin.plugin.parcelize' version "2.0.20"
id 'org.jetbrains.kotlin.plugin.serialization' version "2.0.20"
id "com.google.devtools.ksp" version "2.0.20-1.0.24"
id 'com.google.protobuf' version "0.9.4"
id 'app.cash.licensee' version "1.11.0"
id 'dev.rikka.tools.refine' version "4.4.0"
id 'org.gradle.android.cache-fix' version '3.0.1'
id 'com.diffplug.spotless' version '6.25.0'
}
allprojects {
plugins.withType(AndroidBasePlugin).configureEach {
apply plugin: 'org.gradle.android.cache-fix'
android {
compileSdk 35
defaultConfig {
minSdk 26
targetSdk 34
vectorDrawables.useSupportLibrary = true
}
lint {
abortOnError true
checkReleaseBuilds false
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
}
}
plugins.withId('com.google.protobuf') {
def protocVersion = '4.27.3'
protobuf {
// Configure the protoc executable
protoc {
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
generateProtoTasks {
all().configureEach { task ->
task.builtins {
remove java
java {
option "lite"
}
}
}
}
}
dependencies {
implementation "com.google.protobuf:protobuf-javalite:$protocVersion"
}
}
plugins.withType(JavaBasePlugin).configureEach {
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
}
tasks.withType(KotlinCompile).configureEach {
compilerOptions.freeCompilerArgs.add(
"-Xjvm-default=all",
)
}
ext {
FRAMEWORK_PREBUILTS_DIR = "$rootDir/prebuilts/libs"
daggerVersion = '2.52'
addFrameworkJar = { String name ->
def frameworkJar = new File(FRAMEWORK_PREBUILTS_DIR, name)
if (!frameworkJar.exists()) {
throw new IllegalArgumentException("Framework jar path ${frameworkJar.path} doesn't exist")
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile).configureEach {
classpath = files(frameworkJar, classpath)
}
tasks.withType(KotlinCompile).configureEach {
libraries.from(files(frameworkJar))
}
}
dependencies {
compileOnly files(frameworkJar)
}
}
compileOnlyCommonJars = {
dependencies {
compileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'SystemUI-core.jar')
compileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'SystemUI-statsd.jar')
compileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'WindowManager-Shell-14.jar')
compileOnly projects.compatLib
compileOnly projects.compatLib.compatLibVQ
compileOnly projects.compatLib.compatLibVR
compileOnly projects.compatLib.compatLibVS
compileOnly projects.compatLib.compatLibVT
compileOnly projects.compatLib.compatLibVU
}
}
}
}
final def buildTime = new Date().format("yyyyMMddHHmm")
final def buildCommit = providers.exec {
commandLine('git', 'rev-parse', '--short=7', 'HEAD')
}.standardOutput.asText.get().trim()
final def versionString = "14.0.0"
final def versionDisplayName = "${versionString} (${buildCommit})"
final def parts = versionString.split("\\.")
final def majorVersion = parts[0]
final def versionInt = parts[0].toInteger() * 1000000 + parts[1].toInteger() * 10000 + parts[2].toInteger() * 100
final def quickstepMinSdk = "29"
final def quickstepMaxSdk = "34"
android {
namespace "com.android.launcher3"
defaultConfig {
versionCode versionInt
versionName "${versionDisplayName}"
buildConfigField "String", "VERSION_DISPLAY_NAME", "\"${versionDisplayName}\""
buildConfigField "String", "MAJOR_VERSION", "\"${majorVersion}\""
buildConfigField "String", "COMMIT_HASH", "\"${buildCommit}\""
buildConfigField "boolean", "ENABLE_AUTO_INSTALLS_LAYOUT", "false"
manifestPlaceholders.quickstepMinSdk = quickstepMinSdk
manifestPlaceholders.quickstepMaxSdk = quickstepMaxSdk
buildConfigField "int", "QUICKSTEP_MIN_SDK", quickstepMinSdk
buildConfigField "int", "QUICKSTEP_MAX_SDK", quickstepMaxSdk
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
outputFileName = "Lawnchair-${versionString}-${buildTime}-${buildCommit}.apk"
}
}
androidResources {
generateLocaleConfig true
}
buildFeatures {
aidl true
buildConfig true
resValues true
}
final def keystorePropertiesFile = rootProject.file("keystore.properties")
def releaseSigning = signingConfigs.debug
if (keystorePropertiesFile.exists()) {
final def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
releaseSigning = signingConfigs.create("release") {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile rootProject.file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
packagingOptions.resources.excludes += [
"**/*.proto",
"**/*.bin",
"**/*.java",
"**/*.properties",
"**/*.version",
"**/*.*_module",
"com/**",
"google/**",
"kotlin/**",
"kotlinx/**",
"okhttp3/**",
"META-INF/services/**",
"META-INF/com/**",
"META-INF/licenses/**",
"META-INF/AL2.0",
"META-INF/LGPL2.1",
]
// Load all proguard configs from AOSP
def proguardFilesFromAosp = allprojects
.collect { it.file("proguard.flags") }
.findAll { it.exists() }
.toArray()
buildTypes {
all {
pseudoLocalesEnabled true
resValue("string", "derived_app_name", "Lawnchair")
signingConfig releaseSigning
}
release {
minifyEnabled true
shrinkResources true
proguardFiles proguardFilesFromAosp + "proguard.pro"
}
}
compileOptions {
coreLibraryDesugaringEnabled true
}
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
// See: https://developer.android.com/studio/build/build-variants#flavor-dimensions
flavorDimensions += ["app", "recents"]
productFlavors {
lawn {
dimension "app"
applicationId 'app.lawnchair'
}
withQuickstep {
dimension "recents"
minSdk 26
}
configureEach {
resValue("string", "launcher_component", "${applicationId}/app.lawnchair.LawnchairLauncher")
}
}
sourceSets {
main {
res.srcDirs = ['res']
java.srcDirs = ['src', 'src_plugins']
manifest.srcFile 'AndroidManifest-common.xml'
proto {
srcDirs = ['protos/', 'quickstep/protos_overrides/']
}
}
lawn {
java.srcDirs = ['src_flags', 'src_shortcuts_overrides', 'lawnchair/src', 'tests/shared']
aidl.srcDirs = ['lawnchair/aidl']
res.srcDirs = ['lawnchair/res', 'platform_frameworks_libs_systemui/animationlib/res']
manifest.srcFile "lawnchair/AndroidManifest.xml"
assets {
srcDirs 'lawnchair/assets'
}
proto {
srcDirs = ['lawnchair/protos/']
}
}
lawnWithQuickstep {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
withQuickstep {
res.srcDirs = ['quickstep/res', 'quickstep/recents_ui_overrides/res']
java.srcDirs = ['quickstep/src', 'quickstep/recents_ui_overrides/src']
manifest.srcFile "quickstep/AndroidManifest.xml"
}
}
}
androidComponents {
onVariants(selector().all()) { variant ->
def capName = variant.name.capitalize()
def licenseeTask = tasks.named("licenseeAndroid$capName", LicenseeTask)
def copyArtifactsTask = tasks.register("copy${capName}Artifacts", Copy) {
dependsOn(licenseeTask)
from(licenseeTask.map { it.jsonOutput })
// Copy artifacts.json to a new directory.
into(layout.buildDirectory.dir("generated/dependencyAssets/${variant.name}"))
}
variant.sources.assets?.addGeneratedSourceDirectory(licenseeTask) {
// Avoid using LicenseeTask::outputDir as it contains extra files that we don't need.
objects.directoryProperty().fileProvider(copyArtifactsTask.map { it.destinationDir })
}
}
}
addFrameworkJar('framework-14.jar')
dependencies {
implementation projects.iconloaderlib
implementation projects.searchuilib
implementation projects.animationlib
// Recents lib dependency
withQuickstepCompileOnly projects.hiddenApi
withQuickstepImplementation projects.systemUIShared
withQuickstepImplementation projects.systemUIAnim
withQuickstepImplementation projects.systemUnFold
withQuickstepImplementation projects.systemUIViewCapture
withQuickstepImplementation projects.systemUILog
withQuickstepCompileOnly projects.systemUIPlugin
withQuickstepImplementation projects.systemUIPluginCore
withQuickstepCompileOnly projects.systemUICommon
// QuickSwitch Compat
withQuickstepImplementation projects.compatLib
withQuickstepImplementation projects.compatLib.compatLibVQ
withQuickstepImplementation projects.compatLib.compatLibVR
withQuickstepImplementation projects.compatLib.compatLibVS
withQuickstepImplementation projects.compatLib.compatLibVT
withQuickstepImplementation projects.compatLib.compatLibVU
implementation fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'SystemUI-statsd-14.jar')
implementation fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'WindowManager-Shell-14.jar')
withQuickstepCompileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'framework-14.jar')
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.0'
implementation 'androidx.profileinstaller:profileinstaller:1.3.1'
baselineProfile projects.baselineProfile
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.3.2"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1'
implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7"
implementation 'com.github.ChickenHook:RestrictionBypass:2.2'
implementation 'dev.rikka.tools.refine:runtime:4.4.0'
implementation platform("androidx.compose:compose-bom:2024.08.00")
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-util"
debugImplementation "androidx.compose.ui:ui-tooling"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation "androidx.compose.ui:ui-text-google-fonts"
implementation "androidx.compose.foundation:foundation"
implementation "androidx.compose.material:material-icons-extended"
implementation "androidx.compose.material:material"
implementation "androidx.compose.runtime:runtime-livedata"
implementation 'androidx.compose.material3:material3:1.3.0-rc01'
implementation 'androidx.compose.material3:material3-window-size-class:1.3.0-rc01'
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.activity:activity-compose:1.9.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.8.4"
implementation "androidx.navigation:navigation-compose:2.8.0-rc01"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.slice:slice-core:1.1.0-alpha02"
def accompanistVersion = '0.34.0'
implementation "com.google.accompanist:accompanist-adaptive:$accompanistVersion"
implementation "com.google.accompanist:accompanist-drawablepainter:$accompanistVersion"
implementation "com.google.accompanist:accompanist-permissions:$accompanistVersion"
implementation "com.google.android.material:material:1.12.0"
implementation "io.github.fornewid:material-motion-compose-core:1.2.1"
implementation 'dev.kdrag0n:colorkt:1.0.5'
implementation 'io.coil-kt:coil-compose:2.7.0'
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
def optoVersion = "1.0.18"
implementation "com.patrykmichalik.opto:domain:$optoVersion"
implementation "com.patrykmichalik.opto:core:$optoVersion"
implementation "com.patrykmichalik.opto:compose:$optoVersion"
implementation "androidx.datastore:datastore-preferences:1.1.1"
def retrofitVersion = "2.11.0"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-kotlinx-serialization:$retrofitVersion"
def roomVersion = '2.6.1'
implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
ksp "androidx.room:room-compiler:$roomVersion"
implementation "com.github.topjohnwu.libsu:service:6.0.0"
// Persian Date
implementation 'com.github.samanzamani:PersianDate:1.7.1'
implementation 'com.airbnb.android:lottie:6.5.0'
// Compose drag and drop library
implementation 'sh.calvin.reorderable:reorderable:2.3.1'
// Smartspacer
implementation('com.kieronquinn.smartspacer:sdk-client:1.0.11') {
exclude group: "com.github.skydoves", module: "balloon"
}
implementation("com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3")
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.generateKotlin", "true")
arg("room.incremental", "true")
}
spotless {
java {
target("compatLib/**/src/**/*.java")
googleJavaFormat().aosp()
removeUnusedImports()
}
kotlin {
target("lawnchair/src/**/*.kt")
ktlint().customRuleSets([
"io.nlopez.compose.rules:ktlint:0.4.10",
]).editorConfigOverride([
"ktlint_compose_compositionlocal-allowlist": "disabled",
])
}
}
licensee {
allow("Apache-2.0")
allow("BSD-3-Clause")
allow("GPL-2.0-or-later")
allowDependency("com.github.topjohnwu.libsu", "core", "6.0.0")
allowDependency("com.github.topjohnwu.libsu", "service", "6.0.0")
allowUrl("https://github.com/patrykmichalik/opto/blob/master/LICENSE")
allowUrl("https://github.com/RikkaApps/HiddenApiRefinePlugin/blob/main/LICENSE")
allowUrl("https://opensource.org/licenses/mit-license.php")
}