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

View file

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

View file

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