react-native 0.72.4 → 0.72.5

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.
Files changed (34) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/React/Base/RCTBundleURLProvider.h +33 -2
  3. package/React/Base/RCTBundleURLProvider.mm +78 -15
  4. package/React/Base/RCTVersion.m +1 -1
  5. package/React/CoreModules/RCTTiming.mm +5 -0
  6. package/ReactAndroid/gradle.properties +1 -1
  7. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  8. package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/MaintainVisibleScrollPositionHelper.java +4 -0
  9. package/ReactAndroid/src/main/jni/CMakeLists.txt +5 -0
  10. package/ReactCommon/React-Fabric.podspec +1 -1
  11. package/ReactCommon/ReactCommon.podspec +1 -1
  12. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  13. package/ReactCommon/jsc/JSCRuntime.cpp +10 -0
  14. package/ReactCommon/react/debug/React-debug.podspec +1 -1
  15. package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +1 -1
  16. package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -1
  17. package/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +2 -0
  18. package/ReactCommon/react/renderer/core/RawPropsParser.cpp +1 -0
  19. package/ReactCommon/react/renderer/core/RawPropsPrimitives.h +4 -4
  20. package/ReactCommon/react/renderer/graphics/React-graphics.podspec +1 -1
  21. package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -1
  22. package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +1 -1
  23. package/ReactCommon/react/utils/React-utils.podspec +1 -1
  24. package/package.json +5 -5
  25. package/scripts/cocoapods/__tests__/test_utils/XcodebuildMock.rb +26 -0
  26. package/scripts/cocoapods/__tests__/utils-test.rb +115 -18
  27. package/scripts/cocoapods/helpers.rb +16 -0
  28. package/scripts/cocoapods/utils.rb +97 -8
  29. package/scripts/react_native_pods.rb +6 -2
  30. package/sdks/hermes-engine/utils/build-apple-framework.sh +8 -1
  31. package/sdks/hermes-engine/utils/build-hermes-xcode.sh +8 -0
  32. package/sdks/hermesc/osx-bin/hermesc +0 -0
  33. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  34. package/template/package.json +1 -1
@@ -12,6 +12,6 @@
12
12
  exports.version = {
13
13
  major: 0,
14
14
  minor: 72,
15
- patch: 4,
15
+ patch: 5,
16
16
  prerelease: null,
17
17
  };
@@ -101,6 +101,7 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
101
101
 
102
102
  @property (nonatomic, assign) BOOL enableMinification;
103
103
  @property (nonatomic, assign) BOOL enableDev;
104
+ @property (nonatomic, assign) BOOL inlineSourceMap;
104
105
 
105
106
  /**
106
107
  * The scheme/protocol used of the packager, the default is the http protocol
@@ -125,13 +126,32 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
125
126
  + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
126
127
  packagerHost:(NSString *)packagerHost
127
128
  enableDev:(BOOL)enableDev
128
- enableMinification:(BOOL)enableMinification;
129
+ enableMinification:(BOOL)enableMinification
130
+ __deprecated_msg(
131
+ "Use `jsBundleURLForBundleRoot:packagerHost:enableDev:enableMinification:inlineSourceMap:` instead");
132
+
133
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
134
+ packagerHost:(NSString *)packagerHost
135
+ packagerScheme:(NSString *)scheme
136
+ enableDev:(BOOL)enableDev
137
+ enableMinification:(BOOL)enableMinification
138
+ modulesOnly:(BOOL)modulesOnly
139
+ runModule:(BOOL)runModule
140
+ __deprecated_msg(
141
+ "Use jsBundleURLForBundleRoot:packagerHost:enableDev:enableMinification:inlineSourceMap:modulesOnly:runModule:` instead");
142
+
143
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
144
+ packagerHost:(NSString *)packagerHost
145
+ enableDev:(BOOL)enableDev
146
+ enableMinification:(BOOL)enableMinification
147
+ inlineSourceMap:(BOOL)inlineSourceMap;
129
148
 
130
149
  + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
131
150
  packagerHost:(NSString *)packagerHost
132
151
  packagerScheme:(NSString *)scheme
133
152
  enableDev:(BOOL)enableDev
134
153
  enableMinification:(BOOL)enableMinification
154
+ inlineSourceMap:(BOOL)inlineSourceMap
135
155
  modulesOnly:(BOOL)modulesOnly
136
156
  runModule:(BOOL)runModule;
137
157
  /**
@@ -142,6 +162,17 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
142
162
  + (NSURL *)resourceURLForResourcePath:(NSString *)path
143
163
  packagerHost:(NSString *)packagerHost
144
164
  scheme:(NSString *)scheme
145
- query:(NSString *)query;
165
+ query:(NSString *)query
166
+ __deprecated_msg("Use version with queryItems parameter instead");
167
+
168
+ /**
169
+ * Given a hostname for the packager and a resource path (including "/"), return the URL to the resource.
170
+ * In general, please use the instance method to decide if the packager is running and fallback to the pre-packaged
171
+ * resource if it is not: -resourceURLForResourceRoot:resourceName:resourceExtension:offlineBundle:
172
+ */
173
+ + (NSURL *)resourceURLForResourcePath:(NSString *)path
174
+ packagerHost:(NSString *)packagerHost
175
+ scheme:(NSString *)scheme
176
+ queryItems:(NSArray<NSURLQueryItem *> *)queryItems;
146
177
 
