Files
lawnchair/build.gradle
2022-08-08 13:50:31 +04:30

427 lines
15 KiB
Groovy

buildscript {
ext {
kotlin_version = "1.7.0"
compose_version = "1.2.0-rc03"
compose_compiler_version = "1.2.0"
accompanist_version = '0.24.10-beta'
libsu_version = '3.1.2'
protocVersion = '3.18.0'
room_version = '2.4.2'
}
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath PROTOBUF_CLASS_PATH
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
classpath 'dev.rikka.tools.refine:gradle-plugin:3.1.1'
classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.7.0-1.0.6"
}
}
final String FRAMEWORK_PREBUILTS_DIR = "prebuilts"
final def keystorePropertiesFile = rootProject.file("keystore.properties")
wrapper {
gradleVersion = '6.8.3'
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
ext.getFrameworkJar = { String name ->
def frameworkJar = new File(rootProject.projectDir, 'prebuilts/libs/' + name)
if (!frameworkJar.exists()) {
throw new IllegalArgumentException("Framework jar path doesn't exist")
}
return frameworkJar
}
ext.addFrameworkJar = { String name ->
def frameworkJar = getFrameworkJar(name)
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.bootstrapClasspath = files([frameworkJar] + (options.bootstrapClasspath.files as Iterable<File>))
}
tasks.withType(org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask) {
it.classpath.from(files([frameworkJar]))
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
it.classpath.from(files([frameworkJar]))
}
}
}
ext.replaceFrameworkJar = { String name ->
def frameworkJar = getFrameworkJar(name)
gradle.projectsEvaluated {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
def originalFiles = [] + it.classpath.files
def newFiles = []
originalFiles.each { file ->
if (file.path.endsWith('android.jar')) {
newFiles.add(frameworkJar)
} else {
newFiles.add(file)
}
}
it.classpath.setFrom(files([]))
it.classpath.from(files(newFiles))
}
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.protobuf'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
apply plugin: 'kotlin-parcelize'
apply plugin: "com.google.devtools.ksp"
apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
apply plugin: 'dev.rikka.tools.refine'
final def commitHash = { ->
final def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short=7', 'HEAD'
standardOutput = stdout
}
stdout.toString().trim()
}
def ciBuild = System.getenv("CI") == "true"
def ciRef = System.getenv("GITHUB_REF") ?: ""
def ciRunNumber = System.getenv("GITHUB_RUN_NUMBER") ?: ""
def isReleaseBuild = ciBuild && ciRef.contains("alpha")
def buildCommit = commitHash()
def devReleaseName
if (ciBuild) {
devReleaseName = "Dev (#${ciRunNumber})"
} else {
devReleaseName = "Dev (${buildCommit})"
}
def version = "12.1.0"
def releaseName = "Alpha 4"
def versionDisplayName = "${version} ${isReleaseBuild ? releaseName : devReleaseName}"
def majorVersion = versionDisplayName.split("\\.")[0]
def quickstepMinSdk = "32"
def quickstepMaxSdk = "32"
android {
compileSdkVersion COMPILE_SDK
buildToolsVersion BUILD_TOOLS_VERSION
lintOptions {
checkReleaseBuilds false
}
defaultConfig {
minSdkVersion 26
targetSdkVersion 32
versionCode 12_01_00_05
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
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
ksp { arg("room.schemaLocation", "$projectDir/schemas".toString()) }
}
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "Lawnchair ${variant.versionName}.apk"
}
resValue("string", "launcher_component", "${applicationId}/app.lawnchair.LawnchairLauncher")
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = compose_compiler_version
}
if (keystorePropertiesFile.exists()) {
final def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile rootProject.file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
}
buildTypes {
debug {
}
release {
if (keystorePropertiesFile.exists()) signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
proguardFiles "proguard-android-optimize.txt", "proguard.pro"
}
}
kotlinOptions {
jvmTarget = '1.8'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// 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'
}
withQuickstep {
dimension "recents"
minSdkVersion 26
}
withoutQuickstep {
dimension "recents"
}
}
sourceSets {
main {
res.srcDirs = ['res']
java.srcDirs = ['src', 'src_plugins']
manifest.srcFile 'AndroidManifest-common.xml'
proto {
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']
aidl.srcDirs = ['lawnchair/aidl']
res.srcDirs = ['lawnchair/res']
manifest.srcFile "lawnchair/AndroidManifest.xml"
assets {
srcDirs 'lawnchair/assets'
}
proto {
srcDirs = ['lawnchair/protos/']
}
}
lawnWithoutQuickstep {
manifest.srcFile "AndroidManifest.xml"
}
lawnWithQuickstep {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}
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-12l.jar')
}
allprojects {
repositories {
maven { url "../../../prebuilts/sdk/current/androidx/m2repository" }
maven { url "../../../prebuilts/fullsdk-darwin/extras/android/m2repository" }
maven { url "../../../prebuilts/fullsdk-linux/extras/android/m2repository" }
mavenCentral()
google()
}
}
dependencies {
implementation "androidx.dynamicanimation:dynamicanimation:${ANDROID_X_VERSION}"
implementation "androidx.recyclerview:recyclerview:${ANDROID_X_VERSION}"
implementation "androidx.preference:preference-ktx:${ANDROID_X_VERSION}"
implementation project(':iconloaderlib')
implementation project(':searchuilib')
implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'SystemUI-statsd.jar')
// Recents lib dependency
withQuickstepImplementation project(':SystemUIShared')
withQuickstepCompileOnly project(':hidden-api')
implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'WindowManager-Shell.jar')
// Required for AOSP to compile. This is already included in the sysui_shared.jar
withoutQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'plugin_core.jar')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'org.mockito:mockito-core:4.5.1'
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
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'
androidTestImplementation "androidx.annotation:annotation:${ANDROID_X_VERSION}"
implementation 'com.github.ChickenHook:RestrictionBypass:2.2'
implementation 'dev.rikka.tools.refine:runtime:3.1.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.ui:ui-text-google-fonts:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material3:material3:1.0.0-alpha14"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.compose.runtime:runtime-rxjava2:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_compiler_version"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.activity:activity-compose:1.5.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.0"
implementation "androidx.navigation:navigation-compose:2.5.0"
implementation "androidx.palette:palette-ktx:${ANDROID_X_VERSION}"
implementation "androidx.slice:slice-core:1.1.0-alpha02"
implementation "com.google.accompanist:accompanist-drawablepainter:$accompanist_version"
implementation "com.google.accompanist:accompanist-insets-ui:$accompanist_version"
implementation "com.google.accompanist:accompanist-navigation-animation:$accompanist_version"
implementation "com.google.accompanist:accompanist-permissions:$accompanist_version"
implementation "com.google.accompanist:accompanist-pager:$accompanist_version"
implementation "com.google.accompanist:accompanist-placeholder-material:$accompanist_version"
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
implementation "com.google.android.material:material:1.6.1"
implementation "io.github.fornewid:material-motion-compose-core:0.8.4"
implementation 'dev.kdrag0n:colorkt:1.0.5'
implementation 'io.coil-kt:coil-compose:2.0.0'
implementation 'me.xdrop:fuzzywuzzy:1.4.0'
implementation "com.patrykmichalik:opto:1.0.12"
implementation "androidx.datastore:datastore-preferences:1.0.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
ksp "androidx.room:room-compiler:$room_version"
implementation "com.github.topjohnwu.libsu:core:$libsu_version"
implementation "com.github.topjohnwu.libsu:service:$libsu_version"
implementation 'com.google.protobuf:protobuf-javalite:3.8.0'
implementation 'com.github.LawnchairLauncher:oss-notices:1.0.2'
// Persian Date
implementation 'com.github.samanzamani:PersianDate:1.5.4'
api 'com.airbnb.android:lottie:5.0.3'
}
protobuf {
// Configure the protoc executable
protoc {
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
java {
option "lite"
}
}
}
}
}