14
14
* limitations under the License.
15
15
*/
16
16
17
+ import com.android.build.api.variant.BuildConfigField
18
+ import java.io.StringReader
19
+ import java.util.Properties
20
+
17
21
plugins {
18
22
alias(libs.plugins.nowinandroid.android.library)
19
23
alias(libs.plugins.nowinandroid.android.library.jacoco)
20
24
alias(libs.plugins.nowinandroid.hilt)
21
25
id(" kotlinx-serialization" )
22
- id(" com.google.android.libraries.mapsplatform.secrets-gradle-plugin" )
23
26
}
24
27
25
28
android {
@@ -34,10 +37,6 @@ android {
34
37
}
35
38
}
36
39
37
- secrets {
38
- defaultPropertiesFileName = " secrets.defaults.properties"
39
- }
40
-
41
40
dependencies {
42
41
api(libs.kotlinx.datetime)
43
42
api(projects.core.common)
@@ -52,3 +51,22 @@ dependencies {
52
51
53
52
testImplementation(libs.kotlinx.coroutines.test)
54
53
}
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