Skip to content

Commit

Permalink
fix: shared user manifest for custom builds (#1784)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamilmedina authored May 12, 2023
1 parent cc44de7 commit 287c9dd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions buildSrc/src/main/kotlin/scripts/variants.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ object Default {

fun NamedDomainObjectContainer<ApplicationProductFlavor>.createAppFlavour(
flavorApplicationId: String,
sharedUserId: String,
flavour: ProductFlavors
) {
create(flavour.buildName) {
dimension = flavour.dimensions
applicationId = flavorApplicationId
versionNameSuffix = "-${flavour.buildName}"
resValue("string", "app_name", flavour.appName)
manifestPlaceholders.apply {
put("sharedUserId", flavour.shareduserId)
}
manifestPlaceholders["sharedUserId"] = sharedUserId
}
}

Expand Down Expand Up @@ -100,7 +99,7 @@ android {
isMinifyEnabled = false
applicationIdSuffix = ".${BuildTypes.DEBUG}"
isDebuggable = true
// Just in case a developer is trying to debug some prod crashes by turning on minify
// Just in case a developer is trying to debug some prod crashes by turning on minify
if (isMinifyEnabled) proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
if (enableSigning)
signingConfig = signingConfigs.getByName("debug")
Expand Down Expand Up @@ -148,7 +147,13 @@ android {
requireNotNull(flavorApplicationId) {
"Missing application ID definition for the flavor '$flavorName'"
}
createAppFlavour(flavorApplicationId, flavor)
// prefer value from FeatureConfigs if defined, otherwise fallback to in-code flavor value.
val userId: String = (flavorSpecificMap[FeatureConfigs.USER_ID.value] as? String) ?: flavor.shareduserId
createAppFlavour(
flavorApplicationId = flavorApplicationId,
sharedUserId = userId,
flavour = flavor
)
}
ProductFlavors.all.forEach(::createFlavor)
}
Expand All @@ -157,7 +162,6 @@ android {
overrideResourcesForAllFlavors(it)
}


/**
* Process feature flags and if the feature is not included in a product flavor,
* a default value of "false" or "deactivated" is used.
Expand Down Expand Up @@ -194,7 +198,6 @@ android {
}
}


fun buildStringConfig(productFlavour: ProductFlavor, type: String, name: String, value: String?) {
productFlavour.buildConfigField(
type,
Expand Down

0 comments on commit 287c9dd

Please sign in to comment.