Files
lawnchair/build.gradle

470 lines
16 KiB
Groovy
Raw Normal View History

import app.cash.licensee.LicenseeTask
2023-08-30 15:05:53 +08:00
import com.android.build.gradle.api.AndroidBasePlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'com.android.application' version "8.2.0"
id 'com.android.library' version "8.2.0" apply false
id 'com.android.test' version '8.2.0' apply false
id 'androidx.baselineprofile' version '1.2.2'
id 'org.jetbrains.kotlin.android' version "1.9.21"
id 'org.jetbrains.kotlin.plugin.parcelize' version "1.9.21"
id 'org.jetbrains.kotlin.plugin.serialization' version "1.9.21"
id "com.google.devtools.ksp" version "1.9.21-1.0.16"
id 'com.google.protobuf' version "0.9.4"
2023-09-27 10:14:55 +08:00
id 'app.cash.licensee' version "1.8.0"
id 'dev.rikka.tools.refine' version "4.4.0"
id 'org.gradle.android.cache-fix' version '3.0'
id 'com.diffplug.spotless' version '6.23.3'
}
2021-02-28 02:55:46 +05:30
allprojects {
2023-08-30 15:05:53 +08:00
plugins.withType(AndroidBasePlugin).configureEach {
apply plugin: 'org.gradle.android.cache-fix'
android {
2023-08-10 09:42:33 +08:00
compileSdk 34
defaultConfig {
minSdk 27
targetSdk 34
vectorDrawables.useSupportLibrary = true
}
lint {
abortOnError true
checkReleaseBuilds false
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
}
2021-02-28 02:55:46 +05:30
}
plugins.withId('com.google.protobuf') {
def protocVersion = '3.25.1'
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"
}
}
2023-09-10 19:29:29 +08:00
plugins.withType(JavaBasePlugin).configureEach {
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
}
}
2023-11-14 10:58:50 +08:00
tasks.withType(KotlinCompile).configureEach {
compilerOptions.freeCompilerArgs.add(
"-Xjvm-default=all",
)
2023-11-14 10:58:50 +08:00
}
2023-11-24 20:31:53 +08:00
ext {
FRAMEWORK_PREBUILTS_DIR = "$rootDir/prebuilts/libs"
daggerVersion = '2.49'
2023-11-24 20:31:53 +08:00
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")
2021-02-28 02:55:46 +05:30
}
2023-11-24 20:31:53 +08:00
gradle.projectsEvaluated {
tasks.withType(JavaCompile).configureEach {
classpath = files(frameworkJar, classpath)
}
tasks.withType(KotlinCompile).configureEach {
libraries.from(files(frameworkJar))
}
2022-01-12 22:12:55 +07:00
}
2021-02-28 02:55:46 +05:30
}
2023-11-24 20:31:53 +08:00
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')
2023-12-17 14:26:59 +08:00
compileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'framework-14.jar')
2023-11-24 20:31:53 +08:00
}
}
}
2021-02-28 02:55:46 +05:30
}
final def buildCommit = providers.exec {
commandLine('git', 'rev-parse', '--short=7', 'HEAD')
}.standardOutput.asText.get().trim()
2022-11-28 00:52:22 +08:00
final def ciBuild = System.getenv("CI") == "true"
final def ciRef = System.getenv("GITHUB_REF") ?: ""
final def ciRunNumber = System.getenv("GITHUB_RUN_NUMBER") ?: ""
final def isReleaseBuild = ciBuild && ciRef.contains("alpha")
2023-11-01 14:49:44 +08:00
final def devReleaseName = ciBuild ? "Dev (#${ciRunNumber})" : "Dev (${buildCommit})"
final def version = "14"
2023-12-17 15:37:36 +08:00
final def releaseName = "Beta 1"
2022-11-28 00:52:22 +08:00
final def versionDisplayName = "${version} ${isReleaseBuild ? releaseName : devReleaseName}"
final def majorVersion = versionDisplayName.split("\\.")[0]
2021-10-20 19:59:31 +07:00
2023-12-17 20:29:30 +08:00
final def quickstepMinSdk = "33"
final def quickstepMaxSdk = "34"
2022-05-08 23:20:37 +07:00
android {
namespace "com.android.launcher3"
defaultConfig {
2023-09-21 21:54:56 +08:00
versionCode 13
2021-10-20 19:59:31 +07:00
versionName "${versionDisplayName}"
2021-08-26 23:00:13 +07:00
buildConfigField "String", "VERSION_DISPLAY_NAME", "\"${versionDisplayName}\""
buildConfigField "String", "MAJOR_VERSION", "\"${majorVersion}\""
2021-10-26 15:34:48 +07:00
buildConfigField "String", "COMMIT_HASH", "\"${buildCommit}\""
buildConfigField "boolean", "ENABLE_AUTO_INSTALLS_LAYOUT", "false"
2022-05-08 23:20:37 +07:00
manifestPlaceholders.quickstepMinSdk = quickstepMinSdk
manifestPlaceholders.quickstepMaxSdk = quickstepMaxSdk
buildConfigField "int", "QUICKSTEP_MIN_SDK", quickstepMinSdk
buildConfigField "int", "QUICKSTEP_MAX_SDK", quickstepMaxSdk
}
2021-03-03 14:25:21 +01:00
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.outputDir.file("artifacts.json") })
into(layout.buildDirectory.dir("generated/dependencyAssets"))
}
variant.sources.assets?.addGeneratedSourceDirectory(licenseeTask) {
objects.directoryProperty().fileProvider(copyArtifactsTask.map { it.destinationDir })
}
}
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
2021-03-17 10:29:38 +01:00
outputFileName = "Lawnchair ${variant.versionName}.apk"
}
2022-08-10 17:37:14 +08:00
}
2021-03-03 14:25:21 +01:00
buildFeatures {
aidl true
buildConfig true
2021-03-03 14:25:21 +01:00
compose true
resValues true
2021-03-03 14:25:21 +01:00
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.6"
2021-03-03 14:25:21 +01:00
}
2022-08-10 17:37:14 +08:00
final def keystorePropertiesFile = rootProject.file("keystore.properties")
def releaseSigning = signingConfigs.debug
if (keystorePropertiesFile.exists()) {
final def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
2022-08-10 17:37:14 +08:00
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",
]
buildTypes {
debug {
applicationIdSuffix ".debug"
resValue("string", "derived_app_name", "Lawnchair (Debug)")
signingConfig releaseSigning
}
release {
resValue("string", "derived_app_name", "Lawnchair")
2022-08-10 17:37:14 +08:00
signingConfig releaseSigning
minifyEnabled true
shrinkResources true
proguardFiles "proguard.flags", "proguard.pro"
}
}
compileOptions {
coreLibraryDesugaringEnabled true
}
2022-08-10 17:37:14 +08:00
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
// The flavor dimensions for build variants (e.g. aospWithQuickstep, aospWithoutQuickstep)
// See: https://developer.android.com/studio/build/build-variants#flavor-dimensions
flavorDimensions += ["app", "recents"]
productFlavors {
aosp {
dimension "app"
applicationId 'com.android.launcher3'
testApplicationId 'com.android.launcher3.tests'
}
l3go {
dimension "app"
applicationId 'com.android.launcher3'
testApplicationId 'com.android.launcher3.tests'
}
lawn {
dimension "app"
applicationId 'app.lawnchair'
testApplicationId 'com.android.launcher3.tests'
isDefault true
}
withQuickstep {
dimension "recents"
2022-08-10 17:37:14 +08:00
minSdk 26
isDefault true
}
withoutQuickstep {
dimension "recents"
}
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 {
2021-10-08 12:14:19 +07:00
srcDirs = ['protos/', 'quickstep/protos_overrides/']
}
}
androidTest {
res.srcDirs = ['tests/res']
java.srcDirs = ['tests/src', 'tests/tapl']
manifest.srcFile "tests/AndroidManifest-common.xml"
}
androidTestDebug {
manifest.srcFile "tests/AndroidManifest.xml"
}
aosp {
java.srcDirs = ['src_flags', 'src_shortcuts_overrides']
}
aospWithoutQuickstep {
manifest.srcFile "AndroidManifest.xml"
}
aospWithQuickstep {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
l3go {
res.srcDirs = ['go/res']
java.srcDirs = ['go/src']
manifest.srcFile "go/AndroidManifest.xml"
}
l3goWithoutQuickstepDebug {
manifest.srcFile "AndroidManifest.xml"
}
l3goWithQuickstepDebug {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
lawn {
java.srcDirs = ['src_flags', 'src_shortcuts_overrides', 'lawnchair/src', 'tests/shared']
2021-03-19 03:38:39 +05:30
aidl.srcDirs = ['lawnchair/aidl']
res.srcDirs = ['lawnchair/res', 'platform_frameworks_libs_systemui/animationlib/res']
manifest.srcFile "lawnchair/AndroidManifest.xml"
2021-09-09 21:35:09 +07:00
assets {
srcDirs 'lawnchair/assets'
}
2022-05-18 18:31:18 +07:00
proto {
srcDirs = ['lawnchair/protos/']
}
}
lawnWithoutQuickstep {
manifest.srcFile "AndroidManifest.xml"
}
lawnWithQuickstep {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
assets.srcDir layout.buildDirectory.dir("generated/dependencyAssets/")
}
withoutQuickstep {
java.srcDirs = ['src_ui_overrides']
}
withQuickstep {
res.srcDirs = ['quickstep/res', 'quickstep/recents_ui_overrides/res']
java.srcDirs = ['quickstep/src', 'quickstep/recents_ui_overrides/src']
manifest.srcFile "quickstep/AndroidManifest.xml"
}
}
}
addFrameworkJar('framework-14.jar')
2023-11-18 10:10:55 +08:00
dependencies {
implementation projects.iconloaderlib
implementation projects.searchuilib
implementation projects.animationlib
// Recents lib dependency
withQuickstepCompileOnly projects.hiddenApi
2023-09-21 21:54:56 +08:00
withQuickstepImplementation projects.systemUIShared
withQuickstepImplementation projects.systemUIAnim
2023-11-02 08:08:42 +08:00
withQuickstepImplementation projects.systemUnFold
2023-09-21 21:54:56 +08:00
withQuickstepImplementation projects.systemUIViewCapture
withQuickstepImplementation projects.systemUILog
withQuickstepImplementation projects.systemUIPlugin
withQuickstepImplementation projects.systemUIPluginCore
withQuickstepImplementation projects.systemUICommon
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')
// Required for AOSP to compile. This is already included in the sysui_shared.jar
withoutQuickstepImplementation fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'plugin_core.jar')
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
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.7.3'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2'
implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7"
2021-02-28 02:55:46 +05:30
implementation 'com.github.ChickenHook:RestrictionBypass:2.2'
implementation 'dev.rikka.tools.refine:runtime:4.4.0'
2021-03-03 14:25:21 +01:00
implementation platform("androidx.compose:compose-bom:2023.10.01")
implementation "androidx.compose.ui:ui"
implementation "androidx.compose.ui:ui-util"
debugImplementation "androidx.compose.ui:ui-tooling"
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'
2022-05-28 18:52:15 +02:00
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.activity:activity-compose:1.8.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2"
implementation "androidx.navigation:navigation-compose:2.7.6"
2022-08-15 18:36:32 +08:00
implementation "androidx.palette:palette-ktx:1.0.0"
2021-10-07 09:42:24 +07:00
implementation "androidx.slice:slice-core:1.1.0-alpha02"
2023-11-24 20:31:53 +08:00
def accompanistVersion = '0.32.0'
implementation "com.google.accompanist:accompanist-drawablepainter:$accompanistVersion"
implementation "com.google.accompanist:accompanist-insets-ui:$accompanistVersion"
implementation "com.google.accompanist:accompanist-permissions:$accompanistVersion"
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanistVersion"
implementation "com.google.android.material:material:1.11.0"
implementation "io.github.fornewid:material-motion-compose-core:1.0.7"
2022-05-16 15:40:23 +07:00
implementation 'dev.kdrag0n:colorkt:1.0.5'
implementation 'io.coil-kt:coil-compose:2.5.0'
2022-05-16 15:40:23 +07:00
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
2023-11-24 20:31:53 +08:00
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.0.0"
2022-05-13 15:44:03 +07:00
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0"
2021-06-15 20:26:41 +07:00
def roomVersion = '2.6.1'
2023-11-24 20:31:53 +08:00
implementation "androidx.room:room-runtime:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
ksp "androidx.room:room-compiler:$roomVersion"
2022-01-12 22:12:55 +07:00
implementation "com.github.topjohnwu.libsu:service:5.2.2"
2021-10-07 09:42:24 +07:00
// Persian Date
implementation 'com.github.samanzamani:PersianDate:1.7.1'
implementation 'com.airbnb.android:lottie:6.2.0'
// Smartspacer
implementation('com.kieronquinn.smartspacer:sdk-client:1.0.6') {
exclude group: "com.github.skydoves", module: "balloon"
}
}
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.generateKotlin", "true")
arg("room.incremental", "true")
}
spotless {
kotlin {
target("lawnchair/src/**/*.kt")
ktlint().customRuleSets([
"io.nlopez.compose.rules:ktlint:0.3.8",
]).editorConfigOverride([
"ktlint_compose_modifier-missing-check": "disabled",
"ktlint_compose_compositionlocal-allowlist": "disabled",
])
}
}
licensee {
allow("Apache-2.0")
allow("BSD-3-Clause")
2023-09-27 10:14:55 +08:00
allow("GPL-2.0-or-later")
allowDependency("com.github.topjohnwu.libsu", "core", "5.2.2")
allowDependency("com.github.topjohnwu.libsu", "service", "5.2.2")
allowUrl("https://github.com/patrykmichalik/opto/blob/master/LICENSE")
allowUrl("https://github.com/RikkaApps/HiddenApiRefinePlugin/blob/main/LICENSE")
2023-09-27 10:14:55 +08:00
allowUrl("https://opensource.org/licenses/mit-license.php")
}