pull/1969/merge
Jaehwa Noh 7 days ago committed by GitHub
commit 87c73ce0b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -48,18 +48,19 @@ dependencies {
testImplementation(libs.kotlinx.coroutines.test)
}
val backendUrl = providers.fileContents(
isolated.rootProject.projectDirectory.file("local.properties")
).asText.map { text ->
val backendUrl = provider {
val properties = Properties()
val text = providers.fileContents(
isolated.rootProject.projectDirectory.file("local.properties"),
).asText.getOrElse("")
properties.load(StringReader(text))
properties["BACKEND_URL"]
}.orElse("http://example.com")
val url = properties.getProperty("BACKEND_URL", "http://example.com")
BuildConfigField(type = "String", value = """"$url"""", comment = null)
}
androidComponents {
onVariants {
it.buildConfigFields!!.put("BACKEND_URL", backendUrl.map { value ->
BuildConfigField(type = "String", value = """"$value"""", comment = null)
})
it.buildConfigFields!!.put("BACKEND_URL", backendUrl)
}
}

Loading…
Cancel
Save