migrated flutter gradle plugin usage

This commit is contained in:
Thibault Deckers 2024-03-22 00:05:18 +01:00
parent fe36f7c1bc
commit 1cda37573d
5 changed files with 39 additions and 43 deletions

View file

@ -2,9 +2,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id 'com.android.application'
id 'com.google.devtools.ksp' version "$ksp_version"
id 'com.google.devtools.ksp'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dev.flutter.flutter-gradle-plugin'
}
def packageName = "deckers.thibault.aves"
@ -20,11 +21,6 @@ if (localPropertiesFile.exists()) {
}
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

View file

@ -1,8 +1,5 @@
buildscript {
ext {
kotlin_version = '1.9.21'
ksp_version = "$kotlin_version-1.0.15"
agp_version = '8.3.1'
glide_version = '4.16.0'
// AppGallery Connect plugin versions: https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-sdk-changenotes-0000001058732550
huawei_agconnect_version = '1.9.1.300'
@ -22,9 +19,6 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:$agp_version"
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.4.0'

View file

@ -6,13 +6,13 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
org.gradle.jvmargs=-Xmx4G -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

33
android/settings.gradle Normal file
View file

@ -0,0 +1,33 @@
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
settings.ext.kotlin_version = '1.9.21'
settings.ext.ksp_version = "$kotlin_version-1.0.15"
settings.ext.agp_version = '8.3.1'
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version("1.0.0")
id("com.android.application") version("$agp_version") apply(false)
id("org.jetbrains.kotlin.android") version("$kotlin_version") apply(false)
id("com.google.devtools.ksp") version("$ksp_version") apply(false)
id("org.gradle.toolchains.foojay-resolver-convention") version("0.4.0")
}
include(":app")
include(":exifinterface")

View file

@ -1,27 +0,0 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version ("0.4.0")
}
include(":app")
val localPropertiesFile = File(rootProject.projectDir, "local.properties")
val properties = java.util.Properties()
assert(localPropertiesFile.exists())
localPropertiesFile.reader(Charsets.UTF_8).also { reader -> properties.load(reader) }
val flutterSdkPath: String? = properties.getProperty("flutter.sdk")
assert(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
apply {
from("$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle")
}
include(":exifinterface")