Files
lawnchair/build.gradle

494 lines
16 KiB
Groovy
Raw Permalink Normal View History

import app.cash.licensee.SpdxId
2023-08-30 15:05:53 +08:00
import com.android.build.gradle.api.AndroidBasePlugin
2025-10-23 18:03:11 +08:00
import org.jetbrains.kotlin.gradle.dsl.JvmDefaultMode
2025-03-22 03:53:51 -04:00
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.test) apply false
alias(libs.plugins.androidx.baselineprofile)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.google.ksp)
alias(libs.plugins.google.protobuf)
alias(libs.plugins.cash.licensee)
alias(libs.plugins.rikka.refine)
alias(libs.plugins.diffplug.spotless)
}
2024-10-06 13:34:50 +08:00
2021-02-28 02:55:46 +05:30
allprojects {
2023-08-30 15:05:53 +08:00
plugins.withType(AndroidBasePlugin).configureEach {
android {
buildToolsVersion "36.1.0"
compileSdk {
version = release(36) {
minorApiLevel = 1
}
}
defaultConfig {
2023-12-17 20:44:39 +08:00
minSdk 26
2024-11-05 09:19:39 +08:00
targetSdk 35
vectorDrawables.useSupportLibrary = true
}
lint {
abortOnError true
checkReleaseBuilds false
}
2025-03-22 03:53:51 -04:00
compileOptions {
2025-10-24 18:11:52 +08:00
sourceCompatibility = libs.versions.jdkRelease.get()
targetCompatibility = libs.versions.jdkRelease.get()
2025-03-22 03:53:51 -04:00
}
}
dependencies {
implementation libs.androidx.core.ktx
}
2021-02-28 02:55:46 +05:30
}
plugins.withId('com.google.protobuf') {
protobuf {
// Configure the protoc executable
protoc {
artifact = libs.protobuf.protoc.get().toString()
}
generateProtoTasks {
all().configureEach { task ->
task.builtins {
remove java
java {
option "lite"
}
}
}
}
}
dependencies {
implementation libs.protobuf.javalite
}
}
2023-09-10 19:29:29 +08:00
plugins.withType(JavaBasePlugin).configureEach {
java {
2025-10-24 18:11:52 +08:00
sourceCompatibility = libs.versions.jdkRelease.get()
targetCompatibility = libs.versions.jdkRelease.get()
2023-09-10 19:29:29 +08:00
}
}
2023-11-14 10:58:50 +08:00
tasks.withType(KotlinCompile).configureEach {
2025-03-22 03:53:51 -04:00
compilerOptions {
2025-10-23 18:03:11 +08:00
jvmDefault = JvmDefaultMode.ENABLE
2025-10-24 18:11:52 +08:00
jvmTarget = JvmTarget.fromTarget(libs.versions.jdkRelease.get())
2025-03-22 03:53:51 -04:00
}
2023-11-14 10:58:50 +08:00
}
Fix duplicate class kotlinx.android.parcel.* found ``` Duplicate class kotlinx.android.parcel.IgnoredOnParcel found in modules kotlin-android-extensions-runtime-1.3.72.jar -> kotlin-android-extensions-runtime-1.3.72 (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) and kotlin-parcelize-runtime-2.2.20.jar -> kotlin-parcelize-runtime-2.2.20 (org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20) Duplicate class kotlinx.android.parcel.Parceler found in modules kotlin-android-extensions-runtime-1.3.72.jar -> kotlin-android-extensions-runtime-1.3.72 (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) and kotlin-parcelize-runtime-2.2.20.jar -> kotlin-parcelize-runtime-2.2.20 (org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20) Duplicate class kotlinx.android.parcel.Parceler$DefaultImpls found in modules kotlin-android-extensions-runtime-1.3.72.jar -> kotlin-android-extensions-runtime-1.3.72 (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) and kotlin-parcelize-runtime-2.2.20.jar -> kotlin-parcelize-runtime-2.2.20 (org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20) Duplicate class kotlinx.android.parcel.Parcelize found in modules kotlin-android-extensions-runtime-1.3.72.jar -> kotlin-android-extensions-runtime-1.3.72 (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) and kotlin-parcelize-runtime-2.2.20.jar -> kotlin-parcelize-runtime-2.2.20 (org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20) Duplicate class kotlinx.android.parcel.RawValue found in modules kotlin-android-extensions-runtime-1.3.72.jar -> kotlin-android-extensions-runtime-1.3.72 (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) and kotlin-parcelize-runtime-2.2.20.jar -> kotlin-parcelize-runtime-2.2.20 (org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20) Duplicate class kotlinx.android.parcel.TypeParceler found in modules kotlin-android-extensions-runtime-1.3.72.jar -> kotlin-android-extensions-runtime-1.3.72 (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) and kotlin-parcelize-runtime-2.2.20.jar -> kotlin-parcelize-runtime-2.2.20 (org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20) Duplicate class kotlinx.android.parcel.WriteWith found in modules kotlin-android-extensions-runtime-1.3.72.jar -> kotlin-android-extensions-runtime-1.3.72 (org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.72) and kotlin-parcelize-runtime-2.2.20.jar -> kotlin-parcelize-runtime-2.2.20 (org.jetbrains.kotlin:kotlin-parcelize-runtime:2.2.20) ```
2025-10-23 17:45:18 +08:00
configurations.configureEach {
resolutionStrategy.eachDependency {
// Fix duplicate class kotlinx.android.parcel.* found in these 2 dependencies.
if (requested.module == libs.kotlin.androidExtensionRuntime.get().module) {
useTarget(libs.kotlin.parcelizeRuntime)
}
}
}
2023-11-24 20:31:53 +08:00
ext {
FRAMEWORK_PREBUILTS_DIR = "$rootDir/prebuilts/libs"
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 {
2025-10-23 17:45:09 +08:00
// Make sure the frameworkJar is always first in the classpath.
2023-11-24 20:31:53 +08:00
classpath = files(frameworkJar, classpath)
}
tasks.withType(KotlinCompile).configureEach {
2025-10-23 17:45:09 +08:00
// Make sure the frameworkJar is always first in the classpath.
libraries.setFrom files(frameworkJar, libraries)
2023-11-24 20:31:53 +08:00
}
2022-01-12 22:12:55 +07:00
}
dependencies {
compileOnly files(frameworkJar)
}
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')
2024-10-06 17:33:30 +08:00
compileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'WindowManager-Shell-15.jar')
compileOnly projects.compatLib
compileOnly projects.compatLib.compatLibVQ
compileOnly projects.compatLib.compatLibVR
compileOnly projects.compatLib.compatLibVS
compileOnly projects.compatLib.compatLibVT
compileOnly projects.compatLib.compatLibVU
2024-10-06 17:33:30 +08:00
compileOnly projects.compatLib.compatLibVV
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("beta")
final def devReleaseName = ciBuild ? "Dev.(#${ciRunNumber})" : "Dev.(${buildCommit})"
2024-11-05 22:11:23 +08:00
final def version = "15"
final def releaseName = "Beta 2"
final def versionDisplayName = "${version}.${isReleaseBuild ? releaseName : devReleaseName}"
2022-11-28 00:52:22 +08:00
final def majorVersion = versionDisplayName.split("\\.")[0]
2021-10-20 19:59:31 +07:00
final def quickstepMinSdk = "29"
2024-12-01 06:04:26 +07:00
final def quickstepMaxSdk = "35"
2022-05-08 23:20:37 +07:00
android {
namespace "com.android.launcher3"
defaultConfig {
// Lawnchair Launcher 15.0 Beta 2
// See CONTRIBUTING.md#versioning-scheme
versionCode 15_00_02_02
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
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
def channel = variant.productFlavors.last().name
outputFileName = "Lawnchair.${variant.versionName}.$channel.${variant.buildType.name}.apk"
2021-03-17 10:29:38 +01:00
}
2022-08-10 17:37:14 +08:00
}
androidResources {
generateLocaleConfig true
}
2021-03-03 14:25:21 +01:00
buildFeatures {
aidl true
buildConfig true
resValues true
2021-03-03 14:25:21 +01:00
}
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",
]
2023-12-23 14:24:45 +08:00
// Load all proguard configs from AOSP
def proguardFilesFromAosp = allprojects
.collect { it.file("proguard.flags") }
.findAll { it.exists() }
.toArray()
2024-09-16 08:11:50 +08:00
def releaseSigning
try {
def keystoreProperties = new Properties()
keystoreProperties.load(rootProject.file("keystore.properties").newInputStream())
releaseSigning = signingConfigs.create("release") {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile rootProject.file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
} catch (Exception ignored) {
releaseSigning = signingConfigs.debug
}
buildTypes {
all {
signingConfig releaseSigning
applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
def channel = variant.productFlavors.last().name
// Override signingConfig to debug if the "nightly" flavor is selected
if (channel.any { it == "nightly" }) {
signingConfig = signingConfigs.debug
}
}
}
pseudoLocalesEnabled true
}
debug {
applicationIdSuffix ".debug"
resValue("string", "derived_app_name", "Lawnchair (Debug)")
}
release {
resValue("string", "derived_app_name", "Lawnchair")
minifyEnabled true
shrinkResources true
2023-12-23 14:24:45 +08:00
proguardFiles proguardFilesFromAosp + "proguard.pro"
}
}
compileOptions {
coreLibraryDesugaringEnabled true
}
2022-08-10 17:37:14 +08:00
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
// See: https://developer.android.com/studio/build/build-variants#flavor-dimensions
flavorDimensions += ["app", "recents", "channel"]
productFlavors {
lawn {
dimension "app"
}
withQuickstep {
dimension "recents"
2022-08-10 17:37:14 +08:00
minSdk 26
}
github {
applicationId 'app.lawnchair'
dimension "channel"
}
nightly {
applicationId 'app.lawnchair.nightly'
dimension "channel"
}
play {
applicationId "app.lawnchair.play"
dimension "channel"
isDefault true
}
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/']
}
}
lawn {
java.srcDirs = ['src_flags', 'src_shortcuts_overrides', 'lawnchair/src', 'tests/shared']
2021-03-19 03:38:39 +05:30
aidl.srcDirs = ['lawnchair/aidl']
2024-11-03 18:45:41 +08:00
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/']
}
}
github {
manifest.srcFile "github/AndroidManifest.xml"
}
nightly {
manifest.srcFile "nightly/AndroidManifest.xml"
}
lawnWithQuickstepGithub {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
lawnWithQuickstepNightly {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
lawnWithQuickstepPlay {
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"
}
}
}
composeCompiler {
stabilityConfigurationFiles.addAll(
2025-10-19 20:56:46 +08:00
layout.projectDirectory.file("compose_compiler_config.conf"),
)
reportsDestination = layout.buildDirectory.dir("compose_build_reports")
}
2024-10-06 17:33:30 +08:00
addFrameworkJar('framework-15.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
withQuickstepImplementation projects.shared
withQuickstepImplementation projects.anim
withQuickstepImplementation projects.unfold
withQuickstepImplementation projects.viewcapture
withQuickstepImplementation projects.log
withQuickstepCompileOnly projects.plugin
withQuickstepImplementation projects.plugincore
withQuickstepCompileOnly projects.common
// 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
2024-11-02 10:45:09 +08:00
withQuickstepImplementation projects.compatLib.compatLibVV
withQuickstepImplementation projects.wmshell
withQuickstepImplementation projects.flags
implementation libs.androidx.dynamicanimation
2024-11-03 18:45:41 +08:00
implementation fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'SystemUI-statsd-15.jar')
2024-10-06 17:33:30 +08:00
implementation fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'WindowManager-Shell-15.jar')
withQuickstepCompileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'framework-15.jar')
coreLibraryDesugaring libs.android.desugarJdkLibs
implementation libs.androidx.profileinstaller
baselineProfile projects.baselineProfile
implementation libs.androidx.recyclerview
implementation libs.androidx.preference.ktx
implementation libs.kotlinx.coroutines.android
implementation libs.kotlinx.serialization.json
implementation libs.chickenhook.restrictionbypass
implementation libs.rikka.refine.runtime
implementation platform(libs.compose.bom)
implementation libs.compose.ui
implementation libs.compose.ui.util
debugImplementation libs.compose.ui.tooling
implementation libs.compose.ui.tooling.preview
implementation libs.compose.ui.google.fonts
implementation libs.compose.foundation
implementation libs.compose.material.icons
implementation libs.compose.runtime.livedata
implementation libs.compose.material3
implementation libs.compose.material3.windowSizeClass
implementation libs.androidx.activity.compose
implementation libs.androidx.lifecycle.viewmodel.compose
implementation libs.androidx.navigation.compose
implementation libs.androidx.constraintlayout
implementation libs.androidx.palette.ktx
implementation libs.androidx.slice.core
implementation libs.bundles.accompanist
implementation libs.google.material
implementation libs.material.motion.compose
implementation libs.kdrag0n.colorkt
implementation libs.coil.compose
implementation libs.xdrop.fuzzywuzzy
implementation libs.bundles.opto
implementation libs.androidx.datastore.preferences
implementation libs.bundles.retrofit
implementation libs.bundles.room
ksp libs.room.compiler
implementation libs.libsu.service
2021-10-07 09:42:24 +07:00
// Persian Date
implementation libs.persian.date
implementation libs.airbnb.lottie
// Compose drag and drop library
implementation libs.reorderable
// Smartspacer
implementation(libs.smartspacer.sdk) {
exclude group: "com.github.skydoves", module: "balloon"
}
2024-07-28 18:46:37 +08:00
implementation libs.hoko.blur
implementation libs.androidx.window
}
2024-10-13 08:08:22 +08:00
ksp {
arg("room.schemaLocation", "$projectDir/schemas")
}
2024-10-06 13:34:50 +08:00
spotless {
java {
target("compatLib/**/src/**/*.java")
googleJavaFormat().aosp()
removeUnusedImports()
}
kotlin {
target("lawnchair/src/**/*.kt")
ktlint("1.8.0").customRuleSets([
libs.composeRules.get().toString()
]).editorConfigOverride([
"ktlint_compose_compositionlocal-allowlist": "disabled",
"ktlint_compose_lambda-param-event-trailing": "disabled",
"ktlint_compose_content-slot-reused": "disabled",
])
}
}
licensee {
allow(SpdxId.Apache_20)
allow(SpdxId.BSD_3_Clause)
allow(SpdxId.GPL_20_or_later)
2025-10-19 20:07:12 +08:00
allowDependency(libs.libsu.core)
allowDependency(libs.libsu.service)
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")
bundleAndroidAsset = true
androidAssetReportPath = 'licenses.json'
}