From ae3dd54faee02746b65eeafe36f40f1653b9049b Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Fri, 7 Oct 2022 06:30:28 -0700 Subject: [PATCH] Fix forward: Filtering platform in codegen (#34897) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/34897 This [commit](https://github.com/facebook/react-native/commit/7680bdeb4f96a8092393372a59c77a9d7b729cae) added the possibility to create Codegen specs that are platform specific. However, it also modifies how the codegen is invoked and we need to publish a new version of the `react-native-codegen` package on NPM before we can use that feature. ## Changelog: [General][Fixed] - Remove usage of the codegen spec filtering until we publish a new version of the codegen. Reviewed By: robhogan Differential Revision: D40176447 fbshipit-source-id: 20be630dec3dcd7efb9fd510c6cf9f2c161f906a --- .../com/facebook/react/tasks/GenerateCodegenSchemaTask.kt | 5 +++-- .../facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt | 6 +++--- scripts/codegen/generate-artifacts-executor.js | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt index 89748e1fcbdfeb..120b82c5e4ef5a 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt @@ -61,6 +61,7 @@ abstract class GenerateCodegenSchemaTask : Exec() { } internal fun setupCommandLine() { + // TODO: restore the --platform android parameters as soon as we publish the codegen package. commandLine( windowsAwareCommandLine( *nodeExecutableAndArgs.get().toTypedArray(), @@ -69,8 +70,8 @@ abstract class GenerateCodegenSchemaTask : Exec() { .get() .asFile .absolutePath, - "--platform", - "android", + // "--platform", + // "android", generatedSchemaFile.get().asFile.absolutePath, jsRootDir.asFile.get().absolutePath, )) diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt index 6b51434a6055b1..bc265bd8a31de4 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt @@ -142,13 +142,13 @@ class GenerateCodegenSchemaTaskTest { } task.setupCommandLine() - + // TODO: restore the --platform android parameters as soon as we publish the codegen package. assertEquals( listOf( "--verbose", File(codegenDir, "lib/cli/combine/combine-js-to-schema-cli.js").toString(), - "--platform", - "android", + // "--platform", + // "android", File(outputDir, "schema.json").toString(), jsRootDir.toString(), ), diff --git a/scripts/codegen/generate-artifacts-executor.js b/scripts/codegen/generate-artifacts-executor.js index e1e13518d20290..c937dc3c5253e2 100644 --- a/scripts/codegen/generate-artifacts-executor.js +++ b/scripts/codegen/generate-artifacts-executor.js @@ -311,6 +311,7 @@ function generateSchema(tmpDir, library, node, codegenCliPath) { console.log(`\n\n[Codegen] >>>>> Processing ${library.config.name}`); // Generate one schema for the entire library... + // TODO: restore the `--platform ios` parameters as soon as we publish the codegen package. executeNodeScript( node, `${path.join( @@ -319,7 +320,7 @@ function generateSchema(tmpDir, library, node, codegenCliPath) { 'cli', 'combine', 'combine-js-to-schema-cli.js', - )} --platform ios ${pathToSchema} ${pathToJavaScriptSources}`, + )} ${pathToSchema} ${pathToJavaScriptSources}`, ); console.log(`[Codegen] Generated schema: ${pathToSchema}`); return pathToSchema;