Skip to content

Commit

Permalink
Remove Android.mk from internal Gradle task (facebook#34687)
Browse files Browse the repository at this point in the history
Summary:
`Android.mk`s are no longer used for internal Gradle tasks since [First Round of CMake files for React Android](facebook@b676ca5) and [CMake setup for ReactAndroid](facebook@e3830dd)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Fixed] - Remove Android.mk from internal Gradle task

Pull Request resolved: facebook#34687

Test Plan: None

Reviewed By: cipolleschi

Differential Revision: D39541322

Pulled By: cortinico

fbshipit-source-id: 421591effab2c1a82bcacff656360a2d02439a53
  • Loading branch information
Sunbreak authored and facebook-github-bot committed Sep 15, 2022
1 parent 9cb716f commit d0df6af
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 21 deletions.
8 changes: 4 additions & 4 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Down
task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
from(dependenciesPath ?: tarTree(downloadDoubleConversion.dest))
from("src/main/jni/third-party/double-conversion/")
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk", "CMakeLists.txt")
include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "CMakeLists.txt")
filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
includeEmptyDirs = false
into("$thirdPartyNdkDir/double-conversion")
Expand All @@ -100,7 +100,7 @@ task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
from(dependenciesPath ?: tarTree(downloadFolly.dest))
from("src/main/jni/third-party/folly/")
include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk", "CMakeLists.txt")
include("folly-${FOLLY_VERSION}/folly/**/*", "CMakeLists.txt")
eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
includeEmptyDirs = false
into("$thirdPartyNdkDir/folly")
Expand All @@ -116,7 +116,7 @@ task downloadFmt(dependsOn: createNativeDepsDirectories, type: Download) {
task prepareFmt(dependsOn: dependenciesPath ? [] : [downloadFmt], type: Copy) {
from(dependenciesPath ?: tarTree(downloadFmt.dest))
from("src/main/jni/third-party/fmt/")
include("fmt-${FMT_VERSION}/src/**/*", "fmt-${FMT_VERSION}/include/**/*", "Android.mk", "CMakeLists.txt")
include("fmt-${FMT_VERSION}/src/**/*", "fmt-${FMT_VERSION}/include/**/*", "CMakeLists.txt")
eachFile { fname -> fname.path = (fname.path - "fmt-${FMT_VERSION}/") }
includeEmptyDirs = false
into("$thirdPartyNdkDir/fmt")
Expand Down Expand Up @@ -153,7 +153,7 @@ final def prepareGlog = tasks.register("prepareGlog", PrepareGlogTask) {
it.outputDir.set(new File(thirdPartyNdkDir, "glog"))
}

// Create Android.mk library module based on jsc from npm
// Create Android native library module based on jsc from npm
tasks.register('prepareJSC', PrepareJSCTask) {
it.jscPackagePath.set(findNodeModulePath(projectDir, "jsc-android"))
it.outputDir = project.layout.buildDirectory.dir("third-party-ndk/jsc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ abstract class PrepareBoostTask : DefaultTask() {
it.from(boostPath)
it.from(project.file("src/main/jni/third-party/boost"))
it.include(
"Android.mk",
"CMakeLists.txt",
"boost_${boostVersion.get()}/boost/**/*.hpp",
"boost/boost/**/*.hpp",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class PrepareGlogTask : DefaultTask() {
project.copy {
it.from(glogPath)
it.from(project.file("src/main/jni/third-party/glog/"))
it.include("glog-${glogVersion.get()}/src/**/*", "Android.mk", "CMakeLists.txt", "config.h")
it.include("glog-${glogVersion.get()}/src/**/*", "CMakeLists.txt", "config.h")
it.duplicatesStrategy = DuplicatesStrategy.WARN
it.includeEmptyDirs = false
it.filesMatching("**/*.h.in") { matchedFile ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ abstract class PrepareJSCTask : DefaultTask() {
project.copy { it ->
it.from(soFiles)
it.from(headerFiles)
it.from(project.file("src/main/jni/third-party/jsc/Android.mk"))
it.from(project.file("src/main/jni/third-party/jsc/CMakeLists.txt"))
it.filesMatching("**/*.h") { it.path = "JavaScriptCore/${it.name}" }
it.includeEmptyDirs = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ abstract class PrepareLibeventTask : DefaultTask() {
"libevent-${libeventVersion.get()}-stable/include/**/*",
"evconfig-private.h",
"event-config.h",
"CMakeLists.txt",
"Android.mk")
"CMakeLists.txt")
it.eachFile { it.path = it.path.removePrefix("libevent-${libeventVersion.get()}-stable/") }
it.includeEmptyDirs = false
it.into(outputDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PrepareBoostTaskTest {
}

@Test
fun prepareBoostTask_copiesMakefile() {
fun prepareBoostTask_copiesCMakefile() {
val boostpath = tempFolder.newFolder("boostpath")
val output = tempFolder.newFolder("output")
val project = createProject()
Expand All @@ -37,13 +37,13 @@ class PrepareBoostTaskTest {
it.boostVersion.set("1.0.0")
it.outputDir.set(output)
}
File(project.projectDir, "src/main/jni/third-party/boost/Android.mk").apply {
File(project.projectDir, "src/main/jni/third-party/boost/CMakeLists.txt").apply {
parentFile.mkdirs()
createNewFile()
}
task.taskAction()

assertTrue(output.listFiles()!!.any { it.name == "Android.mk" })
assertTrue(output.listFiles()!!.any { it.name == "CMakeLists.txt" })
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PrepareGlogTaskTest {
}

@Test
fun prepareGlogTask_copiesMakefile() {
fun prepareGlogTask_copiesCMakefile() {
val glogpath = tempFolder.newFolder("glogpath")
val output = tempFolder.newFolder("output")
val project = createProject()
Expand All @@ -37,13 +37,13 @@ class PrepareGlogTaskTest {
it.glogVersion.set("1.0.0")
it.outputDir.set(output)
}
File(project.projectDir, "src/main/jni/third-party/glog/Android.mk").apply {
File(project.projectDir, "src/main/jni/third-party/glog/CMakeLists.txt").apply {
parentFile.mkdirs()
createNewFile()
}
task.taskAction()

assertTrue(output.listFiles()!!.any { it.name == "Android.mk" })
assertTrue(output.listFiles()!!.any { it.name == "CMakeLists.txt" })
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ class PrepareJSCTaskTest {
}

@Test
fun prepareJSCTask_copiesMakefile() {
fun prepareJSCTask_copiesCMakefile() {
val project = createProject()
prepareInputFolder()
File(project.projectDir, "src/main/jni/third-party/jsc/Android.mk").apply {
File(project.projectDir, "src/main/jni/third-party/jsc/CMakeLists.txt").apply {
parentFile.mkdirs()
createNewFile()
}
Expand All @@ -114,7 +114,7 @@ class PrepareJSCTaskTest {

task.taskAction()

assertTrue(File(output, "Android.mk").exists())
assertTrue(File(output, "CMakeLists.txt").exists())
}

private fun prepareInputFolder(aarContent: List<File> = listOf(tempFolder.newFile())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PrepareLibeventTaskTest {
}

@Test
fun prepareBoostTask_copiesMakefile() {
fun prepareBoostTask_copiesCMakefile() {
val libeventPath = tempFolder.newFolder("libeventPath")
val output = tempFolder.newFolder("output")
val project = createProject()
Expand All @@ -37,13 +37,13 @@ class PrepareLibeventTaskTest {
it.libeventVersion.set("1.0.0")
it.outputDir.set(output)
}
File(project.projectDir, "src/main/jni/third-party/libevent/Android.mk").apply {
File(project.projectDir, "src/main/jni/third-party/libevent/CMakeLists.txt").apply {
parentFile.mkdirs()
createNewFile()
}
task.taskAction()

assertTrue(File(output, "Android.mk").exists())
assertTrue(File(output, "CMakeLists.txt").exists())
}

@Test
Expand Down

0 comments on commit d0df6af

Please sign in to comment.