265 lines
No EOL
9.5 KiB
Groovy
265 lines
No EOL
9.5 KiB
Groovy
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
|
|
plugins {
|
|
id 'com.android.application'
|
|
id 'com.google.devtools.ksp' version "$ksp_version"
|
|
id 'kotlin-android'
|
|
id 'kotlin-kapt'
|
|
}
|
|
|
|
def packageName = "deckers.thibault.aves"
|
|
|
|
// Flutter properties
|
|
|
|
def localProperties = new Properties()
|
|
def localPropertiesFile = rootProject.file('local.properties')
|
|
if (localPropertiesFile.exists()) {
|
|
localPropertiesFile.withReader('UTF-8') { reader ->
|
|
localProperties.load(reader)
|
|
}
|
|
}
|
|
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
|
|
def flutterVersionName = localProperties.getProperty('flutter.versionName')
|
|
def flutterRoot = localProperties.getProperty('flutter.sdk')
|
|
if (flutterRoot == null) {
|
|
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
|
|
}
|
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|
|
|
// Keys
|
|
|
|
def keystoreProperties = new Properties()
|
|
def keystorePropertiesFile = rootProject.file('key.properties')
|
|
if (keystorePropertiesFile.exists()) {
|
|
// for release using credentials stored in a local file
|
|
keystorePropertiesFile.withReader('UTF-8') { reader ->
|
|
keystoreProperties.load(reader)
|
|
}
|
|
} else {
|
|
// for release using credentials in environment variables set up by GitHub Actions
|
|
// warning: in property file, single quotes should be escaped with a backslash
|
|
// but they should not be escaped when stored in env variables
|
|
keystoreProperties["storeFile"] = System.getenv("AVES_STORE_FILE") ?: "<NONE>"
|
|
keystoreProperties["storePassword"] = System.getenv("AVES_STORE_PASSWORD") ?: "<NONE>"
|
|
keystoreProperties["keyAlias"] = System.getenv("AVES_KEY_ALIAS") ?: "<NONE>"
|
|
keystoreProperties["keyPassword"] = System.getenv("AVES_KEY_PASSWORD") ?: "<NONE>"
|
|
keystoreProperties["googleApiKey"] = System.getenv("AVES_GOOGLE_API_KEY") ?: "<NONE>"
|
|
keystoreProperties["huaweiApiKey"] = System.getenv("AVES_HUAWEI_API_KEY") ?: "<NONE>"
|
|
}
|
|
|
|
android {
|
|
namespace 'deckers.thibault.aves'
|
|
compileSdk 34
|
|
ndkVersion flutter.ndkVersion
|
|
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
lintOptions {
|
|
checkAllWarnings true
|
|
warningsAsErrors true
|
|
disable 'InvalidPackage'
|
|
}
|
|
|
|
packagingOptions {
|
|
// The Amazon Developer console mistakenly considers the app to not be 64-bit compatible
|
|
// if there are some libs in `lib/armeabi-v7a` unmatched by libs in `lib/arm64-v8a`,
|
|
// so we exclude the extra `neon` libs bundled by `FFmpegKit`.
|
|
exclude 'lib/armeabi-v7a/*_neon.so'
|
|
|
|
// necessary since Flutter v3.16.0
|
|
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
|
|
pickFirst 'lib/arm64-v8a/libc++_shared.so'
|
|
pickFirst 'lib/x86_64/libc++_shared.so'
|
|
}
|
|
|
|
sourceSets {
|
|
main.java.srcDirs += 'src/main/kotlin'
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId packageName
|
|
// minSdk constraints:
|
|
// - Flutter & other plugins: 16
|
|
// - google_maps_flutter v2.1.1: 20
|
|
// - to build XML documents from XMP data, `metadata-extractor` and `PixyMeta` rely on `DocumentBuilder`,
|
|
// which implementation `DocumentBuilderImpl` is provided by the OS and is not customizable on Android,
|
|
// but the implementation on API <19 is not robust enough and fails to build XMP documents
|
|
minSdk 19
|
|
targetSdk 34
|
|
versionCode flutterVersionCode.toInteger()
|
|
versionName flutterVersionName
|
|
manifestPlaceholders = [googleApiKey: keystoreProperties["googleApiKey"] ?: "<NONE>",
|
|
huaweiApiKey: keystoreProperties["huaweiApiKey"] ?: "<NONE>"]
|
|
multiDexEnabled true
|
|
}
|
|
|
|
signingConfigs {
|
|
release {
|
|
keyAlias keystoreProperties["keyAlias"]
|
|
keyPassword keystoreProperties["keyPassword"]
|
|
storeFile keystoreProperties["storeFile"] ? file(keystoreProperties["storeFile"]) : null
|
|
storePassword keystoreProperties["storePassword"]
|
|
}
|
|
}
|
|
|
|
flavorDimensions = ["store"]
|
|
|
|
productFlavors {
|
|
play {
|
|
// Google Play
|
|
dimension "store"
|
|
// generate a universal APK without x86 native libs
|
|
ext.useNdkAbiFilters = true
|
|
}
|
|
|
|
huawei {
|
|
// Huawei AppGallery
|
|
dimension "store"
|
|
// generate a universal APK without x86 native libs
|
|
ext.useNdkAbiFilters = true
|
|
}
|
|
|
|
izzy {
|
|
// IzzyOnDroid
|
|
// check offending libraries with `scanapk`
|
|
// cf https://android.izzysoft.de/articles/named/app-modules-2
|
|
dimension "store"
|
|
// generate APK by ABI, but NDK ABI filters are incompatible with split APK generation
|
|
ext.useNdkAbiFilters = false
|
|
}
|
|
|
|
libre {
|
|
// F-Droid
|
|
// check offending libraries with `fdroidserver`
|
|
// cf https://f-droid.org/en/docs/Submitting_to_F-Droid_Quick_Start_Guide/
|
|
dimension "store"
|
|
// generate APK by ABI, but NDK ABI filters are incompatible with split APK generation
|
|
ext.useNdkAbiFilters = false
|
|
applicationIdSuffix ".libre"
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
applicationIdSuffix ".debug"
|
|
}
|
|
profile {
|
|
applicationIdSuffix ".profile"
|
|
}
|
|
release {
|
|
signingConfig signingConfigs.release
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
}
|
|
|
|
applicationVariants.all { variant ->
|
|
variant.resValue 'string', 'screen_saver_settings_activity', "${applicationId}/${packageName}.ScreenSaverSettingsActivity"
|
|
variant.resValue 'string', 'search_provider', "${applicationId}.search_provider"
|
|
|
|
variant.outputs.each { output ->
|
|
def baseAbiVersionCode = rootProject.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
|
|
if (baseAbiVersionCode != null) {
|
|
output.versionCodeOverride = variant.versionCode * 100 + baseAbiVersionCode
|
|
}
|
|
}
|
|
}
|
|
|
|
android.productFlavors.each { flavor ->
|
|
def tasks = gradle.startParameter.taskNames.toString().toLowerCase()
|
|
if (tasks.contains(flavor.name) && flavor.ext.useNdkAbiFilters) {
|
|
release {
|
|
// specify architectures, to specifically exclude native libs for x86,
|
|
// which lead to: UnsatisfiedLinkError...couldn't find "libflutter.so"
|
|
// cf https://github.com/flutter/flutter/issues/37566#issuecomment-640879500
|
|
ndk {
|
|
//noinspection ChromeOsAbiSupport
|
|
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(KotlinCompile).configureEach {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain(8)
|
|
}
|
|
|
|
flutter {
|
|
source '../..'
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
url 'https://jitpack.io'
|
|
content {
|
|
includeGroup "com.github.deckerst"
|
|
includeGroup "com.github.deckerst.mp4parser"
|
|
}
|
|
}
|
|
maven {
|
|
url 'https://s3.amazonaws.com/repo.commonsware.com'
|
|
content {
|
|
excludeGroupByRegex "com\\.github\\.deckerst.*"
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
|
|
|
|
implementation "androidx.appcompat:appcompat:1.6.1"
|
|
implementation 'androidx.core:core-ktx:1.12.0'
|
|
implementation 'androidx.exifinterface:exifinterface:1.3.6'
|
|
implementation 'androidx.lifecycle:lifecycle-process:2.6.2'
|
|
implementation 'androidx.media:media:1.6.0'
|
|
implementation 'androidx.multidex:multidex:2.0.1'
|
|
implementation 'androidx.security:security-crypto:1.1.0-alpha06'
|
|
implementation 'androidx.work:work-runtime-ktx:2.8.1'
|
|
|
|
implementation 'com.caverock:androidsvg-aar:1.4'
|
|
implementation 'com.commonsware.cwac:document:0.5.0'
|
|
implementation 'com.drewnoakes:metadata-extractor:2.18.0'
|
|
implementation "com.github.bumptech.glide:glide:$glide_version"
|
|
// SLF4J implementation for `mp4parser`
|
|
implementation 'org.slf4j:slf4j-simple:2.0.9'
|
|
|
|
// forked, built by JitPack:
|
|
// - https://jitpack.io/p/deckerst/Android-TiffBitmapFactory
|
|
// - https://jitpack.io/p/deckerst/mp4parser
|
|
// - https://jitpack.io/p/deckerst/pixymeta-android
|
|
implementation 'com.github.deckerst:Android-TiffBitmapFactory:90c06eebf4'
|
|
implementation 'com.github.deckerst.mp4parser:isoparser:4cc0c5d06c'
|
|
implementation 'com.github.deckerst.mp4parser:muxer:4cc0c5d06c'
|
|
implementation 'com.github.deckerst:pixymeta-android:706bd73d6e'
|
|
|
|
// huawei flavor only
|
|
huaweiImplementation "com.huawei.agconnect:agconnect-core:$huawei_agconnect_version"
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.10.1'
|
|
|
|
kapt 'androidx.annotation:annotation:1.7.0'
|
|
ksp "com.github.bumptech.glide:ksp:$glide_version"
|
|
|
|
compileOnly rootProject.findProject(':streams_channel')
|
|
}
|
|
|
|
if (useCrashlytics) {
|
|
println("Building flavor with Crashlytics plugin")
|
|
apply plugin: 'com.google.gms.google-services'
|
|
apply plugin: 'com.google.firebase.crashlytics'
|
|
}
|
|
|
|
if (useHms) {
|
|
println("Building flavor with HMS plugin")
|
|
apply plugin: 'com.huawei.agconnect'
|
|
} |