1414 * limitations under the License.
1515 */
1616
17+ import com.android.build.api.variant.BuildConfigField
18+ import java.io.StringReader
19+ import java.util.Properties
20+
1721plugins {
1822 alias(libs.plugins.nowinandroid.android.library)
1923 alias(libs.plugins.nowinandroid.android.library.jacoco)
2024 alias(libs.plugins.nowinandroid.hilt)
2125 id(" kotlinx-serialization" )
22- id(" com.google.android.libraries.mapsplatform.secrets-gradle-plugin" )
2326}
2427
2528android {
@@ -34,10 +37,6 @@ android {
3437 }
3538}
3639
37- secrets {
38- defaultPropertiesFileName = " secrets.defaults.properties"
39- }
40-
4140dependencies {
4241 api(libs.kotlinx.datetime)
4342 api(projects.core.common)
@@ -52,3 +51,22 @@ dependencies {
5251
5352 testImplementation(libs.kotlinx.coroutines.test)
5453}
54+
55+ val backendUrl = providers.fileContents(
56+ isolated.rootProject.projectDirectory.file(" local.properties" )
57+ ).asText.map { text ->
58+ val properties = Properties ()
59+ properties.load(StringReader (text))
60+ if (properties.containsKey(" BACKEND_URL" ))
61+ (properties[" BACKEND_URL" ] as String )
62+ else " http://example.com"
63+ // Move to returning `properties["BACKEND_URL"] as String?` after upgrading to Gradle 9.0.0
64+ }.orElse(" http://example.com" )
65+
66+ androidComponents {
67+ onVariants {
68+ it.buildConfigFields.put(" BACKEND_URL" , backendUrl.map { value ->
69+ BuildConfigField (type = " String" , value = """ "$value """" , comment = null )
70+ })
71+ }
72+ }
0 commit comments