From eab715c19e9c08745f2779b7782580377726d091 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 16 Oct 2020 22:30:11 +0200 Subject: [PATCH] Refactoring --- app/build.gradle | 106 ++++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 8ff60a580b..6565c895d2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,10 @@ apply plugin: 'com.android.application' apply plugin: 'com.bugsnag.android.gradle' +def getVersionCode = { -> return 1362 } +def getReleaseName = { -> return "\"Xiyunykus\"" } +// https://en.wikipedia.org/wiki/List_of_dinosaur_genera + def keystorePropertiesFile = rootProject.file("keystore.properties") def keystoreProperties = new Properties() @@ -13,12 +17,11 @@ android { applicationId "eu.faircode.email" minSdkVersion 21 targetSdkVersion 30 - versionCode 1362 - versionName "1.1362" + versionCode getVersionCode() + versionName "1." + getVersionCode() archivesBaseName = "FairEmail-v$versionName" - // https://en.wikipedia.org/wiki/List_of_dinosaur_genera - buildConfigField "String", "RELEASE_NAME", "\"Xiyunykus\"" + buildConfigField "String", "RELEASE_NAME", getReleaseName() javaCompileOptions { annotationProcessorOptions { @@ -36,56 +39,17 @@ android { } } - // https://stackoverflow.com/questions/28948538/ - // $JAVA_HOME/bin/java -jar ~/Android/Sdk/tools/proguard/lib/retrace.jar ~/email/app/schemas/mapping/FairEmail-v1.nnn-github-release-mapping.txt - applicationVariants.all { variant -> - if (variant.getBuildType().isMinifyEnabled()) - variant.assembleProvider.get().doLast { - for (file in variant.getMappingFileProvider().get().files) - if (file != null && file.exists()) { - def dir = "${rootDir}/app/schemas/mapping" - def name = "$archivesBaseName-$variant.baseName-$file.name" - def target = new File(dir, name) - if (!target.exists()) - copy { - from file - into dir - rename { String fileName -> name } - } - } - } - } - - android { - buildFeatures { - buildFeatures { - buildConfig = true - viewBinding = false - dataBinding = false - aidl = true - renderScript = false - resValues = false - shaders = false - } + sourceSets { + github { + java.srcDirs = ['src/main/java', 'src/play/java'] } - - sourceSets { - github { - java.srcDirs = ['src/main/java', 'src/play/java'] - } - fdroid { - java.srcDirs = ['src/main/java', 'src/fdroid/java'] - } - play { - java.srcDirs = ['src/main/java', 'src/play/java'] - } - main.res.srcDirs += 'src/main/resExtra' + fdroid { + java.srcDirs = ['src/main/java', 'src/fdroid/java'] } - } - - dependenciesInfo { - includeInApk = false - includeInBundle = false + play { + java.srcDirs = ['src/main/java', 'src/play/java'] + } + main.res.srcDirs += 'src/main/resExtra' } lintOptions { @@ -104,6 +68,11 @@ android { } } + dependenciesInfo { + includeInApk = false + includeInBundle = false + } + packagingOptions { exclude 'LICENSES' exclude 'META-INF/LICENSE.txt' @@ -127,6 +96,19 @@ android { } } + buildFeatures { + buildFeatures { + buildConfig = true + viewBinding = false + dataBinding = false + aidl = true + renderScript = false + resValues = false + shaders = false + compose = false + } + } + buildTypes { // https://developer.android.com/studio/build/shrink-code release { @@ -186,6 +168,26 @@ android { } } + // https://stackoverflow.com/questions/28948538/ + // $JAVA_HOME/bin/java -jar ~/Android/Sdk/tools/proguard/lib/retrace.jar ~/email/app/schemas/mapping/FairEmail-v1.nnn-github-release-mapping.txt + applicationVariants.all { variant -> + if (variant.getBuildType().isMinifyEnabled()) + variant.assembleProvider.get().doLast { + for (file in variant.getMappingFileProvider().get().files) + if (file != null && file.exists()) { + def dir = "${rootDir}/app/schemas/mapping" + def name = "$archivesBaseName-$variant.baseName-$file.name" + def target = new File(dir, name) + if (!target.exists()) + copy { + from file + into dir + rename { String fileName -> name } + } + } + } + } + bugsnag { // https://docs.bugsnag.com/build-integrations/gradle/ uploadJvmMappings = false // disables upload of ProGuard/DexGuard/R8 mapping files