#29 guard buildscript proprietary dependencies behind flags

This commit is contained in:
Thibault Deckers 2022-11-17 19:11:57 +01:00
parent e2a8142185
commit a8ba0e2679
3 changed files with 46 additions and 33 deletions

View file

@ -80,8 +80,6 @@ android {
play {
// Google Play
dimension "store"
ext.useCrashlytics = true
ext.useHMS = false
// generate a universal APK without x86 native libs
ext.useNdkAbiFilters = true
}
@ -89,8 +87,6 @@ android {
huawei {
// Huawei AppGallery
dimension "store"
ext.useCrashlytics = false
ext.useHMS = true
// generate a universal APK without x86 native libs
ext.useNdkAbiFilters = true
}
@ -100,20 +96,18 @@ android {
// check offending libraries with `scanapk`
// cf https://android.izzysoft.de/articles/named/app-modules-2
dimension "store"
ext.useCrashlytics = false
ext.useHMS = false
// generate APK by ABI, but NDK ABI filters are incompatible with split APK generation
ext.useNdkAbiFilters = false
}
libre {
// F-Droid
applicationIdSuffix ".libre"
// check offending libraries with `fdroidserver`
// cf https://f-droid.org/en/docs/Submitting_to_F-Droid_Quick_Start_Guide/
dimension "store"
ext.useCrashlytics = false
ext.useHMS = false
// generate a universal APK without x86 native libs
ext.useNdkAbiFilters = true
applicationIdSuffix ".libre"
}
}
@ -150,6 +144,7 @@ android {
}
}
}
lint {
disable 'InvalidPackage'
}
@ -208,15 +203,13 @@ dependencies {
compileOnly rootProject.findProject(':streams_channel')
}
android.productFlavors.each { flavor ->
def tasks = gradle.startParameter.taskRequests.toString().toLowerCase()
if (tasks.contains(flavor.name) && flavor.ext.useCrashlytics) {
println("Building flavor [${flavor.name}] with Crashlytics plugin")
if (useCrashlytics) {
println("Building flavor with Crashlytics plugin")
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
}
if (tasks.contains(flavor.name) && flavor.ext.useHMS) {
println("Building flavor [${flavor.name}] with HMS plugin")
apply plugin: 'com.huawei.agconnect'
}
}
if (useHms) {
println("Building flavor with HMS plugin")
apply plugin: 'com.huawei.agconnect'
}

View file

@ -1,29 +1,49 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.7.20'
ext.useCrashlytics = gradle.startParameter.taskNames.any { task -> task.containsIgnoreCase("play") }
ext.useHms = gradle.startParameter.taskNames.any { task -> task.containsIgnoreCase("huawei") }
repositories {
google()
mavenCentral()
if (useHms) {
// HMS (used by some flavors only)
maven { url 'https://developer.huawei.com/repo/' }
}
}
dependencies {
// TODO TLAD upgrade Android Gradle plugin >=7.3 when this is fixed: https://github.com/flutter/flutter/issues/115100
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
if (useCrashlytics) {
// GMS & Firebase Crashlytics (used by some flavors only)
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
}
if (useHms) {
// HMS (used by some flavors only)
classpath 'com.huawei.agconnect:agcp:1.7.2.300'
}
}
}
allprojects {
repositories {
google()
mavenCentral()
if (useHms) {
// HMS (used by some flavors only)
maven { url 'https://developer.huawei.com/repo/' }
}
}
// gradle.projectsEvaluated {
// tasks.withType(JavaCompile) {
// options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"

View file

@ -14,7 +14,7 @@ packages:
name: _flutterfire_internals
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
version: "1.0.9"
analyzer:
dependency: transitive
description:
@ -133,14 +133,14 @@ packages:
name: cloud_firestore_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.8.5"
version: "5.9.0"
cloud_firestore_web:
dependency: transitive
description:
name: cloud_firestore_web
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.5"
version: "3.1.0"
collection:
dependency: "direct main"
description:
@ -291,7 +291,7 @@ packages:
name: firebase_core
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.3.0"
firebase_core_platform_interface:
dependency: transitive
description:
@ -312,14 +312,14 @@ packages:
name: firebase_crashlytics
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.5"
version: "3.0.6"
firebase_crashlytics_platform_interface:
dependency: transitive
description:
name: firebase_crashlytics_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.3.6"
version: "3.3.7"
flex_color_picker:
dependency: "direct main"
description: