Skip to content

Define RN_BUILDING for React Native's own CocoaPods targets (#57858) - #57858

Open
coado wants to merge 2 commits into
react:mainfrom
coado:export-D115051089
Open

Define RN_BUILDING for React Native's own CocoaPods targets (#57858)#57858
coado wants to merge 2 commits into
react:mainfrom
coado:export-D115051089

Conversation

@coado

@coado coado commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary:

RN_BUILDING marks React Native's own targets so the react/cxxstableapi guards stay inert for internal sources, which keep including fine-grained headers directly.

It is required whenever RN_STRICT_API reaches React Native's own compilation rather than only the consumer's:

  • Project-wide enablement — a consumer applying the flag to every pod target (the CocoaPods post_install idiom) or through a global Buck config. Without RN_BUILDING, React Native's own translation units fail against their own guards.
  • Private headers — PrivateGuard.h has no umbrella escape (#if defined(RN_STRICT_API) && !defined(RN_BUILDING)), so RN_BUILDING is the only way internal code can include them at all.

Mark every first-party pod as part of React Native's own build by defining
RN_BUILDING for it, through a new mark_as_react_native_build helper called last in
each spec block

This change is inert on its own: nothing behaves differently unless a consumer defines
RN_STRICT_API.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D115051089

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 7, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Aug 7, 2026
@meta-codesync

meta-codesync Bot commented Aug 7, 2026

Copy link
Copy Markdown

@coado has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115051089.

@meta-codesync meta-codesync Bot changed the title Define RN_BUILDING for React Native's own CocoaPods targets Define RN_BUILDING for React Native's own CocoaPods targets (#57858) Aug 11, 2026
@coado
coado force-pushed the export-D115051089 branch from 855c8d8 to dd822b4 Compare August 11, 2026 09:25
coado added a commit to coado/react-native that referenced this pull request Aug 11, 2026
)

Summary:
Pull Request resolved: react#57858

`RN_BUILDING` marks React Native's own targets so the react/cxxstableapi guards stay inert for internal sources, which keep including fine-grained headers directly.

It is required whenever `RN_STRICT_API` reaches React Native's own compilation rather than only the consumer's:
- Project-wide enablement — a consumer applying the flag to every pod target (the CocoaPods post_install idiom) or through a global Buck config. Without RN_BUILDING, React Native's own translation units fail against their own guards.
- Private headers — `PrivateGuard.h` has no umbrella escape (#if defined(RN_STRICT_API) && !defined(RN_BUILDING)), so RN_BUILDING is the only way internal code can include them at all.

Mark every first-party pod as part of React Native's own build by defining
`RN_BUILDING` for it, through a new `mark_as_react_native_build` helper called last in
each spec block

This change is inert on its own: nothing behaves differently unless a consumer defines
`RN_STRICT_API`.

Changelog: [Internal]

Differential Revision: D115051089
coado added a commit to coado/react-native that referenced this pull request Aug 11, 2026
)

Summary:
Pull Request resolved: react#57858

`RN_BUILDING` marks React Native's own targets so the react/cxxstableapi guards stay inert for internal sources, which keep including fine-grained headers directly.

It is required whenever `RN_STRICT_API` reaches React Native's own compilation rather than only the consumer's:
- Project-wide enablement — a consumer applying the flag to every pod target (the CocoaPods post_install idiom) or through a global Buck config. Without RN_BUILDING, React Native's own translation units fail against their own guards.
- Private headers — `PrivateGuard.h` has no umbrella escape (#if defined(RN_STRICT_API) && !defined(RN_BUILDING)), so RN_BUILDING is the only way internal code can include them at all.

Mark every first-party pod as part of React Native's own build by defining
`RN_BUILDING` for it, through a new `mark_as_react_native_build` helper called last in
each spec block

This change is inert on its own: nothing behaves differently unless a consumer defines
`RN_STRICT_API`.

Changelog: [Internal]

Differential Revision: D115051089
@coado
coado force-pushed the export-D115051089 branch from dd822b4 to c484781 Compare August 11, 2026 09:56
Summary:
`install_modules_dependencies` is the helper every third-party New Architecture library calls from its own podspec, and `update_search_paths` covers the user project and the pod targets that don't go through it. Neither knew about `React-cxxstableapi`.

React Native's public C++ headers are starting to include the shared guard header `<react/cxxstableapi/UmbrellaGuard.h>`. The include is unconditional, so a third-party pod that includes any guarded React Native header has to be able to resolve it. Today it can't: in the default static-library mode `$(PODS_ROOT)/Headers/Public/React-cxxstableapi` is missing from the search path, and under `use_frameworks!` the `React_cxxstableapi.framework/Headers` entry is missing.

Declare the dependency and add the matching framework header search path in both places.

Changelog:
[iOS][Added] - Add a `React-cxxstableapi` dependency to third-party New Architecture pods so they can resolve React Native's C++ API guard headers

Differential Revision: D110052811
coado added a commit to coado/react-native that referenced this pull request Aug 12, 2026
)

Summary:
Pull Request resolved: react#57858

`RN_BUILDING` marks React Native's own targets so the react/cxxstableapi guards stay inert for internal sources, which keep including fine-grained headers directly.

It is required whenever `RN_STRICT_API` reaches React Native's own compilation rather than only the consumer's:
- Project-wide enablement — a consumer applying the flag to every pod target (the CocoaPods post_install idiom) or through a global Buck config. Without RN_BUILDING, React Native's own translation units fail against their own guards.
- Private headers — `PrivateGuard.h` has no umbrella escape (#if defined(RN_STRICT_API) && !defined(RN_BUILDING)), so RN_BUILDING is the only way internal code can include them at all.

Mark every first-party pod as part of React Native's own build by defining
`RN_BUILDING` for it, through a new `mark_as_react_native_build` helper called last in
each spec block

This change is inert on its own: nothing behaves differently unless a consumer defines
`RN_STRICT_API`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D115051089
@coado
coado force-pushed the export-D115051089 branch from c484781 to 2d89235 Compare August 12, 2026 12:37
)

Summary:
Pull Request resolved: react#57858

`RN_BUILDING` marks React Native's own targets so the react/cxxstableapi guards stay inert for internal sources, which keep including fine-grained headers directly.

It is required whenever `RN_STRICT_API` reaches React Native's own compilation rather than only the consumer's:
- Project-wide enablement — a consumer applying the flag to every pod target (the CocoaPods post_install idiom) or through a global Buck config. Without RN_BUILDING, React Native's own translation units fail against their own guards.
- Private headers — `PrivateGuard.h` has no umbrella escape (#if defined(RN_STRICT_API) && !defined(RN_BUILDING)), so RN_BUILDING is the only way internal code can include them at all.

Mark every first-party pod as part of React Native's own build by defining
`RN_BUILDING` for it, through a new `mark_as_react_native_build` helper called last in
each spec block

This change is inert on its own: nothing behaves differently unless a consumer defines
`RN_STRICT_API`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D115051089
@coado
coado force-pushed the export-D115051089 branch from 2d89235 to 4208a34 Compare August 12, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant