75 lines
2.3 KiB
Plaintext
75 lines
2.3 KiB
Plaintext
import java.util.Properties
|
|
import java.io.FileInputStream
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
|
id("dev.flutter.flutter-gradle-plugin")
|
|
id("com.google.gms.google-services")
|
|
}
|
|
|
|
val keystoreProperties = Properties()
|
|
val keystorePropertiesFile = rootProject.file("key.properties")
|
|
val hasReleaseKeystore = if (keystorePropertiesFile.exists()) {
|
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
|
true
|
|
} else {
|
|
false
|
|
}
|
|
|
|
android {
|
|
namespace = "app.motorsignal.motorcycle"
|
|
compileSdk = 37
|
|
ndkVersion = flutter.ndkVersion
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId = "app.motorsignal.motorcycle"
|
|
minSdk = flutter.minSdkVersion
|
|
targetSdk = flutter.targetSdkVersion
|
|
versionCode = flutter.versionCode
|
|
versionName = flutter.versionName
|
|
}
|
|
|
|
signingConfigs {
|
|
create("release") {
|
|
if (hasReleaseKeystore) {
|
|
keyAlias = keystoreProperties.getProperty("keyAlias")
|
|
keyPassword = keystoreProperties.getProperty("keyPassword")
|
|
val storeFilePath = keystoreProperties.getProperty("storeFile")
|
|
storeFile = rootProject.file(storeFilePath)
|
|
storePassword = keystoreProperties.getProperty("storePassword")
|
|
storeType = "PKCS12"
|
|
}
|
|
// If hasReleaseKeystore is false, properties are intentionally left null.
|
|
// The release buildType below will throw before the signing step is reached.
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
if (!hasReleaseKeystore) {
|
|
throw GradleException(
|
|
"Release build requires android/key.properties with production keystore credentials. " +
|
|
"Copy android/key.properties.template to android/key.properties and fill in your keystore details."
|
|
)
|
|
}
|
|
signingConfig = signingConfigs.getByName("release")
|
|
}
|
|
}
|
|
}
|
|
|
|
kotlin {
|
|
compilerOptions {
|
|
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source = "../.."
|
|
}
|