Skip to content

[ios][prebuild] build xcframeworks from prebuild script #51596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chrfalch
Copy link
Collaborator

@chrfalch chrfalch commented May 26, 2025

Summary

This commit adds support for building XCFrameworks from the prebuild-script

  • Added build script to help build xcframeworks
  • Added full header file structure
  • Added calling the build script from the main prebuild script

TODO: We need to add resources / privacy bundles

Changelog:

[IOS] [ADDED] - Added building XCFframework from the prebuild script

Test Plan:

Run prebuild script and verify that XCFrameworks are successfully built.

chrfalch added 2 commits May 26, 2025 09:58
This commit adds building the swift package from the prebuild script:

- Added swiftpackage.js for building the swift package
- Added calling building from the main script
- Added configurable build type from the main script.
- Removed params in jsdoc from the link method
This commit adds support for building XCFrameworks from the prebuild-script

- Added build script to help build xcframeworks
- Added full header file structure
- Added calling the build script from the main prebuild script

TODO: We need to add resources / privacy bundles
@chrfalch chrfalch requested a review from cipolleschi May 26, 2025 08:02
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels May 26, 2025
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

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

Only one thing that I think needs to be fixed. But great job!

const fileName = path.basename(filePath, path.extname(filePath));
const cppFilePath = path.join(
path.dirname(filePath),
fileName + (fileName.endsWith('mm') ? '.cpp' : '.mm'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fileName + (fileName.endsWith('mm') ? '.cpp' : '.mm'),
fileName + (!fileName.endsWith('mm') ? '.cpp' : '.mm'),

why are we adding the .cpp extension if the file ends with mm? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

In the framework, we also have some pure C++ headers, with no implementation code.
I think it is fine so far, as I don't think we have such things in Objc.. Maybe some protocol only files... 🤔
How are we handling that case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not super happy with how the "automatic" detection of header files are done here, but maybe we can make a more static list when we move away from cocoapods. This implementation was the smallest denominator to get a demo project up and running. I expect us to have to refactor this when we find missing headers in f.ex. Expo.

Copy link
Contributor

Choose a reason for hiding this comment

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

that makes sense. We can use this as a starting point!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed now!

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

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

Only one thing that I think needs to be fixed. But great job!

@chrfalch chrfalch changed the title [ios][prebuild] build swift package from prebuild script [ios][prebuild] build xcframeworks from prebuild script May 27, 2025
@chrfalch chrfalch requested a review from cipolleschi May 27, 2025 10:56
@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants