Created
March 9, 2022 14:31
-
-
Save Kudo/17dde98d7721601697d2dc05ec1dcba1 to your computer and use it in GitHub Desktop.
react-native use_frameworks! build error fix for 0.68.0-rc.2
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
diff --git a/node_modules/react-native/Libraries/Blob/React-RCTBlob.podspec b/node_modules/react-native/Libraries/Blob/React-RCTBlob.podspec | |
index 15a46df..e879b4e 100644 | |
--- a/node_modules/react-native/Libraries/Blob/React-RCTBlob.podspec | |
+++ b/node_modules/react-native/Libraries/Blob/React-RCTBlob.podspec | |
@@ -35,11 +35,11 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
s.dependency "RCT-Folly", folly_version | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
s.dependency "React-jsi", version | |
s.dependency "React-Core/RCTBlobHeaders", version | |
diff --git a/node_modules/react-native/Libraries/Image/React-RCTImage.podspec b/node_modules/react-native/Libraries/Image/React-RCTImage.podspec | |
index bdbd33d..93cd9f5 100644 | |
--- a/node_modules/react-native/Libraries/Image/React-RCTImage.podspec | |
+++ b/node_modules/react-native/Libraries/Image/React-RCTImage.podspec | |
@@ -36,11 +36,11 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
s.dependency "RCT-Folly", folly_version | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "RCTTypeSafety", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
s.dependency "React-jsi", version | |
diff --git a/node_modules/react-native/Libraries/LinkingIOS/React-RCTLinking.podspec b/node_modules/react-native/Libraries/LinkingIOS/React-RCTLinking.podspec | |
index a50ce13..c8ba294 100644 | |
--- a/node_modules/react-native/Libraries/LinkingIOS/React-RCTLinking.podspec | |
+++ b/node_modules/react-native/Libraries/LinkingIOS/React-RCTLinking.podspec | |
@@ -36,10 +36,10 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "React-Core/RCTLinkingHeaders", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
s.dependency "React-jsi", version | |
diff --git a/node_modules/react-native/Libraries/NativeAnimation/React-RCTAnimation.podspec b/node_modules/react-native/Libraries/NativeAnimation/React-RCTAnimation.podspec | |
index 94af813..e7bd94c 100644 | |
--- a/node_modules/react-native/Libraries/NativeAnimation/React-RCTAnimation.podspec | |
+++ b/node_modules/react-native/Libraries/NativeAnimation/React-RCTAnimation.podspec | |
@@ -35,11 +35,11 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
s.dependency "RCT-Folly", folly_version | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "RCTTypeSafety", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
s.dependency "React-jsi", version | |
diff --git a/node_modules/react-native/Libraries/Network/React-RCTNetwork.podspec b/node_modules/react-native/Libraries/Network/React-RCTNetwork.podspec | |
index 06c3f16..e32a692 100644 | |
--- a/node_modules/react-native/Libraries/Network/React-RCTNetwork.podspec | |
+++ b/node_modules/react-native/Libraries/Network/React-RCTNetwork.podspec | |
@@ -35,12 +35,12 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
s.frameworks = "MobileCoreServices" | |
s.dependency "RCT-Folly", folly_version | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "RCTTypeSafety", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
s.dependency "React-jsi", version | |
diff --git a/node_modules/react-native/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec b/node_modules/react-native/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec | |
index a23c9a9..4806070 100644 | |
--- a/node_modules/react-native/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec | |
+++ b/node_modules/react-native/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec | |
@@ -36,11 +36,11 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
s.framework = "UserNotifications" | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "RCTTypeSafety", version | |
s.dependency "React-Core/RCTPushNotificationHeaders", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
diff --git a/node_modules/react-native/Libraries/Settings/React-RCTSettings.podspec b/node_modules/react-native/Libraries/Settings/React-RCTSettings.podspec | |
index 2715eb9..6ff0a1f 100644 | |
--- a/node_modules/react-native/Libraries/Settings/React-RCTSettings.podspec | |
+++ b/node_modules/react-native/Libraries/Settings/React-RCTSettings.podspec | |
@@ -36,11 +36,11 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
s.dependency "RCT-Folly", folly_version | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "RCTTypeSafety", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
s.dependency "React-jsi", version | |
diff --git a/node_modules/react-native/Libraries/Vibration/React-RCTVibration.podspec b/node_modules/react-native/Libraries/Vibration/React-RCTVibration.podspec | |
index 775a4f1..e0d985a 100644 | |
--- a/node_modules/react-native/Libraries/Vibration/React-RCTVibration.podspec | |
+++ b/node_modules/react-native/Libraries/Vibration/React-RCTVibration.podspec | |
@@ -36,12 +36,12 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
s.frameworks = "AudioToolbox" | |
s.dependency "RCT-Folly", folly_version | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "ReactCommon/turbomodule/core", version | |
s.dependency "React-jsi", version | |
s.dependency "React-Core/RCTVibrationHeaders", version | |
diff --git a/node_modules/react-native/React/CoreModules/React-CoreModules.podspec b/node_modules/react-native/React/CoreModules/React-CoreModules.podspec | |
index e3c55c0..890492b 100644 | |
--- a/node_modules/react-native/React/CoreModules/React-CoreModules.podspec | |
+++ b/node_modules/react-native/React/CoreModules/React-CoreModules.podspec | |
@@ -34,10 +34,10 @@ Pod::Spec.new do |s| | |
s.pod_target_xcconfig = { | |
"USE_HEADERMAP" => "YES", | |
"CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/React/CoreModules\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"" | |
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/React/CoreModules\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"" | |
} | |
- s.dependency "React-Codegen", version | |
+ s.dependency "FBReactNativeSpec", version | |
s.dependency "RCT-Folly", folly_version | |
s.dependency "RCTTypeSafety", version | |
s.dependency "React-Core/CoreModulesHeaders", version | |
diff --git a/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec b/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec | |
deleted file mode 100644 | |
index 16079fd..0000000 | |
--- a/node_modules/react-native/React/FBReactNativeSpec/FBReactNativeSpec.podspec | |
+++ /dev/null | |
@@ -1,58 +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. | |
- | |
-require "json" | |
- | |
-react_native_path = "../.." | |
-require_relative "#{react_native_path}/scripts/react_native_pods.rb" | |
- | |
-package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) | |
-version = package['version'] | |
- | |
-source = { :git => 'https://github.com/facebook/react-native.git' } | |
-if version == '1000.0.0' | |
- # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. | |
- source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") | |
-else | |
- source[:tag] = "v#{version}" | |
-end | |
- | |
-folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' | |
-folly_version = '2021.06.28.00-v2' | |
- | |
-Pod::Spec.new do |s| | |
- s.name = "FBReactNativeSpec" | |
- s.version = version | |
- s.summary = "-" # TODO | |
- s.homepage = "https://reactnative.dev/" | |
- s.license = package["license"] | |
- s.author = "Facebook, Inc. and its affiliates" | |
- s.platforms = { :ios => "11.0" } | |
- s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' | |
- s.source = source | |
- # This podspec is used to trigger the codegen, and built files are generated in a different location. | |
- # We don't want this pod to actually include any files. | |
- s.header_dir = "FBReactNativeSpec" | |
- | |
- s.pod_target_xcconfig = { | |
- "USE_HEADERMAP" => "YES", | |
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", | |
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" | |
- } | |
- | |
- s.dependency "RCT-Folly", folly_version | |
- s.dependency "RCTRequired", version | |
- s.dependency "RCTTypeSafety", version | |
- s.dependency "React-Core", version | |
- s.dependency "React-jsi", version | |
- s.dependency "ReactCommon/turbomodule/core", version | |
- | |
- use_react_native_codegen!(s, { | |
- :react_native_path => react_native_path, | |
- :js_srcs_dir => "#{react_native_path}/Libraries", | |
- :library_name => "FBReactNativeSpec", | |
- :library_type => "modules", | |
- }) | |
-end | |
diff --git a/node_modules/react-native/React/React-RCTFabric.podspec b/node_modules/react-native/React/React-RCTFabric.podspec | |
index fb7c850..e7c8bf8 100644 | |
--- a/node_modules/react-native/React/React-RCTFabric.podspec | |
+++ b/node_modules/react-native/React/React-RCTFabric.podspec | |
@@ -36,7 +36,7 @@ Pod::Spec.new do |s| | |
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags | |
s.header_dir = "React" | |
s.framework = "JavaScriptCore" | |
- s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Public/React-Codegen\"" } | |
+ s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Public/FBReactNativeSpec\"" } | |
s.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\"", | |
"OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags } | |
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb | |
index f751862..3752aec 100644 | |
--- a/node_modules/react-native/scripts/react_native_pods.rb | |
+++ b/node_modules/react-native/scripts/react_native_pods.rb | |
@@ -42,7 +42,6 @@ def use_react_native! (options={}) | |
# The Pods which should be included in all projects | |
pod 'FBLazyVector', :path => "#{prefix}/Libraries/FBLazyVector" | |
- pod 'FBReactNativeSpec', :path => "#{prefix}/React/FBReactNativeSpec" | |
pod 'RCTRequired', :path => "#{prefix}/Libraries/RCTRequired" | |
pod 'RCTTypeSafety', :path => "#{prefix}/Libraries/TypeSafety" | |
pod 'React', :path => "#{prefix}/" | |
@@ -95,7 +94,7 @@ def use_react_native! (options={}) | |
generate_react_codegen_podspec!(react_codegen_spec) | |
end | |
- pod 'React-Codegen', :path => $CODEGEN_OUTPUT_DIR | |
+ pod 'FBReactNativeSpec', :path => $CODEGEN_OUTPUT_DIR | |
if fabric_enabled | |
checkAndGenerateEmptyThirdPartyProvider!(prefix) | |
@@ -343,7 +342,7 @@ def get_react_codegen_spec(options={}) | |
boost_compiler_flags = '-Wno-documentation' | |
spec = { | |
- 'name' => "React-Codegen", | |
+ 'name' => "FBReactNativeSpec", | |
'version' => version, | |
'summary' => 'Temp pod for generated files for React Native', | |
'homepage' => 'https://facebook.com/', | |
@@ -351,7 +350,6 @@ def get_react_codegen_spec(options={}) | |
'authors' => 'Facebook', | |
'compiler_flags' => "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness", | |
'source' => { :git => '' }, | |
- 'header_mappings_dir' => './', | |
'platforms' => { | |
'ios' => '11.0', | |
}, | |
@@ -360,13 +358,12 @@ def get_react_codegen_spec(options={}) | |
[ | |
"\"$(PODS_ROOT)/boost\"", | |
"\"$(PODS_ROOT)/RCT-Folly\"", | |
- "\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"", | |
+ "\"${PODS_ROOT}/Headers/Public/FBReactNativeSpec/react/renderer/components\"", | |
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"", | |
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"", | |
].join(' ') | |
}, | |
'dependencies': { | |
- "FBReactNativeSpec": [version], | |
"React-jsiexecutor": [version], | |
"RCT-Folly": [folly_version], | |
"RCTRequired": [version], | |
@@ -382,13 +379,27 @@ def get_react_codegen_spec(options={}) | |
'React-graphics': [version], | |
'React-rncore': [version], | |
}); | |
+ | |
+ # only setup header_mappings_dir for fabric mode, because there are still some other imports like `rncore`. | |
+ # however, set header_mappings_dir will break `use_frameworks!` build for FBReactNativeSpec. | |
+ # so far `use_frameworks!` with fabric is not supported. | |
+ spec[:header_mappings_dir] = '.' | |
end | |
if script_phases | |
- Pod::UI.puts "[Codegen] Adding script_phases to React-Codegen." | |
+ Pod::UI.puts "[Codegen] Adding script_phases to FBReactNativeSpec." | |
spec[:'script_phases'] = script_phases | |
end | |
+ codegen_output_dir = Pod::Config.instance.installation_root + $CODEGEN_OUTPUT_DIR | |
+ use_react_native_codegen!(spec, { | |
+ :react_native_path => Pathname.new("#{__dir__}/..").relative_path_from(codegen_output_dir), | |
+ :js_srcs_dir => Pathname.new("#{__dir__}/../Libraries").relative_path_from(Pathname.pwd), | |
+ :js_srcs_dir_in_script_phase => Pathname.new("#{__dir__}/../Libraries").relative_path_from(codegen_output_dir), | |
+ :library_name => "FBReactNativeSpec", | |
+ :library_type => "modules", | |
+ }) | |
+ | |
return spec | |
end | |
@@ -443,7 +454,7 @@ def get_react_codegen_script_phases(options={}) | |
'execution_position': :before_compile, | |
'input_files' => input_files, | |
'show_env_vars_in_log': true, | |
- 'output_files': ["${DERIVED_FILE_DIR}/react-codegen.log"], | |
+ 'output_files': ["${DERIVED_FILE_DIR}/FBReactNativeSpec.log"], | |
'script': get_script_phases_with_codegen_discovery( | |
react_native_path: react_native_path, | |
relative_app_root: relative_app_root, | |
@@ -466,14 +477,14 @@ def generate_react_codegen_podspec!(spec) | |
# This podspec file should only be create once in the session/pod install. | |
# This happens when multiple targets are calling use_react_native!. | |
if has_react_codegen_podspec_generated() | |
- Pod::UI.puts "[Codegen] Skipping React-Codegen podspec generation." | |
+ Pod::UI.puts "[Codegen] Skipping FBReactNativeSpec podspec generation." | |
return | |
end | |
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd) | |
output_dir = "#{relative_installation_root}/#{$CODEGEN_OUTPUT_DIR}" | |
Pod::Executable.execute_command("mkdir", ["-p", output_dir]); | |
- podspec_path = File.join(output_dir, 'React-Codegen.podspec.json') | |
+ podspec_path = File.join(output_dir, 'FBReactNativeSpec.podspec.json') | |
Pod::UI.puts "[Codegen] Generating #{podspec_path}" | |
File.open(podspec_path, 'w') do |f| | |
@@ -510,7 +521,7 @@ def use_react_native_codegen_discovery!(options={}) | |
exit 1 | |
end | |
- # Generate React-Codegen podspec here to add the script phases. | |
+ # Generate FBReactNativeSpec podspec here to add the script phases. | |
script_phases = get_react_codegen_script_phases(options) | |
react_codegen_spec = get_react_codegen_spec(fabric_enabled: fabric_enabled, script_phases: script_phases) | |
generate_react_codegen_podspec!(react_codegen_spec) | |
@@ -571,6 +582,7 @@ def use_react_native_codegen!(spec, options={}) | |
# The path to JavaScript files | |
js_srcs_dir = options[:js_srcs_dir] ||= "./" | |
+ js_srcs_dir_in_script_phase = options[:js_srcs_dir_in_script_phase] ||= js_srcs_dir | |
library_type = options[:library_type] | |
if library_type | |
@@ -599,27 +611,35 @@ def use_react_native_codegen!(spec, options={}) | |
# Prepare filesystem by creating empty files that will be picked up as references by CocoaPods. | |
prepare_command = "mkdir -p #{generated_dirs.join(" ")} && touch -a #{generated_files.join(" ")}" | |
system(prepare_command) # Always run prepare_command when a podspec uses the codegen, as CocoaPods may skip invoking this command in certain scenarios. Replace with pre_integrate_hook after updating to CocoaPods 1.11 | |
- spec.prepare_command = prepare_command | |
- spec.script_phase = { | |
+ script_phases = [{ | |
:name => 'Generate Specs', | |
:input_files => input_files, # This also needs to be relative to Xcode | |
:output_files => ["${DERIVED_FILE_DIR}/codegen-#{library_name}.log"].concat(generated_files.map { |filename| " ${PODS_TARGET_SRCROOT}/#{filename}"} ), | |
# The final generated files will be created when this script is invoked at Xcode build time. | |
:script => get_script_phases_no_codegen_discovery( | |
react_native_path: react_native_path, | |
- codegen_output_dir: $CODEGEN_OUTPUT_DIR, | |
+ codegen_output_dir: output_dir, | |
codegen_module_dir: $CODEGEN_MODULE_DIR, | |
codegen_component_dir: $CODEGEN_COMPONENT_DIR, | |
library_name: library_name, | |
library_type: library_type, | |
js_srcs_pattern: js_srcs_pattern, | |
- js_srcs_dir: js_srcs_dir, | |
+ js_srcs_dir: js_srcs_dir_in_script_phase, | |
file_list: file_list | |
), | |
:execution_position => :before_compile, | |
:show_env_vars_in_log => true | |
- } | |
+ }] | |
+ | |
+ if spec.class == Pod::Specification | |
+ spec.prepare_command = prepare_command | |
+ spec.script_phases += script_phases | |
+ else | |
+ spec[:prepare_command] = prepare_command | |
+ spec[:script_phases] ||= [] | |
+ spec[:script_phases] += script_phases | |
+ end | |
end | |
# This provides a post_install workaround for build issues related Xcode 12.5 and Apple Silicon (M1) machines. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment