react-native-tvos 0.72.4-0rc0 → 0.72.5-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/Components/Pressable/Pressable.js +11 -5
- package/Libraries/Components/ScrollView/ScrollView.d.ts +7 -0
- package/Libraries/Components/ScrollView/ScrollView.js +8 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +1 -0
- package/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +1 -0
- package/Libraries/Components/ScrollView/ScrollViewViewConfig.js +1 -0
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/README-core.md +147 -0
- package/README.md +32 -39
- package/React/Base/RCTBundleURLProvider.h +33 -2
- package/React/Base/RCTBundleURLProvider.mm +78 -15
- package/React/Base/RCTVersion.m +2 -2
- package/React/CoreModules/RCTTiming.mm +5 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +4 -0
- package/React/Fabric/RCTThirdPartyFabricComponentsProvider.h +29 -0
- package/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm +29 -0
- package/React/Views/ScrollView/RCTScrollView.h +1 -0
- package/React/Views/ScrollView/RCTScrollView.m +12 -0
- package/React/Views/ScrollView/RCTScrollViewManager.m +1 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.java +4 -0
- package/ReactAndroid/src/main/jni/CMakeLists.txt +5 -0
- package/ReactCommon/React-Fabric.podspec +1 -1
- package/ReactCommon/ReactCommon.podspec +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/jsc/JSCRuntime.cpp +10 -0
- package/ReactCommon/react/debug/React-debug.podspec +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +1 -1
- package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -1
- package/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h +29 -0
- package/ReactCommon/react/renderer/components/rncore/EventEmitters.cpp +111 -0
- package/ReactCommon/react/renderer/components/rncore/EventEmitters.h +186 -0
- package/ReactCommon/react/renderer/components/rncore/Props.cpp +157 -0
- package/ReactCommon/react/renderer/components/rncore/Props.h +395 -0
- package/ReactCommon/react/renderer/components/rncore/RCTComponentViewHelpers.h +257 -0
- package/ReactCommon/react/renderer/components/rncore/ShadowNodes.cpp +26 -0
- package/ReactCommon/react/renderer/components/rncore/ShadowNodes.h +111 -0
- package/ReactCommon/react/renderer/components/rncore/States.cpp +18 -0
- package/ReactCommon/react/renderer/components/rncore/States.h +141 -0
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp +15 -1
- package/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h +1 -0
- package/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +2 -0
- package/ReactCommon/react/renderer/core/RawPropsParser.cpp +1 -0
- package/ReactCommon/react/renderer/core/RawPropsPrimitives.h +4 -4
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -1
- package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +1 -1
- package/ReactCommon/react/utils/React-utils.podspec +1 -1
- package/package.json +7 -6
- package/scripts/cocoapods/helpers.rb +16 -0
- package/scripts/cocoapods/utils.rb +98 -8
- package/scripts/react_native_pods.rb +6 -2
- package/sdks/.hermesversion +1 -1
- package/sdks/hermes-engine/utils/build-apple-framework.sh +8 -1
- package/sdks/hermes-engine/utils/build-hermes-xcode.sh +8 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +95 -13
- package/template/package.json +5 -4
- package/types/index.d.ts +1 -0
- package/types/public/ReactNativeTVTypes.d.ts +192 -0
- package/scripts/cocoapods/__tests__/codegen-test.rb +0 -242
- package/scripts/cocoapods/__tests__/codegen_utils-test.rb +0 -602
- package/scripts/cocoapods/__tests__/fabric-test.rb +0 -68
- package/scripts/cocoapods/__tests__/flipper-test.rb +0 -161
- package/scripts/cocoapods/__tests__/jsengine-test.rb +0 -130
- package/scripts/cocoapods/__tests__/local_podspec_patch-test.rb +0 -167
- package/scripts/cocoapods/__tests__/new_architecture-test.rb +0 -303
- package/scripts/cocoapods/__tests__/test_utils/CodegenScriptPhaseExtractorMock.rb +0 -21
- package/scripts/cocoapods/__tests__/test_utils/CodegenUtilsMock.rb +0 -108
- package/scripts/cocoapods/__tests__/test_utils/DirMock.rb +0 -72
- package/scripts/cocoapods/__tests__/test_utils/EnvironmentMock.rb +0 -21
- package/scripts/cocoapods/__tests__/test_utils/FileMock.rb +0 -113
- package/scripts/cocoapods/__tests__/test_utils/FileUtilsMock.rb +0 -40
- package/scripts/cocoapods/__tests__/test_utils/FinderMock.rb +0 -28
- package/scripts/cocoapods/__tests__/test_utils/InstallerMock.rb +0 -222
- package/scripts/cocoapods/__tests__/test_utils/LocalPodspecPatchMock.rb +0 -14
- package/scripts/cocoapods/__tests__/test_utils/Open3Mock.rb +0 -43
- package/scripts/cocoapods/__tests__/test_utils/PathnameMock.rb +0 -42
- package/scripts/cocoapods/__tests__/test_utils/PodMock.rb +0 -144
- package/scripts/cocoapods/__tests__/test_utils/SpecMock.rb +0 -30
- package/scripts/cocoapods/__tests__/test_utils/SysctlCheckerMock.rb +0 -21
- package/scripts/cocoapods/__tests__/test_utils/TargetDefinitionMock.rb +0 -12
- package/scripts/cocoapods/__tests__/test_utils/podSpy.rb +0 -39
- package/scripts/cocoapods/__tests__/test_utils/systemUtils.rb +0 -14
- package/scripts/cocoapods/__tests__/utils-test.rb +0 -766
- package/scripts/codegen/__test_fixtures__/fixtures.js +0 -132
- package/scripts/codegen/__tests__/generate-artifacts-executor-test.js +0 -500
- package/scripts/codegen/__tests__/generate-specs-cli-executor-test.js +0 -88
|
@@ -1,161 +0,0 @@
|
|
|
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
|
-
require "test/unit"
|
|
7
|
-
require_relative "../flipper.rb"
|
|
8
|
-
require_relative "./test_utils/podSpy.rb"
|
|
9
|
-
require_relative "./test_utils/InstallerMock.rb"
|
|
10
|
-
|
|
11
|
-
class FlipperTests < Test::Unit::TestCase
|
|
12
|
-
def setup
|
|
13
|
-
podSpy_cleanUp()
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# =========================== #
|
|
17
|
-
# TEST - Install Dependencies #
|
|
18
|
-
# =========================== #
|
|
19
|
-
def test_installFlipperDependencies_installDependencies
|
|
20
|
-
# Act
|
|
21
|
-
install_flipper_dependencies('../..')
|
|
22
|
-
|
|
23
|
-
# Assert
|
|
24
|
-
assert_equal($podInvocationCount, 1)
|
|
25
|
-
assert_equal($podInvocation['React-Core/DevSupport'][:path], "../../" )
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# ======================= #
|
|
29
|
-
# TEST - Use Flipper Pods #
|
|
30
|
-
# ======================= #
|
|
31
|
-
|
|
32
|
-
def test_UseFlipperPods_WithDefaultValues_InstallsPods
|
|
33
|
-
# Arrange
|
|
34
|
-
configurations = ['Debug']
|
|
35
|
-
|
|
36
|
-
# Act
|
|
37
|
-
use_flipper_pods()
|
|
38
|
-
|
|
39
|
-
# Assert
|
|
40
|
-
check_all_flipper_pods($flipper_default_versions, configurations)
|
|
41
|
-
# the number of times the `pod` function has been invoked to install a dependency
|
|
42
|
-
assert_equal($podInvocationCount, 21)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_UseFlipperPods_WithCustomValues_InstallsPods
|
|
46
|
-
# Arrange
|
|
47
|
-
versions = {
|
|
48
|
-
"Flipper" => "1.0.0",
|
|
49
|
-
"Flipper-Boost-iOSX" => "1.1.0",
|
|
50
|
-
"Flipper-DoubleConversion" => "1.1.1",
|
|
51
|
-
"Flipper-Fmt" => "1.2.1",
|
|
52
|
-
"Flipper-Folly" => "2.1.1",
|
|
53
|
-
"Flipper-Glog" => "0.1.2",
|
|
54
|
-
"Flipper-PeerTalk" => "0.0.1",
|
|
55
|
-
"OpenSSL-Universal" => "2.2.2200",
|
|
56
|
-
}
|
|
57
|
-
configurations = ['Debug', 'CI']
|
|
58
|
-
|
|
59
|
-
# Act
|
|
60
|
-
use_flipper_pods(versions, :configurations => configurations)
|
|
61
|
-
|
|
62
|
-
# Assert
|
|
63
|
-
check_all_flipper_pods(versions, configurations)
|
|
64
|
-
# the number of times the `pod` function has been invoked to install a dependency
|
|
65
|
-
assert_equal($podInvocationCount, 21)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# ================= #
|
|
69
|
-
# Test Post Install #
|
|
70
|
-
# ================= #
|
|
71
|
-
|
|
72
|
-
def test_postInstall_updatesThePodCorrectly
|
|
73
|
-
# Arrange
|
|
74
|
-
installer = prepare_mocked_installer
|
|
75
|
-
|
|
76
|
-
# Act
|
|
77
|
-
flipper_post_install(installer)
|
|
78
|
-
|
|
79
|
-
# Assert
|
|
80
|
-
yoga_target = installer.target_with_name("YogaKit")
|
|
81
|
-
yoga_target.build_configurations.each do |config|
|
|
82
|
-
assert_equal(config.build_settings['SWIFT_VERSION'], '4.1')
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
reactCore_target = installer.target_with_name("React-RCTAppDelegate")
|
|
86
|
-
reactCore_target.build_configurations.each do |config|
|
|
87
|
-
if config.name == 'Debug' || config.name == 'CustomConfig' then
|
|
88
|
-
assert_equal(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'], ['$(inherited)', 'FB_SONARKIT_ENABLED=1'])
|
|
89
|
-
else
|
|
90
|
-
assert_true(config.build_settings.empty?)
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
# ======= #
|
|
96
|
-
# HELPERS #
|
|
97
|
-
# ======= #
|
|
98
|
-
|
|
99
|
-
def check_all_flipper_pods(versions, configurations)
|
|
100
|
-
check_flipper_pod('Flipper', versions['Flipper'], configurations)
|
|
101
|
-
check_flipper_pod('FlipperKit', versions['Flipper'], configurations)
|
|
102
|
-
check_flipper_pod('FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], configurations)
|
|
103
|
-
check_flipper_pod('FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], configurations)
|
|
104
|
-
check_flipper_pod('FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], configurations)
|
|
105
|
-
check_flipper_pod('FlipperKit/FlipperKitReactPlugin', versions['Flipper'], configurations)
|
|
106
|
-
check_flipper_pod('FlipperKit/Core', versions['Flipper'], configurations)
|
|
107
|
-
check_flipper_pod('FlipperKit/CppBridge', versions['Flipper'], configurations)
|
|
108
|
-
check_flipper_pod('FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], configurations)
|
|
109
|
-
check_flipper_pod('FlipperKit/FBDefines', versions['Flipper'], configurations)
|
|
110
|
-
check_flipper_pod('FlipperKit/FKPortForwarding', versions['Flipper'], configurations)
|
|
111
|
-
check_flipper_pod('FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], configurations)
|
|
112
|
-
check_flipper_pod('FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], configurations)
|
|
113
|
-
check_flipper_pod('FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], configurations)
|
|
114
|
-
check_flipper_pod('Flipper-Boost-iOSX', versions['Flipper-Boost-iOSX'], configurations)
|
|
115
|
-
check_flipper_pod('Flipper-DoubleConversion', versions['Flipper-DoubleConversion'], configurations)
|
|
116
|
-
check_flipper_pod('Flipper-Fmt', versions['Flipper-Fmt'], configurations)
|
|
117
|
-
check_flipper_pod('Flipper-Folly', versions['Flipper-Folly'], configurations)
|
|
118
|
-
check_flipper_pod('Flipper-Glog', versions['Flipper-Glog'], configurations)
|
|
119
|
-
check_flipper_pod('Flipper-PeerTalk', versions['Flipper-PeerTalk'], configurations)
|
|
120
|
-
check_flipper_pod('OpenSSL-Universal', versions['OpenSSL-Universal'], configurations)
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def check_flipper_pod(name, expectedVersion, expectedConfigurations)
|
|
124
|
-
params = $podInvocation[name]
|
|
125
|
-
assert_equal(params[:version], expectedVersion)
|
|
126
|
-
assert_equal(params[:configurations], expectedConfigurations)
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def prepare_mocked_installer
|
|
130
|
-
return InstallerMock.new(
|
|
131
|
-
PodsProjectMock.new([
|
|
132
|
-
TargetMock.new(
|
|
133
|
-
"YogaKit",
|
|
134
|
-
[
|
|
135
|
-
BuildConfigurationMock.new("Debug", is_debug: true),
|
|
136
|
-
BuildConfigurationMock.new("Release", is_debug: false),
|
|
137
|
-
BuildConfigurationMock.new("CustomConfig", is_debug: true),
|
|
138
|
-
]
|
|
139
|
-
),
|
|
140
|
-
TargetMock.new(
|
|
141
|
-
"React-Core",
|
|
142
|
-
[
|
|
143
|
-
BuildConfigurationMock.new("Debug", is_debug: true),
|
|
144
|
-
BuildConfigurationMock.new("Release", is_debug: false),
|
|
145
|
-
BuildConfigurationMock.new("CustomConfig", is_debug: true),
|
|
146
|
-
]
|
|
147
|
-
),
|
|
148
|
-
TargetMock.new(
|
|
149
|
-
"React-RCTAppDelegate",
|
|
150
|
-
[
|
|
151
|
-
BuildConfigurationMock.new("Debug", is_debug: true),
|
|
152
|
-
BuildConfigurationMock.new("Release", is_debug: false),
|
|
153
|
-
BuildConfigurationMock.new("CustomConfig", is_debug: true),
|
|
154
|
-
]
|
|
155
|
-
)
|
|
156
|
-
]
|
|
157
|
-
)
|
|
158
|
-
)
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
end
|
|
@@ -1,130 +0,0 @@
|
|
|
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
|
-
require "test/unit"
|
|
7
|
-
require_relative "../jsengine.rb"
|
|
8
|
-
require_relative "./test_utils/podSpy.rb"
|
|
9
|
-
require_relative "./test_utils/PodMock.rb"
|
|
10
|
-
require_relative "./test_utils/Open3Mock.rb"
|
|
11
|
-
|
|
12
|
-
class JSEngineTests < Test::Unit::TestCase
|
|
13
|
-
|
|
14
|
-
:react_native_path
|
|
15
|
-
|
|
16
|
-
def setup
|
|
17
|
-
@react_native_path = "../.."
|
|
18
|
-
podSpy_cleanUp()
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def teardown
|
|
23
|
-
ENV['HERMES_ENGINE_TARBALL_PATH'] = nil
|
|
24
|
-
Open3.reset()
|
|
25
|
-
Pod::Config.reset()
|
|
26
|
-
Pod::UI.reset()
|
|
27
|
-
podSpy_cleanUp()
|
|
28
|
-
ENV['USE_HERMES'] = '1'
|
|
29
|
-
ENV['CI'] = nil
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# =============== #
|
|
33
|
-
# TEST - setupJsc #
|
|
34
|
-
# =============== #
|
|
35
|
-
def test_setupJsc_installsPods
|
|
36
|
-
# Arrange
|
|
37
|
-
fabric_enabled = false
|
|
38
|
-
|
|
39
|
-
# Act
|
|
40
|
-
setup_jsc!(:react_native_path => @react_native_path, :fabric_enabled => fabric_enabled)
|
|
41
|
-
|
|
42
|
-
# Assert
|
|
43
|
-
assert_equal($podInvocationCount, 2)
|
|
44
|
-
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
|
|
45
|
-
assert_equal($podInvocation["React-jsc"][:path], "../../ReactCommon/jsc")
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def test_setupJsc_installsPods_installsFabricSubspecWhenFabricEnabled
|
|
49
|
-
# Arrange
|
|
50
|
-
fabric_enabled = true
|
|
51
|
-
|
|
52
|
-
# Act
|
|
53
|
-
setup_jsc!(:react_native_path => @react_native_path, :fabric_enabled => fabric_enabled)
|
|
54
|
-
|
|
55
|
-
# Assert
|
|
56
|
-
assert_equal($podInvocationCount, 3)
|
|
57
|
-
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
|
|
58
|
-
assert_equal($podInvocation["React-jsc"][:path], "../../ReactCommon/jsc")
|
|
59
|
-
assert_equal($podInvocation["React-jsc/Fabric"][:path], "../../ReactCommon/jsc")
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# ================== #
|
|
63
|
-
# TEST - setupHermes #
|
|
64
|
-
# ================== #
|
|
65
|
-
def test_setupHermes_whenHermesScriptFails_abort
|
|
66
|
-
# Arrange
|
|
67
|
-
fabric_enabled = false
|
|
68
|
-
Pod::Config.instance.installation_root.set_installation_root("Pods/")
|
|
69
|
-
Open3.set_returned_status(1)
|
|
70
|
-
Open3.set_returned_text("This test\nshould fail")
|
|
71
|
-
|
|
72
|
-
# Act
|
|
73
|
-
assert_raises {
|
|
74
|
-
setup_hermes!(:react_native_path => @react_native_path, :fabric_enabled => fabric_enabled)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
# Assert
|
|
78
|
-
assert_equal(Open3.collected_commands, ["node scripts/hermes/prepare-hermes-for-build"])
|
|
79
|
-
assert_equal(Open3.collected_dirs, ["Pods/../.."])
|
|
80
|
-
assert_equal(Pod::UI.collected_infoes, ["This test", "should fail"])
|
|
81
|
-
assert_equal($podInvocationCount, 0)
|
|
82
|
-
assert_equal($podInvocation, {})
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
def test_setupHermes_whenHermesScriptSucceeds_installsPods
|
|
86
|
-
# Arrange
|
|
87
|
-
fabric_enabled = false
|
|
88
|
-
Pod::Config.instance.installation_root.set_installation_root("Pods/")
|
|
89
|
-
Open3.set_returned_status(0)
|
|
90
|
-
Open3.set_returned_text("This is\nthe text\nreturned by\nprepare-hermes-for-build")
|
|
91
|
-
|
|
92
|
-
# Act
|
|
93
|
-
setup_hermes!(:react_native_path => @react_native_path, :fabric_enabled => fabric_enabled)
|
|
94
|
-
|
|
95
|
-
# Assert
|
|
96
|
-
assert_equal(Open3.collected_commands, ["node scripts/hermes/prepare-hermes-for-build"])
|
|
97
|
-
assert_equal(Open3.collected_dirs, ["Pods/../.."])
|
|
98
|
-
assert_equal(Pod::UI.collected_infoes, [
|
|
99
|
-
"This is",
|
|
100
|
-
"the text",
|
|
101
|
-
"returned by",
|
|
102
|
-
"prepare-hermes-for-build",
|
|
103
|
-
])
|
|
104
|
-
assert_equal($podInvocationCount, 4)
|
|
105
|
-
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
|
|
106
|
-
assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
|
|
107
|
-
assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
|
|
108
|
-
hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
|
|
109
|
-
assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
|
|
110
|
-
assert_equal(hermes_engine_pod_invocation[:tag], "")
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def test_setupHermes_installsPods_installsFabricSubspecWhenFabricEnabled
|
|
114
|
-
# Arrange
|
|
115
|
-
fabric_enabled = true
|
|
116
|
-
|
|
117
|
-
# Act
|
|
118
|
-
setup_hermes!(:react_native_path => @react_native_path, :fabric_enabled => fabric_enabled)
|
|
119
|
-
|
|
120
|
-
# Assert
|
|
121
|
-
assert_equal($podInvocationCount, 4)
|
|
122
|
-
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
|
|
123
|
-
hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
|
|
124
|
-
assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
|
|
125
|
-
assert_equal(hermes_engine_pod_invocation[:tag], "")
|
|
126
|
-
assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
|
|
127
|
-
assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
end
|
|
@@ -1,167 +0,0 @@
|
|
|
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
|
-
require "test/unit"
|
|
7
|
-
require "json"
|
|
8
|
-
require_relative "../local_podspec_patch.rb"
|
|
9
|
-
require_relative "./test_utils/FileMock.rb"
|
|
10
|
-
require_relative "./test_utils/DirMock.rb"
|
|
11
|
-
require_relative "./test_utils/PodMock.rb"
|
|
12
|
-
require_relative "./test_utils/LocalPodspecPatchMock.rb"
|
|
13
|
-
|
|
14
|
-
class LocalPodspecPatchTests < Test::Unit::TestCase
|
|
15
|
-
|
|
16
|
-
def teardown
|
|
17
|
-
FileMock.reset()
|
|
18
|
-
DirMock.reset()
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# =================== #
|
|
22
|
-
# Test - Pods To Update #
|
|
23
|
-
# =================== #
|
|
24
|
-
|
|
25
|
-
def test_podsToUpdate_whenNoFilesExists_returnLocalPodspecs
|
|
26
|
-
# Arrange
|
|
27
|
-
react_native_path = "../node_modules/react-native"
|
|
28
|
-
globs = ["a/path/to/boost.podspec", "a/path/to/DoubleConversion.podspec"]
|
|
29
|
-
mocked_pwd = "a/path/to"
|
|
30
|
-
DirMock.mocked_existing_globs(globs, "#{react_native_path}/third-party-podspecs/*")
|
|
31
|
-
DirMock.set_pwd(mocked_pwd)
|
|
32
|
-
|
|
33
|
-
# Act
|
|
34
|
-
local_podspec = LocalPodspecPatch.pods_to_update(:react_native_path => react_native_path, dir_manager: DirMock, file_manager: FileMock)
|
|
35
|
-
|
|
36
|
-
# Assert
|
|
37
|
-
assert_equal(local_podspec, [])
|
|
38
|
-
assert_equal(DirMock.glob_invocation, ["#{react_native_path}/third-party-podspecs/*"])
|
|
39
|
-
assert_equal(FileMock.exist_invocation_params, [
|
|
40
|
-
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "boost.podspec.json"),
|
|
41
|
-
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "DoubleConversion.podspec.json"),
|
|
42
|
-
])
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_podsToUpdate_whenFilesExistsWithSameVersions_returnsEmpty
|
|
46
|
-
# Arrange
|
|
47
|
-
react_native_path = "../node_modules/react-native"
|
|
48
|
-
globs = ["a/path/to/boost.podspec", "a/path/to/DoubleConversion.podspec"]
|
|
49
|
-
mocked_pwd = "a/path/to"
|
|
50
|
-
prepare_PodsToUpdate_test_withMatchingVersions(react_native_path, globs, mocked_pwd)
|
|
51
|
-
|
|
52
|
-
# Act
|
|
53
|
-
local_podspec = LocalPodspecPatch.pods_to_update(:react_native_path => react_native_path, dir_manager: DirMock, file_manager: FileMock)
|
|
54
|
-
|
|
55
|
-
# Assert
|
|
56
|
-
assert_equal(local_podspec, [])
|
|
57
|
-
assert_equal(DirMock.glob_invocation, ["#{react_native_path}/third-party-podspecs/*"])
|
|
58
|
-
assert_equal(FileMock.exist_invocation_params, [
|
|
59
|
-
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "boost.podspec.json"),
|
|
60
|
-
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "DoubleConversion.podspec.json"),
|
|
61
|
-
])
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def test_podsToUpdate_whenFilesExistsWithDifferentVersions_returnsThem
|
|
65
|
-
# Arrange
|
|
66
|
-
react_native_path = "../node_modules/react-native"
|
|
67
|
-
globs = ["a/path/to/boost.podspec", "a/path/to/DoubleConversion.podspec"]
|
|
68
|
-
mocked_pwd = "a/path/to"
|
|
69
|
-
prepare_PodsToUpdate_test_withDifferentVersions(react_native_path, globs, mocked_pwd)
|
|
70
|
-
|
|
71
|
-
# Act
|
|
72
|
-
local_podspec = LocalPodspecPatch.pods_to_update(:react_native_path => react_native_path, dir_manager: DirMock, file_manager: FileMock)
|
|
73
|
-
|
|
74
|
-
# Assert
|
|
75
|
-
assert_equal(local_podspec, [
|
|
76
|
-
"boost",
|
|
77
|
-
"DoubleConversion"
|
|
78
|
-
])
|
|
79
|
-
assert_equal(DirMock.glob_invocation, ["#{react_native_path}/third-party-podspecs/*"])
|
|
80
|
-
assert_equal(FileMock.exist_invocation_params, [
|
|
81
|
-
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "boost.podspec.json"),
|
|
82
|
-
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "DoubleConversion.podspec.json"),
|
|
83
|
-
])
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# ======================================== #
|
|
87
|
-
# Test - Patch Detect Changes With Podfile #
|
|
88
|
-
# ======================================== #
|
|
89
|
-
def test_patchDetectChangesWithPodfile_whenAlreadyChanged_returnSameChangeSet()
|
|
90
|
-
local_pods = [
|
|
91
|
-
"boost",
|
|
92
|
-
"DoubleConversion"
|
|
93
|
-
]
|
|
94
|
-
LocalPodspecPatch.mock_local_podspecs(local_pods)
|
|
95
|
-
changes = {
|
|
96
|
-
:unchanged => ["some_pod"],
|
|
97
|
-
:changed => ["boost", "DoubleConversion", "another_pod"]
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
Pod::Lockfile.prepend(LocalPodspecPatch)
|
|
101
|
-
|
|
102
|
-
new_changes = Pod::Lockfile.new().patch_detect_changes_with_podfile(changes)
|
|
103
|
-
|
|
104
|
-
assert_equal(new_changes, {
|
|
105
|
-
:unchanged => ["some_pod"],
|
|
106
|
-
:changed => ["boost", "DoubleConversion", "another_pod"]
|
|
107
|
-
})
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
def test_patchDetectChangesWithPodfile_whenLocalPodsUnchanged_movesLocalPodsToChangeSet()
|
|
111
|
-
pods = [
|
|
112
|
-
"boost",
|
|
113
|
-
"DoubleConversion"
|
|
114
|
-
]
|
|
115
|
-
LocalPodspecPatch.mock_local_podspecs(pods)
|
|
116
|
-
changes = {
|
|
117
|
-
:unchanged => ["first_pod", "boost", "DoubleConversion"],
|
|
118
|
-
:changed => ["another_pod"]
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
Pod::Lockfile.prepend(LocalPodspecPatch)
|
|
122
|
-
|
|
123
|
-
new_changes = Pod::Lockfile.new().patch_detect_changes_with_podfile(changes)
|
|
124
|
-
|
|
125
|
-
assert_equal(new_changes, {
|
|
126
|
-
:unchanged => ["first_pod"],
|
|
127
|
-
:changed => ["another_pod", "boost", "DoubleConversion"]
|
|
128
|
-
})
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# ========= #
|
|
132
|
-
# Utilities #
|
|
133
|
-
# ========= #
|
|
134
|
-
def prepare_PodsToUpdate_test_withMatchingVersions(react_native_path, globs, mocked_pwd)
|
|
135
|
-
FileMock.mocked_existing_files([
|
|
136
|
-
"a/path/to/Pods/Local Podspecs/boost.podspec.json",
|
|
137
|
-
"a/path/to/Pods/Local Podspecs/DoubleConversion.podspec.json"
|
|
138
|
-
])
|
|
139
|
-
FileMock.files_to_read({
|
|
140
|
-
"a/path/to/Pods/Local Podspecs/boost.podspec.json" => "{ \"version\": \"0.0.1\"}",
|
|
141
|
-
"a/path/to/Pods/Local Podspecs/DoubleConversion.podspec.json" => "{ \"version\": \"1.0.1\"}",
|
|
142
|
-
})
|
|
143
|
-
DirMock.mocked_existing_globs(globs, "#{react_native_path}/third-party-podspecs/*")
|
|
144
|
-
DirMock.set_pwd(mocked_pwd)
|
|
145
|
-
Pod::Specification.specs_from_file({
|
|
146
|
-
"../node_modules/react-native/third-party-podspecs/boost.podspec" => Pod::PodSpecMock.new(:version => "0.0.1"),
|
|
147
|
-
"../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" => Pod::PodSpecMock.new(:version => "1.0.1"),
|
|
148
|
-
})
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def prepare_PodsToUpdate_test_withDifferentVersions(react_native_path, globs, mocked_pwd)
|
|
152
|
-
FileMock.mocked_existing_files([
|
|
153
|
-
"a/path/to/Pods/Local Podspecs/boost.podspec.json",
|
|
154
|
-
"a/path/to/Pods/Local Podspecs/DoubleConversion.podspec.json"
|
|
155
|
-
])
|
|
156
|
-
FileMock.files_to_read({
|
|
157
|
-
"a/path/to/Pods/Local Podspecs/boost.podspec.json" => "{ \"version\": \"0.0.1\"}",
|
|
158
|
-
"a/path/to/Pods/Local Podspecs/DoubleConversion.podspec.json" => "{ \"version\": \"1.0.1\"}",
|
|
159
|
-
})
|
|
160
|
-
DirMock.mocked_existing_globs(globs, "#{react_native_path}/third-party-podspecs/*")
|
|
161
|
-
DirMock.set_pwd(mocked_pwd)
|
|
162
|
-
Pod::Specification.specs_from_file({
|
|
163
|
-
"../node_modules/react-native/third-party-podspecs/boost.podspec" => Pod::PodSpecMock.new(:version => "0.1.1"),
|
|
164
|
-
"../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" => Pod::PodSpecMock.new(:version => "1.1.1"),
|
|
165
|
-
})
|
|
166
|
-
end
|
|
167
|
-
end
|