147
178
  @end
@@ -22,10 +22,12 @@ void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed)
22
22
  kRCTAllowPackagerAccess = allowed;
23
23
  }
24
24
  #endif
25
+ static NSString *const kRCTPlatformName = @"ios";
25
26
  static NSString *const kRCTPackagerSchemeKey = @"RCT_packager_scheme";
26
27
  static NSString *const kRCTJsLocationKey = @"RCT_jsLocation";
27
28
  static NSString *const kRCTEnableDevKey = @"RCT_enableDev";
28
29
  static NSString *const kRCTEnableMinificationKey = @"RCT_enableMinification";
30
+ static NSString *const kRCTInlineSourceMapKey = @"RCT_inlineSourceMap";
29
31
 
30
32
  @implementation RCTBundleURLProvider
31
33
 
@@ -187,6 +189,7 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
187
189
  packagerScheme:[self packagerScheme]
188
190
  enableDev:[self enableDev]
189
191
  enableMinification:[self enableMinification]
192
+ inlineSourceMap:[self inlineSourceMap]
190
193
  modulesOnly:NO
191
194
  runModule:YES];
192
195
  }
@@ -199,6 +202,7 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
199
202
  packagerScheme:[self packagerScheme]
200
203
  enableDev:[self enableDev]
201
204
  enableMinification:[self enableMinification]
205
+ inlineSourceMap:[self inlineSourceMap]
202
206
  modulesOnly:YES
203
207
  runModule:NO];
204
208
  }
@@ -238,13 +242,29 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
238
242
  return [[self class] resourceURLForResourcePath:path
239
243
  packagerHost:packagerServerHostPort
240
244
  scheme:packagerServerScheme
241
- query:nil];
245
+ queryItems:nil];
242
246
  }
243
247
 
244
248
  + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
245
249
  packagerHost:(NSString *)packagerHost
246
250
  enableDev:(BOOL)enableDev
247
251
  enableMinification:(BOOL)enableMinification
252
+ {
253
+ return [self jsBundleURLForBundleRoot:bundleRoot
254
+ packagerHost:packagerHost
255
+ packagerScheme:nil
256
+ enableDev:enableDev
257
+ enableMinification:enableMinification
258
+ inlineSourceMap:NO
259
+ modulesOnly:NO
260
+ runModule:YES];
261
+ }
262
+
263
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
264
+ packagerHost:(NSString *)packagerHost
265
+ enableDev:(BOOL)enableDev
266
+ enableMinification:(BOOL)enableMinification
267
+ inlineSourceMap:(BOOL)inlineSourceMap
248
268
 
249
269
  {
250
270
  return [self jsBundleURLForBundleRoot:bundleRoot
@@ -252,6 +272,7 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
252
272
  packagerScheme:nil
253
273
  enableDev:enableDev
254
274
  enableMinification:enableMinification
275
+ inlineSourceMap:inlineSourceMap
255
276
  modulesOnly:NO
256
277
  runModule:YES];
257
278
  }
@@ -263,27 +284,45 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
263
284
  enableMinification:(BOOL)enableMinification
264
285
  modulesOnly:(BOOL)modulesOnly
265
286
  runModule:(BOOL)runModule
287
+ {
288
+ return [self jsBundleURLForBundleRoot:bundleRoot
289
+ packagerHost:packagerHost
290
+ packagerScheme:nil
291
+ enableDev:enableDev
292
+ enableMinification:enableMinification
293
+ inlineSourceMap:NO
294
+ modulesOnly:modulesOnly
295
+ runModule:runModule];
296
+ }
297
+
298
+ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
299
+ packagerHost:(NSString *)packagerHost
300
+ packagerScheme:(NSString *)scheme
301
+ enableDev:(BOOL)enableDev
302
+ enableMinification:(BOOL)enableMinification
303
+ inlineSourceMap:(BOOL)inlineSourceMap
304
+ modulesOnly:(BOOL)modulesOnly
305
+ runModule:(BOOL)runModule
266
306
  {
267
307
  NSString *path = [NSString stringWithFormat:@"/%@.bundle", bundleRoot];
308
+ BOOL lazy = enableDev;
309
+ NSArray<NSURLQueryItem *> *queryItems = @[
310
+ [[NSURLQueryItem alloc] initWithName:@"platform" value:kRCTPlatformName],
311
+ [[NSURLQueryItem alloc] initWithName:@"dev" value:enableDev ? @"true" : @"false"],
312
+ [[NSURLQueryItem alloc] initWithName:@"minify" value:enableMinification ? @"true" : @"false"],
313
+ [[NSURLQueryItem alloc] initWithName:@"inlineSourceMap" value:inlineSourceMap ? @"true" : @"false"],
314
+ [[NSURLQueryItem alloc] initWithName:@"modulesOnly" value:modulesOnly ? @"true" : @"false"],
315
+ [[NSURLQueryItem alloc] initWithName:@"runModule" value:runModule ? @"true" : @"false"],
268
316
  #ifdef HERMES_BYTECODE_VERSION
269
- NSString *runtimeBytecodeVersion = [NSString stringWithFormat:@"&runtimeBytecodeVersion=%u", HERMES_BYTECODE_VERSION];
270
- #else
271
- NSString *runtimeBytecodeVersion = @"";
272
- #endif
273
-
274
- // When we support only iOS 8 and above, use queryItems for a better API.
275
- NSString *query = [NSString stringWithFormat:@"platform=ios&dev=%@&minify=%@&modulesOnly=%@&runModule=%@%@",
276
- enableDev ? @"true" : @"false",
277
- enableMinification ? @"true" : @"false",
278
- modulesOnly ? @"true" : @"false",
279
- runModule ? @"true" : @"false",
280
- runtimeBytecodeVersion];
317
+ [[NSURLQueryItem alloc] initWithName:@"runtimeBytecodeVersion" value:HERMES_BYTECODE_VERSION],
318
+ #endif
319
+ ];
281
320
 
282
321
  NSString *bundleID = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleIdentifierKey];
283
322
  if (bundleID) {
284
- query = [NSString stringWithFormat:@"%@&app=%@", query, bundleID];
323
+ queryItems = [queryItems arrayByAddingObject:[[NSURLQueryItem alloc] initWithName:@"app" value:bundleID]];
285
324
  }
286
- return [[self class] resourceURLForResourcePath:path packagerHost:packagerHost scheme:scheme query:query];
325
+ return [[self class] resourceURLForResourcePath:path packagerHost:packagerHost scheme:scheme queryItems:queryItems];
287
326
  }
288
327
 
289
328
  + (NSURL *)resourceURLForResourcePath:(NSString *)path
@@ -300,6 +339,20 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
300
339
  return components.URL;
301
340
  }
302
341
 
342
+ + (NSURL *)resourceURLForResourcePath:(NSString *)path
343
+ packagerHost:(NSString *)packagerHost
344
+ scheme:(NSString *)scheme
345
+ queryItems:(NSArray<NSURLQueryItem *> *)queryItems
346
+ {
347
+ NSURLComponents *components = [NSURLComponents componentsWithURL:serverRootWithHostPort(packagerHost, scheme)
348
+ resolvingAgainstBaseURL:NO];
349
+ components.path = path;
350
+ if (queryItems != nil) {
351
+ components.queryItems = queryItems;
352
+ }
353
+ return components.URL;
354
+ }
355
+
303
356
  - (void)updateValue:(id)object forKey:(NSString *)key
304
357
  {
305
358
  [[NSUserDefaults standardUserDefaults] setObject:object forKey:key];
@@ -317,6 +370,11 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
317
370
  return [[NSUserDefaults standardUserDefaults] boolForKey:kRCTEnableMinificationKey];
318
371
  }
319
372
 
373
+ - (BOOL)inlineSourceMap
374
+ {
375
+ return [[NSUserDefaults standardUserDefaults] boolForKey:kRCTInlineSourceMapKey];
376
+ }
377
+
320
378
  - (NSString *)jsLocation
321
379
  {
322
380
  return [[NSUserDefaults standardUserDefaults] stringForKey:kRCTJsLocationKey];
@@ -346,6 +404,11 @@ static NSURL *serverRootWithHostPort(NSString *hostPort, NSString *scheme)
346
404
  [self updateValue:@(enableMinification) forKey:kRCTEnableMinificationKey];
347
405
  }
348
406
 
407
+ - (void)setInlineSourceMap:(BOOL)inlineSourceMap
408
+ {
409
+ [self updateValue:@(inlineSourceMap) forKey:kRCTInlineSourceMapKey];
410
+ }
411
+
349
412
  - (void)setPackagerScheme:(NSString *)packagerScheme
350
413
  {
351
414
  [self updateValue:packagerScheme forKey:kRCTPackagerSchemeKey];
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(72),
26
- RCTVersionPatch: @(4),
26
+ RCTVersionPatch: @(5),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -128,6 +128,11 @@ RCT_EXPORT_MODULE()
128
128
  _paused = YES;
129
129
  _timers = [NSMutableDictionary new];
130
130
  _inBackground = NO;
131
+ RCTExecuteOnMainQueue(^{
132
+ if (!self->_inBackground && [RCTSharedApplication() applicationState] == UIApplicationStateBackground) {
133
+ [self appDidMoveToBackground];
134
+ }
135
+ });
131
136
 
132
137
  for (NSString *name in @[
133
138
  UIApplicationWillResignActiveNotification,
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.72.4
1
+ VERSION_NAME=0.72.5
2
2
  GROUP=com.facebook.react
3
3
 
4
4
  # JVM Versions
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 72,
20
- "patch", 4,
20
+ "patch", 5,
21
21
  "prerelease", null);
22
22
  }
@@ -103,6 +103,10 @@ public class MaintainVisibleScrollPositionHelper<ScrollViewT extends ViewGroup &
103
103
  }
104
104
 
105
105
  View firstVisibleView = mFirstVisibleView.get();
106
+ if (firstVisibleView == null) {
107
+ return;
108
+ }
109
+
106
110
  Rect newFrame = new Rect();
107
111
  firstVisibleView.getHitRect(newFrame);
108
112
 
@@ -8,6 +8,11 @@ set(CMAKE_VERBOSE_MAKEFILE on)
8
8
 
9
9
  project(ReactAndroid)
10
10
 
