diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/model/ModelCodegenConfig.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/model/ModelCodegenConfig.kt index 3b2b674a907b6e..afd02bc06ab490 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/model/ModelCodegenConfig.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/model/ModelCodegenConfig.kt @@ -13,5 +13,4 @@ data class ModelCodegenConfig( val jsSrcsDir: String?, val android: ModelCodegenConfigAndroid?, val includesGeneratedCode: Boolean?, - val cxxModules: List?, ) diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/model/ModelCodegenConfigCxxModules.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/model/ModelCodegenConfigCxxModules.kt deleted file mode 100644 index d0adc8d235aa8a..00000000000000 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/model/ModelCodegenConfigCxxModules.kt +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.model - -data class ModelCodegenConfigCxxModules( - val name: String, - val headerPath: String, -) diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt index c5156235c73437..93e6b79ff6c7d8 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt @@ -45,12 +45,12 @@ abstract class GenerateCodegenArtifactsTask : Exec() { @get:OutputDirectory val generatedJniFiles: Provider = generatedSrcDir.dir("jni") override fun exec() { - val (resolvedLibraryName, resolvedCodegenJavaPackageName, cxxModules) = resolveTaskParameters() - setupCommandLine(resolvedLibraryName, resolvedCodegenJavaPackageName, cxxModules) + val (resolvedLibraryName, resolvedCodegenJavaPackageName) = resolveTaskParameters() + setupCommandLine(resolvedLibraryName, resolvedCodegenJavaPackageName) super.exec() } - internal fun resolveTaskParameters(): List { + internal fun resolveTaskParameters(): Pair { val parsedPackageJson = if (packageJsonFile.isPresent && packageJsonFile.get().asFile.exists()) { JsonUtils.fromPackageJson(packageJsonFile.get().asFile) @@ -60,40 +60,24 @@ abstract class GenerateCodegenArtifactsTask : Exec() { val resolvedLibraryName = parsedPackageJson?.codegenConfig?.name ?: libraryName.get() val resolvedCodegenJavaPackageName = parsedPackageJson?.codegenConfig?.android?.javaPackageName ?: codegenJavaPackageName.get() - val cxxModules = parsedPackageJson?.codegenConfig?.cxxModules ?: emptyList() - val separatedCxxModules = cxxModules.joinToString(":") { "${it.name}:${it.headerPath}" } - return listOf(resolvedLibraryName, resolvedCodegenJavaPackageName, separatedCxxModules) + return resolvedLibraryName to resolvedCodegenJavaPackageName } - internal fun setupCommandLine( - libraryName: String, - codegenJavaPackageName: String, - cxxModules: String - ) { + internal fun setupCommandLine(libraryName: String, codegenJavaPackageName: String) { val workingDir = project.projectDir - val generateSpecsCli = + commandLine( windowsAwareCommandLine( - *nodeExecutableAndArgs.get().toTypedArray(), - reactNativeDir - .file("scripts/generate-specs-cli.js") - .get() - .asFile - .cliPath(workingDir), - "--platform", - "android", - "--schemaPath", - generatedSchemaFile.get().asFile.cliPath(workingDir), - "--outputDir", - generatedSrcDir.get().asFile.cliPath(workingDir), - "--libraryName", - libraryName, - "--javaPackageName", - codegenJavaPackageName) - .toMutableList() - if (cxxModules.isNotBlank()) { - generateSpecsCli.add("--cxxModules") - generateSpecsCli.add(cxxModules) - } - commandLine(generateSpecsCli) + *nodeExecutableAndArgs.get().toTypedArray(), + reactNativeDir.file("scripts/generate-specs-cli.js").get().asFile.cliPath(workingDir), + "--platform", + "android", + "--schemaPath", + generatedSchemaFile.get().asFile.cliPath(workingDir), + "--outputDir", + generatedSrcDir.get().asFile.cliPath(workingDir), + "--libraryName", + libraryName, + "--javaPackageName", + codegenJavaPackageName)) } } diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt index 09ec41b4a6e619..780710cce45539 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt @@ -75,7 +75,7 @@ class GenerateCodegenArtifactsTaskTest { it.nodeExecutableAndArgs.set(listOf("--verbose")) } - task.setupCommandLine("example-test", "com.example.test", "Module:Module.h") + task.setupCommandLine("example-test", "com.example.test") assertEquals( listOf( @@ -91,8 +91,6 @@ class GenerateCodegenArtifactsTaskTest { "example-test", "--javaPackageName", "com.example.test", - "--cxxModules", - "Module:Module.h", ), task.commandLine.toMutableList()) } @@ -111,7 +109,7 @@ class GenerateCodegenArtifactsTaskTest { it.nodeExecutableAndArgs.set(listOf("--verbose")) } - task.setupCommandLine("example-test", "com.example.test", "Module:Module.h") + task.setupCommandLine("example-test", "com.example.test") assertEquals( listOf( @@ -131,8 +129,6 @@ class GenerateCodegenArtifactsTaskTest { "example-test", "--javaPackageName", "com.example.test", - "--cxxModules", - "Module:Module.h", ), task.commandLine.toMutableList()) } @@ -145,7 +141,7 @@ class GenerateCodegenArtifactsTaskTest { writeText( """ { - "name": "@a/library", + "name": "@a/libray", "codegenConfig": { "name": "an-awesome-library", "android": { @@ -170,44 +166,6 @@ class GenerateCodegenArtifactsTaskTest { assertEquals("com.awesome.package", javaPackageName) } - @Test - fun resolveTaskParameters_withCxxModules_parsesIt() { - val packageJsonFile = - tempFolder.newFile("package.json").apply { - // language=JSON - writeText( - """ - { - "name": "@a/library", - "codegenConfig": { - "name": "an-awesome-library", - "android": { - "javaPackageName": "com.awesome.package" - }, - "cxxModules": [ - { - "name": "Module1", - "headerPath": "Module1.h" - }, - { - "name": "Module2", - "headerPath": "another/header/path/Module2.h" - } - ] - } - } - """ - .trimIndent()) - } - - val task = - createTestTask { it.packageJsonFile.set(packageJsonFile) } - - val (_, _, cxxModules) = task.resolveTaskParameters() - - assertEquals("Module1:Module1.h:Module2:another/header/path/Module2.h", cxxModules) - } - @Test fun resolveTaskParameters_withConfigMissingInPackageJson_usesGradleOne() { val packageJsonFile = diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt index a8dc80ad18c170..6c87c88edac641 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/ProjectUtilsTest.kt @@ -263,8 +263,7 @@ class ProjectUtilsTest { @Test fun needsCodegenFromPackageJson_withCodegenConfigInModel_returnsTrue() { val project = createProject() - val model = - ModelPackageJson("1000.0.0", ModelCodegenConfig(null, null, null, null, false, null)) + val model = ModelPackageJson("1000.0.0", ModelCodegenConfig(null, null, null, null, false)) assertTrue(project.needsCodegenFromPackageJson(model)) } diff --git a/packages/react-native/scripts/codegen/generate-specs-cli-executor.js b/packages/react-native/scripts/codegen/generate-specs-cli-executor.js index 29d47057f2ee7c..c0e9ef183d38c2 100644 --- a/packages/react-native/scripts/codegen/generate-specs-cli-executor.js +++ b/packages/react-native/scripts/codegen/generate-specs-cli-executor.js @@ -72,7 +72,6 @@ function generateSpecFromInMemorySchema( packageName, libraryType, useLocalIncludePaths, - cxxModules, ) { validateLibraryType(libraryType); createOutputDirectoryIfNeeded(outputDirectory, libraryName); @@ -112,7 +111,6 @@ function generateSpec( libraryName, packageName, libraryType, - cxxModules, ) { generateSpecFromInMemorySchema( platform, diff --git a/packages/react-native/scripts/generate-specs-cli.js b/packages/react-native/scripts/generate-specs-cli.js index c7adcb5c6c07f4..2c3a0eb78b1199 100644 --- a/packages/react-native/scripts/generate-specs-cli.js +++ b/packages/react-native/scripts/generate-specs-cli.js @@ -41,12 +41,6 @@ const argv = yargs describe: 'all, components, or modules.', default: 'all', }) - .option('c', { - alias: 'cxxModules', - describe: - 'A colon separated list of modules name & modules header path, used to support CXX TurboModule linking.', - default: 'all', - }) .usage('Usage: $0 ') .demandOption( ['platform', 'schemaPath', 'outputDir'], @@ -61,7 +55,6 @@ function main() { argv.libraryName, argv.javaPackageName, argv.libraryType, - argv.cxxModules, ); }