From 2b0d283ba4ef1e03a1448391076cf359b4cf1064 Mon Sep 17 00:00:00 2001 From: Vitor Hugo Schwaab Date: Thu, 6 Jun 2024 09:32:36 +0000 Subject: [PATCH 1/2] Commit with unresolved merge conflicts outside of submodules --- app/build.gradle.kts | 48 +++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d5ea6e64513..e0c6d497597 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -46,6 +46,7 @@ repositories { google() } +<<<<<<< HEAD fun isFossSourceSet(): Boolean { return (Variants_gradle.Default.explicitBuildFlavor() ?: gradle.startParameter.taskRequests.toString()) .lowercase() @@ -60,6 +61,11 @@ private fun getFlavorsSettings(): NormalizedFlavorSettings = } catch (e: Exception) { error(">> Error reading current flavors, exception: ${e.localizedMessage}") } +======= +val nonFreeFlavors = setOf("prod", "internal", "staging", "beta", "dev") +val fossFlavors = setOf("fdroid") +val allFlavors = nonFreeFlavors + fossFlavors +>>>>>>> bc1a1848a (chore: solve foss source sets and dependencies statically (#3082)) android { // Most of the configuration is done in the build-logic @@ -76,21 +82,17 @@ android { } android.buildFeatures.buildConfig = true - val fdroidBuild = isFossSourceSet() - sourceSets { - // Add the "foss" sourceSets for the fdroid flavor - if (fdroidBuild) { - getByName("fdroid") { - java.srcDirs("src/foss/kotlin", "src/prod/kotlin") - res.srcDirs("src/prod/res") - println("Building with FOSS sourceSets") - } - // For all other flavors use the "nonfree" sourceSets - } else { - getByName("main") { - java.srcDirs("src/nonfree/kotlin") - println("Building with non-free sourceSets") + allFlavors.forEach { flavor -> + getByName(flavor) { + if (flavor in fossFlavors) { + java.srcDirs("src/foss/kotlin", "src/prod/kotlin") + res.srcDirs("src/prod/res") + println("Adding FOSS sourceSets to '$flavor' flavor") + } else { + java.srcDirs("src/nonfree/kotlin") + println("Adding non-free sourceSets to '$flavor' flavor") + } } } } @@ -193,15 +195,15 @@ dependencies { implementation(libs.resaca.hilt) implementation(libs.bundlizer.core) - var fdroidBuild = isFossSourceSet() - - if (!fdroidBuild) { - // firebase - implementation(platform(libs.firebase.bom)) - implementation(libs.firebase.fcm) - implementation(libs.googleGms.location) - } else { - println("Excluding FireBase for FDroid build") + allFlavors.forEach { flavor -> + if (flavor in nonFreeFlavors) { + println("Adding nonfree libraries to '$flavor' flavor") + add("${flavor}Implementation", platform(libs.firebase.bom)) + add("${flavor}Implementation", libs.firebase.fcm) + add("${flavor}Implementation", libs.googleGms.location) + } else { + println("Skipping nonfree libraries for '$flavor' flavor") + } } implementation(libs.androidx.work) From 12d8170100d3448cf6a762073fd5e599f78abf5f Mon Sep 17 00:00:00 2001 From: Vitor Hugo Schwaab Date: Thu, 6 Jun 2024 14:29:15 +0200 Subject: [PATCH 2/2] chore: solve conflicts --- app/build.gradle.kts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e0c6d497597..c6e1f47e140 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -46,12 +46,9 @@ repositories { google() } -<<<<<<< HEAD -fun isFossSourceSet(): Boolean { - return (Variants_gradle.Default.explicitBuildFlavor() ?: gradle.startParameter.taskRequests.toString()) - .lowercase() - .contains("fdroid") -} +val nonFreeFlavors = setOf("prod", "internal", "staging", "beta", "dev") +val fossFlavors = setOf("fdroid") +val allFlavors = nonFreeFlavors + fossFlavors private fun getFlavorsSettings(): NormalizedFlavorSettings = try { @@ -61,11 +58,6 @@ private fun getFlavorsSettings(): NormalizedFlavorSettings = } catch (e: Exception) { error(">> Error reading current flavors, exception: ${e.localizedMessage}") } -======= -val nonFreeFlavors = setOf("prod", "internal", "staging", "beta", "dev") -val fossFlavors = setOf("fdroid") -val allFlavors = nonFreeFlavors + fossFlavors ->>>>>>> bc1a1848a (chore: solve foss source sets and dependencies statically (#3082)) android { // Most of the configuration is done in the build-logic