Skip to content

Conversation

@cipolleschi
Copy link
Contributor

Summary:

Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

Changed

This change adds a function to add missing section to the project. This function is used by a coordination function in a future diff on the stack.

Changelog:

[Internal] -

Differential Revision: D81778443

@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 Sep 9, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81778443

Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81778443

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Sep 10, 2025
…'t have them (facebook#53654)

Summary:
Pull Request resolved: facebook#53654

Pull Request resolved: facebook#53648

## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

This change adds a function to add missing section to the project. This function is used by a coordination function in a future diff on the stack.

## Changelog:
[Internal] -

Differential Revision: D81778443
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81778443

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Sep 10, 2025
…'t have them (facebook#53654)

Summary:
Pull Request resolved: facebook#53654

Pull Request resolved: facebook#53648

## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

This change adds a function to add missing section to the project. This function is used by a coordination function in a future diff on the stack.

## Changelog:
[Internal] -

Differential Revision: D81778443
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81778443

cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Sep 10, 2025
…'t have them (facebook#53654)

Summary:
Pull Request resolved: facebook#53654

Pull Request resolved: facebook#53648

## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

This change adds a function to add missing section to the project. This function is used by a coordination function in a future diff on the stack.

## Changelog:
[Internal] -

Differential Revision: D81778443
cipolleschi and others added 15 commits September 11, 2025 08:56
Summary:
This change adds a simple function that manages symlinks. This is used through the stack of changes to avoid code repetition.

## Context
SwiftPM is very picky in how the header structure must be.
In order to preserve the import/include statements as much as possible when building from source, we can recreate the header structure in a temporary folder inside the react-native package using symlinks.

In this way, users can still modify the headers and build RNTester and HelloWorld using SwiftPM without breaking changes.

## Changelog:
[Internal] -

Differential Revision: D82202860

Reviewed By: cortinico
Summary:
This change add a utility function to extract headers (both .h and .hpp) from a folder. It also allow to exclude some specific folders (e.g.: `tests`, non supported platforms, ...)

## Changelog:
[Internal] -