11
+ # Convert input paths to CMake format (with forward slashes)
12
+ file(TO_CMAKE_PATH "${REACT_ANDROID_DIR}" REACT_ANDROID_DIR)
13
+ file(TO_CMAKE_PATH "${REACT_BUILD_DIR}" REACT_BUILD_DIR)
14
+ file(TO_CMAKE_PATH "${REACT_COMMON_DIR}" REACT_COMMON_DIR)
15
+
11
16
  # If you have ccache installed, we're going to honor it.
12
17
  find_program(CCACHE_FOUND ccache)
13
18
  if(CCACHE_FOUND)
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
36
36
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
37
37
 
38
38
  if ENV['USE_FRAMEWORKS']
39
- s.header_mappings_dir = File.absolute_path('./')
39
+ s.header_mappings_dir = './'
40
40
  s.module_name = 'React_Fabric'
41
41
  end
42
42
 
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
37
37
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
38
38
  "GCC_WARN_PEDANTIC" => "YES" }
39
39
  if ENV['USE_FRAMEWORKS']
40
- s.header_mappings_dir = File.absolute_path("./")
40
+ s.header_mappings_dir = './'
41
41
  end
42
42
 
43
43
  # TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 72;
20
- int32_t Patch = 4;
20
+ int32_t Patch = 5;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -302,6 +302,9 @@ class JSCRuntime : public jsi::Runtime {
302
302
  #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0
303
303
  #define _JSC_NO_ARRAY_BUFFERS
304
304
  #endif
305
+ #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400
306
+ #define _JSC_HAS_INSPECTABLE
307
+ #endif
305
308
  #endif
306
309
  #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
307
310
  #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_11
@@ -398,6 +401,13 @@ JSCRuntime::JSCRuntime(JSGlobalContextRef ctx)
398
401
  stringCounter_(0)
399
402
  #endif
400
403
  {
404
+ #ifndef NDEBUG
405
+ #ifdef _JSC_HAS_INSPECTABLE
406
+ if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) {
407
+ JSGlobalContextSetInspectable(ctx_, true);
408
+ }
409
+ #endif
410
+ #endif
401
411
  }
402
412
 
403
413
  JSCRuntime::~JSCRuntime() {
@@ -31,6 +31,6 @@ Pod::Spec.new do |s|
31
31
 
32
32
  if ENV['USE_FRAMEWORKS']
33
33
  s.module_name = "React_debug"
34
- s.header_mappings_dir = File.absolute_path("../..")
34
+ s.header_mappings_dir = "../.."
35
35
  end
36
36
  end
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
37
37
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
38
38
  "GCC_WARN_PEDANTIC" => "YES" }
39
39
  if ENV['USE_FRAMEWORKS']
40
- s.header_mappings_dir = File.absolute_path('./')
40
+ s.header_mappings_dir = './'
41
41
  end
42
42
 
43
43
  s.source_files = "ReactCommon/**/*.{mm,cpp,h}"
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
37
37
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
38
38
  "GCC_WARN_PEDANTIC" => "YES" }
39
39
  if ENV['USE_FRAMEWORKS']
40
- s.header_mappings_dir = File.absolute_path('./')
40
+ s.header_mappings_dir = './'
41
41
  end
42
42
 
43
43
 
@@ -38,6 +38,8 @@ void RawPropsKeyMap::insert(
38
38
  item.value = value;
39
39
  key.render(item.name, &item.length);
40
40
  items_.push_back(item);
41
+ react_native_assert(
42
+ items_.size() < std::numeric_limits<RawPropsPropNameLength>::max());
41
43
  }
42
44
 
