react-native-tvos 0.72.4-0rc1 → 0.72.6-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/Libraries/vendor/emitter/EventEmitter.js +3 -1
- 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/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/shell/MainReactPackage.java +5 -0
- 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/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 +8 -7
- package/scripts/cocoapods/helpers.rb +16 -0
- package/scripts/cocoapods/utils.rb +104 -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/linux64-bin/hermesc +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/Gemfile +2 -1
- 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/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.java +0 -98
- 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,766 +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 "../utils.rb"
|
|
8
|
-
require_relative "../flipper.rb"
|
|
9
|
-
require_relative "./test_utils/PodMock.rb"
|
|
10
|
-
require_relative "./test_utils/InstallerMock.rb"
|
|
11
|
-
require_relative "./test_utils/EnvironmentMock.rb"
|
|
12
|
-
require_relative "./test_utils/SysctlCheckerMock.rb"
|
|
13
|
-
require_relative "./test_utils/FileMock.rb"
|
|
14
|
-
require_relative "./test_utils/systemUtils.rb"
|
|
15
|
-
require_relative "./test_utils/PathnameMock.rb"
|
|
16
|
-
require_relative "./test_utils/TargetDefinitionMock.rb"
|
|
17
|
-
|
|
18
|
-
class UtilsTests < Test::Unit::TestCase
|
|
19
|
-
def setup
|
|
20
|
-
@base_path = "~/app/ios"
|
|
21
|
-
Pathname.pwd!(@base_path)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def teardown
|
|
25
|
-
FileMock.reset()
|
|
26
|
-
Pod::UI.reset()
|
|
27
|
-
Pathname.reset()
|
|
28
|
-
Pod::Config.reset()
|
|
29
|
-
SysctlChecker.reset()
|
|
30
|
-
Environment.reset()
|
|
31
|
-
ENV['RCT_NEW_ARCH_ENABLED'] = '0'
|
|
32
|
-
ENV['USE_HERMES'] = '1'
|
|
33
|
-
ENV['USE_FRAMEWORKS'] = nil
|
|
34
|
-
system_reset_commands
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# ======================= #
|
|
38
|
-
# TEST - warnIfNotOnArm64 #
|
|
39
|
-
# ======================= #
|
|
40
|
-
|
|
41
|
-
def test_warnIfNotOnArm64_whenSysctlReturnsNot1_printsNothing
|
|
42
|
-
# Arrange
|
|
43
|
-
SysctlChecker.set_call_sysctl_arm64_return_value(23)
|
|
44
|
-
Environment.set_ruby_platform("something")
|
|
45
|
-
|
|
46
|
-
# Act
|
|
47
|
-
ReactNativePodsUtils.warn_if_not_on_arm64()
|
|
48
|
-
|
|
49
|
-
# Assert
|
|
50
|
-
assert_equal(Pod::UI.collected_messages, [])
|
|
51
|
-
assert_equal(Pod::UI.collected_warns, [])
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def test_warnIfNotOnArm64_whenSysctlReturns1AndRubyIncludeArm64_printsNothing
|
|
56
|
-
# Arrange
|
|
57
|
-
SysctlChecker.set_call_sysctl_arm64_return_value(1)
|
|
58
|
-
Environment.set_ruby_platform("arm64-darwin21")
|
|
59
|
-
|
|
60
|
-
# Act
|
|
61
|
-
ReactNativePodsUtils.warn_if_not_on_arm64()
|
|
62
|
-
|
|
63
|
-
# Assert
|
|
64
|
-
assert_equal(Pod::UI.collected_messages, [])
|
|
65
|
-
assert_equal(Pod::UI.collected_warns, [])
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def test_warnIfNotOnArm64_whenSysctlReturns1AndRubyNotIncludeArm64_warns
|
|
69
|
-
# Arrange
|
|
70
|
-
SysctlChecker.set_call_sysctl_arm64_return_value(1)
|
|
71
|
-
Environment.set_ruby_platform("something else")
|
|
72
|
-
|
|
73
|
-
# Act
|
|
74
|
-
ReactNativePodsUtils.warn_if_not_on_arm64()
|
|
75
|
-
|
|
76
|
-
# Assert
|
|
77
|
-
assert_equal(Pod::UI.collected_messages, [])
|
|
78
|
-
assert_equal(Pod::UI.collected_warns, [
|
|
79
|
-
'Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).',
|
|
80
|
-
' - Emulated x86_64 is slower than native arm64',
|
|
81
|
-
' - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)',
|
|
82
|
-
'Run "env /usr/bin/arch -arm64 /bin/bash --login" then try again.',
|
|
83
|
-
])
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# ====================== #
|
|
87
|
-
# TEST - getDefaultFlags #
|
|
88
|
-
# ====================== #
|
|
89
|
-
def test_getDefaultFlag_whenOldArchitecture()
|
|
90
|
-
# Arrange
|
|
91
|
-
ENV['RCT_NEW_ARCH_ENABLED'] = '0'
|
|
92
|
-
|
|
93
|
-
# Act
|
|
94
|
-
flags = ReactNativePodsUtils.get_default_flags()
|
|
95
|
-
|
|
96
|
-
# Assert
|
|
97
|
-
assert_equal(flags, {
|
|
98
|
-
:fabric_enabled => false,
|
|
99
|
-
:hermes_enabled => true,
|
|
100
|
-
:flipper_configuration => FlipperConfiguration.disabled
|
|
101
|
-
})
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def test_getDefaultFlag_whenOldArchitectureButHermesDisabled()
|
|
105
|
-
# Arrange
|
|
106
|
-
ENV['RCT_NEW_ARCH_ENABLED'] = '0'
|
|
107
|
-
ENV['USE_HERMES'] = '0'
|
|
108
|
-
|
|
109
|
-
# Act
|
|
110
|
-
flags = ReactNativePodsUtils.get_default_flags()
|
|
111
|
-
|
|
112
|
-
# Assert
|
|
113
|
-
assert_equal(flags, {
|
|
114
|
-
:fabric_enabled => false,
|
|
115
|
-
:hermes_enabled => false,
|
|
116
|
-
:flipper_configuration => FlipperConfiguration.disabled
|
|
117
|
-
})
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def test_getDefaultFlag_whenNewArchitecture()
|
|
121
|
-
# Arrange
|
|
122
|
-
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
|
|
123
|
-
|
|
124
|
-
# Act
|
|
125
|
-
flags = ReactNativePodsUtils.get_default_flags()
|
|
126
|
-
|
|
127
|
-
# Assert
|
|
128
|
-
assert_equal(flags, {
|
|
129
|
-
:fabric_enabled => true,
|
|
130
|
-
:hermes_enabled => true,
|
|
131
|
-
:flipper_configuration => FlipperConfiguration.disabled
|
|
132
|
-
})
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def test_getDefaultFlag_whenNewArchitectureButHermesDisabled()
|
|
136
|
-
# Arrange
|
|
137
|
-
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
|
|
138
|
-
ENV['USE_HERMES'] = '0'
|
|
139
|
-
|
|
140
|
-
# Act
|
|
141
|
-
flags = ReactNativePodsUtils.get_default_flags()
|
|
142
|
-
|
|
143
|
-
# Assert
|
|
144
|
-
assert_equal(flags, {
|
|
145
|
-
:fabric_enabled => true,
|
|
146
|
-
:hermes_enabled => false,
|
|
147
|
-
:flipper_configuration => FlipperConfiguration.disabled
|
|
148
|
-
})
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
# ============== #
|
|
152
|
-
# TEST - has_pod #
|
|
153
|
-
# ============== #
|
|
154
|
-
def test_hasPod_whenInstallerDoesNotHavePod_returnFalse
|
|
155
|
-
# Arrange
|
|
156
|
-
installer = InstallerMock.new(PodsProjectMock.new([], {"other_pod" => {}}))
|
|
157
|
-
|
|
158
|
-
# Act
|
|
159
|
-
result = ReactNativePodsUtils.has_pod(installer, "some_pod")
|
|
160
|
-
|
|
161
|
-
# Assert
|
|
162
|
-
assert_equal(result, false)
|
|
163
|
-
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
def test_hasPod_whenInstallerHasPod_returnTrue
|
|
167
|
-
# Arrange
|
|
168
|
-
installer = InstallerMock.new(PodsProjectMock.new([], {"some_pod" => {}}))
|
|
169
|
-
|
|
170
|
-
# Act
|
|
171
|
-
result = ReactNativePodsUtils.has_pod(installer, "some_pod")
|
|
172
|
-
|
|
173
|
-
# Assert
|
|
174
|
-
assert_equal(result, true)
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
# ============================ #
|
|
178
|
-
# Test - Exclude Architectures #
|
|
179
|
-
# ============================ #
|
|
180
|
-
def test_excludeArchitectures_whenHermesEngineIsNotIncluded_excludeNothing
|
|
181
|
-
# Arrange
|
|
182
|
-
user_project_mock = prepare_empty_user_project_mock()
|
|
183
|
-
pods_projects_mock = PodsProjectMock.new()
|
|
184
|
-
installer = InstallerMock.new(PodsProjectMock.new(), [
|
|
185
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
186
|
-
])
|
|
187
|
-
|
|
188
|
-
# Act
|
|
189
|
-
ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
|
|
190
|
-
|
|
191
|
-
# Assert
|
|
192
|
-
user_project_mock.build_configurations.each do |config|
|
|
193
|
-
assert_equal(config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"], "")
|
|
194
|
-
end
|
|
195
|
-
assert_equal(user_project_mock.save_invocation_count, 1)
|
|
196
|
-
assert_equal(pods_projects_mock.save_invocation_count, 0)
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
def test_excludeArchitectures_whenHermesEngineIsIncluded_excludeI386
|
|
200
|
-
# Arrange
|
|
201
|
-
user_project_mock = prepare_empty_user_project_mock()
|
|
202
|
-
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}})
|
|
203
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
204
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
205
|
-
])
|
|
206
|
-
|
|
207
|
-
# Act
|
|
208
|
-
ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
|
|
209
|
-
|
|
210
|
-
# Assert
|
|
211
|
-
user_project_mock.build_configurations.each do |config|
|
|
212
|
-
assert_equal(config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"], "i386")
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
assert_equal(user_project_mock.save_invocation_count, 1)
|
|
216
|
-
assert_equal(pods_projects_mock.save_invocation_count, 1)
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
# ================= #
|
|
220
|
-
# Test - Fix Config #
|
|
221
|
-
# ================= #
|
|
222
|
-
|
|
223
|
-
def test_fixLibrarySearchPath_whenThereIsNoSearchPaths_doNothing
|
|
224
|
-
# Arrange
|
|
225
|
-
buildConfig = BuildConfigurationMock.new("Debug")
|
|
226
|
-
|
|
227
|
-
# Act
|
|
228
|
-
ReactNativePodsUtils.fix_library_search_path(buildConfig)
|
|
229
|
-
|
|
230
|
-
# Assert
|
|
231
|
-
assert_nil(buildConfig.build_settings["LIBRARY_SEARCH_PATHS"])
|
|
232
|
-
end
|
|
233
|
-
|
|
234
|
-
def test_fixLibrarySearchPath_whenThereAreSearchPathsAndSwiftUnescaped_removesSwift5_5
|
|
235
|
-
# Arrange
|
|
236
|
-
buildConfig = BuildConfigurationMock.new("Debug", {"LIBRARY_SEARCH_PATHS" => [
|
|
237
|
-
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
|
|
238
|
-
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
239
|
-
"$(SDKROOT)/usr/lib/swift"
|
|
240
|
-
]})
|
|
241
|
-
|
|
242
|
-
# Act
|
|
243
|
-
ReactNativePodsUtils.fix_library_search_path(buildConfig)
|
|
244
|
-
|
|
245
|
-
# Assert
|
|
246
|
-
assert_equal(buildConfig.build_settings["LIBRARY_SEARCH_PATHS"], ["$(SDKROOT)/usr/lib/swift"])
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
def test_fixLibrarySearchPath_whenThereAreSearchPathsAndSwiftEscaped_removesSwift5_5
|
|
250
|
-
# Arrange
|
|
251
|
-
buildConfig = BuildConfigurationMock.new("Debug", {"LIBRARY_SEARCH_PATHS" => [
|
|
252
|
-
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
|
|
253
|
-
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
254
|
-
"another/path",
|
|
255
|
-
"\"$(SDKROOT)/usr/lib/swift\""
|
|
256
|
-
]})
|
|
257
|
-
|
|
258
|
-
# Act
|
|
259
|
-
ReactNativePodsUtils.fix_library_search_path(buildConfig)
|
|
260
|
-
|
|
261
|
-
# Assert
|
|
262
|
-
assert_equal(buildConfig.build_settings["LIBRARY_SEARCH_PATHS"], ["another/path", "\"$(SDKROOT)/usr/lib/swift\""])
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
def test_fixLibrarySearchPath_whenThereAreSearchPathsAndNoSwift_removesSwift5_5AndAddsSwiftAsFirst
|
|
266
|
-
# Arrange
|
|
267
|
-
buildConfig = BuildConfigurationMock.new("Debug", {"LIBRARY_SEARCH_PATHS" => [
|
|
268
|
-
"another/path"
|
|
269
|
-
]})
|
|
270
|
-
|
|
271
|
-
# Act
|
|
272
|
-
ReactNativePodsUtils.fix_library_search_path(buildConfig)
|
|
273
|
-
|
|
274
|
-
# Assert
|
|
275
|
-
assert_equal(buildConfig.build_settings["LIBRARY_SEARCH_PATHS"], ["$(SDKROOT)/usr/lib/swift", "another/path"])
|
|
276
|
-
end
|
|
277
|
-
|
|
278
|
-
# ============================== #
|
|
279
|
-
# Test - Fix Library Search Path #
|
|
280
|
-
# ============================== #
|
|
281
|
-
|
|
282
|
-
def test_fixLibrarySearchPaths_correctlySetsTheSearchPathsForAllProjects
|
|
283
|
-
first_target = prepare_target("FirstTarget")
|
|
284
|
-
second_target = prepare_target("SecondTarget")
|
|
285
|
-
third_target = prepare_target("ThirdTarget")
|
|
286
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
287
|
-
prepare_config("Debug"),
|
|
288
|
-
prepare_config("Release"),
|
|
289
|
-
],
|
|
290
|
-
:native_targets => [
|
|
291
|
-
first_target,
|
|
292
|
-
second_target
|
|
293
|
-
]
|
|
294
|
-
)
|
|
295
|
-
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
|
|
296
|
-
third_target
|
|
297
|
-
])
|
|
298
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
299
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
300
|
-
])
|
|
301
|
-
|
|
302
|
-
# Act
|
|
303
|
-
ReactNativePodsUtils.fix_library_search_paths(installer)
|
|
304
|
-
|
|
305
|
-
# Assert
|
|
306
|
-
user_project_mock.build_configurations.each do |config|
|
|
307
|
-
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], [
|
|
308
|
-
"$(SDKROOT)/usr/lib/swift", "another/path"
|
|
309
|
-
])
|
|
310
|
-
end
|
|
311
|
-
|
|
312
|
-
user_project_mock.native_targets.each do |target|
|
|
313
|
-
target.build_configurations.each do |config|
|
|
314
|
-
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], [
|
|
315
|
-
"$(SDKROOT)/usr/lib/swift", "another/path"
|
|
316
|
-
])
|
|
317
|
-
end
|
|
318
|
-
end
|
|
319
|
-
|
|
320
|
-
pods_projects_mock.native_targets.each do |target|
|
|
321
|
-
target.build_configurations.each do |config|
|
|
322
|
-
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], [
|
|
323
|
-
"$(SDKROOT)/usr/lib/swift", "another/path"
|
|
324
|
-
])
|
|
325
|
-
end
|
|
326
|
-
end
|
|
327
|
-
|
|
328
|
-
assert_equal(user_project_mock.save_invocation_count, 1)
|
|
329
|
-
assert_equal(pods_projects_mock.save_invocation_count, 1)
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
# ===================================== #
|
|
333
|
-
# Test - Apply Xcode14 React-Core patch #
|
|
334
|
-
# ===================================== #
|
|
335
|
-
|
|
336
|
-
def test_turnOffResourceBundleReactCore_correctlyAppliesPatch
|
|
337
|
-
# Arrange
|
|
338
|
-
react_core_target = TargetMock.new('React-Core')
|
|
339
|
-
react_core_target_native_target = react_core_target
|
|
340
|
-
react_core_debug_config = prepare_Code_Signing_build_configuration("Debug", "YES")
|
|
341
|
-
react_core_release_config = prepare_Code_Signing_build_configuration("Release", "YES")
|
|
342
|
-
|
|
343
|
-
hermes_engine_target = TargetMock.new('hermes-engine')
|
|
344
|
-
hermes_engine_target_native_target = hermes_engine_target
|
|
345
|
-
hermes_engine_debug_config = prepare_Code_Signing_build_configuration("Debug", "NO")
|
|
346
|
-
hermes_engine_release_config = prepare_Code_Signing_build_configuration("Release", "NO")
|
|
347
|
-
|
|
348
|
-
assets_target = TargetMock.new('assets')
|
|
349
|
-
assets_target_native_target = assets_target
|
|
350
|
-
assets_debug_config = prepare_Code_Signing_build_configuration("Debug", "YES")
|
|
351
|
-
assets_release_config = prepare_Code_Signing_build_configuration("Release", "YES")
|
|
352
|
-
|
|
353
|
-
installer = InstallerMock.new(pod_target_installation_results: {
|
|
354
|
-
'React-Core':
|
|
355
|
-
TargetInstallationResultMock.new(
|
|
356
|
-
react_core_target,
|
|
357
|
-
react_core_target_native_target,
|
|
358
|
-
[TargetMock.new('React-Core',[react_core_debug_config, react_core_release_config])]
|
|
359
|
-
),
|
|
360
|
-
'hermes-engine':
|
|
361
|
-
TargetInstallationResultMock.new(
|
|
362
|
-
hermes_engine_target,
|
|
363
|
-
hermes_engine_target_native_target,
|
|
364
|
-
[TargetMock.new('hermes-engine',[hermes_engine_debug_config, hermes_engine_release_config])]
|
|
365
|
-
),
|
|
366
|
-
'assets':
|
|
367
|
-
TargetInstallationResultMock.new(
|
|
368
|
-
assets_target,
|
|
369
|
-
assets_target_native_target,
|
|
370
|
-
[TargetMock.new('assets',[assets_debug_config, assets_release_config])]
|
|
371
|
-
),
|
|
372
|
-
})
|
|
373
|
-
|
|
374
|
-
# Act
|
|
375
|
-
ReactNativePodsUtils.turn_off_resource_bundle_react_core(installer)
|
|
376
|
-
|
|
377
|
-
# Assert
|
|
378
|
-
# these must have changed
|
|
379
|
-
assert_equal(react_core_debug_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
|
|
380
|
-
assert_equal(react_core_release_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
|
|
381
|
-
# these needs to stay the same
|
|
382
|
-
assert_equal(hermes_engine_debug_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
|
|
383
|
-
assert_equal(hermes_engine_release_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
|
|
384
|
-
assert_equal(assets_debug_config.build_settings["CODE_SIGNING_ALLOWED"], "YES")
|
|
385
|
-
assert_equal(assets_release_config.build_settings["CODE_SIGNING_ALLOWED"], "YES")
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
# ================================= #
|
|
389
|
-
# Test - Apply Mac Catalyst Patches #
|
|
390
|
-
# ================================= #
|
|
391
|
-
|
|
392
|
-
def test_applyMacCatalystPatches_correctlyAppliesNecessaryPatches
|
|
393
|
-
first_target = prepare_target("FirstTarget")
|
|
394
|
-
second_target = prepare_target("SecondTarget")
|
|
395
|
-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
|
|
396
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
397
|
-
prepare_config("Debug"),
|
|
398
|
-
prepare_config("Release"),
|
|
399
|
-
],
|
|
400
|
-
:native_targets => [
|
|
401
|
-
first_target,
|
|
402
|
-
second_target
|
|
403
|
-
]
|
|
404
|
-
)
|
|
405
|
-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}}, :native_targets => [])
|
|
406
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
407
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
408
|
-
])
|
|
409
|
-
|
|
410
|
-
# Act
|
|
411
|
-
ReactNativePodsUtils.apply_mac_catalyst_patches(installer)
|
|
412
|
-
|
|
413
|
-
# Assert
|
|
414
|
-
first_target.build_configurations.each do |config|
|
|
415
|
-
assert_nil(config.build_settings["CODE_SIGN_IDENTITY[sdk=macosx*]"])
|
|
416
|
-
end
|
|
417
|
-
|
|
418
|
-
second_target.build_configurations.each do |config|
|
|
419
|
-
assert_nil(config.build_settings["CODE_SIGN_IDENTITY[sdk=macosx*]"])
|
|
420
|
-
end
|
|
421
|
-
|
|
422
|
-
third_target.build_configurations.each do |config|
|
|
423
|
-
assert_equal(config.build_settings["CODE_SIGN_IDENTITY[sdk=macosx*]"], "-")
|
|
424
|
-
end
|
|
425
|
-
|
|
426
|
-
user_project_mock.native_targets.each do |target|
|
|
427
|
-
target.build_configurations.each do |config|
|
|
428
|
-
assert_equal(config.build_settings["DEAD_CODE_STRIPPING"], "YES")
|
|
429
|
-
assert_equal(config.build_settings["PRESERVE_DEAD_CODE_INITS_AND_TERMS"], "YES")
|
|
430
|
-
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], ["$(SDKROOT)/usr/lib/swift", "$(SDKROOT)/System/iOSSupport/usr/lib/swift", "$(inherited)"])
|
|
431
|
-
end
|
|
432
|
-
end
|
|
433
|
-
|
|
434
|
-
assert_equal(user_project_mock.save_invocation_count, 1)
|
|
435
|
-
end
|
|
436
|
-
|
|
437
|
-
# ================================= #
|
|
438
|
-
# Test - Apply Xcode 15 Patch #
|
|
439
|
-
# ================================= #
|
|
440
|
-
|
|
441
|
-
def test_applyXcode15Patch_correctlyAppliesNecessaryPatch
|
|
442
|
-
# Arrange
|
|
443
|
-
first_target = prepare_target("FirstTarget")
|
|
444
|
-
second_target = prepare_target("SecondTarget")
|
|
445
|
-
third_target = TargetMock.new("ThirdTarget", [
|
|
446
|
-
BuildConfigurationMock.new("Debug", {
|
|
447
|
-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
|
|
448
|
-
}),
|
|
449
|
-
BuildConfigurationMock.new("Release", {
|
|
450
|
-
"GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
|
|
451
|
-
}),
|
|
452
|
-
], nil)
|
|
453
|
-
|
|
454
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
455
|
-
prepare_config("Debug"),
|
|
456
|
-
prepare_config("Release"),
|
|
457
|
-
],
|
|
458
|
-
:native_targets => [
|
|
459
|
-
first_target,
|
|
460
|
-
second_target
|
|
461
|
-
]
|
|
462
|
-
)
|
|
463
|
-
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
|
|
464
|
-
third_target
|
|
465
|
-
])
|
|
466
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
467
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
468
|
-
])
|
|
469
|
-
|
|
470
|
-
# Act
|
|
471
|
-
ReactNativePodsUtils.apply_xcode_15_patch(installer)
|
|
472
|
-
|
|
473
|
-
# 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
|
-
)
|
|
478
|
-
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
|
-
)
|
|
483
|
-
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
|
-
)
|
|
488
|
-
end
|
|
489
|
-
end
|
|
490
|
-
|
|
491
|
-
# ==================================== #
|
|
492
|
-
# Test - Set Node_Modules User Setting #
|
|
493
|
-
# ==================================== #
|
|
494
|
-
|
|
495
|
-
def test_setNodeModulesUserSettings_addTheUserSetting
|
|
496
|
-
# Arrange
|
|
497
|
-
react_native_path = "react_native/node_modules"
|
|
498
|
-
user_project_mock = prepare_empty_user_project_mock()
|
|
499
|
-
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}})
|
|
500
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
501
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
502
|
-
])
|
|
503
|
-
|
|
504
|
-
# Act
|
|
505
|
-
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
|
|
506
|
-
|
|
507
|
-
# Assert
|
|
508
|
-
user_project_mock.build_configurations.each do |config|
|
|
509
|
-
assert_equal(config.build_settings["REACT_NATIVE_PATH"], "${PODS_ROOT}/../#{react_native_path}")
|
|
510
|
-
end
|
|
511
|
-
|
|
512
|
-
assert_equal(user_project_mock.save_invocation_count, 1)
|
|
513
|
-
assert_equal(pods_projects_mock.save_invocation_count, 1)
|
|
514
|
-
assert_equal(Pod::UI.collected_messages, ["Setting REACT_NATIVE build settings"])
|
|
515
|
-
end
|
|
516
|
-
|
|
517
|
-
# =================================== #
|
|
518
|
-
# Test - Prepare React Native Project #
|
|
519
|
-
# =================================== #
|
|
520
|
-
def test_createXcodeEnvIfMissing_whenItIsPresent_doNothing
|
|
521
|
-
# Arrange
|
|
522
|
-
FileMock.mocked_existing_files("/.xcode.env")
|
|
523
|
-
# Act
|
|
524
|
-
ReactNativePodsUtils.create_xcode_env_if_missing(file_manager: FileMock)
|
|
525
|
-
# Assert
|
|
526
|
-
assert_equal(FileMock.exist_invocation_params, ["/.xcode.env"])
|
|
527
|
-
assert_equal($collected_commands, [])
|
|
528
|
-
end
|
|
529
|
-
|
|
530
|
-
def test_createXcodeEnvIfMissing_whenItIsNotPresent_createsIt
|
|
531
|
-
# Arrange
|
|
532
|
-
|
|
533
|
-
# Act
|
|
534
|
-
ReactNativePodsUtils.create_xcode_env_if_missing(file_manager: FileMock)
|
|
535
|
-
# Assert
|
|
536
|
-
assert_equal(FileMock.exist_invocation_params, ["/.xcode.env"])
|
|
537
|
-
assert_equal($collected_commands, ["echo 'export NODE_BINARY=$(command -v node)' > /.xcode.env"])
|
|
538
|
-
end
|
|
539
|
-
|
|
540
|
-
# ============================ #
|
|
541
|
-
# Test - Detect Use Frameworks #
|
|
542
|
-
# ============================ #
|
|
543
|
-
def test_detectUseFrameworks_whenEnvAlreadySet_DoesNothing
|
|
544
|
-
# Arrange
|
|
545
|
-
ENV['USE_FRAMEWORKS'] = 'static'
|
|
546
|
-
target_definition = TargetDefinitionMock.new('something')
|
|
547
|
-
|
|
548
|
-
# Act
|
|
549
|
-
ReactNativePodsUtils.detect_use_frameworks(target_definition)
|
|
550
|
-
|
|
551
|
-
# Assert
|
|
552
|
-
assert_equal(Pod::UI.collected_messages, [])
|
|
553
|
-
end
|
|
554
|
-
|
|
555
|
-
def test_detectUseFrameworks_whenEnvNotSetAndNotUsed_setEnvVarToNil
|
|
556
|
-
# Arrange
|
|
557
|
-
target_definition = TargetDefinitionMock.new('static library')
|
|
558
|
-
|
|
559
|
-
# Act
|
|
560
|
-
ReactNativePodsUtils.detect_use_frameworks(target_definition)
|
|
561
|
-
|
|
562
|
-
# Assert
|
|
563
|
-
assert_equal(Pod::UI.collected_messages, ["Framework build type is static library"])
|
|
564
|
-
assert_nil(ENV['USE_FRAMEWORKS'])
|
|
565
|
-
end
|
|
566
|
-
|
|
567
|
-
def test_detectUseFrameworks_whenEnvNotSetAndStaticFrameworks_setEnvVarToStatic
|
|
568
|
-
# Arrange
|
|
569
|
-
target_definition = TargetDefinitionMock.new('static framework')
|
|
570
|
-
|
|
571
|
-
# Act
|
|
572
|
-
ReactNativePodsUtils.detect_use_frameworks(target_definition)
|
|
573
|
-
|
|
574
|
-
# Assert
|
|
575
|
-
assert_equal(Pod::UI.collected_messages, ["Framework build type is static framework"])
|
|
576
|
-
assert_equal(ENV['USE_FRAMEWORKS'], 'static')
|
|
577
|
-
end
|
|
578
|
-
|
|
579
|
-
def test_detectUseFrameworks_whenEnvNotSetAndDynamicFrameworks_setEnvVarToDynamic
|
|
580
|
-
# Arrange
|
|
581
|
-
target_definition = TargetDefinitionMock.new('dynamic framework')
|
|
582
|
-
|
|
583
|
-
# Act
|
|
584
|
-
ReactNativePodsUtils.detect_use_frameworks(target_definition)
|
|
585
|
-
|
|
586
|
-
# Assert
|
|
587
|
-
assert_equal(Pod::UI.collected_messages, ["Framework build type is dynamic framework"])
|
|
588
|
-
assert_equal(ENV['USE_FRAMEWORKS'], 'dynamic')
|
|
589
|
-
end
|
|
590
|
-
|
|
591
|
-
# ============================ #
|
|
592
|
-
# Test - Update Search Paths #
|
|
593
|
-
# ============================ #
|
|
594
|
-
def test_updateSearchPaths_whenUseFrameworks_addsSearchPaths
|
|
595
|
-
# Arrange
|
|
596
|
-
ENV['USE_FRAMEWORKS'] = 'static'
|
|
597
|
-
first_target = prepare_target("FirstTarget")
|
|
598
|
-
second_target = prepare_target("SecondTarget", nil, [
|
|
599
|
-
DependencyMock.new("RCT-Folly"),
|
|
600
|
-
DependencyMock.new("React-Codegen"),
|
|
601
|
-
DependencyMock.new("ReactCommon"),
|
|
602
|
-
DependencyMock.new("React-RCTFabric"),
|
|
603
|
-
DependencyMock.new("React-ImageManager"),
|
|
604
|
-
])
|
|
605
|
-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
|
|
606
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
607
|
-
prepare_config("Debug"),
|
|
608
|
-
prepare_config("Release"),
|
|
609
|
-
],
|
|
610
|
-
:native_targets => [
|
|
611
|
-
first_target,
|
|
612
|
-
second_target
|
|
613
|
-
]
|
|
614
|
-
)
|
|
615
|
-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
|
|
616
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
617
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
618
|
-
])
|
|
619
|
-
|
|
620
|
-
# Act
|
|
621
|
-
ReactNativePodsUtils.update_search_paths(installer)
|
|
622
|
-
|
|
623
|
-
# Assert
|
|
624
|
-
user_project_mock.build_configurations.each do |config|
|
|
625
|
-
received_search_path = config.build_settings["HEADER_SEARCH_PATHS"]
|
|
626
|
-
expected_search_path = "$(inherited) ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios ${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios"
|
|
627
|
-
assert_equal(expected_search_path, received_search_path)
|
|
628
|
-
end
|
|
629
|
-
|
|
630
|
-
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
|
|
631
|
-
if pod_name == "SecondTarget"
|
|
632
|
-
target_installation_result.native_target.build_configurations.each do |config|
|
|
633
|
-
received_search_path = config.build_settings["HEADER_SEARCH_PATHS"]
|
|
634
|
-
expected_Search_path = "$(inherited) \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.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-Fabric/React_Fabric.framework/Headers\" \"${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/react/renderer/imagemanager/platform/ios\""
|
|
635
|
-
assert_equal(received_search_path, expected_Search_path)
|
|
636
|
-
end
|
|
637
|
-
else
|
|
638
|
-
target_installation_result.native_target.build_configurations.each do |config|
|
|
639
|
-
assert_nil(config.build_settings["HEADER_SEARCH_PATHS"])
|
|
640
|
-
end
|
|
641
|
-
end
|
|
642
|
-
end
|
|
643
|
-
end
|
|
644
|
-
|
|
645
|
-
def test_updateSearchPaths_whenNotUseFrameworks_addsSearchPaths
|
|
646
|
-
# Arrange
|
|
647
|
-
first_target = prepare_target("FirstTarget")
|
|
648
|
-
second_target = prepare_target("SecondTarget")
|
|
649
|
-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
|
|
650
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
651
|
-
prepare_config("Debug"),
|
|
652
|
-
prepare_config("Release"),
|
|
653
|
-
],
|
|
654
|
-
:native_targets => [
|
|
655
|
-
first_target,
|
|
656
|
-
second_target
|
|
657
|
-
]
|
|
658
|
-
)
|
|
659
|
-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
|
|
660
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
661
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
662
|
-
])
|
|
663
|
-
|
|
664
|
-
# Act
|
|
665
|
-
ReactNativePodsUtils.update_search_paths(installer)
|
|
666
|
-
|
|
667
|
-
# Assert
|
|
668
|
-
user_project_mock.build_configurations.each do |config|
|
|
669
|
-
assert_nil(config.build_settings["HEADER_SEARCH_PATHS"])
|
|
670
|
-
end
|
|
671
|
-
end
|
|
672
|
-
|
|
673
|
-
# ============================= #
|
|
674
|
-
# Test - Apply Flags For Fabric #
|
|
675
|
-
# ============================= #
|
|
676
|
-
def test_applyFlagsForFabric_whenFabricEnabled_addsTheFlag
|
|
677
|
-
# Arrange
|
|
678
|
-
first_target = prepare_target("FirstTarget")
|
|
679
|
-
second_target = prepare_target("SecondTarget")
|
|
680
|
-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
|
|
681
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
682
|
-
prepare_config("Debug"),
|
|
683
|
-
prepare_config("Release"),
|
|
684
|
-
],
|
|
685
|
-
:native_targets => [
|
|
686
|
-
first_target,
|
|
687
|
-
second_target
|
|
688
|
-
]
|
|
689
|
-
)
|
|
690
|
-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
|
|
691
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
692
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
693
|
-
])
|
|
694
|
-
|
|
695
|
-
# Act
|
|
696
|
-
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: true)
|
|
697
|
-
|
|
698
|
-
# Assert
|
|
699
|
-
user_project_mock.build_configurations.each do |config|
|
|
700
|
-
received_cflags = config.build_settings["OTHER_CFLAGS"]
|
|
701
|
-
expected_cflags = "$(inherited) -DRN_FABRIC_ENABLED"
|
|
702
|
-
assert_equal(received_cflags, expected_cflags)
|
|
703
|
-
end
|
|
704
|
-
|
|
705
|
-
end
|
|
706
|
-
|
|
707
|
-
def test_applyFlagsForFabric_whenFabricDisabled_doNothing
|
|
708
|
-
# Arrange
|
|
709
|
-
first_target = prepare_target("FirstTarget")
|
|
710
|
-
second_target = prepare_target("SecondTarget")
|
|
711
|
-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
|
|
712
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
713
|
-
prepare_config("Debug"),
|
|
714
|
-
prepare_config("Release"),
|
|
715
|
-
],
|
|
716
|
-
:native_targets => [
|
|
717
|
-
first_target,
|
|
718
|
-
second_target
|
|
719
|
-
]
|
|
720
|
-
)
|
|
721
|
-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
|
|
722
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
723
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
724
|
-
])
|
|
725
|
-
|
|
726
|
-
# Act
|
|
727
|
-
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: false)
|
|
728
|
-
|
|
729
|
-
# Assert
|
|
730
|
-
user_project_mock.build_configurations.each do |config|
|
|
731
|
-
assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited)")
|
|
732
|
-
end
|
|
733
|
-
end
|
|
734
|
-
end
|
|
735
|
-
|
|
736
|
-
# ===== #
|
|
737
|
-
# UTILS #
|
|
738
|
-
# ===== #
|
|
739
|
-
|
|
740
|
-
def prepare_empty_user_project_mock
|
|
741
|
-
return UserProjectMock.new("a/path", [
|
|
742
|
-
BuildConfigurationMock.new("Debug"),
|
|
743
|
-
BuildConfigurationMock.new("Release"),
|
|
744
|
-
])
|
|
745
|
-
end
|
|
746
|
-
|
|
747
|
-
def prepare_config(config_name)
|
|
748
|
-
return BuildConfigurationMock.new(config_name, {"LIBRARY_SEARCH_PATHS" => [
|
|
749
|
-
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
|
|
750
|
-
"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
|
|
751
|
-
"another/path",
|
|
752
|
-
]})
|
|
753
|
-
end
|
|
754
|
-
|
|
755
|
-
def prepare_target(name, product_type = nil, dependencies = [])
|
|
756
|
-
return TargetMock.new(name, [
|
|
757
|
-
prepare_config("Debug"),
|
|
758
|
-
prepare_config("Release")
|
|
759
|
-
], product_type, dependencies)
|
|
760
|
-
end
|
|
761
|
-
|
|
762
|
-
def prepare_Code_Signing_build_configuration(name, param)
|
|
763
|
-
return BuildConfigurationMock.new(name, {
|
|
764
|
-
"CODE_SIGNING_ALLOWED" => param
|
|
765
|
-
})
|
|
766
|
-
end
|