|
4 | 4 | # LICENSE file in the root directory of this source tree. |
5 | 5 |
|
6 | 6 | require "json" |
| 7 | +require_relative "../../scripts/react_native_pods.rb" |
7 | 8 |
|
8 | 9 | package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) |
9 | 10 | version = package['version'] |
10 | 11 |
|
11 | 12 | source = { :git => 'https://github.com/facebook/react-native.git' } |
12 | | -codegen_path_prefix = ".." |
13 | 13 | if version == '1000.0.0' |
14 | 14 | # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. |
15 | 15 | source[:commit] = `git rev-parse HEAD`.strip |
16 | | - codegen_path_prefix = "packages" |
17 | 16 | else |
18 | 17 | source[:tag] = "v#{version}" |
19 | 18 | end |
20 | 19 |
|
21 | | -react_native_path = File.join(__dir__, "..", "..") |
22 | | -srcs_dir = File.join(__dir__, "..") |
23 | | -codegen_script_path = File.join(react_native_path, "scripts", "generate-specs.sh") |
24 | | -codegen_path = File.join(react_native_path, codegen_path_prefix, "react-native-codegen") |
25 | | -codegen_command = "CODEGEN_PATH=#{codegen_path} sh '#{codegen_script_path}' | tee \"${SCRIPT_OUTPUT_FILE_0}\"" |
26 | | -modules_output_dir = File.join(__dir__, "FBReactNativeSpec") |
27 | | -components_output_dir = File.join(react_native_path, "ReactCommon", "react", "renderer", "components", "rncore") |
28 | | -generated_filenames = [ "FBReactNativeSpec.h", "FBReactNativeSpec-generated.mm" ] |
29 | | -generated_files = generated_filenames.map { |filename| File.join(modules_output_dir, filename) } |
30 | | - |
31 | | -if ENV['USE_FABRIC'] == '1' |
32 | | - components_generated_filenames = [ |
33 | | - "ComponentDescriptors.h", |
34 | | - "EventEmitters.cpp", |
35 | | - "EventEmitters.h", |
36 | | - "Props.cpp", |
37 | | - "Props.h", |
38 | | - "RCTComponentViewHelpers.h", |
39 | | - "ShadowNodes.cpp", |
40 | | - "ShadowNodes.h" |
41 | | - ] |
42 | | - generated_files = generated_files.concat(components_generated_filenames.map { |filename| File.join(components_output_dir, filename) }) |
43 | | -end |
44 | | - |
45 | 20 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' |
46 | 21 | folly_version = '2020.01.13.00' |
47 | 22 |
|
@@ -72,12 +47,5 @@ Pod::Spec.new do |s| |
72 | 47 | s.dependency "React-jsi", version |
73 | 48 | s.dependency "ReactCommon/turbomodule/core", version |
74 | 49 |
|
75 | | - s.prepare_command = "mkdir -p #{modules_output_dir} #{components_output_dir} && touch #{generated_files.reduce() { |str, file| str + " " + file }}" |
76 | | - s.script_phase = { |
77 | | - :name => 'Generate Specs', |
78 | | - :input_files => [srcs_dir], |
79 | | - :output_files => ["$(DERIVED_FILE_DIR)/codegen.log"], |
80 | | - :script => codegen_command, |
81 | | - :execution_position => :before_compile |
82 | | - } |
| 50 | + use_react_native_codegen! (s) |
83 | 51 | end |
0 commit comments