Skip to content

Commit

Permalink
chore: unify external logger code (#3098)
Browse files Browse the repository at this point in the history
(cherry picked from commit e88f509)
  • Loading branch information
MohamadJaara committed Jun 17, 2024
1 parent 480891a commit 6c44105
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 481 deletions.
23 changes: 20 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import customization.ConfigurationFileImporter
import customization.NormalizedFlavorSettings
import scripts.Variants_gradle

/*
* Wire
Expand Down Expand Up @@ -48,6 +47,7 @@ repositories {

val nonFreeFlavors = setOf("prod", "internal", "staging", "beta", "dev")
val fossFlavors = setOf("fdroid")
val internalFlavors = setOf("internal", "staging", "beta", "dev")
val allFlavors = nonFreeFlavors + fossFlavors

private fun getFlavorsSettings(): NormalizedFlavorSettings =
Expand All @@ -60,6 +60,15 @@ private fun getFlavorsSettings(): NormalizedFlavorSettings =
}

android {
defaultConfig {
val datadogApiKeyKey = "DATADOG_CLIENT_TOKEN"
val apiKey: String? = System.getenv(datadogApiKeyKey) ?: project.getLocalProperty(datadogApiKeyKey, null)
buildConfigField("String", "DATADOG_CLIENT_TOKEN", apiKey?.let { "\"$it\"" } ?: "null")

val datadogAppId = "DATADOG_APP_ID"
val appId: String? = System.getenv(datadogAppId) ?: project.getLocalProperty(datadogAppId, null)
buildConfigField("String", datadogAppId, appId?.let { "\"$it\"" } ?: "null")
}
// Most of the configuration is done in the build-logic
// through the Wire Application convention plugin

Expand All @@ -77,6 +86,14 @@ android {
sourceSets {
allFlavors.forEach { flavor ->
getByName(flavor) {
if (flavor in internalFlavors) {
java.srcDirs("src/private/kotlin")
println("Adding external datadog logger internal sourceSets to '$flavor' flavor")
} else {
java.srcDirs("src/public/kotlin")
println("Adding external datadog logger sourceSets to '$flavor' flavor")
}

if (flavor in fossFlavors) {
java.srcDirs("src/foss/kotlin", "src/prod/kotlin")
res.srcDirs("src/prod/res")
Expand Down Expand Up @@ -204,9 +221,9 @@ dependencies {
flavors.flavorMap.entries.forEach { (key, configs) ->
if (configs["analytics_enabled"] as? Boolean == true) {
println(">> Adding Anonymous Analytics dependency to [$key] flavor")
add("${key}Implementation",project(":core:analytics-enabled"))
add("${key}Implementation", project(":core:analytics-enabled"))
} else {
add("${key}Implementation",project(":core:analytics-disabled"))
add("${key}Implementation", project(":core:analytics-disabled"))
}
}

Expand Down
91 changes: 0 additions & 91 deletions app/src/beta/kotlin/com/wire/android/ExternalLoggerManager.kt

This file was deleted.

This file was deleted.

55 changes: 0 additions & 55 deletions app/src/beta/kotlin/com/wire/android/util/DataDogLogger.kt

This file was deleted.

66 changes: 0 additions & 66 deletions app/src/dev/kotlin/com/wire/android/ExternalLoggerManager.kt

This file was deleted.

This file was deleted.

57 changes: 0 additions & 57 deletions app/src/internal/kotlin/com/wire/android/util/DataDogLogger.kt

This file was deleted.

Loading

0 comments on commit 6c44105

Please sign in to comment.