fix(build): add explicit Kotlin imports for Properties/FileInputStream and fix signing config casts
- Add import statements for java.util.Properties and java.io.FileInputStream (newer Kotlin DSL requires explicit imports) - Replace deprecated jvmTarget = JavaVersion.VERSION_17.toString() with "17" - Replace unsafe 'as String' casts with Properties.getProperty() in signing config - Fix same import issue in settings.gradle.kts
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
import java.util.Properties
|
||||||
|
import java.io.FileInputStream
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
id("kotlin-android")
|
id("kotlin-android")
|
||||||
@@ -14,9 +17,9 @@ dependencies {
|
|||||||
|
|
||||||
// Load release signing properties if key.properties exists (set by CI pipeline)
|
// Load release signing properties if key.properties exists (set by CI pipeline)
|
||||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||||
val keystoreProperties = java.util.Properties()
|
val keystoreProperties = Properties()
|
||||||
if (keystorePropertiesFile.exists()) {
|
if (keystorePropertiesFile.exists()) {
|
||||||
keystoreProperties.load(java.io.FileInputStream(keystorePropertiesFile))
|
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@@ -30,7 +33,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
jvmTarget = "17"
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@@ -47,10 +50,10 @@ android {
|
|||||||
signingConfigs {
|
signingConfigs {
|
||||||
create("release") {
|
create("release") {
|
||||||
if (keystorePropertiesFile.exists()) {
|
if (keystorePropertiesFile.exists()) {
|
||||||
keyAlias = keystoreProperties["keyAlias"] as String
|
keyAlias = keystoreProperties.getProperty("keyAlias")
|
||||||
keyPassword = keystoreProperties["keyPassword"] as String
|
keyPassword = keystoreProperties.getProperty("keyPassword")
|
||||||
storeFile = file(keystoreProperties["storeFile"] as String)
|
storeFile = file(keystoreProperties.getProperty("storeFile"))
|
||||||
storePassword = keystoreProperties["storePassword"] as String
|
storePassword = keystoreProperties.getProperty("storePassword")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
import java.util.Properties
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
val flutterSdkPath =
|
val flutterSdkPath =
|
||||||
run {
|
run {
|
||||||
val properties = java.util.Properties()
|
val properties = Properties()
|
||||||
file("local.properties").inputStream().use { properties.load(it) }
|
file("local.properties").inputStream().use { properties.load(it) }
|
||||||
val flutterSdkPath = properties.getProperty("flutter.sdk")
|
val flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
|
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
|
||||||
|
|||||||
Reference in New Issue
Block a user