Skip to content

Commit

Permalink
Merge pull request #1731 from DataDog/xgouchet/build_logger
Browse files Browse the repository at this point in the history
Reduce noise in logs when building the project
  • Loading branch information
xgouchet authored Nov 17, 2023
2 parents 9872af5 + e7764a7 commit 9dcdb2d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package com.datadog.gradle.config

import com.android.build.api.dsl.ApplicationProductFlavor
import com.google.gson.Gson
import org.gradle.api.Project
import java.io.File
import java.util.Locale

Expand All @@ -23,9 +24,13 @@ fun sampleAppConfig(filePath: String): SampleAppConfig {
}

@Suppress("UnstableApiUsage")
fun configureFlavorForSampleApp(flavor: ApplicationProductFlavor, rootDir: File) {
fun configureFlavorForSampleApp(
project: Project,
flavor: ApplicationProductFlavor,
rootDir: File
) {
val config = sampleAppConfig("${rootDir.absolutePath}/config/${flavor.name}.json")
println("Configuring flavor: [${flavor.name}] with config: [$config]")
project.logger.info("Configuring flavor: [${flavor.name}] with config: [$config]")
flavor.buildConfigField(
"String",
"DD_OVERRIDE_LOGS_URL",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ open class GenerateApiSurfaceTask : DefaultTask() {

private fun visitDirectoryRecursively(file: File) {
when {
!file.exists() -> logger.warn("File $file doesn't exist, ignoring")
!file.exists() -> logger.info("File $file doesn't exist, ignoring")
file.isDirectory ->
file.listFiles().orEmpty()
.sortedBy { it.absolutePath }
Expand Down
2 changes: 1 addition & 1 deletion sample/kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ android {
register(region) {
isDefault = index == 0
dimension = "site"
configureFlavorForSampleApp(this, project.rootDir)
configureFlavorForSampleApp(project, this, project.rootDir)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion sample/wear/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ android {
register(region) {
isDefault = index == 0
dimension = "site"
configureFlavorForSampleApp(this, project.rootDir)
configureFlavorForSampleApp(project, this, project.rootDir)
}
}
}
Expand Down

0 comments on commit 9dcdb2d

Please sign in to comment.