diff --git a/app/k9mail/build.gradle.kts b/app/k9mail/build.gradle.kts index 194da69d2b2cbd5b66c91c0d0d2ee4674d3f9853..88d056375ee4eb81a67b93335fecfc42357e58c8 100644 --- a/app/k9mail/build.gradle.kts +++ b/app/k9mail/build.gradle.kts @@ -1,3 +1,5 @@ +import java.util.Properties + plugins { id(ThunderbirdPlugins.App.android) } @@ -45,6 +47,17 @@ dependencies { testImplementation(libs.robolectric) } +fun getProperty(property: String): String { + return System.getenv(property) ?: run { + val properties = Properties() + val propertiesFile = project.rootProject.file("local.properties") + if (propertiesFile.exists()) { + propertiesFile.inputStream().use { properties.load(it) } + } + properties.getProperty(property) + } ?: throw GradleException("$property not found in local.properties or CI-CD variables") +} + android { namespace = "com.fsck.k9" @@ -112,11 +125,11 @@ android { "OAUTH_AOL_CLIENT_ID", "\"dj0yJmk9dUNqYXZhYWxOYkdRJmQ9WVdrOU1YQnZVRFZoY1ZrbWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PWIw\"", ) - buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"e647013a-ada4-4114-b419-e43d250f99c5\"") + buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MICROSOFT_CLIENT_ID")}\"") buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", - "\"msauth://com.fsck.k9/Dx8yUsuhyU3dYYba1aA16Wxu5eM%3D\"", + "\"msauth://foundation.e.mail/${getProperty("MICROSOFT_REDIRECT_URI_SUFFIX")}\"", ) manifestPlaceholders["appAuthRedirectScheme"] = "foundation.e.mail" @@ -144,11 +157,11 @@ android { "OAUTH_AOL_CLIENT_ID", "\"dj0yJmk9cHYydkJkTUxHcXlYJmQ9WVdrOWVHZHhVVXN4VVV3bWNHbzlNQT09JnM9Y29uc3VtZXJzZWNyZXQmc3Y9MCZ4PTdm\"", ) - buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"e647013a-ada4-4114-b419-e43d250f99c5\"") + buildConfigField("String", "OAUTH_MICROSOFT_CLIENT_ID", "\"${getProperty("MICROSOFT_CLIENT_ID")}\"") buildConfigField( "String", "OAUTH_MICROSOFT_REDIRECT_URI", - "\"msauth://com.fsck.k9.debug/VZF2DYuLYAu4TurFd6usQB2JPts%3D\"", + "\"msauth://foundation.e.mail/${getProperty("MICROSOFT_REDIRECT_URI_SUFFIX")}\"", ) manifestPlaceholders["appAuthRedirectScheme"] = "foundation.e.mail.debug"