react-native-tvos 0.72.4-0rc1 → 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/Core/ReactNativeVersion.js +2 -2
- package/README-core.md +147 -0
- package/README.md +4 -3
- 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/RCTThirdPartyFabricComponentsProvider.h +29 -0
- package/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm +29 -0
- package/ReactAndroid/gradle.properties +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/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/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 +2 -2
- 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,303 +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 "../new_architecture.rb"
|
|
8
|
-
require_relative "./test_utils/InstallerMock.rb"
|
|
9
|
-
require_relative "./test_utils/PodMock.rb"
|
|
10
|
-
require_relative "./test_utils/SpecMock.rb"
|
|
11
|
-
|
|
12
|
-
class NewArchitectureTests < Test::Unit::TestCase
|
|
13
|
-
def teardown
|
|
14
|
-
Pod::UI.reset()
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# ============================= #
|
|
18
|
-
# Test - Set Clang Cxx Lang Std #
|
|
19
|
-
# ============================= #
|
|
20
|
-
|
|
21
|
-
def test_setClangCxxLanguageStandardIfNeeded_whenReactCoreIsPresent
|
|
22
|
-
installer = prepare_mocked_installer_with_react_core
|
|
23
|
-
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
|
|
24
|
-
|
|
25
|
-
assert_equal(installer.aggregate_targets[0].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
|
26
|
-
assert_equal(installer.aggregate_targets[1].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
|
27
|
-
assert_equal(installer.pods_project.targets[1].received_resolved_build_setting_parameters, [ReceivedCommonResolvedBuildSettings.new("CLANG_CXX_LANGUAGE_STANDARD", true)])
|
|
28
|
-
assert_equal(Pod::UI.collected_messages, ["Setting CLANG_CXX_LANGUAGE_STANDARD to c++17 on /test/path.xcproj", "Setting CLANG_CXX_LANGUAGE_STANDARD to c++17 on /test/path2.xcproj"])
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_setClangCxxLanguageStandardIfNeeded_whenReactCoreIsNotPresent
|
|
32
|
-
installer = prepare_mocked_installer_without_react_core
|
|
33
|
-
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
|
|
34
|
-
|
|
35
|
-
assert_equal(installer.aggregate_targets[0].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], nil)
|
|
36
|
-
assert_equal(installer.aggregate_targets[1].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], nil)
|
|
37
|
-
assert_equal(installer.pods_project.targets[0].received_resolved_build_setting_parameters, [])
|
|
38
|
-
assert_equal(Pod::UI.collected_messages, [])
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def test_setClangCxxLanguageStandardIfNeeded_whenThereAreDifferentValuesForLanguageStandard_takesTheFirstValue
|
|
42
|
-
installer = prepare_mocked_installer_with_react_core_and_different_language_standards
|
|
43
|
-
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
|
|
44
|
-
|
|
45
|
-
assert_equal(installer.aggregate_targets[0].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
|
46
|
-
assert_equal(installer.aggregate_targets[1].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
|
47
|
-
assert_equal(installer.pods_project.targets[1].received_resolved_build_setting_parameters, [ReceivedCommonResolvedBuildSettings.new("CLANG_CXX_LANGUAGE_STANDARD", true)])
|
|
48
|
-
assert_equal(Pod::UI.collected_messages, ["Setting CLANG_CXX_LANGUAGE_STANDARD to c++17 on /test/path.xcproj", "Setting CLANG_CXX_LANGUAGE_STANDARD to c++17 on /test/path2.xcproj"])
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# =================== #
|
|
52
|
-
# Test - Modify Flags #
|
|
53
|
-
# =================== #
|
|
54
|
-
def test_modifyFlagsForNewArch_whenOnOldArch_doNothing
|
|
55
|
-
# Arrange
|
|
56
|
-
first_xcconfig = prepare_xcconfig("First")
|
|
57
|
-
second_xcconfig = prepare_xcconfig("Second")
|
|
58
|
-
react_core_debug_config = prepare_CXX_Flags_build_configuration("Debug")
|
|
59
|
-
react_core_release_config = prepare_CXX_Flags_build_configuration("Release")
|
|
60
|
-
yoga_debug_config = prepare_CXX_Flags_build_configuration("Debug")
|
|
61
|
-
yoga_release_config = prepare_CXX_Flags_build_configuration("Release")
|
|
62
|
-
|
|
63
|
-
installer = prepare_installer_for_cpp_flags(
|
|
64
|
-
[ first_xcconfig, second_xcconfig ],
|
|
65
|
-
{
|
|
66
|
-
"React-Core" => [ react_core_debug_config, react_core_release_config ],
|
|
67
|
-
"Yoga" => [ yoga_debug_config, yoga_release_config ],
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
# Act
|
|
71
|
-
NewArchitectureHelper.modify_flags_for_new_architecture(installer, false)
|
|
72
|
-
|
|
73
|
-
# Assert
|
|
74
|
-
assert_equal(first_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
|
|
75
|
-
assert_equal(first_xcconfig.save_as_invocation, [])
|
|
76
|
-
assert_equal(second_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
|
|
77
|
-
assert_equal(second_xcconfig.save_as_invocation, [])
|
|
78
|
-
assert_equal(react_core_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
|
|
79
|
-
assert_equal(react_core_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
|
|
80
|
-
assert_equal(yoga_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
|
|
81
|
-
assert_equal(yoga_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def test_modifyFlagsForNewArch_whenOnNewArchAndIsRelease_updateFlags
|
|
85
|
-
# Arrange
|
|
86
|
-
first_xcconfig = prepare_xcconfig("First")
|
|
87
|
-
second_xcconfig = prepare_xcconfig("Second")
|
|
88
|
-
react_core_debug_config = prepare_CXX_Flags_build_configuration("Debug")
|
|
89
|
-
react_core_release_config = prepare_CXX_Flags_build_configuration("Release")
|
|
90
|
-
yoga_debug_config = prepare_CXX_Flags_build_configuration("Debug")
|
|
91
|
-
yoga_release_config = prepare_CXX_Flags_build_configuration("Release")
|
|
92
|
-
|
|
93
|
-
installer = prepare_installer_for_cpp_flags(
|
|
94
|
-
[ first_xcconfig, second_xcconfig ],
|
|
95
|
-
{
|
|
96
|
-
"React-Core" => [ react_core_debug_config, react_core_release_config ],
|
|
97
|
-
"Yoga" => [ yoga_debug_config, yoga_release_config ],
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
# Act
|
|
101
|
-
NewArchitectureHelper.modify_flags_for_new_architecture(installer, true)
|
|
102
|
-
|
|
103
|
-
# Assert
|
|
104
|
-
assert_equal(first_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
|
|
105
|
-
assert_nil(first_xcconfig.attributes["OTHER_CFLAGS"])
|
|
106
|
-
assert_equal(first_xcconfig.save_as_invocation, ["a/path/First.xcconfig"])
|
|
107
|
-
assert_equal(second_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
|
|
108
|
-
assert_nil(second_xcconfig.attributes["OTHER_CFLAGS"])
|
|
109
|
-
assert_equal(second_xcconfig.save_as_invocation, ["a/path/Second.xcconfig"])
|
|
110
|
-
assert_equal(react_core_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
|
|
111
|
-
assert_nil(react_core_debug_config.build_settings["OTHER_CFLAGS"])
|
|
112
|
-
assert_equal(react_core_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DNDEBUG")
|
|
113
|
-
assert_equal(react_core_release_config.build_settings["OTHER_CFLAGS"], "$(inherited) -DNDEBUG")
|
|
114
|
-
assert_equal(yoga_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
|
|
115
|
-
assert_nil(yoga_debug_config.build_settings["OTHER_CFLAGS"])
|
|
116
|
-
assert_equal(yoga_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DNDEBUG")
|
|
117
|
-
assert_equal(yoga_release_config.build_settings["OTHER_CFLAGS"], "$(inherited) -DNDEBUG")
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
# =================================== #
|
|
121
|
-
# Test - install Modules Dependencies #
|
|
122
|
-
# =================================== #
|
|
123
|
-
def test_installModulesDependencies_whenNewArchEnabledAndNewArchAndNoSearchPathsNorCompilerFlagsArePresent_itInstallDependencies
|
|
124
|
-
# Arrange
|
|
125
|
-
spec = SpecMock.new
|
|
126
|
-
|
|
127
|
-
# Act
|
|
128
|
-
NewArchitectureHelper.install_modules_dependencies(spec, true, '2021.07.22.00')
|
|
129
|
-
|
|
130
|
-
# Assert
|
|
131
|
-
assert_equal(spec.compiler_flags, NewArchitectureHelper.folly_compiler_flags)
|
|
132
|
-
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"")
|
|
133
|
-
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
|
134
|
-
assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1")
|
|
135
|
-
assert_equal(
|
|
136
|
-
spec.dependencies,
|
|
137
|
-
[
|
|
138
|
-
{ :dependency_name => "React-Core" },
|
|
139
|
-
{ :dependency_name => "RCT-Folly", "version"=>"2021.07.22.00" },
|
|
140
|
-
{ :dependency_name => "React-RCTFabric" },
|
|
141
|
-
{ :dependency_name => "React-Codegen" },
|
|
142
|
-
{ :dependency_name => "RCTRequired" },
|
|
143
|
-
{ :dependency_name => "RCTTypeSafety" },
|
|
144
|
-
{ :dependency_name => "ReactCommon/turbomodule/bridging" },
|
|
145
|
-
{ :dependency_name => "ReactCommon/turbomodule/core" },
|
|
146
|
-
{ :dependency_name => "React-NativeModulesApple" },
|
|
147
|
-
{ :dependency_name => "Yoga" },
|
|
148
|
-
{ :dependency_name => "React-Fabric" },
|
|
149
|
-
{ :dependency_name => "React-graphics" },
|
|
150
|
-
{ :dependency_name => "React-utils" },
|
|
151
|
-
{ :dependency_name => "React-debug" },
|
|
152
|
-
{ :dependency_name => "hermes-engine" }
|
|
153
|
-
])
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompilerFlagsArePresent_itInstallDependenciesAndPreserveOtherSettings
|
|
157
|
-
# Arrange
|
|
158
|
-
spec = SpecMock.new
|
|
159
|
-
spec.compiler_flags = '-Wno-nullability-completeness'
|
|
160
|
-
other_flags = "\"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\""
|
|
161
|
-
spec.pod_target_xcconfig = {
|
|
162
|
-
"HEADER_SEARCH_PATHS" => other_flags
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
# Act
|
|
166
|
-
NewArchitectureHelper.install_modules_dependencies(spec, false, '2021.07.22.00')
|
|
167
|
-
|
|
168
|
-
# Assert
|
|
169
|
-
assert_equal(spec.compiler_flags, "-Wno-nullability-completeness #{NewArchitectureHelper.folly_compiler_flags}")
|
|
170
|
-
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\"")
|
|
171
|
-
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++17")
|
|
172
|
-
assert_equal(
|
|
173
|
-
spec.dependencies,
|
|
174
|
-
[
|
|
175
|
-
{ :dependency_name => "React-Core" },
|
|
176
|
-
{ :dependency_name => "RCT-Folly", "version"=>"2021.07.22.00" },
|
|
177
|
-
]
|
|
178
|
-
)
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# ================ #
|
|
183
|
-
# Test - Utilities #
|
|
184
|
-
# ================ #
|
|
185
|
-
def prepare_mocked_installer_with_react_core
|
|
186
|
-
return InstallerMock.new(
|
|
187
|
-
PodsProjectMock.new([
|
|
188
|
-
TargetMock.new(
|
|
189
|
-
"YogaKit",
|
|
190
|
-
[
|
|
191
|
-
BuildConfigurationMock.new("Debug"),
|
|
192
|
-
BuildConfigurationMock.new("Release"),
|
|
193
|
-
]
|
|
194
|
-
),
|
|
195
|
-
TargetMock.new(
|
|
196
|
-
"React-Core",
|
|
197
|
-
[
|
|
198
|
-
BuildConfigurationMock.new("Debug", { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }),
|
|
199
|
-
BuildConfigurationMock.new("Release", { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }),
|
|
200
|
-
]
|
|
201
|
-
)
|
|
202
|
-
]
|
|
203
|
-
),
|
|
204
|
-
[
|
|
205
|
-
AggregatedProjectMock.new(
|
|
206
|
-
UserProjectMock.new("/test/path.xcproj", [BuildConfigurationMock.new("Debug")])
|
|
207
|
-
),
|
|
208
|
-
AggregatedProjectMock.new(
|
|
209
|
-
UserProjectMock.new("/test/path2.xcproj", [BuildConfigurationMock.new("Debug")])
|
|
210
|
-
),
|
|
211
|
-
]
|
|
212
|
-
)
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
def prepare_mocked_installer_with_react_core_and_different_language_standards
|
|
216
|
-
return InstallerMock.new(
|
|
217
|
-
PodsProjectMock.new([
|
|
218
|
-
TargetMock.new(
|
|
219
|
-
"YogaKit",
|
|
220
|
-
[
|
|
221
|
-
BuildConfigurationMock.new("Debug"),
|
|
222
|
-
BuildConfigurationMock.new("Release"),
|
|
223
|
-
]
|
|
224
|
-
),
|
|
225
|
-
TargetMock.new(
|
|
226
|
-
"React-Core",
|
|
227
|
-
[
|
|
228
|
-
BuildConfigurationMock.new("Debug", { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }),
|
|
229
|
-
BuildConfigurationMock.new("Release", { "CLANG_CXX_LANGUAGE_STANDARD" => "new" }),
|
|
230
|
-
]
|
|
231
|
-
)
|
|
232
|
-
]
|
|
233
|
-
),
|
|
234
|
-
[
|
|
235
|
-
AggregatedProjectMock.new(
|
|
236
|
-
UserProjectMock.new("/test/path.xcproj", [BuildConfigurationMock.new("Debug")])
|
|
237
|
-
),
|
|
238
|
-
AggregatedProjectMock.new(
|
|
239
|
-
UserProjectMock.new("/test/path2.xcproj", [BuildConfigurationMock.new("Debug")])
|
|
240
|
-
),
|
|
241
|
-
]
|
|
242
|
-
)
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
def prepare_mocked_installer_without_react_core
|
|
246
|
-
return InstallerMock.new(
|
|
247
|
-
PodsProjectMock.new([
|
|
248
|
-
TargetMock.new(
|
|
249
|
-
"YogaKit",
|
|
250
|
-
[
|
|
251
|
-
BuildConfigurationMock.new("Debug"),
|
|
252
|
-
BuildConfigurationMock.new("Release"),
|
|
253
|
-
]
|
|
254
|
-
)
|
|
255
|
-
]
|
|
256
|
-
),
|
|
257
|
-
[
|
|
258
|
-
AggregatedProjectMock.new(
|
|
259
|
-
UserProjectMock.new("/test/path.xcproj", [BuildConfigurationMock.new("Debug")])
|
|
260
|
-
),
|
|
261
|
-
AggregatedProjectMock.new(
|
|
262
|
-
UserProjectMock.new("/test/path2.xcproj", [BuildConfigurationMock.new("Debug")])
|
|
263
|
-
),
|
|
264
|
-
]
|
|
265
|
-
)
|
|
266
|
-
end
|
|
267
|
-
|
|
268
|
-
def prepare_xcconfig(name)
|
|
269
|
-
return XCConfigMock.new(name, :attributes => {"OTHER_CPLUSPLUSFLAGS" => "$(inherited)"})
|
|
270
|
-
end
|
|
271
|
-
|
|
272
|
-
def prepare_CXX_Flags_build_configuration(name)
|
|
273
|
-
return BuildConfigurationMock.new(name, {
|
|
274
|
-
"OTHER_CPLUSPLUSFLAGS" => "$(inherited)"
|
|
275
|
-
})
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
def prepare_pod_target_installation_results_mock(name, configs)
|
|
279
|
-
target = TargetMock.new(name, configs)
|
|
280
|
-
return TargetInstallationResultMock.new(target, target)
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
def prepare_installer_for_cpp_flags(xcconfigs, build_configs)
|
|
284
|
-
xcconfigs_map = {}
|
|
285
|
-
xcconfigs.each do |config|
|
|
286
|
-
xcconfigs_map[config.name.to_s] = config
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
pod_target_installation_results_map = {}
|
|
290
|
-
build_configs.each do |name, build_configs|
|
|
291
|
-
pod_target_installation_results_map[name.to_s] = prepare_pod_target_installation_results_mock(
|
|
292
|
-
name.to_s, build_configs
|
|
293
|
-
)
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
return InstallerMock.new(
|
|
297
|
-
PodsProjectMock.new,
|
|
298
|
-
[
|
|
299
|
-
AggregatedProjectMock.new(:xcconfigs => xcconfigs_map, :base_path => "a/path/")
|
|
300
|
-
],
|
|
301
|
-
:pod_target_installation_results => pod_target_installation_results_map
|
|
302
|
-
)
|
|
303
|
-
end
|
|
@@ -1,21 +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
|
-
class CodegenScriptPhaseExtractorMock
|
|
7
|
-
|
|
8
|
-
attr_reader :extract_script_phase_params
|
|
9
|
-
@script_phase
|
|
10
|
-
|
|
11
|
-
def initialize(script_phase)
|
|
12
|
-
@script_phase = script_phase
|
|
13
|
-
@extract_script_phase_params = []
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def extract_script_phase(options)
|
|
17
|
-
@extract_script_phase_params.push(options)
|
|
18
|
-
return @script_phase
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
@@ -1,108 +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
|
-
class CodegenUtilsMock
|
|
7
|
-
@js_spec_list
|
|
8
|
-
@codegen_config
|
|
9
|
-
|
|
10
|
-
@react_codegen_script_phases
|
|
11
|
-
@react_codegen_spec
|
|
12
|
-
|
|
13
|
-
attr_reader :get_codegen_config_from_file_params
|
|
14
|
-
attr_reader :get_list_of_js_specs_params
|
|
15
|
-
attr_reader :get_react_codegen_script_phases_params
|
|
16
|
-
attr_reader :get_react_codegen_spec_params
|
|
17
|
-
attr_reader :generate_react_codegen_spec_params
|
|
18
|
-
attr_reader :use_react_native_codegen_discovery_params
|
|
19
|
-
|
|
20
|
-
def initialize(js_spec_list: [], codegen_config: {}, react_codegen_script_phases: "", react_codegen_spec: {})
|
|
21
|
-
@js_spec_list = js_spec_list
|
|
22
|
-
@codegen_config = codegen_config
|
|
23
|
-
@get_codegen_config_from_file_params = []
|
|
24
|
-
@get_list_of_js_specs_params = []
|
|
25
|
-
|
|
26
|
-
@react_codegen_script_phases = react_codegen_script_phases
|
|
27
|
-
@react_codegen_spec = react_codegen_spec
|
|
28
|
-
@get_react_codegen_script_phases_params = []
|
|
29
|
-
@get_react_codegen_spec_params = []
|
|
30
|
-
@generate_react_codegen_spec_params = []
|
|
31
|
-
@use_react_native_codegen_discovery_params = []
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def get_codegen_config_from_file(config_path, config_key)
|
|
35
|
-
@get_codegen_config_from_file_params.push({
|
|
36
|
-
"config_path" => config_path,
|
|
37
|
-
"config_key" => config_key
|
|
38
|
-
})
|
|
39
|
-
return @codegen_config
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def get_list_of_js_specs(app_codegen_config, app_path)
|
|
43
|
-
@get_list_of_js_specs_params.push({
|
|
44
|
-
"app_codegen_config" => app_codegen_config,
|
|
45
|
-
"app_path" => app_path
|
|
46
|
-
})
|
|
47
|
-
return @js_spec_list
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def get_react_codegen_script_phases(
|
|
51
|
-
app_path,
|
|
52
|
-
fabric_enabled: false,
|
|
53
|
-
config_file_dir: '',
|
|
54
|
-
react_native_path: "../node_modules/react-native",
|
|
55
|
-
config_key: 'codegenConfig',
|
|
56
|
-
codegen_utils: CodegenUtils.new(),
|
|
57
|
-
script_phase_extractor: CodegenScriptPhaseExtractor.new()
|
|
58
|
-
)
|
|
59
|
-
@get_react_codegen_script_phases_params.push({
|
|
60
|
-
app_path: app_path,
|
|
61
|
-
fabric_enabled: fabric_enabled,
|
|
62
|
-
config_file_dir: config_file_dir,
|
|
63
|
-
react_native_path: react_native_path,
|
|
64
|
-
config_key: config_key
|
|
65
|
-
})
|
|
66
|
-
return @react_codegen_script_phases
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fabric_enabled: false, hermes_enabled: true, script_phases: nil)
|
|
70
|
-
@get_react_codegen_spec_params.push({
|
|
71
|
-
package_json_file: package_json_file,
|
|
72
|
-
folly_version: folly_version,
|
|
73
|
-
fabric_enabled: fabric_enabled,
|
|
74
|
-
script_phases: script_phases
|
|
75
|
-
})
|
|
76
|
-
return @react_codegen_spec
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def generate_react_codegen_podspec!(react_codegen_spec, codegen_output_dir)
|
|
80
|
-
@generate_react_codegen_spec_params.push({
|
|
81
|
-
react_codegen_spec: react_codegen_spec,
|
|
82
|
-
codegen_output_dir: codegen_output_dir
|
|
83
|
-
})
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def use_react_native_codegen_discovery!(
|
|
87
|
-
codegen_disabled,
|
|
88
|
-
app_path,
|
|
89
|
-
react_native_path: "../node_modules/react-native",
|
|
90
|
-
fabric_enabled: false,
|
|
91
|
-
hermes_enabled: true,
|
|
92
|
-
config_file_dir: '',
|
|
93
|
-
codegen_output_dir: 'build/generated/ios',
|
|
94
|
-
config_key: 'codegenConfig',
|
|
95
|
-
folly_version: "2021.07.22.00",
|
|
96
|
-
codegen_utils: CodegenUtilsMock.new()
|
|
97
|
-
)
|
|
98
|
-
@use_react_native_codegen_discovery_params.push({
|
|
99
|
-
codegen_disabled: codegen_disabled,
|
|
100
|
-
app_path: app_path,
|
|
101
|
-
react_native_path: react_native_path,
|
|
102
|
-
fabric_enabled: fabric_enabled,
|
|
103
|
-
config_file_dir: config_file_dir,
|
|
104
|
-
codegen_output_dir: codegen_output_dir,
|
|
105
|
-
folly_version: folly_version
|
|
106
|
-
})
|
|
107
|
-
end
|
|
108
|
-
end
|
|
@@ -1,72 +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
|
-
class DirMock < Dir
|
|
7
|
-
@@exist_invocation_params = []
|
|
8
|
-
@@mocked_existing_dirs = []
|
|
9
|
-
|
|
10
|
-
@@glob_invocation = []
|
|
11
|
-
@@mocked_existing_globs = {}
|
|
12
|
-
|
|
13
|
-
@@pwd = nil
|
|
14
|
-
|
|
15
|
-
# Monkey patched exists? method.
|
|
16
|
-
# It is used also by the test runner, so it can't start monkey patched
|
|
17
|
-
# To use this, invoke the `is_testing` method before starting your test.
|
|
18
|
-
# Remember to invoke `reset` after the test.
|
|
19
|
-
def self.exist?(path)
|
|
20
|
-
@@exist_invocation_params.push(path)
|
|
21
|
-
return @@mocked_existing_dirs.include?(path)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Getter for the `exist_invocation_params` to check that the exist method
|
|
25
|
-
# is invoked with the right parameters
|
|
26
|
-
def self.exist_invocation_params()
|
|
27
|
-
return @@exist_invocation_params
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# Set the list of dirs the test must return as existing
|
|
31
|
-
def self.mocked_existing_dirs(dirs)
|
|
32
|
-
@@mocked_existing_dirs = dirs
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Set what the `glob` function should return
|
|
36
|
-
def self.mocked_existing_globs(globs, path)
|
|
37
|
-
@@mocked_existing_globs[path] = globs
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def self.glob_invocation
|
|
41
|
-
return @@glob_invocation
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def self.glob(path)
|
|
45
|
-
@@glob_invocation.push(path)
|
|
46
|
-
return @@mocked_existing_globs[path] != nil ? @@mocked_existing_globs[path] : []
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def self.remove_mocked_paths(path)
|
|
50
|
-
@@mocked_existing_globs = @@mocked_existing_globs.select { |k, v| v != path }
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def self.set_pwd(pwd)
|
|
54
|
-
@@pwd = pwd
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def self.pwd
|
|
58
|
-
if @@pwd != nil
|
|
59
|
-
return @@pwd
|
|
60
|
-
end
|
|
61
|
-
return pwd
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
# Resets all the settings for the File mock
|
|
65
|
-
def self.reset()
|
|
66
|
-
@@pwd = nil
|
|
67
|
-
@@mocked_existing_dirs = []
|
|
68
|
-
@@exist_invocation_params = []
|
|
69
|
-
@@glob_invocation = []
|
|
70
|
-
@@mocked_existing_globs = {}
|
|
71
|
-
end
|
|
72
|
-
end
|
|
@@ -1,21 +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
|
-
# Mock object for the Environment
|
|
7
|
-
class Environment
|
|
8
|
-
@@RUBY_PLATFORM = "arm64-darwin21"
|
|
9
|
-
|
|
10
|
-
def ruby_platform
|
|
11
|
-
return @@RUBY_PLATFORM
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
def self.set_ruby_platform(newPlatform)
|
|
15
|
-
@@RUBY_PLATFORM = newPlatform
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def self.reset()
|
|
19
|
-
@@RUBY_PLATFORM = "arm64-darwin21"
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,113 +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
|
-
class FileMock < File
|
|
7
|
-
@@exist_invocation_params = []
|
|
8
|
-
@@mocked_existing_files = []
|
|
9
|
-
|
|
10
|
-
@@delete_invocation_count = 0
|
|
11
|
-
@@deleted_files = []
|
|
12
|
-
|
|
13
|
-
@@open_files_with_mode = {}
|
|
14
|
-
@@open_invocation_count = 0
|
|
15
|
-
|
|
16
|
-
@@open_files = []
|
|
17
|
-
|
|
18
|
-
@@files_to_read = {}
|
|
19
|
-
attr_reader :collected_write
|
|
20
|
-
attr_reader :fsync_invocation_count
|
|
21
|
-
|
|
22
|
-
def initialize()
|
|
23
|
-
@collected_write = []
|
|
24
|
-
@fsync_invocation_count = 0
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Monkey patched exists? method.
|
|
28
|
-
# It is used also by the test runner, so it can't start monkey patched
|
|
29
|
-
# To use this, invoke the `is_testing` method before starting your test.
|
|
30
|
-
# Remember to invoke `reset` after the test.
|
|
31
|
-
def self.exist?(path)
|
|
32
|
-
@@exist_invocation_params.push(path)
|
|
33
|
-
return @@mocked_existing_files.include?(path)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def self.delete(path)
|
|
37
|
-
@@delete_invocation_count += 1
|
|
38
|
-
@@deleted_files.push(path)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def self.delete_invocation_count
|
|
42
|
-
return @@delete_invocation_count
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def self.deleted_files
|
|
46
|
-
return @@deleted_files
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# Getter for the `exist_invocation_params` to check that the exist method
|
|
50
|
-
# is invoked the right number of times with the right parameters
|
|
51
|
-
def self.exist_invocation_params()
|
|
52
|
-
return @@exist_invocation_params
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Set the list of files the test must return as existing
|
|
56
|
-
def self.mocked_existing_files(files)
|
|
57
|
-
@@mocked_existing_files = files
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def self.open(path, mode, &block)
|
|
61
|
-
@@open_files_with_mode[path] = mode
|
|
62
|
-
@@open_invocation_count += 1
|
|
63
|
-
file = FileMock.new()
|
|
64
|
-
@@open_files.push(file)
|
|
65
|
-
yield(file)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def self.open_files_with_mode
|
|
69
|
-
return @@open_files_with_mode
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def self.open_invocation_count
|
|
73
|
-
return @@open_invocation_count
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def self.open_files
|
|
77
|
-
return @@open_files
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def self.file_invocation_params
|
|
81
|
-
return @@file_invocation_params
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
def write(text)
|
|
85
|
-
@collected_write.push(text.to_s)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def fsync()
|
|
89
|
-
@fsync_invocation_count += 1
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
def self.files_to_read(files)
|
|
94
|
-
@@files_to_read = files
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def self.read(filepath)
|
|
98
|
-
return @@files_to_read[filepath]
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# Resets all the settings for the File mock
|
|
102
|
-
def self.reset()
|
|
103
|
-
@@delete_invocation_count = 0
|
|
104
|
-
@@deleted_files = []
|
|
105
|
-
@@open_files = []
|
|
106
|
-
@@open_files_with_mode = {}
|
|
107
|
-
@@open_invocation_count = 0
|
|
108
|
-
@@mocked_existing_files = []
|
|
109
|
-
@@file_invocation_params = []
|
|
110
|
-
@@exist_invocation_params = []
|
|
111
|
-
@@files_to_read = {}
|
|
112
|
-
end
|
|
113
|
-
end
|
|
@@ -1,40 +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_relative './DirMock.rb'
|
|
7
|
-
|
|
8
|
-
module FileUtils
|
|
9
|
-
class FileUtilsStorage
|
|
10
|
-
@@RMRF_INVOCATION_COUNT = 0
|
|
11
|
-
@@RMRF_PATHS = []
|
|
12
|
-
|
|
13
|
-
def self.rmrf_invocation_count
|
|
14
|
-
return @@RMRF_INVOCATION_COUNT
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def self.increase_rmrfi_invocation_count
|
|
18
|
-
@@RMRF_INVOCATION_COUNT += 1
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def self.rmrf_paths
|
|
22
|
-
return @@RMRF_PATHS
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def self.push_rmrf_path(path)
|
|
26
|
-
@@RMRF_PATHS.push(path)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def self.reset
|
|
30
|
-
@@RMRF_INVOCATION_COUNT = 0
|
|
31
|
-
@@RMRF_PATHS = []
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def self.rm_rf(path)
|
|
36
|
-
FileUtilsStorage.push_rmrf_path(path)
|
|
37
|
-
FileUtilsStorage.increase_rmrfi_invocation_count
|
|
38
|
-
DirMock.remove_mocked_paths(path)
|
|
39
|
-
end
|
|
40
|
-
end
|