43
45
  void RawPropsKeyMap::reindex() noexcept {
@@ -42,6 +42,7 @@ RawValue const *RawPropsParser::at(
42
42
  // This is not thread-safe part; this happens only during initialization of
43
43
  // a `ComponentDescriptor` where it is actually safe.
44
44
  keys_.push_back(key);
45
+ react_native_assert(size < std::numeric_limits<RawPropsValueIndex>::max());
45
46
  nameToIndex_.insert(key, static_cast<RawPropsValueIndex>(size));
46
47
  return nullptr;
47
48
  }
@@ -16,11 +16,11 @@ namespace react {
16
16
  /*
17
17
  * Type used to represent an index of some stored values in small arrays.
18
18
  */
19
- using RawPropsValueIndex = uint8_t;
19
+ using RawPropsValueIndex = uint16_t;
20
20
  static_assert(
21
- sizeof(RawPropsValueIndex) == 1,
22
- "RawPropsValueIndex must be one byte size.");
23
- using RawPropsPropNameLength = uint8_t;
21
+ sizeof(RawPropsValueIndex) == 2,
22
+ "RawPropsValueIndex must be two byte size.");
23
+ using RawPropsPropNameLength = uint16_t;
24
24
  using RawPropsPropNameHash = uint32_t;
25
25
 
26
26
  /*
@@ -45,7 +45,7 @@ Pod::Spec.new do |s|
45
45
 
46
46
  if ENV['USE_FRAMEWORKS']
47
47
  s.module_name = "React_graphics"
48
- s.header_mappings_dir = File.absolute_path("../../..")
48
+ s.header_mappings_dir = "../../.."
49
49
  header_search_paths = header_search_paths + ["\"$(PODS_TARGET_SRCROOT)/platform/ios\""]
50
50
  end
51
51
 
@@ -42,7 +42,7 @@ Pod::Spec.new do |s|
42
42
 
43
43
  if ENV['USE_FRAMEWORKS']
44
44
  s.module_name = "React_ImageManager"
45
- s.header_mappings_dir = File.absolute_path("./")
45
+ s.header_mappings_dir = "./"
46
46
  header_search_paths = header_search_paths + [
47
47
  "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\"",
48
48
  "\"$(PODS_ROOT)/DoubleConversion\"",
@@ -47,7 +47,7 @@ Pod::Spec.new do |s|
47
47
 
48
48
  if ENV['USE_FRAMEWORKS']
49
49
  s.module_name = "React_runtimescheduler"
50
- s.header_mappings_dir = File.absolute_path("../../..")
50
+ s.header_mappings_dir = "../../.."
51
51
  end
52
52
 
53
53
  s.dependency "React-jsi"
@@ -48,7 +48,7 @@ Pod::Spec.new do |s|
48
48
 
49
49
  if ENV['USE_FRAMEWORKS']
50
50
  s.module_name = "React_utils"
51
- s.header_mappings_dir = File.absolute_path("../..")
51
+ s.header_mappings_dir = "../.."
52
52
  end
53
53
 
54
54
  s.dependency "RCT-Folly", folly_version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.72.4",
3
+ "version": "0.72.5",
4
4
  "bin": "./cli.js",
5
5
  "description": "A framework for building native apps using React",
6
6
  "license": "MIT",
@@ -79,11 +79,11 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@jest/create-cache-key-function": "^29.2.1",
82
- "@react-native-community/cli": "11.3.6",
83
- "@react-native-community/cli-platform-android": "11.3.6",
84
- "@react-native-community/cli-platform-ios": "11.3.6",
82
+ "@react-native-community/cli": "11.3.7",
83
+ "@react-native-community/cli-platform-android": "11.3.7",
84
+ "@react-native-community/cli-platform-ios": "11.3.7",
85
85
  "@react-native/assets-registry": "^0.72.0",
86
- "@react-native/codegen": "^0.72.6",
86
+ "@react-native/codegen": "^0.72.7",
87
87
  "@react-native/gradle-plugin": "^0.72.11",
88
88
  "@react-native/js-polyfills": "^0.72.1",
89
89
  "@react-native/normalize-colors": "^0.72.0",
@@ -0,0 +1,26 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ class XcodebuildMock < Xcodebuild
7
+ @@version = ""
8
+ @@version_invocation_count = 0
9
+
10
+ def self.set_version=(v)
11
+ @@version = v
12
+ end
13
+
14
+ def self.version
15
+ @@version_invocation_count += 1
16
+ @@version
17
+ end
18
+
19
+ def self.version_invocation_count
20
+ @@version_invocation_count
21
+ end
22
+
23
+ def self.reset()
24
+ @@version_invocation_count = 0
25
+ end
26
+ end
@@ -14,6 +14,7 @@ require_relative "./test_utils/FileMock.rb"
14
14
  require_relative "./test_utils/systemUtils.rb"
15
15
  require_relative "./test_utils/PathnameMock.rb"
16
16
  require_relative "./test_utils/TargetDefinitionMock.rb"
17
+ require_relative "./test_utils/XcodebuildMock.rb"
17
18
 
18
19
  class UtilsTests < Test::Unit::TestCase
19
20
  def setup
@@ -28,6 +29,7 @@ class UtilsTests < Test::Unit::TestCase
28
29
  Pod::Config.reset()
29
30
  SysctlChecker.reset()
30
31
  Environment.reset()
32
+ XcodebuildMock.reset()
31
33
  ENV['RCT_NEW_ARCH_ENABLED'] = '0'
32
34
  ENV['USE_HERMES'] = '1'
33
35
  ENV['USE_FRAMEWORKS'] = nil
@@ -437,9 +439,9 @@ class UtilsTests < Test::Unit::TestCase
437
439
  # ================================= #
438
440
  # Test - Apply Xcode 15 Patch #
439
441
  # ================================= #
440
-
441
- def test_applyXcode15Patch_correctlyAppliesNecessaryPatch
442
+ def test_applyXcode15Patch_whenXcodebuild14_correctlyAppliesNecessaryPatch
442
443
  # Arrange
444
+ XcodebuildMock.set_version = "Xcode 14.3"
443
445
  first_target = prepare_target("FirstTarget")
444
446
  second_target = prepare_target("SecondTarget")
445
447
  third_target = TargetMock.new("ThirdTarget", [
@@ -468,24 +470,117 @@ class UtilsTests < Test::Unit::TestCase
468
470
  ])
469
471
 
470
472
  # Act
471
- ReactNativePodsUtils.apply_xcode_15_patch(installer)
473
+ user_project_mock.build_configurations.each do |config|
474
+ assert_nil(config.build_settings["OTHER_LDFLAGS"])
475
+ end
476
+
477
+ ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
472
478
 
473
479
  # Assert
474
- first_target.build_configurations.each do |config|
475
- assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
476
- '$(inherited) "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
477
- )
480
+ user_project_mock.build_configurations.each do |config|
481
+ assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
482
+ assert_equal("$(inherited) ", config.build_settings["OTHER_LDFLAGS"])
478
483
  end
479
- second_target.build_configurations.each do |config|
480
- assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
481
- '$(inherited) "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
482
- )
484
+
485
+ # User project and Pods project
486
+ assert_equal(2, XcodebuildMock.version_invocation_count)
487
+ end
488
+
489
+ def test_applyXcode15Patch_whenXcodebuild15_correctlyAppliesNecessaryPatch
490
+ # Arrange
491
+ XcodebuildMock.set_version = "Xcode 15.0"
492
+ first_target = prepare_target("FirstTarget")
493
+ second_target = prepare_target("SecondTarget")
494
+ third_target = TargetMock.new("ThirdTarget", [
495
+ BuildConfigurationMock.new("Debug", {
496
+ "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
497
+ }),
498
+ BuildConfigurationMock.new("Release", {
499
+ "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
500
+ }),
501
+ ], nil)
502
+
503
+ user_project_mock = UserProjectMock.new("/a/path", [
504
+ prepare_config("Debug"),
505
+ prepare_config("Release"),
506
+ ],
507
+ :native_targets => [
508
+ first_target,
509
+ second_target
510
+ ]
511
+ )
512
+ pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
513
+ third_target
514
+ ])
515
+ installer = InstallerMock.new(pods_projects_mock, [
516
+ AggregatedProjectMock.new(user_project_mock)
517
+ ])
518
+
519
+ # Act
520
+ user_project_mock.build_configurations.each do |config|
521
+ assert_nil(config.build_settings["OTHER_LDFLAGS"])
483
522
  end
484
- third_target.build_configurations.each do |config|
485
- assert_equal(config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"].strip,
486
- '$(inherited) "SomeFlag=1" "_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION"'
487
- )
523
+
524
+ ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
525
+
526
+ # Assert
527
+ user_project_mock.build_configurations.each do |config|
528
+ assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
529
+ assert_equal("$(inherited) -Wl -ld_classic ", config.build_settings["OTHER_LDFLAGS"])
488
530
  end
531
+
532
+ # User project and Pods project
533
+ assert_equal(2, XcodebuildMock.version_invocation_count)
534
+ end
535
+
536
+ def test_applyXcode15Patch_whenXcodebuild14ButProjectHasSettings_correctlyRemovesNecessaryPatch
537
+ # Arrange
538
+ XcodebuildMock.set_version = "Xcode 14.3"
539
+ first_target = prepare_target("FirstTarget")
540
+ second_target = prepare_target("SecondTarget")
541
+ third_target = TargetMock.new("ThirdTarget", [
542
+ BuildConfigurationMock.new("Debug", {
543
+ "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
544
+ }),
545
+ BuildConfigurationMock.new("Release", {
546
+ "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) "SomeFlag=1" '
547
+ }),
548
+ ], nil)
549
+
550
+ debug_config = prepare_config("Debug", {"OTHER_LDFLAGS" => "$(inherited) -Wl -ld_classic "})
551
+ release_config = prepare_config("Release", {"OTHER_LDFLAGS" => "$(inherited) -Wl -ld_classic "})
552
+
553
+ user_project_mock = UserProjectMock.new("/a/path", [
554
+ debug_config,
555
+ release_config,
556
+ ],
557
+ :native_targets => [
558
+ first_target,
559
+ second_target
560
+ ]
561
+ )
562
+ pods_projects_mock = PodsProjectMock.new([debug_config.clone, release_config.clone], {"hermes-engine" => {}}, :native_targets => [
563
+ third_target
564
+ ])
565
+ installer = InstallerMock.new(pods_projects_mock, [
566
+ AggregatedProjectMock.new(user_project_mock)
567
+ ])
568
+
569
+ # Act
570
+ user_project_mock.build_configurations.each do |config|
571
+ assert_equal("$(inherited) -Wl -ld_classic ", config.build_settings["OTHER_LDFLAGS"])
572
+ end
573
+
574
+ ReactNativePodsUtils.apply_xcode_15_patch(installer, :xcodebuild_manager => XcodebuildMock)
575
+
576
+ # Assert
577
+ user_project_mock.build_configurations.each do |config|
578
+ assert_equal("$(inherited) _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION", config.build_settings["GCC_PREPROCESSOR_DEFINITIONS"])
579
+ assert_equal("$(inherited) ", config.build_settings["OTHER_LDFLAGS"])
580
+ end
581
+
582
+ # User project and Pods project
583
+ assert_equal(2, XcodebuildMock.version_invocation_count)
489
584
  end
490
585
 
491
586
  # ==================================== #
@@ -744,12 +839,14 @@ def prepare_empty_user_project_mock
744
839
  ])
745
840
  end
746
841
 
747
- def prepare_config(config_name)
748
- return BuildConfigurationMock.new(config_name, {"LIBRARY_SEARCH_PATHS" => [
842
+ def prepare_config(config_name, extra_config = {})
843
+ config = {"LIBRARY_SEARCH_PATHS" => [
749
844
  "$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
750
845
  "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
751
846
  "another/path",
752
- ]})
847
+ ]}.merge(extra_config)
848
+
849
+ return BuildConfigurationMock.new(config_name, config)
753
850
  end
754
851
 
755
852
  def prepare_target(name, product_type = nil, dependencies = [])
@@ -11,6 +11,14 @@ class SysctlChecker
11
11
  end
12
12
  end
13
13
 
14
+ # Helper class that is used to easily send commands to Xcodebuild
15
+ # And that can be subclassed for testing purposes.
16
+ class Xcodebuild
17
+ def self.version
18
+ `xcodebuild -version`
19
+ end
20
+ end
21
+
14
22
  # Helper object to wrap system properties like RUBY_PLATFORM
15
23
  # This makes it easier to mock the behaviour in tests
16
24
  class Environment
@@ -26,3 +34,11 @@ class Finder
26
34
  return `find #{path} -type f \\( #{js_files} -or #{ts_files} \\)`.split("\n").sort()
27
35
  end
28
36
  end
37
+
38
+ module Helpers
39
+ class Constants
40
+ def self.min_ios_version_supported
41
+ return '12.4'
42
+ end
43
+ end
44
+ end
@@ -121,16 +121,31 @@ class ReactNativePodsUtils
121
121
  end
122
122
  end
123
123
 
124
- def self.apply_xcode_15_patch(installer)
125
- installer.target_installation_results.pod_target_installation_results
126
- .each do |pod_name, target_installation_result|
127
- target_installation_result.native_target.build_configurations.each do |config|
128
- # unary_function and binary_function are no longer provided in C++17 and newer standard modes as part of Xcode 15. They can be re-enabled with setting _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION
129
- # Ref: https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Deprecations
130
- config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= '$(inherited) '
131
- config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << '"_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION" '
124
+ def self.apply_xcode_15_patch(installer, xcodebuild_manager: Xcodebuild)
125
+ projects = self.extract_projects(installer)
126
+
127
+ gcc_preprocessor_definition_key = 'GCC_PREPROCESSOR_DEFINITIONS'
128
+ other_ld_flags_key = 'OTHER_LDFLAGS'
129
+ libcpp_cxx17_fix = '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION'
130
+ xcode15_compatibility_flags = '-Wl -ld_classic '
131
+
132
+ projects.each do |project|
133
+ project.build_configurations.each do |config|
134
+ # fix for unary_function and binary_function
135
+ self.safe_init(config, gcc_preprocessor_definition_key)
136
+ self.add_value_to_setting_if_missing(config, gcc_preprocessor_definition_key, libcpp_cxx17_fix)
137
+
138
+ # fix for weak linking
139
+ self.safe_init(config, other_ld_flags_key)
140
+ if self.is_using_xcode15_or_greter(:xcodebuild_manager => xcodebuild_manager)
141
+ self.add_value_to_setting_if_missing(config, other_ld_flags_key, xcode15_compatibility_flags)
142
+ else
143
+ self.remove_value_to_setting_if_present(config, other_ld_flags_key, xcode15_compatibility_flags)
144
+ end
132
145
  end
146
+ project.save()
133
147
  end
148
+
134
149
  end
135
150
 
136
151
  def self.apply_flags_for_fabric(installer, fabric_enabled: false)
@@ -232,6 +247,37 @@ class ReactNativePodsUtils
232
247
  end
233
248
  end
234
249
 
250
+ def self.updateIphoneOSDeploymentTarget(installer)
251
+ pod_to_update = Set.new([
252
+ "boost",
253
+ "CocoaAsyncSocket",
254
+ "Flipper",
255
+ "Flipper-DoubleConversion",
256
+ "Flipper-Fmt",
257
+ "Flipper-Boost-iOSX",
258
+ "Flipper-Folly",
259
+ "Flipper-Glog",
260
+ "Flipper-PeerTalk",
261
+ "FlipperKit",
262
+ "fmt",
263
+ "libevent",
264
+ "OpenSSL-Universal",
265
+ "RCT-Folly",
266
+ "SocketRocket",
267
+ "YogaKit"
268
+ ])
269
+
270
+ installer.target_installation_results.pod_target_installation_results
271
+ .each do |pod_name, target_installation_result|
272
+ unless pod_to_update.include?(pod_name)
273
+ next
274
+ end
275
+ target_installation_result.native_target.build_configurations.each do |config|
276
+ config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = Helpers::Constants.min_ios_version_supported
277
+ end
278
+ end
279
+ end
280
+
235
281
  # ========= #
236
282
  # Utilities #
237
283
  # ========= #
@@ -243,6 +289,49 @@ class ReactNativePodsUtils
243
289
  .push(installer.pods_project)
244
290
  end
245
291
 
292
+ def self.safe_init(config, setting_name)
293
+ old_config = config.build_settings[setting_name]
294
+ if old_config == nil
295
+ config.build_settings[setting_name] ||= '$(inherited) '
296
+ end
297
+ end
298
+
299
+ def self.add_value_to_setting_if_missing(config, setting_name, value)
300
+ old_config = config.build_settings[setting_name]
301
+ if !old_config.include?(value)
302
+ config.build_settings[setting_name] << value
303
+ end
304
+ end
305
+
306
+ def self.remove_value_to_setting_if_present(config, setting_name, value)
307
+ old_config = config.build_settings[setting_name]
308
+ if old_config.include?(value)
309
+ # Old config can be either an Array or a String
310
+ if old_config.is_a?(Array)
311
+ old_config = old_config.join(" ")
312
+ end
313
+ new_config = old_config.gsub(value, "")
314
+ config.build_settings[setting_name] = new_config
315
+ end
316
+ end
317
+
318
+ def self.is_using_xcode15_or_greter(xcodebuild_manager: Xcodebuild)
319
+ xcodebuild_version = xcodebuild_manager.version
320
+
321
+ # The output of xcodebuild -version is something like
322
+ # Xcode 15.0
323
+ # or
324
+ # Xcode 14.3.1
325
+ # We want to capture the version digits
326
+ regex = /(\d+)\.(\d+)(?:\.(\d+))?/
327
+ if match_data = xcodebuild_version.match(regex)
328
+ major = match_data[1].to_i
329
+ return major >= 15
330
+ end
331
+
332
+ return false
333
+ end
334
+
246
335
  def self.add_compiler_flag_to_project(installer, flag, configuration: nil)
247
336
  projects = self.extract_projects(installer)
248
337
 
@@ -15,6 +15,7 @@ require_relative './cocoapods/codegen_utils.rb'
15
15
  require_relative './cocoapods/utils.rb'
16
16
  require_relative './cocoapods/new_architecture.rb'
17
17
  require_relative './cocoapods/local_podspec_patch.rb'
18
+ require_relative './cocoapods/helpers.rb'
18
19
 
19
20
  $CODEGEN_OUTPUT_DIR = 'build/generated/ios'
20
21
  $CODEGEN_COMPONENT_DIR = 'react/renderer/components'
@@ -34,11 +35,12 @@ require Pod::Executable.execute_command('node', ['-p',
34
35
  {paths: [process.argv[1]]},
35
36
  )', __dir__]).strip
36
37
 
37
- # This function returns the min iOS version supported by React Native
38
+
39
+ # This function returns the min supported OS versions supported by React Native
38
40
  # By using this function, you won't have to manually change your Podfile
39
41
  # when we change the minimum version supported by the framework.
40
42
  def min_ios_version_supported
41
- return '12.4'
43
+ return Helpers::Constants.min_ios_version_supported
42
44
  end
43
45
 
44
46
  # This function prepares the project for React Native, before processing
@@ -245,11 +247,13 @@ def react_native_post_install(
245
247
  ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
246
248
  ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
247
249
  ReactNativePodsUtils.apply_xcode_15_patch(installer)
250
+ ReactNativePodsUtils.updateIphoneOSDeploymentTarget(installer)
248
251
 
249
252
  NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
250
253
  is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"
251
254
  NewArchitectureHelper.modify_flags_for_new_architecture(installer, is_new_arch_enabled)
252
255
 
256
+
253
257
  Pod::UI.puts "Pod install took #{Time.now.to_i - $START_TIME} [s] to run".green
254
258
  end
255
259
 
@@ -52,7 +52,7 @@ function build_host_hermesc {
52
52
 
53
53
  # Utility function to configure an Apple framework
54
54
  function configure_apple_framework {
55
- local build_cli_tools enable_bitcode enable_debugger cmake_build_type
55
+ local build_cli_tools enable_bitcode enable_debugger cmake_build_type xcode_15_flags xcode_major_version
56
56
 
57
57
  if [[ $1 == iphoneos || $1 == catalyst ]]; then
58
58
  enable_bitcode="true"
@@ -77,8 +77,15 @@ function configure_apple_framework {
77
77
  cmake_build_type="MinSizeRel"
78
78
  fi
79
79
 
80
+ xcode_15_flags=""
81
+ xcode_major_version=$(xcodebuild -version | grep -oE '[0-9]*' | head -n 1)
82
+ if [[ $xcode_major_version -ge 15 ]]; then
83
+ xcode_15_flags="LINKER:-ld_classic"
84
+ fi
85
+
80
86
  pushd "$HERMES_PATH" > /dev/null || exit 1
81
87
  cmake -S . -B "build_$1" \
88
+ -DHERMES_EXTRA_LINKER_FLAGS="$xcode_15_flags" \
82
89
  -DHERMES_APPLE_TARGET_PLATFORM:STRING="$1" \
83
90
  -DCMAKE_OSX_ARCHITECTURES:STRING="$2" \
84
91
  -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$3" \
@@ -33,6 +33,13 @@ if [ -z "$deployment_target" ]; then
33
33
  deployment_target=${MACOSX_DEPLOYMENT_TARGET}
34
34
  fi
35
35
 
36
+ xcode_15_flags=""
37
+ xcode_major_version=$(xcodebuild -version | grep -oE '[0-9]*' | head -n 1)
38
+ if [[ $xcode_major_version -ge 15 ]]; then
39
+ echo "########### Using LINKER:-ld_classic ###########"
40
+ xcode_15_flags="LINKER:-ld_classic"
41
+ fi
42
+
36
43
  architectures=$( echo "$ARCHS" | tr " " ";" )
37
44
 
38
45
  echo "Configure Apple framework"
@@ -40,6 +47,7 @@ echo "Configure Apple framework"
40
47
  "$CMAKE_BINARY" \
41
48
  -S "${PODS_ROOT}/hermes-engine" \
42
49
  -B "${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}" \
50
+ -DHERMES_EXTRA_LINKER_FLAGS="$xcode_15_flags" \
43
51
  -DHERMES_APPLE_TARGET_PLATFORM:STRING="$PLATFORM_NAME" \
44
52
  -DCMAKE_OSX_ARCHITECTURES:STRING="$architectures" \
45
53
  -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$deployment_target" \
Binary file
Binary file
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "react": "18.2.0",
14
- "react-native": "0.72.4"
14
+ "react-native": "0.72.5"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@babel/core": "^7.20.0",