Skip to content

Commit 5465647

Browse files
ramonclaudiometa-codesync[bot]
authored andcommitted
Declare RCTBundleURLProviderAllowPackagerServerAccess unconditionally (#57517)
Summary: Declares `RCTBundleURLProviderAllowPackagerServerAccess` unconditionally and keeps every read of the flag gated, so the function is a no-op instead of a compile error when packager support is compiled out, the same shape as `RCTDevLoadingViewSetEnabled`. The function exists only for out-of-tree callers (the header comment describes test runs disabling packager access, and nothing in this repo calls it), but it is declared only under `#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY`, so it vanishes in Release and an unguarded call fails with `call to undeclared function 'RCTBundleURLProviderAllowPackagerServerAccess'`. That broke every Release CI build in expo/expo when expo/expo#47638 called it directly, worked around at the call sites in expo/expo#47688. Builds with packager support keep identical behavior and preprocessor output. ## Changelog: [IOS] [CHANGED] - Declare `RCTBundleURLProviderAllowPackagerServerAccess` unconditionally (no-op when packager support is compiled out) Pull Request resolved: #57517 Test Plan: - Without the macros (Release defaults), compiling a call against the current headers fails with the ISO C99 undeclared-function error, and compiles with this change. - With `-DDEBUG=1`, compiles before and after. Every read of `kRCTAllowPackagerAccess` stays inside the guard, so dev behavior is unchanged. - Both files pass `clang-format --dry-run --Werror`, and `packages/rn-tester` builds in Release with this change. The RNTester unit suite (162 tests, run together with #57518 so the suite compiles) passes with 0 failures. Reviewed By: christophpurrer Differential Revision: D113812551 Pulled By: fabriziocucci fbshipit-source-id: e3c3cda822ceb33a63f9d6295e3402f76809c189
1 parent 908872a commit 5465647

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

packages/react-native/React/Base/RCTBundleURLProvider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
RCT_EXTERN NSString *_Nonnull const RCTBundleURLProviderUpdatedNotification;
1515
RCT_EXTERN const NSUInteger kRCTBundleURLProviderDefaultPort;
1616

17-
#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY
1817
/**
1918
* Allow/disallow accessing the packager server for various runtime scenario.
2019
* For instance, if a test run should never access the packager, disable it
2120
* by calling this function before initializing React Native (RCTBridge etc).
22-
* By default the access is enabled.
21+
* By default the access is enabled. When packager support is compiled out
22+
* (neither RCT_DEV_MENU nor RCT_PACKAGER_LOADING_FUNCTIONALITY is set),
23+
* calling this function is a no-op.
2324
*/
2425
RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
25-
#endif
2626

2727
NS_ASSUME_NONNULL_BEGIN
2828

packages/react-native/React/Base/RCTBundleURLProvider.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919

2020
const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT;
2121

22-
#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY
22+
// Declared unconditionally so out-of-tree callers link in every configuration,
23+
// same shape as RCTDevLoadingViewSetEnabled. Reads stay gated below, so this is
24+
// a no-op when packager support is compiled out.
2325
static BOOL kRCTAllowPackagerAccess = YES;
2426
void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed)
2527
{
2628
kRCTAllowPackagerAccess = allowed;
2729
}
28-
#endif
2930
static NSString *const kRCTPackagerSchemeKey = @"RCT_packager_scheme";
3031
static NSString *const kRCTJsLocationKey = @"RCT_jsLocation";
3132
static NSString *const kRCTEnableDevKey = @"RCT_enableDev";

0 commit comments

Comments
 (0)