Differential Revision: D82205692
…a destination path (facebook#53620)

Summary:
Pull Request resolved: facebook#53620

## Context

One of the quirk of SwiftPM is that the packages has to have access to the headers they need. Usually this is solved by properly setting the header_search_path. However, in  SwiftPM, we are not allowed to use headers search path that escape the package itself (basically, header search path can't start with `../`).

To work around this limitation we are recreating the correct Header structure by using hardlinks to the actual headers.

## Changed

In this change we are adding an helper function that creates links between a source folder and a destination folder.

## Changelog:
[Internal] -

Differential Revision: D81778469

Reviewed By: cortinico
…ers in the ReactApple folder (facebook#53629)

Summary:
Pull Request resolved: facebook#53629

## Context

One of the quirk of SwiftPM is that the packages has to have access to the headers they need. Usually this is solved by properly setting the header_search_path. However, in  SwiftPM, we are not allowed to use headers search path that escape the package itself (basically, header search path can't start with `../`).

To work around this limitation we are recreating the correct Header structure by using hardlinks to the actual headers.

## Changed

In this change we are adding a function to properly create the header structure for the headers in ReactApple that requires a special case.

## Changelog:
[Internal] -

Differential Revision: D81778471

Reviewed By: cortinico
…ers in the ReactCommon folder (facebook#53631)

Summary:
Pull Request resolved: facebook#53631

## Context

One of the quirk of SwiftPM is that the packages has to have access to the headers they need. Usually this is solved by properly setting the header_search_path. However, in  SwiftPM, we are not allowed to use headers search path that escape the package itself (basically, header search path can't start with `../`).

To work around this limitation we are recreating the correct Header structure by using hardlinks to the actual headers.

## Changed

In this change we are adding an helper function that creates links for the ReactCommon folder that has a complex structure and complex mapping requirements

## Changelog:
[Internal] -

Differential Revision: D81778470

Reviewed By: cortinico
…Native Core

Summary:
## Context

One of the quirk of SwiftPM is that the packages has to have access to the headers they need. Usually this is solved by properly setting the header_search_path. However, in  SwiftPM, we are not allowed to use headers search path that escape the package itself (basically, header search path can't start with `../`).

To work around this limitation we are recreating the correct Header structure by using hardlinks to the actual headers.

## Changed

In this change we did two things:
1. we move the helper functions to a headers-utils.js file (and the tests to the `headers-utils-test.js` file)
2. we added a function that coordinates the creation of the header links *and added tests for it)

## Changelog:
[Internal] -

Differential Revision: D81778464
…ndencies

Summary:
## Context

One of the quirk of SwiftPM is that the packages has to have access to the headers they need. Usually this is solved by properly setting the header_search_path. However, in  SwiftPM, we are not allowed to use headers search path that escape the package itself (basically, header search path can't start with `../`).

To work around this limitation we are recreating the correct Header structure by using hardlinks to the actual headers.

## Changed

In this change we are adding an helper function that creates links for the ThirdPartyDependencies that React native and libraries might need to access.

## Changelog:
[Internal] -

Differential Revision: D81778459
Summary:
## Context

One of the quirk of SwiftPM is that the packages has to have access to the headers they need. Usually this is solved by properly setting the header_search_path. However, in  SwiftPM, we are not allowed to use headers search path that escape the package itself (basically, header search path can't start with `../`).

To work around this limitation we are recreating the correct Header structure by using hardlinks to the actual headers.

## Changed

In this change we are adding an helper function to create hard links to Codegen Headers so that other libraries can access them.

## Changelog:
[Internal] -

Differential Revision: D81778450
…ard links

Summary:
## Context

One of the quirk of SwiftPM is that the packages has to have access to the headers they need. Usually this is solved by properly setting the header_search_path. However, in  SwiftPM, we are not allowed to use headers search path that escape the package itself (basically, header search path can't start with `../`).

To work around this limitation we are recreating the correct Header structure by using hardlinks to the actual headers.

## Changed

In this change we are adding a function that is used to orchestrate the helpers function defined in previous changes.

## Changelog:
[Internal] -

Differential Revision: D81778457
Summary:
## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

All the Xcode project elements have an id of 24 hex characters. This change adds a function to generate the id randomly.

## Changelog:
[Internal] -

Differential Revision: D81778473
Summary:
## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

Apple provides a helpful CLI program called `plutils` that can take a xcodeproj and convert it to json. We use that to parse the xcodeproject.

## Changelog:
[Internal] -

Differential Revision: D81778448
Summary:
## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

We are adding a function that deintegrate local Swift Packages. This helps to make sure we can have an idempotent script and that we don't add the same package twice.

## Changelog:
[Internal] -

Differential Revision: D81778458
Summary:
## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

This change adds some helper function that can be used to serialize some simple Xcodeproject objects back to string.
This will be used in future diffs to rewrite the Xcodeproj file.

## Changelog:
[Internal] -

Differential Revision: D81778445
Summary:
## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

This change does two things:
- moves the function that generate the object id to a different file
- adds a function to add the local Swift packages to the project

Moving the generateObjectId function to a separate file is a required step to mock it in the tests.

## Changelog:
[Internal] -

Differential Revision: D81934363
…'t have them (facebook#53654)

Summary:
Pull Request resolved: facebook#53654

Pull Request resolved: facebook#53648

## Context

Apple does not have a tool from CLI to add a package to
a project, therefore we need to manually modify the Xcodeproject to integrate some Swift packages into it.

## Changed

This change adds a function to add missing section to the project. This function is used by a coordination function in a future diff on the stack.

## Changelog:
[Internal] -

Differential Revision: D81778443
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81778443

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. fb-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants