79 lines
2.5 KiB
Kotlin
79 lines
2.5 KiB
Kotlin
import java.util.Properties
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
id("kotlin-android")
|
|
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
|
id("dev.flutter.flutter-gradle-plugin")
|
|
}
|
|
|
|
val keystoreProperties = Properties()
|
|
val keystorePropertiesFile = rootProject.file("key.properties")
|
|
if (keystorePropertiesFile.exists()) {
|
|
keystorePropertiesFile.inputStream().use { keystoreProperties.load(it) }
|
|
}
|
|
|
|
val releaseStoreFile = System.getenv("ANDROID_KEYSTORE_PATH")
|
|
?: keystoreProperties.getProperty("storeFile")
|
|
val releaseStorePassword = System.getenv("ANDROID_KEYSTORE_PASSWORD")
|
|
?: keystoreProperties.getProperty("storePassword")
|
|
val releaseKeyAlias = System.getenv("ANDROID_KEY_ALIAS")
|
|
?: keystoreProperties.getProperty("keyAlias")
|
|
val releaseKeyPassword = System.getenv("ANDROID_KEY_PASSWORD")
|
|
?: keystoreProperties.getProperty("keyPassword")
|
|
|
|
val hasReleaseKeystore = listOf(
|
|
releaseStoreFile,
|
|
releaseStorePassword,
|
|
releaseKeyAlias,
|
|
releaseKeyPassword
|
|
).all { !it.isNullOrBlank() }
|
|
|
|
android {
|
|
namespace = "com.example.mileograph_flutter"
|
|
compileSdk = flutter.compileSdkVersion
|
|
ndkVersion = "27.0.12077973"
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = JavaVersion.VERSION_11.toString()
|
|
}
|
|
|
|
defaultConfig {
|
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
|
applicationId = "com.example.mileograph_flutter"
|
|
// You can update the following values to match your application needs.
|
|
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
|
minSdk = flutter.minSdkVersion
|
|
targetSdk = flutter.targetSdkVersion
|
|
versionCode = flutter.versionCode
|
|
versionName = flutter.versionName
|
|
}
|
|
|
|
signingConfigs {
|
|
if (hasReleaseKeystore) {
|
|
create("release") {
|
|
storeFile = file(releaseStoreFile!!)
|
|
storePassword = releaseStorePassword
|
|
keyAlias = releaseKeyAlias!!
|
|
keyPassword = releaseKeyPassword
|
|
}
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
// Use a real release keystore when provided; fall back to debug keys otherwise.
|
|
signingConfig = signingConfigs.getByName(if (hasReleaseKeystore) "release" else "debug")
|
|
}
|
|
}
|
|
}
|
|
|
|
flutter {
|
|
source = "../.."
|
|
}
|