Update app Android gradle scripts to use flutter.versionName and flutter.versionCode (#146604)

Follow up of #146044 and #141417

Minor change to make Gradle buildscripts shorter.
This commit is contained in:
Bartek Pacia 2024-04-11 14:46:13 +01:00 committed by GitHub
parent 9436b3c1c8
commit 557fbf5167
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 40 deletions

View file

@ -5,24 +5,6 @@ plugins {
id "dev.flutter.flutter-gradle-plugin"
}
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")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}
android {
namespace = "{{androidIdentifier}}"
compileSdk = flutter.compileSdkVersion
@ -40,8 +22,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {

View file

@ -5,24 +5,6 @@ plugins {
id "dev.flutter.flutter-gradle-plugin"
}
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")
if (flutterVersionCode == null) {
flutterVersionCode = "1"
}
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = "1.0"
}
android {
namespace = "{{androidIdentifier}}"
compileSdk = flutter.compileSdkVersion
@ -40,8 +22,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {