Skip to content

Commit f564539

Browse files
authored
Merge pull request #1940 from amgleitman/0.72-merge-to-core-0.72.5
[0.72-stable] Merge to RNCore 0.72.5
2 parents 1a36419 + a54805f commit f564539

File tree

12 files changed

+375
-334
lines changed

12 files changed

+375
-334
lines changed

Gemfile.lock

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ GEM
33
specs:
44
CFPropertyList (3.0.6)
55
rexml
6-
activesupport (7.0.7.2)
6+
activesupport (7.0.8)
77
concurrent-ruby (~> 1.0, >= 1.0.2)
88
i18n (>= 1.6, < 2)
99
minitest (>= 5.1)
@@ -15,10 +15,10 @@ GEM
1515
json (>= 1.5.1)
1616
atomos (0.1.3)
1717
claide (1.1.0)
18-
cocoapods (1.12.1)
18+
cocoapods (1.13.0)
1919
addressable (~> 2.8)
2020
claide (>= 1.0.2, < 2.0)
21-
cocoapods-core (= 1.12.1)
21+
cocoapods-core (= 1.13.0)
2222
cocoapods-deintegrate (>= 1.0.3, < 2.0)
2323
cocoapods-downloader (>= 1.6.0, < 2.0)
2424
cocoapods-plugins (>= 1.0.0, < 2.0)
@@ -32,8 +32,8 @@ GEM
3232
molinillo (~> 0.8.0)
3333
nap (~> 1.0)
3434
ruby-macho (>= 2.3.0, < 3.0)
35-
xcodeproj (>= 1.21.0, < 2.0)
36-
cocoapods-core (1.12.1)
35+
xcodeproj (>= 1.23.0, < 2.0)
36+
cocoapods-core (1.13.0)
3737
activesupport (>= 5.0, < 8)
3838
addressable (~> 2.8)
3939
algoliasearch (~> 1.0)
@@ -57,7 +57,7 @@ GEM
5757
escape (0.0.4)
5858
ethon (0.16.0)
5959
ffi (>= 1.15.0)
60-
ffi (1.15.5)
60+
ffi (1.16.1)
6161
fourflusher (2.3.1)
6262
fuzzy_match (2.0.4)
6363
gh_inspector (1.1.3)
@@ -77,7 +77,7 @@ GEM
7777
ethon (>= 0.9.0)
7878
tzinfo (2.0.6)
7979
concurrent-ruby (~> 1.0)
80-
xcodeproj (1.22.0)
80+
xcodeproj (1.23.0)
8181
CFPropertyList (>= 2.3.3, < 4.0)
8282
atomos (~> 0.1.3)
8383
claide (>= 1.0.2, < 2.0)

