@react-native/gradle-plugin 0.76.1 → 0.76.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -59,15 +59,15 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() {
|
|
|
59
59
|
val cxxModuleCMakeListsPath = dep.cxxModuleCMakeListsPath
|
|
60
60
|
if (libraryName != null && cmakeListsPath != null) {
|
|
61
61
|
// If user provided a custom cmakeListsPath, let's honor it.
|
|
62
|
-
val nativeFolderPath = cmakeListsPath
|
|
62
|
+
val nativeFolderPath = sanitizeCmakeListsPath(cmakeListsPath)
|
|
63
63
|
addDirectoryString +=
|
|
64
|
-
"add_subdirectory($nativeFolderPath ${libraryName}_autolinked_build)"
|
|
64
|
+
"add_subdirectory(\"$nativeFolderPath\" ${libraryName}_autolinked_build)"
|
|
65
65
|
}
|
|
66
66
|
if (cxxModuleCMakeListsPath != null) {
|
|
67
67
|
// If user provided a custom cxxModuleCMakeListsPath, let's honor it.
|
|
68
|
-
val nativeFolderPath = cxxModuleCMakeListsPath
|
|
68
|
+
val nativeFolderPath = sanitizeCmakeListsPath(cxxModuleCMakeListsPath)
|
|
69
69
|
addDirectoryString +=
|
|
70
|
-
"\nadd_subdirectory($nativeFolderPath ${libraryName}_cxxmodule_autolinked_build)"
|
|
70
|
+
"\nadd_subdirectory(\"$nativeFolderPath\" ${libraryName}_cxxmodule_autolinked_build)"
|
|
71
71
|
}
|
|
72
72
|
addDirectoryString
|
|
73
73
|
}
|
|
@@ -159,6 +159,9 @@ abstract class GenerateAutolinkingNewArchitecturesFileTask : DefaultTask() {
|
|
|
159
159
|
const val COMPONENT_DESCRIPTOR_FILENAME = "ComponentDescriptors.h"
|
|
160
160
|
const val COMPONENT_INCLUDE_PATH = "react/renderer/components"
|
|
161
161
|
|
|
162
|
+
internal fun sanitizeCmakeListsPath(cmakeListsPath: String): String =
|
|
163
|
+
cmakeListsPath.replace("CMakeLists.txt", "").replace(" ", "\\ ")
|
|
164
|
+
|
|
162
165
|
// language=cmake
|
|
163
166
|
val CMAKE_TEMPLATE =
|
|
164
167
|
"""
|
|
@@ -11,6 +11,7 @@ import com.facebook.react.model.ModelAutolinkingConfigJson
|
|
|
11
11
|
import com.facebook.react.model.ModelAutolinkingDependenciesJson
|
|
12
12
|
import com.facebook.react.model.ModelAutolinkingDependenciesPlatformAndroidJson
|
|
13
13
|
import com.facebook.react.model.ModelAutolinkingDependenciesPlatformJson
|
|
14
|
+
import com.facebook.react.tasks.GenerateAutolinkingNewArchitecturesFileTask.Companion.sanitizeCmakeListsPath
|
|
14
15
|
import com.facebook.react.tests.createTestTask
|
|
15
16
|
import org.assertj.core.api.Assertions.assertThat
|
|
16
17
|
import org.junit.Rule
|
|
@@ -145,9 +146,9 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
|
|
145
146
|
# or link against a old prefab target (this is needed for React Native 0.76 on).
|
|
146
147
|
set(REACTNATIVE_MERGED_SO true)
|
|
147
148
|
|
|
148
|
-
add_subdirectory(./a/directory/ aPackage_autolinked_build)
|
|
149
|
-
add_subdirectory(./another/directory/ anotherPackage_autolinked_build)
|
|
150
|
-
add_subdirectory(./another/directory/cxx/ anotherPackage_cxxmodule_autolinked_build)
|
|
149
|
+
add_subdirectory("./a/directory/" aPackage_autolinked_build)
|
|
150
|
+
add_subdirectory("./another/directory/with\ spaces/" anotherPackage_autolinked_build)
|
|
151
|
+
add_subdirectory("./another/directory/cxx/" anotherPackage_cxxmodule_autolinked_build)
|
|
151
152
|
|
|
152
153
|
set(AUTOLINKED_LIBRARIES
|
|
153
154
|
react_codegen_aPackage
|
|
@@ -258,6 +259,24 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
|
|
258
259
|
.trimIndent())
|
|
259
260
|
}
|
|
260
261
|
|
|
262
|
+
@Test
|
|
263
|
+
fun sanitizeCmakeListsPath_withPathEndingWithFileName_removesFilename() {
|
|
264
|
+
val input = "./a/directory/CMakeLists.txt"
|
|
265
|
+
assertThat(sanitizeCmakeListsPath(input)).isEqualTo("./a/directory/")
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
@Test
|
|
269
|
+
fun sanitizeCmakeListsPath_withSpaces_removesSpaces() {
|
|
270
|
+
val input = "./a/dir ectory/with spaces/"
|
|
271
|
+
assertThat(sanitizeCmakeListsPath(input)).isEqualTo("./a/dir\\ ectory/with\\ spaces/")
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
@Test
|
|
275
|
+
fun sanitizeCmakeListsPath_withPathEndingWithFileNameAndSpaces_sanitizesIt() {
|
|
276
|
+
val input = "./a/dir ectory/CMakeLists.txt"
|
|
277
|
+
assertThat(sanitizeCmakeListsPath(input)).isEqualTo("./a/dir\\ ectory/")
|
|
278
|
+
}
|
|
279
|
+
|
|
261
280
|
private val testDependencies =
|
|
262
281
|
listOf(
|
|
263
282
|
ModelAutolinkingDependenciesPlatformAndroidJson(
|
|
@@ -276,7 +295,7 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
|
|
|
276
295
|
buildTypes = emptyList(),
|
|
277
296
|
libraryName = "anotherPackage",
|
|
278
297
|
componentDescriptors = listOf("AnotherPackageComponentDescriptor"),
|
|
279
|
-
cmakeListsPath = "./another/directory/CMakeLists.txt",
|
|
298
|
+
cmakeListsPath = "./another/directory/with spaces/CMakeLists.txt",
|
|
280
299
|
cxxModuleCMakeListsPath = "./another/directory/cxx/CMakeLists.txt",
|
|
281
300
|
cxxModuleHeaderName = "AnotherCxxModule",
|
|
282
301
|
cxxModuleCMakeListsModuleName = "another_cxxModule",
|