-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure codegen runs at Xcode buildtime (#30449)
Summary: Pull Request resolved: #30449 Changelog: Differential Revision: D25138896 fbshipit-source-id: be930cf9149803eac8b633b380f1ca7962049662
- Loading branch information
1 parent
ae6f4f3
commit bc0ce39
Showing
6 changed files
with
59 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/ruby | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# This source code is licensed under the MIT license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
require 'tmpdir' | ||
|
||
# Handle Core Modules | ||
def codegen_core_modules(codegenPath) | ||
reactNativePath = File.join(__dir__, "..") | ||
srcsDir = File.join(reactNativePath, "Libraries") | ||
libraryName = "FBReactNativeSpec" | ||
outputDir = File.join(srcsDir, libraryName, libraryName) | ||
|
||
codegen(codegenPath, srcsDir, libraryName, outputDir) | ||
end | ||
|
||
def codegen(codegenPath, srcsDir, libraryName, outputDir) | ||
Dir.mktmpdir do |dir| | ||
schemaFilePath = File.join(dir, "schema-#{libraryName}.json") | ||
combineCliPath = File.join(codegenPath, "lib", "cli", "combine", "combine-js-to-schema-cli.js") | ||
generateSpecsCliPath = File.join(__dir__, "generate-native-modules-specs-cli.js") | ||
system("node #{combineCliPath} #{schemaFilePath} #{srcsDir}") or raise "Could not generate Native Module schema" | ||
system("node #{generateSpecsCliPath} ios #{schemaFilePath} #{outputDir} #{libraryName}") or raise "Could not generate code for #{libraryName}" | ||
end | ||
end | ||
|
||
def main() | ||
codegenPath = ENV["CODEGEN_PATH"] ||= File.join(reactNativePath, "..", "react-native-codegen") | ||
codegen_core_modules(codegenPath) | ||
end | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters