Skip to content

Commit

Permalink
Restore Filtering platform in codegen (#35028)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #35028

**This Diff require a bump in the react-native-codegen (including this [commit](7680bde)) to work**

This diff sets up iOS and Android to pass their platform to the codegen so that we can have platform-specific specs.

## Changelog
[General][Added] - Enable platform-specific Codegen Specs

Reviewed By: cortinico

Differential Revision: D40516395

fbshipit-source-id: 0624f0bfb93c90f78131a605a4847e780783bbaf
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Oct 31, 2022
1 parent a2166b2 commit ab7b4d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ 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(),
Expand All @@ -72,8 +71,8 @@ abstract class GenerateCodegenSchemaTask : Exec() {
.get()
.asFile
.absolutePath,
// "--platform",
// "android",
"--platform",
"android",
generatedSchemaFile.get().asFile.absolutePath,
jsRootDir.asFile.get().absolutePath,
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,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(),
),
Expand Down
3 changes: 1 addition & 2 deletions scripts/codegen/generate-artifacts-executor.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ 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(
Expand All @@ -320,7 +319,7 @@ function generateSchema(tmpDir, library, node, codegenCliPath) {
'cli',
'combine',
'combine-js-to-schema-cli.js',
)} ${pathToSchema} ${pathToJavaScriptSources}`,
)} --platform ios ${pathToSchema} ${pathToJavaScriptSources}`,
);
console.log(`[Codegen] Generated schema: ${pathToSchema}`);
return pathToSchema;
Expand Down

0 comments on commit ab7b4d4

Please sign in to comment.