Skip to content

Commit

Permalink
[native] Fix unstable checksum for FBReactNativeSpec
Browse files Browse the repository at this point in the history
Summary: This fixes [this GitHub issue](facebook/react-native#31193) by pulling in [the commit](facebook/react-native@bdfe2a5) that resolved it.

Test Plan: `pod install`

Reviewers: atul

Reviewed By: atul

Subscribers: KatPo, palys-swm, Adrian

Differential Revision: https://phabricator.ashoat.com/D1739
  • Loading branch information
Ashoat committed Jul 16, 2021
1 parent d1cb7dc commit 5c828a6
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 1 deletion.
2 changes: 1 addition & 1 deletion native/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ SPEC CHECKSUMS:
EXPermissions: 24b97f734ce9172d245a5be38ad9ccfcb6135964
EXSplashScreen: c4ed5d39cd5dbc1329f8dec720e280276bafa28b
FBLazyVector: 49cbe4b43e445b06bf29199b6ad2057649e4c8f5
FBReactNativeSpec: a54741e1187040b47edc7a0cf6c0cca80ceab705
FBReactNativeSpec: e70e2235774c20416564d24d53d9a69a7abbcbb2
Flipper: 1bd2db48dcc31e4b167b9a33ec1df01c2ded4893
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
Flipper-Folly: 755929a4f851b2fb2c347d533a23f191b008554c
Expand Down
140 changes: 140 additions & 0 deletions patches/react-native+0.64.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,146 @@ index 152c1f6..e6c44a9 100644
boost_compiler_flags = '-Wno-documentation'

Pod::Spec.new do |s|
diff --git a/node_modules/react-native/scripts/generate-specs.sh b/node_modules/react-native/scripts/generate-specs.sh
index aed955e..b7096de 100755
--- a/node_modules/react-native/scripts/generate-specs.sh
+++ b/node_modules/react-native/scripts/generate-specs.sh
@@ -10,14 +10,14 @@
#
# Optionally, set these envvars to override defaults:
# - SRCS_DIR: Path to JavaScript sources
-# - CODEGEN_MODULES_LIBRARY_NAME: Defaults to FBReactNativeSpec
-# - CODEGEN_MODULES_OUTPUT_DIR: Defaults to React/$CODEGEN_MODULES_LIBRARY_NAME/$CODEGEN_MODULES_LIBRARY_NAME
-# - CODEGEN_COMPONENTS_LIBRARY_NAME: Defaults to rncore
-# - CODEGEN_COMPONENTS_OUTPUT_DIR: Defaults to ReactCommon/react/renderer/components/$CODEGEN_COMPONENTS_LIBRARY_NAME
+# - MODULES_LIBRARY_NAME: Defaults to FBReactNativeSpec
+# - MODULES_OUTPUT_DIR: Defaults to React/$MODULES_LIBRARY_NAME/$MODULES_LIBRARY_NAME
+# - COMPONENTS_LIBRARY_NAME: Defaults to rncore
+# - COMPONENTS_OUTPUT_DIR: Defaults to ReactCommon/react/renderer/components/$COMPONENTS_LIBRARY_NAME
#
# Usage:
# ./scripts/generate-specs.sh
-# SRCS_DIR=myapp/js CODEGEN_MODULES_LIBRARY_NAME=MySpecs CODEGEN_MODULES_OUTPUT_DIR=myapp/MySpecs ./scripts/generate-specs.sh
+# SRCS_DIR=myapp/js MODULES_LIBRARY_NAME=MySpecs MODULES_OUTPUT_DIR=myapp/MySpecs ./scripts/generate-specs.sh
#

# shellcheck disable=SC2038
@@ -46,13 +46,13 @@ describe () {

main() {
SRCS_DIR=${SRCS_DIR:-$(cd "$RN_DIR/Libraries" && pwd)}
- CODEGEN_MODULES_LIBRARY_NAME=${CODEGEN_MODULES_LIBRARY_NAME:-FBReactNativeSpec}
+ MODULES_LIBRARY_NAME=${MODULES_LIBRARY_NAME:-FBReactNativeSpec}

- CODEGEN_COMPONENTS_LIBRARY_NAME=${CODEGEN_COMPONENTS_LIBRARY_NAME:-rncore}
- CODEGEN_MODULES_OUTPUT_DIR=${CODEGEN_MODULES_OUTPUT_DIR:-"$RN_DIR/React/$CODEGEN_MODULES_LIBRARY_NAME/$CODEGEN_MODULES_LIBRARY_NAME"}
- # TODO: $CODEGEN_COMPONENTS_PATH should be programmatically specified, and may change with use_frameworks! support.
- CODEGEN_COMPONENTS_PATH="ReactCommon/react/renderer/components"
- CODEGEN_COMPONENTS_OUTPUT_DIR=${CODEGEN_COMPONENTS_OUTPUT_DIR:-"$RN_DIR/$CODEGEN_COMPONENTS_PATH/$CODEGEN_COMPONENTS_LIBRARY_NAME"}
+ COMPONENTS_LIBRARY_NAME=${COMPONENTS_LIBRARY_NAME:-rncore}
+ MODULES_OUTPUT_DIR=${MODULES_OUTPUT_DIR:-"$RN_DIR/React/$MODULES_LIBRARY_NAME/$MODULES_LIBRARY_NAME"}
+ # TODO: $COMPONENTS_PATH should be programmatically specified, and may change with use_frameworks! support.
+ COMPONENTS_PATH="ReactCommon/react/renderer/components"
+ COMPONENTS_OUTPUT_DIR=${COMPONENTS_OUTPUT_DIR:-"$RN_DIR/$COMPONENTS_PATH/$COMPONENTS_LIBRARY_NAME"}

TEMP_OUTPUT_DIR="$TEMP_DIR/out"
SCHEMA_FILE="$TEMP_DIR/schema.json"
@@ -75,14 +75,14 @@ main() {

describe "Generating native code from schema (iOS)"
pushd "$RN_DIR" >/dev/null || exit 1
- "$NODE_BINARY" scripts/generate-specs-cli.js ios "$SCHEMA_FILE" "$TEMP_OUTPUT_DIR" "$CODEGEN_MODULES_LIBRARY_NAME"
+ "$NODE_BINARY" scripts/generate-specs-cli.js ios "$SCHEMA_FILE" "$TEMP_OUTPUT_DIR" "$MODULES_LIBRARY_NAME"
popd >/dev/null || exit 1

describe "Copying output to final directory"
- mkdir -p "$CODEGEN_COMPONENTS_OUTPUT_DIR" "$CODEGEN_MODULES_OUTPUT_DIR"
- cp -R "$TEMP_OUTPUT_DIR/$CODEGEN_MODULES_LIBRARY_NAME.h" "$TEMP_OUTPUT_DIR/$CODEGEN_MODULES_LIBRARY_NAME-generated.mm" "$CODEGEN_MODULES_OUTPUT_DIR" || exit 1
- find "$TEMP_OUTPUT_DIR" -type f | xargs sed -i.bak "s/$CODEGEN_MODULES_LIBRARY_NAME/$CODEGEN_COMPONENTS_LIBRARY_NAME/g" || exit 1
- find "$TEMP_OUTPUT_DIR" -type f -not -iname "$CODEGEN_MODULES_LIBRARY_NAME*" -exec cp '{}' "$CODEGEN_COMPONENTS_OUTPUT_DIR/" ';' || exit 1
+ mkdir -p "$COMPONENTS_OUTPUT_DIR" "$MODULES_OUTPUT_DIR"
+ cp -R "$TEMP_OUTPUT_DIR/$MODULES_LIBRARY_NAME.h" "$TEMP_OUTPUT_DIR/$MODULES_LIBRARY_NAME-generated.mm" "$MODULES_OUTPUT_DIR" || exit 1
+ find "$TEMP_OUTPUT_DIR" -type f | xargs sed -i.bak "s/$MODULES_LIBRARY_NAME/$COMPONENTS_LIBRARY_NAME/g" || exit 1
+ find "$TEMP_OUTPUT_DIR" -type f -not -iname "$MODULES_LIBRARY_NAME*" -exec cp '{}' "$COMPONENTS_OUTPUT_DIR/" ';' || exit 1

echo >&2 'Done.'
}
diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb
index 2a8affb..5434997 100644
--- a/node_modules/react-native/scripts/react_native_pods.rb
+++ b/node_modules/react-native/scripts/react_native_pods.rb
@@ -148,33 +148,31 @@ end
def use_react_native_codegen!(spec, options={})
return if ENV['DISABLE_CODEGEN'] == '1'

- # The path to react-native (e.g. react_native_path)
- prefix = options[:path] ||= File.join(__dir__, "..")
+ # The path to react-native
+ prefix = options[:path] ||= "${PODS_TARGET_SRCROOT}/../.."

# The path to JavaScript files
- srcs_dir = options[:srcs_dir] ||= File.join(prefix, "Libraries")
+ js_srcs = options[:js_srcs_dir] ||= "#{prefix}/Libraries"

# Library name (e.g. FBReactNativeSpec)
- codegen_modules_library_name = spec.name
- codegen_modules_output_dir = options[:codegen_modules_output_dir] ||= File.join(prefix, "React/#{codegen_modules_library_name}/#{codegen_modules_library_name}")
+ modules_library_name = spec.name
+ modules_output_dir = "React/#{modules_library_name}/#{modules_library_name}"

# Run the codegen as part of the Xcode build pipeline.
- env_vars = "SRCS_DIR=#{srcs_dir}"
- env_vars += " CODEGEN_MODULES_OUTPUT_DIR=#{codegen_modules_output_dir}"
+ env_vars = "SRCS_DIR=#{js_srcs}"
+ env_vars += " MODULES_OUTPUT_DIR=#{prefix}/#{modules_output_dir}"
+ env_vars += " MODULES_LIBRARY_NAME=#{modules_library_name}"

- # Since the generated files are not guaranteed to exist when CocoaPods is run, we need to create
- # empty files to ensure the references are included in the resulting Pods Xcode project.
- mkdir_command = "mkdir -p #{codegen_modules_output_dir}"
- generated_filenames = [ "#{codegen_modules_library_name}.h", "#{codegen_modules_library_name}-generated.mm" ]
- generated_files = generated_filenames.map { |filename| File.join(codegen_modules_output_dir, filename) }
+ generated_dirs = [ modules_output_dir ]
+ generated_filenames = [ "#{modules_library_name}.h", "#{modules_library_name}-generated.mm" ]
+ generated_files = generated_filenames.map { |filename| "#{modules_output_dir}/#{filename}" }

if ENV['USE_FABRIC'] == '1'
# We use a different library name for components, as well as an additional set of files.
- # Eventually, we want these to be part of the same library as #{codegen_modules_library_name} above.
- codegen_components_library_name = "rncore"
- codegen_components_output_dir = File.join(prefix, "ReactCommon/react/renderer/components/#{codegen_components_library_name}")
- env_vars += " CODEGEN_COMPONENTS_OUTPUT_DIR=#{codegen_components_output_dir}"
- mkdir_command += " #{codegen_components_output_dir}"
+ # Eventually, we want these to be part of the same library as #{modules_library_name} above.
+ components_output_dir = "ReactCommon/react/renderer/components/rncore/"
+ generated_dirs.push components_output_dir
+ env_vars += " COMPONENTS_OUTPUT_DIR=#{prefix}/#{components_output_dir}"
components_generated_filenames = [
"ComponentDescriptors.h",
"EventEmitters.cpp",
@@ -185,17 +183,16 @@ def use_react_native_codegen!(spec, options={})
"ShadowNodes.cpp",
"ShadowNodes.h"
]
- generated_files = generated_files.concat(components_generated_filenames.map { |filename| File.join(codegen_components_output_dir, filename) })
+ generated_files = generated_files.concat(components_generated_filenames.map { |filename| "#{components_output_dir}/#{filename}" })
end

spec.script_phase = {
:name => 'Generate Specs',
- :input_files => [srcs_dir],
- :output_files => ["$(DERIVED_FILE_DIR)/codegen-#{codegen_modules_library_name}.log"].concat(generated_files),
- :script => "set -o pipefail\n\nbash -l -c '#{env_vars} CODEGEN_MODULES_LIBRARY_NAME=#{codegen_modules_library_name} #{File.join(__dir__, "generate-specs.sh")}' 2>&1 | tee \"${SCRIPT_OUTPUT_FILE_0}\"",
+ :input_files => [js_srcs],
+ :output_files => ["${DERIVED_FILE_DIR}/codegen-#{modules_library_name}.log"].concat(generated_files.map { |filename| "#{prefix}/#{filename}"} ),
+ :script => "set -o pipefail\n\nbash -l -c '#{env_vars} ${PODS_TARGET_SRCROOT}/../../scripts/generate-specs.sh' 2>&1 | tee \"${SCRIPT_OUTPUT_FILE_0}\"",
:execution_position => :before_compile,
:show_env_vars_in_log => true
}
-
- spec.prepare_command = "#{mkdir_command} && touch #{generated_files.reduce() { |str, file| str + " " + file }}"
+ spec.prepare_command = "mkdir -p #{generated_dirs.reduce("") { |str, dir| "#{str} ../../#{dir}" }} && touch #{generated_files.reduce("") { |str, filename| "#{str} ../../#{filename}" }}"
end
diff --git a/node_modules/react-native/third-party-podspecs/RCT-Folly.podspec b/node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
index cacafb8..be6da22 100644
--- a/node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
Expand Down

0 comments on commit 5c828a6

Please sign in to comment.