Skip to content

Commit

Permalink
[0.72] Merge up to 0.72.6 upstream (#1952)
Browse files Browse the repository at this point in the history
* Move hermes-engine.podspec and hermes-utils.rb from hermes-engine to hermes folders when building (facebook#39575)

* Update Xcode 15 patches to be more robust (facebook#39710)

Summary:
Pull Request resolved: facebook#39710

Last week Apple released Xcode 15, which required us to ship a workaround for the new linker.
Unfortunately, the previous fix was not good enough and there were some edge cases that were not covered.
For example, in some occasions the flags are read as an array and the `-Wl` and the `-ld_classic` flags were separated and not properly removed when moving from Xcode 15 to Xcpde 14.3.1.

This change fixes those edge cases, with a more robust solution where:
- We convert the flags to a string.
- We trim the string and the values properly.
- We add the flags when running `pod install` with Xcode 15 as the default iOS toolchain.
- We remove the flags when running `pod install` with Xcode <15 as the default iOS toolchain.

## Changelog:
[Internal] - Make the Xcode 15 workaround more robust.

Reviewed By: dmytrorykun

Differential Revision: D49748844

fbshipit-source-id: 34976d148f123c5aacba6487a500874bb938fe99

# Conflicts:
#	packages/react-native/scripts/cocoapods/__tests__/utils-test.rb
#	packages/react-native/scripts/cocoapods/utils.rb

* Fix Gemfile, setting Active support to < 7.1.0 (facebook#39828)

Summary:
Pull Request resolved: facebook#39828

Active Suppert released a new Gem which is incompatible with Cocoapods 1.13.0, the latest release, as they removed a method used by cocoapods.

This fix ensures that we install compatible versions of the Gem.

## Changelog:
[iOS][Fixed] - Set the max version of Active support to 7.0.8

Reviewed By: hoxyq

Differential Revision: D49949782

fbshipit-source-id: 278097502d3a416567cc8c0b90090fee4fb21503

# Conflicts:
#	Gemfile

* RN: Switch EventEmitter to `Array.from(...)` (facebook#39525)

Summary:
Pull Request resolved: facebook#39525

Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](facebook#35577 (comment)) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Reviewed By: javache

Differential Revision: D49389813

fbshipit-source-id: 7caf63734fc047496afe2f1ed6d918c22747258a

* [Local] Fix CI for 0.72, with Acitve Support and Xcode15 (facebook#40855)

* [0.72.6] Bump version numbers

* Bump deprecated-react-native-prop-types to ^4.2.3

This version correctly sets a dependency on `"@react-native/normalize-colors": "<0.73.0"` (from `"*"`), preventing future unwanted breakages.

* Fix broken Loading/Refreshing indicator on Android

Summary:
The Loading.../Refreshing... indicator is currently broken on Android.
The reason is related to D42599220
We used to have a Toast shown to users on Android as a fallback, but as the
DevLoadingView is not always loaded as a module in the core package, this ends up in the banner never beign shown to the user (on RN Tester or template apps).

Changelog:
[Android] [Fixed] - Fix broken Loading/Refreshing indicator on Android

Reviewed By: cipolleschi

Differential Revision: D49876757

fbshipit-source-id: 400e002327ebca908e3e7a7f81c5066888ac4e9b

---------

Co-authored-by: Riccardo Cipolleschi <cipolleschi@meta.com>
Co-authored-by: Tim Yung <yungsters@meta.com>
Co-authored-by: Distiller <distiller@static.38.39.185.90.cyberlynk.net>
Co-authored-by: Alex Hunt <hello@alexhunt.io>
Co-authored-by: Nicola Corti <ncor@meta.com>
  • Loading branch information
6 people authored Oct 16, 2023
1 parent c7e2986 commit d56fb34
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ package-lock.json
/packages/react-native/template/vendor
.ruby-version
/**/.ruby-version
./vendor/
vendor/

# iOS / CocoaPods
/packages/react-native/template/ios/build/
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ source 'https://rubygems.org'
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.12'
gem 'activesupport', '>= 6.1.7.1'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ GEM
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.16.2)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
Expand Down Expand Up @@ -89,7 +89,7 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.1)
activesupport (>= 6.1.7.3, < 7.1.0)
cocoapods (~> 1.12)

RUBY VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ export default class EventEmitter<TEventToArgsMap: {...}>
Registration<$ElementType<TEventToArgsMap, TEvent>>,
> = this._registry[eventType];
if (registrations != null) {
for (const registration of [...registrations]) {
// Copy `registrations` to take a snapshot when we invoke `emit`, in case
// registrations are added or removed when listeners are invoked.
for (const registration of Array.from(registrations)) {
registration.listener.apply(registration.context, args);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.facebook.react.modules.blob.FileReaderModule;
import com.facebook.react.modules.camera.ImageStoreManager;
import com.facebook.react.modules.clipboard.ClipboardModule;
import com.facebook.react.modules.devloading.DevLoadingModule;
import com.facebook.react.modules.devtoolssettings.DevToolsSettingsManagerModule;
import com.facebook.react.modules.dialog.DialogModule;
import com.facebook.react.modules.fresco.FrescoModule;
Expand Down Expand Up @@ -72,6 +73,7 @@
AppearanceModule.class,
AppStateModule.class,
BlobModule.class,
DevLoadingModule.class,
FileReaderModule.class,
ClipboardModule.class,
DialogModule.class,
Expand Down Expand Up @@ -113,6 +115,8 @@ public MainReactPackage(MainPackageConfig config) {
return new AppStateModule(context);
case BlobModule.NAME:
return new BlobModule(context);
case DevLoadingModule.NAME:
return new DevLoadingModule(context);
case FileReaderModule.NAME:
return new FileReaderModule(context);
case ClipboardModule.NAME:
Expand Down Expand Up @@ -371,6 +375,7 @@ public ReactModuleInfoProvider getReactModuleInfoProvider() {
AppearanceModule.class,
AppStateModule.class,
BlobModule.class,
DevLoadingModule.class,
FileReaderModule.class,
ClipboardModule.class,
DialogModule.class,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"abort-controller": "^3.0.0",
"anser": "^1.4.9",
"base64-js": "^1.1.2",
"deprecated-react-native-prop-types": "4.1.0",
"deprecated-react-native-prop-types": "^4.2.3",
"event-target-shim": "^5.0.1",
"flow-enums-runtime": "^0.0.5",
"invariant": "^2.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def test_applyXcode15Patch_whenXcodebuild15_correctlyAppliesNecessaryPatch
# Assert
user_project_mock.build_configurations.each do |config|
assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
assert_equal("$(inherited) -Wl -ld_classic ", config.build_settings["OTHER_LDFLAGS"])
assert_equal("$(inherited) -Wl -ld_classic", config.build_settings["OTHER_LDFLAGS"])
end

# User project and Pods project
Expand Down Expand Up @@ -576,7 +576,7 @@ def test_applyXcode15Patch_whenXcodebuild14ButProjectHasSettings_correctlyRemove
# Assert
user_project_mock.build_configurations.each do |config|
assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
assert_equal("$(inherited) ", config.build_settings["OTHER_LDFLAGS"])
assert_equal("$(inherited)", config.build_settings["OTHER_LDFLAGS"])
end

# User project and Pods project
Expand Down
28 changes: 17 additions & 11 deletions packages/react-native/scripts/cocoapods/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def self.apply_xcode_15_patch(installer, xcodebuild_manager: Xcodebuild)
if self.is_using_xcode15_or_greter(:xcodebuild_manager => xcodebuild_manager)
self.add_value_to_setting_if_missing(config, other_ld_flags_key, xcode15_compatibility_flags)
else
self.remove_value_to_setting_if_present(config, other_ld_flags_key, xcode15_compatibility_flags)
self.remove_value_from_setting_if_present(config, other_ld_flags_key, xcode15_compatibility_flags)
end
end
project.save()
Expand Down Expand Up @@ -298,20 +298,26 @@ def self.safe_init(config, setting_name)

def self.add_value_to_setting_if_missing(config, setting_name, value)
old_config = config.build_settings[setting_name]
if !old_config.include?(value)
config.build_settings[setting_name] << value
if old_config.is_a?(Array)
old_config = old_config.join(" ")
end

trimmed_value = value.strip()
if !old_config.include?(trimmed_value)
config.build_settings[setting_name] = "#{old_config.strip()} #{trimmed_value}".strip()
end
end

def self.remove_value_to_setting_if_present(config, setting_name, value)
def self.remove_value_from_setting_if_present(config, setting_name, value)
old_config = config.build_settings[setting_name]
if old_config.include?(value)
# Old config can be either an Array or a String
if old_config.is_a?(Array)
old_config = old_config.join(" ")
end
new_config = old_config.gsub(value, "")
config.build_settings[setting_name] = new_config
if old_config.is_a?(Array)
old_config = old_config.join(" ")
end

trimmed_value = value.strip()
if old_config.include?(trimmed_value)
new_config = old_config.gsub(trimmed_value, "")
config.build_settings[setting_name] = new_config.strip()
end
end

Expand Down
3 changes: 2 additions & 1 deletion packages/react-native/template/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.12'
gem 'cocoapods', '~> 1.13'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
1 change: 1 addition & 0 deletions packages/rn-tester/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ source 'https://rubygems.org'

gem 'cocoapods', '~> 1.12'
gem 'rexml'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
2 changes: 1 addition & 1 deletion packages/rn-tester/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -614,4 +614,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 23258155130fc3ae417bc5bb12e76438f3b9a394

COCOAPODS: 1.13.0
COCOAPODS: 1.12.0
14 changes: 13 additions & 1 deletion scripts/testing-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,19 @@ function buildArtifactsLocally(
expandHermesSourceTarball();
}

// need to move the scripts inside the local hermes cloned folder
// need to move the podspec file from hermes-engine to hermes folder
// cp sdks/hermes-engine/hermes-engine.podspec <your_hermes_checkout>/hermes-engine.podspec
cp(
`${reactNativePackagePath}/sdks/hermes-engine/hermes-engine.podspec`,
`${reactNativePackagePath}/sdks/hermes/hermes-engine.podspec`,
);
// need to move the hermes-utils file from hermes-engine to hermes folder
// cp sdks/hermes-engine/hermes-utils.rb <your_hermes_checkout>/hermes-utils.rb
cp(
`${reactNativePackagePath}/sdks/hermes-engine/hermes-utils.rb`,
`${reactNativePackagePath}/sdks/hermes/hermes-utils.rb`,
);
// need to move the shell scripts file from hermes-engine to hermes folder
// cp sdks/hermes-engine/utils/*.sh <your_hermes_checkout>/utils/.
cp(
`${reactNativePackagePath}/sdks/hermes-engine/utils/*.sh`,
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4458,14 +4458,14 @@ depd@2.0.0, depd@^2.0.0:
resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df"
integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==

deprecated-react-native-prop-types@4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-4.1.0.tgz#8ed03a64c21b7fbdd2d000957b6838d4f38d2c66"
integrity sha512-WfepZHmRbbdTvhcolb8aOKEvQdcmTMn5tKLbqbXmkBvjFjRVWAYqsXk/DBsV8TZxws8SdGHLuHaJrHSQUPRdfw==
deprecated-react-native-prop-types@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-4.2.3.tgz#0ef845c1a80ef1636bd09060e4cdf70f9727e5ad"
integrity sha512-2rLTiMKidIFFYpIVM69UnQKngLqQfL6I11Ch8wGSBftS18FUXda+o2we2950X+1dmbgps28niI3qwyH4eX3Z1g==
dependencies:
"@react-native/normalize-colors" "*"
invariant "*"
prop-types "*"
"@react-native/normalize-colors" "<0.73.0"
invariant "^2.2.4"
prop-types "^15.8.1"

deprecation@^2.0.0, deprecation@^2.3.1:
version "2.3.1"
Expand Down Expand Up @@ -5987,7 +5987,7 @@ interpret@^1.0.0:
resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e"
integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==

invariant@*, invariant@^2.2.4:
invariant@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
Expand Down Expand Up @@ -8503,7 +8503,7 @@ prompts@^2.0.1, prompts@^2.3.0, prompts@^2.4.0, prompts@^2.4.2:
kleur "^3.0.3"
sisteransi "^1.0.5"

prop-types@*, prop-types@^15.8.1:
prop-types@^15.8.1:
version "15.8.1"
resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5"
integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==
Expand Down

0 comments on commit d56fb34

Please sign in to comment.