Skip to content

Commit

Permalink
Fix build warning for prepareGlog (facebook#46756)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#46756

prepareGlog was firing a warning due to a duplicate config.h file. Here I'm setting so that the file is always overridden (which is the desired behavior) to suppress this warning.

Changelog:
[Internal] [Changed] - Fix build warning for prepareGlog

Reviewed By: cipolleschi

Differential Revision: D63696664
  • Loading branch information
cortinico authored and facebook-github-bot committed Oct 1, 2024
1 parent b61c319 commit 376b8b3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ abstract class PrepareGlogTask : DefaultTask() {

@TaskAction
fun taskAction() {
project.copy {
it.from(glogPath)
it.from(project.file("src/main/jni/third-party/glog/"))
it.include("glog-${glogVersion.get()}/src/**/*", "CMakeLists.txt", "config.h")
it.duplicatesStrategy = DuplicatesStrategy.WARN
it.includeEmptyDirs = false
it.filesMatching("**/*.h.in") { matchedFile ->
project.copy { action ->
action.from(glogPath)
action.from(project.file("src/main/jni/third-party/glog/"))
action.include("glog-${glogVersion.get()}/src/**/*", "CMakeLists.txt", "config.h")
action.duplicatesStrategy = DuplicatesStrategy.INCLUDE
action.includeEmptyDirs = false
action.filesMatching("**/*.h.in") { matchedFile ->
matchedFile.filter(
mapOf(
"tokens" to
Expand All @@ -60,20 +60,20 @@ abstract class PrepareGlogTask : DefaultTask() {
ReplaceTokens::class.java)
matchedFile.path = (matchedFile.name.removeSuffix(".in"))
}
it.into(outputDir)
action.into(outputDir)
}
val exportedDir = File(outputDir.asFile.get(), "exported/glog/").apply { mkdirs() }
project.copy {
it.from(outputDir)
it.include(
project.copy { action ->
action.from(outputDir)
action.include(
"stl_logging.h",
"logging.h",
"raw_logging.h",
"vlog_is_on.h",
"**/src/glog/log_severity.h")
it.eachFile { file -> file.path = file.name }
it.includeEmptyDirs = false
it.into(exportedDir)
action.eachFile { file -> file.path = file.name }
action.includeEmptyDirs = false
action.into(exportedDir)
}
}
}
2 changes: 0 additions & 2 deletions packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ val prepareGtest by
into(File(thirdPartyNdkDir, "googletest"))
}

// Prepare glog sources to be compiled, this task will perform steps that normally should've been
// executed by automake. This way we can avoid dependencies on make/automake
val prepareGlog by
tasks.registering(PrepareGlogTask::class) {
dependsOn(if (dependenciesPath != null) emptyList() else listOf(downloadGlog))
Expand Down

0 comments on commit 376b8b3

Please sign in to comment.