From d0df6afe7646032c77643ebd25fa69c507c9ef92 Mon Sep 17 00:00:00 2001 From: Sunbreak Date: Thu, 15 Sep 2022 06:32:49 -0700 Subject: [PATCH] Remove Android.mk from internal Gradle task (#34687) Summary: `Android.mk`s are no longer used for internal Gradle tasks since [First Round of CMake files for React Android](https://github.com/facebook/react-native/commit/b676ca560d8af686276ac4b88e4feb9c5b7e468d) and [CMake setup for ReactAndroid](https://github.com/facebook/react-native/commit/e3830ddffd9260fe071e0c9f9df40b379d54cf26) ## Changelog [General] [Fixed] - Remove Android.mk from internal Gradle task Pull Request resolved: https://github.com/facebook/react-native/pull/34687 Test Plan: None Reviewed By: cipolleschi Differential Revision: D39541322 Pulled By: cortinico fbshipit-source-id: 421591effab2c1a82bcacff656360a2d02439a53 --- ReactAndroid/build.gradle | 8 ++++---- .../com/facebook/react/tasks/internal/PrepareBoostTask.kt | 1 - .../com/facebook/react/tasks/internal/PrepareGlogTask.kt | 2 +- .../com/facebook/react/tasks/internal/PrepareJSCTask.kt | 1 - .../facebook/react/tasks/internal/PrepareLibeventTask.kt | 3 +-- .../facebook/react/tasks/internal/PrepareBoostTaskTest.kt | 6 +++--- .../facebook/react/tasks/internal/PrepareGlogTaskTest.kt | 6 +++--- .../facebook/react/tasks/internal/PrepareJSCTaskTest.kt | 6 +++--- .../react/tasks/internal/PrepareLibeventTaskTest.kt | 6 +++--- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index d7fba23fca259e..09a72ee8692796 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -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") @@ -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") @@ -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") @@ -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") diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt index 9fe06794aeabd5..ee680337af4977 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt @@ -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", diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt index f2320718872434..fcbd204517c865 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt @@ -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 -> diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt index de742285bb64b3..9b6913df88fa29 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt @@ -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 diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt index f5faa9ff75b6bd..fb00626557f307 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt @@ -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) diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt index d1ebb9c665f70f..73cb3fe8122e4a 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt @@ -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() @@ -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 diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt index ceb0c916e16dc3..e767577aa4a0a4 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt @@ -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() @@ -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 diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt index 669664b881426c..bcffaa58910701 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt @@ -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() } @@ -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 = listOf(tempFolder.newFile())) { diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTaskTest.kt index 1bb571fa769b5d..f5085df947a484 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTaskTest.kt @@ -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() @@ -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