Refactoring

pull/187/head
M66B 4 years ago
parent 4453ab69ec
commit eab715c19e

@ -1,6 +1,10 @@
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'com.bugsnag.android.gradle' 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 keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties() def keystoreProperties = new Properties()
@ -13,12 +17,11 @@ android {
applicationId "eu.faircode.email" applicationId "eu.faircode.email"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 1362 versionCode getVersionCode()
versionName "1.1362" versionName "1." + getVersionCode()
archivesBaseName = "FairEmail-v$versionName" archivesBaseName = "FairEmail-v$versionName"
// https://en.wikipedia.org/wiki/List_of_dinosaur_genera buildConfigField "String", "RELEASE_NAME", getReleaseName()
buildConfigField "String", "RELEASE_NAME", "\"Xiyunykus\""
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {
@ -36,56 +39,17 @@ android {
} }
} }
// https://stackoverflow.com/questions/28948538/ sourceSets {
// $JAVA_HOME/bin/java -jar ~/Android/Sdk/tools/proguard/lib/retrace.jar ~/email/app/schemas/mapping/FairEmail-v1.nnn-github-release-mapping.txt github {
applicationVariants.all { variant -> java.srcDirs = ['src/main/java', 'src/play/java']
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
}
} }
fdroid {
sourceSets { java.srcDirs = ['src/main/java', 'src/fdroid/java']
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'
} }
} play {
java.srcDirs = ['src/main/java', 'src/play/java']
dependenciesInfo { }
includeInApk = false main.res.srcDirs += 'src/main/resExtra'
includeInBundle = false
} }
lintOptions { lintOptions {
@ -104,6 +68,11 @@ android {
} }
} }
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
packagingOptions { packagingOptions {
exclude 'LICENSES' exclude 'LICENSES'
exclude 'META-INF/LICENSE.txt' 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 { buildTypes {
// https://developer.android.com/studio/build/shrink-code // https://developer.android.com/studio/build/shrink-code
release { 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 { bugsnag {
// https://docs.bugsnag.com/build-integrations/gradle/ // https://docs.bugsnag.com/build-integrations/gradle/
uploadJvmMappings = false // disables upload of ProGuard/DexGuard/R8 mapping files uploadJvmMappings = false // disables upload of ProGuard/DexGuard/R8 mapping files

Loading…
Cancel
Save