Skip to content

Commit e5ed0a0

Browse files
committed
Move build parameters to a common file
1 parent d92d85f commit e5ed0a0

File tree

3 files changed

+23
-25
lines changed

3 files changed

+23
-25
lines changed

app/build.gradle.kts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
1111
import com.android.build.gradle.internal.tasks.factory.dependsOn
1212
import com.android.build.gradle.tasks.GenerateBuildConfig
13+
import config.BuildTimeConfig
1314
import extension.AssetCopyTask
1415
import extension.ComponentMergingStrategy
1516
import extension.GitBranchNameValueSource
@@ -43,11 +44,7 @@ android {
4344
namespace = "io.element.android.x"
4445

4546
defaultConfig {
46-
applicationId = if (isEnterpriseBuild) {
47-
"io.element.enterprise"
48-
} else {
49-
"io.element.android.x"
50-
}
47+
applicationId = BuildTimeConfig.APPLICATION_ID
5148
targetSdk = Versions.TARGET_SDK
5249
versionCode = Versions.VERSION_CODE
5350
versionName = Versions.VERSION_NAME
@@ -97,11 +94,7 @@ android {
9794
}
9895
}
9996

100-
val baseAppName = if (isEnterpriseBuild) {
101-
"Element Enterprise"
102-
} else {
103-
"Element X"
104-
}
97+
val baseAppName = BuildTimeConfig.APPLICATION_NAME
10598
logger.warnInBox("Building $baseAppName")
10699

107100
buildTypes {

libraries/pushproviders/firebase/build.gradle.kts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
@file:Suppress("UnstableApiUsage")
99

10+
import config.BuildTimeConfig
1011
import extension.setupAnvil
1112

1213
plugins {
@@ -22,22 +23,14 @@ android {
2223
resValue(
2324
type = "string",
2425
name = "google_app_id",
25-
value = if (isEnterpriseBuild) {
26-
"1:912726360885:android:d273c2077ec3291500427c"
27-
} else {
28-
"1:912726360885:android:d097de99a4c23d2700427c"
29-
}
26+
value = BuildTimeConfig.GOOGLE_APP_ID_RELEASE,
3027
)
3128
}
3229
getByName("debug") {
3330
resValue(
3431
type = "string",
3532
name = "google_app_id",
36-
value = if (isEnterpriseBuild) {
37-
"1:912726360885:android:f8de9126a94143d300427c"
38-
} else {
39-
"1:912726360885:android:def0a4e454042e9b00427c"
40-
}
33+
value = BuildTimeConfig.GOOGLE_APP_ID_DEBUG,
4134
)
4235
}
4336
register("nightly") {
@@ -46,11 +39,7 @@ android {
4639
resValue(
4740
type = "string",
4841
name = "google_app_id",
49-
value = if (isEnterpriseBuild) {
50-
"1:912726360885:android:3f7e1fe644d99d5a00427c"
51-
} else {
52-
"1:912726360885:android:e17435e0beb0303000427c"
53-
}
42+
value = BuildTimeConfig.GOOGLE_APP_ID_NIGHTLY,
5443
)
5544
}
5645
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2025 New Vector Ltd.
3+
*
4+
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5+
* Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
package config
9+
10+
object BuildTimeConfig {
11+
const val APPLICATION_ID = "io.element.android.x"
12+
const val APPLICATION_NAME = "Element X"
13+
const val GOOGLE_APP_ID_RELEASE = "1:912726360885:android:d097de99a4c23d2700427c"
14+
const val GOOGLE_APP_ID_DEBUG = "1:912726360885:android:def0a4e454042e9b00427c"
15+
const val GOOGLE_APP_ID_NIGHTLY = "1:912726360885:android:e17435e0beb0303000427c"
16+
}

0 commit comments

Comments
 (0)