packages/react-native-codegen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-native/codegen",
3-
"version": "0.72.6",
3+
"version": "0.72.7",
44
"description": "⚛️ Code generation tools for React Native",
55
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen",
66
"repository": {

packages/react-native/React/CoreModules/RCTTiming.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ - (void)setup
128128
_paused = YES;
129129
_timers = [NSMutableDictionary new];
130130
_inBackground = NO;
131+
RCTExecuteOnMainQueue(^{
132+
#if !TARGET_OS_OSX // [macOS]
133+
if (!self->_inBackground && [RCTSharedApplication() applicationState] == UIApplicationStateBackground) {
134+
#else // [macOS
135+
if (!self->_inBackground && ![RCTSharedApplication() isHidden]) {
136+
#endif
137+
[self appDidMoveToBackground];
138+
}
139+
});
131140

132141
#if !TARGET_OS_OSX // [macOS]
133142
for (NSString *name in @[

packages/react-native/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@
8080
},
8181
"dependencies": {
8282
"@jest/create-cache-key-function": "^29.2.1",
83-
"@react-native-community/cli": "11.3.6",
84-
"@react-native-community/cli-platform-android": "11.3.6",
85-
"@react-native-community/cli-platform-ios": "11.3.6",
83+
"@react-native-community/cli": "11.3.7",
84+
"@react-native-community/cli-platform-android": "11.3.7",
85+
"@react-native-community/cli-platform-ios": "11.3.7",
8686
"@react-native/assets-registry": "^0.72.0",
87-
"@react-native/codegen": "^0.72.6",
87+
"@react-native/codegen": "^0.72.7",
8888
"@react-native/gradle-plugin": "^0.72.11",
8989
"@react-native/js-polyfills": "^0.72.1",
9090
"@react-native/normalize-colors": "^0.72.0",
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
#
3+
# This source code is licensed under the MIT license found in the
4+
# LICENSE file in the root directory of this source tree.
5+
6+
class XcodebuildMock < Xcodebuild
7+
@@version = ""
8+
@@version_invocation_count = 0
9+
10+
def self.set_version=(v)
11+
@@version = v
12+
end
13+
14+
def self.version
15+
@@version_invocation_count += 1
16+
@@version
17+
end
18+
19+
def self.version_invocation_count
20+
@@version_invocation_count
21+
end
22+
23+
def self.reset()
24+
@@version_invocation_count = 0
25+
end
26+
end

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

Lines changed: 115 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
require_relative "./test_utils/systemUtils.rb"
1515
require_relative "./test_utils/PathnameMock.rb"
1616
require_relative "./test_utils/TargetDefinitionMock.rb"
17+
require_relative "./test_utils/XcodebuildMock.rb"
1718

1819
class UtilsTests < Test::Unit::TestCase
1920
def setup
@@ -28,6 +29,7 @@ def teardown
2829
Pod::Config.reset()
2930
SysctlChecker.reset()
3031
Environment.reset()
32+
XcodebuildMock.reset()
3133
ENV['RCT_NEW_ARCH_ENABLED'] = '0'
3234
ENV['USE_HERMES'] = '1'
3335
ENV['USE_FRAMEWORKS'] = nil
@@ -437,9 +439,9 @@ def test_applyMacCatalystPatches_correctlyAppliesNecessaryPatches
437439
# ================================= #
438440
# Test - Apply Xcode 15 Patch #
439441
# ================================= #
440-
441-
def test_applyXcode15Patch_correctlyAppliesNecessaryPatch
442+
def test_applyXcode15Patch_whenXcodebuild14_correctlyAppliesNecessaryPatch
442443
# Arrange
444+
XcodebuildMock.set_version = "Xcode 14.3"
443445
first_target = prepare_target("FirstTarget")
444446
second_target = prepare_target("SecondTarget")
445447
third_target = TargetMock.new("ThirdTarget", [
@@ -468,24 +470,117 @@ def test_applyXcode15Patch_correctlyAppliesNecessaryPatch
468470
])
469471

470472
# Act
471-
ReactNativePodsUtils.apply_xcode_15_patch(installer)
473+
user_project_mock.build_configurations.each do |config|
474+
assert_nil(config.build_settings["OTHER_LDFLAGS"])
475+
end
476+
477+
ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
472478

473479
# Assert
474-
first_target.build_configurations.each do |config|
475-
assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
476-
'$(inherited) "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
477-
)
480+
user_project_mock.build_configurations.each do |config|
481+
assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
482+
assert_equal("$(inherited) ", config.build_settings["OTHER_LDFLAGS"])
478483
end
479-
second_target.build_configurations.each do |config|
480-
assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
481-
'$(inherited) "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
482-
)
484+
485+
# User project and Pods project
486+
assert_equal(2, XcodebuildMock.version_invocation_count)
487+
end
488+
489+
def test_applyXcode15Patch_whenXcodebuild15_correctlyAppliesNecessaryPatch
490+
# Arrange
491+
XcodebuildMock.set_version = "Xcode 15.0"
492+
first_target = prepare_target("FirstTarget")
493+
second_target = prepare_target("SecondTarget")
494+
third_target = TargetMock.new("ThirdTarget", [
495+
BuildConfigurationMock.new("Debug", {
496+
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
497+
}),
498+
BuildConfigurationMock.new("Release", {
499+
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
500+
}),
501+
], nil)
502+
503+
user_project_mock = UserProjectMock.new("/a/path", [
504+
prepare_config("Debug"),
505+
prepare_config("Release"),
506+
],
507+
:native_targets => [
508+
first_target,
509+
second_target
510+
]
511+
)
512+
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
513+
third_target
514+
])
515+
installer = InstallerMock.new(pods_projects_mock, [
516+
AggregatedProjectMock.new(user_project_mock)
517+
])
518+
519+
# Act
520+
user_project_mock.build_configurations.each do |config|
521+
assert_nil(config.build_settings["OTHER_LDFLAGS"])
483522
end
484-
third_target.build_configurations.each do |config|
485-
assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
486-
'$(inherited) "SomeFlag=1" "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
487-
)
523+
524+
ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
525+
526+
# Assert
527+
user_project_mock.build_configurations.each do |config|
528+
assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
529+
assert_equal("$(inherited) -Wl -ld_classic ", config.build_settings["OTHER_LDFLAGS"])
488530
end
531+
532+
# User project and Pods project
533+
assert_equal(2, XcodebuildMock.version_invocation_count)
534+
end
535+
536+
def test_applyXcode15Patch_whenXcodebuild14ButProjectHasSettings_correctlyRemovesNecessaryPatch
537+
# Arrange
538+
XcodebuildMock.set_version = "Xcode 14.3"
539+
first_target = prepare_target("FirstTarget")
540+
second_target = prepare_target("SecondTarget")
541+
third_target = TargetMock.new("ThirdTarget", [
542+
BuildConfigurationMock.new("Debug", {
543+
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
544+
}),
545+
BuildConfigurationMock.new("Release", {
546+
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
547+
}),
548+
], nil)
549+
550+
debug_config = prepare_config("Debug", {"OTHER_LDFLAGS" => "$(inherited) -Wl -ld_classic "})
551+
release_config = prepare_config("Release", {"OTHER_LDFLAGS" => "$(inherited) -Wl -ld_classic "})
552+
553+
user_project_mock = UserProjectMock.new("/a/path", [
554+
debug_config,
555+
release_config,
556+
],
557+
:native_targets => [
558+
first_target,
559+
second_target
560+
]
561+
)
562+
pods_projects_mock = PodsProjectMock.new([debug_config.clone, release_config.clone], {"hermes-engine" => {}}, :native_targets => [
563+
third_target
564+
])
565+
installer = InstallerMock.new(pods_projects_mock, [
566+
AggregatedProjectMock.new(user_project_mock)
567+
])
568+
569+
# Act
570+
user_project_mock.build_configurations.each do |config|
571+
assert_equal("$(inherited) -Wl -ld_classic ", config.build_settings["OTHER_LDFLAGS"])
572+
end
573+
574+
ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
575+
576+
# Assert
577+
user_project_mock.build_configurations.each do |config|
578+
assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
579+
assert_equal("$(inherited) ", config.build_settings["OTHER_LDFLAGS"])
580+
end
581+
582+
# User project and Pods project
583+
assert_equal(2, XcodebuildMock.version_invocation_count)
489584
end
490585

