Files
lawnchair/build.gradle
2021-06-18 17:14:00 +02:00

321 lines
10 KiB
Groovy

buildscript {
ext {
kotlin_version = '1.5.10'
compose_version = '1.0.0-beta09'
accompanist_version = '0.12.0'
libsu_version = '3.1.2'
}
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0-alpha02'
classpath PROTOBUF_CLASS_PATH
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
}
}
final String FRAMEWORK_PREBUILTS_DIR = "prebuilts"
final def keystorePropertiesFile = rootProject.file("keystore.properties")
wrapper {
gradleVersion = '6.8.3'
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
ext.addFrameworkJar = { String path ->
def frameworkJar = new File(rootProject.projectDir, 'prebuilts/libs/' + path)
if (!frameworkJar.exists()) {
throw new IllegalArgumentException("Framework jar path doesn't exist")
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.bootstrapClasspath = files([frameworkJar] + (options.bootstrapClasspath.files as Iterable<File>))
}
}
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.protobuf'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'
final def commitHash = { ->
final def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short=7', 'HEAD'
standardOutput = stdout
}
stdout.toString().trim()
}
android {
compileSdkVersion COMPILE_SDK
buildToolsVersion BUILD_TOOLS_VERSION
lintOptions {
checkReleaseBuilds false
}
defaultConfig {
minSdkVersion 25
targetSdkVersion 30
versionCode 5
versionName "11.0-alpha.5+${commitHash()}"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "Lawnchair ${variant.versionName}.apk"
}
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.0.0-beta08"
}
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 {
versionNameSuffix ".debug"
}
release {
if (keystorePropertiesFile.exists()) signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
versionNameSuffix ".release"
proguardFiles "proguard-android-optimize.txt", "proguard.flags"
}
}
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 28
}
withoutQuickstep {
dimension "recents"
}
}
sourceSets {
main {
res.srcDirs = ['res']
java.srcDirs = ['src', 'src_plugins']
manifest.srcFile 'AndroidManifest-common.xml'
proto {
srcDir 'protos/'
srcDir 'proto_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"
}
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.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()
jcenter()
}
}
dependencies {
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
implementation "androidx.dynamicanimation:dynamicanimation:${ANDROID_X_VERSION}"
implementation "androidx.recyclerview:recyclerview:${ANDROID_X_VERSION}"
implementation "androidx.preference:preference-ktx:${ANDROID_X_VERSION}"
implementation project(':IconLoader')
withQuickstepImplementation project(':SharedLibWrapper')
implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'launcher_protos.jar')
implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'sysui_statslog.jar')
// Recents lib dependency
withQuickstepImplementation project(':SystemUIShared')
// 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"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'org.mockito:mockito-core:3.9.0'
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.google.protobuf.nano:protobuf-javanano:3.2.0rc2'
implementation 'com.github.ChickenHook:RestrictionBypass:2.2'
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation 'androidx.activity:activity-compose:1.3.0-beta02'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07'
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.compose.runtime:runtime-rxjava2:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_version"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha03"
implementation "com.google.accompanist:accompanist-glide:$accompanist_version"
implementation "com.google.accompanist:accompanist-insets:$accompanist_version"
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"
implementation 'me.xdrop:fuzzywuzzy:1.3.1'
implementation "com.github.topjohnwu.libsu:core:$libsu_version"
implementation "com.github.topjohnwu.libsu:service:$libsu_version"
}
protobuf {
// Configure the protoc executable
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0'
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
javanano {
option "java_package=launcher_log_extension.proto|com.android.launcher3.userevent.nano"
option "java_package=launcher_log.proto|com.android.launcher3.userevent.nano"
option "java_package=launcher_dump.proto|com.android.launcher3.model.nano"
option "enum_style=java"
}
}
}
}
}
}