Move build parameters to a common file

This commit is contained in:
Benoit Marty
2025-02-19 17:10:30 +01:00
committed by Benoit Marty
parent 86d9abfef7
commit c9890d3073
3 changed files with 23 additions and 25 deletions

View File

@@ -10,6 +10,7 @@
import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
import com.android.build.gradle.internal.tasks.factory.dependsOn
import com.android.build.gradle.tasks.GenerateBuildConfig
import config.BuildTimeConfig
import extension.AssetCopyTask
import extension.ComponentMergingStrategy
import extension.GitBranchNameValueSource
@@ -43,11 +44,7 @@ android {
namespace = "io.element.android.x"
defaultConfig {
applicationId = if (isEnterpriseBuild) {
"io.element.enterprise"
} else {
"io.element.android.x"
}
applicationId = BuildTimeConfig.APPLICATION_ID
targetSdk = Versions.TARGET_SDK
versionCode = Versions.VERSION_CODE
versionName = Versions.VERSION_NAME
@@ -97,11 +94,7 @@ android {
}
}
val baseAppName = if (isEnterpriseBuild) {
"Element Enterprise"
} else {
"Element X"
}
val baseAppName = BuildTimeConfig.APPLICATION_NAME
logger.warnInBox("Building $baseAppName")
buildTypes {

View File

@@ -7,6 +7,7 @@
@file:Suppress("UnstableApiUsage")
import config.BuildTimeConfig
import extension.setupAnvil
plugins {
@@ -22,22 +23,14 @@ android {
resValue(
type = "string",
name = "google_app_id",
value = if (isEnterpriseBuild) {
"1:912726360885:android:d273c2077ec3291500427c"
} else {
"1:912726360885:android:d097de99a4c23d2700427c"
}
value = BuildTimeConfig.GOOGLE_APP_ID_RELEASE,
)
}
getByName("debug") {
resValue(
type = "string",
name = "google_app_id",
value = if (isEnterpriseBuild) {
"1:912726360885:android:f8de9126a94143d300427c"
} else {
"1:912726360885:android:def0a4e454042e9b00427c"
}
value = BuildTimeConfig.GOOGLE_APP_ID_DEBUG,
)
}
register("nightly") {
@@ -46,11 +39,7 @@ android {
resValue(
type = "string",
name = "google_app_id",
value = if (isEnterpriseBuild) {
"1:912726360885:android:3f7e1fe644d99d5a00427c"
} else {
"1:912726360885:android:e17435e0beb0303000427c"
}
value = BuildTimeConfig.GOOGLE_APP_ID_NIGHTLY,
)
}
}

View File

@@ -0,0 +1,16 @@
/*
* Copyright 2025 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
package config
object BuildTimeConfig {
const val APPLICATION_ID = "io.element.android.x"
const val APPLICATION_NAME = "Element X"
const val GOOGLE_APP_ID_RELEASE = "1:912726360885:android:d097de99a4c23d2700427c"
const val GOOGLE_APP_ID_DEBUG = "1:912726360885:android:def0a4e454042e9b00427c"
const val GOOGLE_APP_ID_NIGHTLY = "1:912726360885:android:e17435e0beb0303000427c"
}