491586
# ==================================== #
@@ -744,12 +839,14 @@ def prepare_empty_user_project_mock
744839
])
745840
end
746841

747-
def prepare_config(config_name)
748-
return BuildConfigurationMock.new(config_name, {"LIBRARY_SEARCH_PATHS" => [
842+
def prepare_config(config_name, extra_config = {})
843+
config = {"LIBRARY_SEARCH_PATHS" => [
749844
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
750845
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
751846
"another/path",
752-
]})
847+
]}.merge(extra_config)
848+
849+
return BuildConfigurationMock.new(config_name, config)
753850
end
754851

755852
def prepare_target(name, product_type = nil, dependencies = [])

packages/react-native/scripts/cocoapods/helpers.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ def call_sysctl_arm64
1111
end
1212
end
1313

14+
# Helper class that is used to easily send commands to Xcodebuild
15+
# And that can be subclassed for testing purposes.
16+
class Xcodebuild
17+
def self.version
18+
`xcodebuild -version`
19+
end
20+
end
21+
1422
# Helper object to wrap system properties like RUBY_PLATFORM
1523
# This makes it easier to mock the behaviour in tests
1624
class Environment
@@ -26,3 +34,11 @@ def self.find_codegen_file(path)
2634
return `find #{path} -type f \\( #{js_files} -or #{ts_files} \\)`.split("\n").sort()
2735
end
2836
end
37+
38+
module Helpers
39+
class Constants
40+
def self.min_ios_version_supported
41+
return '12.4'
42+
end
43+
end
44+
end

0 commit comments

Comments
 (0)