Commit Graph

99 Commits

Author SHA1 Message Date
Moti Zilberman 1f57ae5249 Distribute React Native DevTools binaries via GitHub Releases (#52930)
Summary:
bypass-github-export-checks

OSS release infrastructure for the (experimental) React Native DevTools standalone shell.

Currently, binaries are built continuously on Meta infra and served from the Meta CDN using fbcdn.net URLs checked into a DotSlash file in the repo, e.g.:

https://github.com/facebook/react-native/blob/15373218ec572c0e43325845b80a849ad5174cc3/packages/debugger-shell/bin/react-native-devtools#L9-L18

For open source releases we want to primarily distribute the binaries as GitHub release assets, while keeping the Meta CDN URLs as a secondary option. This PR makes the necessary changes to the release workflows to support this:

* `workflows/create-release.yml` (modified): As part of the release commit, rewrite the DotSlash file to include the release asset URLs.
  * **NOTE:** After this commit, **the new URLs don't work yet**, because they refer to a release that hasn't been published. Despite this, the DotSlash file remains valid and usable (because DotSlash will happily fall back to the Meta CDN URLs, which are still in the file).
* `workflows/create-draft-release.yml` (modified): After creating a draft release, fetch the binaries from the Meta CDN and reupload them to GitHub as release assets. This is based on the contents of the DotSlash file rewritten by `create-release.yml`.
* `workflows/validate-dotslash-artifacts.yml` (new): After the release is published, all URLs referenced by the DotSlash (both Meta CDN URL and GH release asset URLs) should be valid and refer to the same artifacts. This workflow checks that this is the case.
  * If this workflow fails on a published release, the release may need to be burned or a hotfix release may be necessary - as the release will stop working correctly once the Meta CDN stops serving the assets.
  * This workflow will also be running continuously on `main`. If it fails on a commit in `main`, there might be a connectivity issue between the GHA runner and the Meta CDN, or there might be an issue on the Meta side.

NOTE: These changes to the release pipeline are generic and reusable; if we later add another DotSlash-based tool whose binaries need to be mirrored as GitHub release assets, we just need to add it to the `FIRST_PARTY_DOTSLASH_FILES` array.

## Changelog:

[Internal] Mirror React Native DevTools binaries in GitHub Releases

Pull Request resolved: https://github.com/facebook/react-native/pull/52930

Test Plan:
### Step 0: Unit tests

I've added unit tests for `dotslash-utils`, `curl-utils`, and for the majority of the logic that makes up the new release scripts (`write-dotslash-release-assets-urls`, `upload-release-assets-for-dotslash`, `validate-dotslash-artifacts`).

### Step 1: Test release commit

Created a test branch and draft PR: https://github.com/facebook/react-native/pull/53147.

Locally created a release commit, simulating the create-release GH workflow:

```
node scripts/releases/create-release-commit.js --reactNativeVersion 0.82.0-20250903-0830 --no-dry-run
```

This updated the DotSlash file in the branch: https://github.com/facebook/react-native/pull/53147/commits/2deeb7e70376ee80b99f27bea4825789f22a89a3#diff-205a9ff6005e30be061eaa64b9cb50b15b0e909dd188e0866189e952655a3483

NOTE: I've also ensured that the `create-release-commit` script correctly updates the DotSlash file when running from a branch that already has a release commit - see screenshot:
<img width="1483" height="587" alt="image" src="https://github.com/user-attachments/assets/1ffd859b-e02b-483d-8067-9cc9116829a4" />

### Step 2: Test draft release

Enabled testing the create-draft-release GH workflow in the test branch using these temporary hacks:

* https://github.com/facebook/react-native/pull/53147/commits/81f334eac5147d4dbf5f6d7d627ddfa52cd197be
* https://github.com/facebook/react-native/pull/53147/commits/6d8851657629de7e0b710ed8f5dd7d0f7b9847cc
* https://github.com/facebook/react-native/pull/53147/commits/1428a8da8b9fb29c45fc33d79f311dd1fe273433

Workflow run: https://github.com/facebook/react-native/actions/runs/17426711373/job/49475327346
Draft release: https://github.com/facebook/react-native/releases/tag/untagged-c6a62a58e5baa37936e1
Draft release screenshot for posterity (since we'll likely delete the draft release after landing this):

<img width="1024" height="814" alt="image" src="https://github.com/user-attachments/assets/1900da15-48f6-4274-b29c-0ac2019d92c0" />

### Step 3: Test post-release validation script

For obvious reasons, I've avoided actually publishing the above draft release. But I have run the `validate-dotslash-artifacts` workflow on the *current* branch to ensure that the logic is correct: https://github.com/motiz88/react-native/actions/runs/17426885205/job/49475888486

Running `node scripts/releases/validate-dotslash-artifacts.js` in the release branch (without publishing the release first) fails, as expected:

<img width="1105" height="748" alt="image" src="https://github.com/user-attachments/assets/ed23a2e2-7a31-42eb-a324-f1d50eafe2fb" />

## Next steps

This PR is all the infra needed ahead of the 0.82 ~~branch cut~~ infra freeze to support the React Native DevTools standalone shell, at least on the GitHub side. ~~Some minor infra work remains on the Meta side, plus some product/logic changes to the React Native DevTools standalone shell that I'm intending to finish in time for 0.82 (for an experimental rollout).~~ EDIT: All the planned work has landed; the feature is code-complete on `main` as well as in `0.82-stable` (apart from this infra change).

As a one-off, once we've actually published 0.82.0-rc.1, we'll want to have a human look at the published artifacts and CI workflow logs to ensure everything is in order. (I'll make sure to communicate this to the 0.82 release crew.) Afterwards, the automation added in this PR should be sufficient.

Reviewed By: huntie

Differential Revision: D81578704

Pulled By: motiz88

fbshipit-source-id: 6a4a48c3713221a89dd5fc88851674c1ddc6bb10
2025-09-04 11:25:39 -07:00
Jakub Piasecki 3e9990f860 Allow to opt-in to use the new Hermes on Android (#53580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53580

Changelog: [ANDROID][ADDED] Added opt-in to use the new Hermes

Reviewed By: cortinico

Differential Revision: D81035114

fbshipit-source-id: d01e44190941d161cf641ec4e03ed487aff18dd8
2025-09-04 07:42:12 -07:00
Christian Falch a843119ff1 Fix copy symbol files in RNDeps precompile (#53353)
Summary:
Symbol files wasn't copied correctly when building - as with bundles we did overwrite the files and ended up with only the last symbol file.

This commit fixes this by mapping the framework build folder architecture type to the xcframework slices creating the correct file structure under the Symbols folder.

- Each slice gets a folder with the architecture name under Symbols containing the dSym folder for that slice
- Refactored getting correct architecture folder into a separate function.
- Refactored target folder lookup in copyBundles
- Removed unused async modifier on function

## Changelog:

[IOS] [FIXED] - Fixed how we copy and build the Symbols folder when precompiling ReactNativeDependencies

Pull Request resolved: https://github.com/facebook/react-native/pull/53353

Test Plan: Run nightlies and verify that ReactNativeDependencies.framework.dSym files contains symbol files for all architectures.

Reviewed By: cortinico

Differential Revision: D80692019

Pulled By: cipolleschi

fbshipit-source-id: 77983bc29d1965edf3bc0fcbd9cb3177071991d3
2025-08-22 03:26:54 -07:00
Christian Falch e3adf47214 fixed copying bundles correctly (#53325)
Summary:
When copying bundle files from the platform folders in the .build output, the script had a bug where all bundles were copied - meaning that only the last one would be in the resulting xcframework output.

This caused an issue when we tried to publish an app built with precompiled binaries to AppStore where the field `CFBundleSupportedPlatforms` was wrong and caused the submission to be rejected. This was caused by the script copying the wrong bundle file into the final xcframework outputs.

This issue is described here:
https://github.com/react-native-community/discussions-and-proposals/discussions/923#discussioncomment-14089245

This commit fixes the above error by using the iOS 15 `vtool` to show the actual platform for a given framework and then making sure we don't copy bundles in the wrong way.

Testing this on my local machine for iOS/iOS-simulator/MacOS/catalyst yields the following results (before/after this fix):

**Before:**

```bash
Copying bundles to the framework...
  ../.build/Build/Products/Debug/ReactNativeDependencies_glog.bundle → ios-arm64
  ../.build/Build/Products/Debug/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug/ReactNativeDependencies_glog.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug/ReactNativeDependencies_boost.bundle → ios-arm64
  ../.build/Build/Products/Debug/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug/ReactNativeDependencies_boost.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug/ReactNativeDependencies_folly.bundle → ios-arm64
  ../.build/Build/Products/Debug/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug/ReactNativeDependencies_folly.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_glog.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_glog.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_boost.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_boost.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_folly.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_folly.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_glog.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_glog.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_boost.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_boost.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_folly.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_folly.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_glog.bundle → ios-arm64
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_glog.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_boost.bundle → ios-arm64
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_boost.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_folly.bundle → ios-arm64
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_folly.bundle → macos-arm64_x86_64
```

  **After:**

```bash
  Copying bundles to the framework...
  ../.build/Build/Products/Debug/ReactNativeDependencies_glog.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug/ReactNativeDependencies_boost.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug/ReactNativeDependencies_folly.bundle → macos-arm64_x86_64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_glog.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_boost.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphoneos/ReactNativeDependencies_folly.bundle → ios-arm64
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-iphonesimulator/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-simulator
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_glog.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_boost.bundle → ios-arm64_x86_64-maccatalyst
  ../.build/Build/Products/Debug-maccatalyst/ReactNativeDependencies_folly.bundle → ios-arm64_x86_64-maccatalyst
```

## Changelog:

[IOS] [FIXED] - Fixed copying bundles correctly to xcframeworks when precompiling ReactNativeDependencies.xcframework

Pull Request resolved: https://github.com/facebook/react-native/pull/53325

Test Plan: Ensure that the info.plist files in the nightlies for the ReactNativeDepdendencies.xcframework has the correct bundles for its targets.

Reviewed By: andrewdacenko

Differential Revision: D80457335

Pulled By: cipolleschi

fbshipit-source-id: aeb4166f66218f72bdd29b6fc579fcc7b6d12844
2025-08-19 02:47:40 -07:00
Sam Zhou cf664c65e2 Standardize subtyping error code into incompatible-type in react native and metro (#53312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53312

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D80400976

fbshipit-source-id: 196af69c0b9621b2a2675b232406639773e04933
2025-08-18 09:04:31 -07:00
Sam Zhou 94d260ee6a Unbreak RN CI (#53261)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53261

Replace type annotation with comment syntax

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D80231004

fbshipit-source-id: a863091bec8b5521bc998b57ef08d892823238e6
2025-08-13 20:53:12 -07:00
Sam Zhou 35bee1a857 Add annotations to fix future natural inference errors in xplat/js
Summary: Changelog: [Internal]

Reviewed By: marcoww6

Differential Revision: D80207164

fbshipit-source-id: e9a786c83f89a97db8b383812767978c47d9536c
2025-08-13 18:15:27 -07:00
Sam Zhou af1bcb6d44 Mass replace $FlowIgnore with $FlowFixMe in react-native (#53076)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53076

Changelog: [Internal]

Reviewed By: marcoww6

Differential Revision: D79672242

fbshipit-source-id: 560f057d8658ed602cf7241e584bade70d8f3a99
2025-08-05 15:44:41 -07:00
Alex Hunt ec5638abd0 Expose ReactNativeVersion API (#52784)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52784

Resolves https://github.com/react-native-community/discussions-and-proposals/discussions/893#discussioncomment-13860767.

**Changes**

- Formalises the design of `ReactNativeVersion` as a single object and adds a `getVersionString` accessor.
- Expose `ReactNativeVersion` as a root export on `index.js`.
- Update deep imports use in `NewAppScreen`.

**Notes**

- Subtly, we also have `Platform.constants.reactNativeVersion` in our public API already. **However**, this is the per-platform ***native-reported*** RN version, distinct from the JS version (this diff). See [`ReactNativeVersionCheck.js`](https://github.com/facebook/react-native/blob/54d733311d87e9ab4e18f947edf3f5c85f9a6275/packages/react-native/Libraries/Core/ReactNativeVersionCheck.js#L24).

Changelog:
[General][Added] - Expose `ReactNativeVersion` API as JavaScript root export

Reviewed By: cortinico

Differential Revision: D78806347

fbshipit-source-id: 974251fdaa9ab18fac8a584644fea894e4f6e083
2025-07-23 08:28:32 -07:00
Alex Hunt fc5e33b582 Reorganise shared script utils (#52473)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52473

Shared utils that were located in the root of `scripts/` are now colocated closer to their dependencies or moved to `scripts/shared/` — simplifying the root directory layout.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D77873875

fbshipit-source-id: e04dba41a1ef811d32793931033fdfa93afad0cd
2025-07-08 06:10:36 -07:00
Nicola Corti 9258e90c92 Publish, Close and Release the Maven repository during build_npm_package
Summary:
Due to us moving to central.sonatype.com for publishing, we cannot publish and release the Maven repository in 2 distinct invocations.
This consolidates all the publishing job to happen during build_npm_package

Changelog:
[Internal] [Changed] -

Reviewed By: fabriziocucci

Differential Revision: D76888543

fbshipit-source-id: 3cb0db6176ed2221a12b4f3f1f575232aa006a6c
2025-06-18 04:02:28 -07:00
Gabriel Donadel 3ae9328571 Bump @types/react to 19.1 (#52059)
Summary:
While testing I notice that `types/react` was not updated in some peer depencies

## Changelog:

[GENERAL] [CHANGED] - Bump types/react to 19.1

Pull Request resolved: https://github.com/facebook/react-native/pull/52059

Test Plan: CI should be green

Reviewed By: christophpurrer

Differential Revision: D76763084

Pulled By: sbuggay

fbshipit-source-id: c078c03aa57ca04040c64986dd7957da8a6f2c2d
2025-06-16 17:45:11 -07:00
Riccardo Cipolleschi a6ea626255 Remove the option to use JSC from core (#51946)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51946

This change simplified the setp disallowing to use JSC from core.
As a side effect, it simplified the setup by always falling back to hermes if the users decides not to use the third party JSC

## Changelog:
[iOS][Removed] - remove the option to use JSC from core

Reviewed By: cortinico

Differential Revision: D76342625

fbshipit-source-id: c925ab4fab1e171e289a1c5f75890c92da1b3f08
2025-06-16 02:36:45 -07:00
Tim Yung df52bbe649 RN: Update set-versions for private/ Packages (#51937)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51937

Updates the `set-versions` script to also update workspace packages in `private/*`. Unlike with packages in `packages/*`, this does not change their `"version"` fields, though. It only updates their dependencies.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D76358273

fbshipit-source-id: d0e0557d17c355828020a218083b98dd177a6732
2025-06-10 16:37:49 -07:00
Tim Yung 3e6423fe65 RN: Flowify packages/rn-tester (#51788)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51788

Adds `flow` to the remaining files that are lacking it in the `packages/rn-tester` directory.

This also adds any necessary type annotations and fixes lint warnings.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75899307

fbshipit-source-id: 27a74ed0007b3b754446a45931c2c148312d5e3a
2025-06-04 12:03:52 -07:00
Tim Yung 9c38daf2ef RN: Flowify scripts (#51780)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51780

Adds `flow` to the remaining files that are lacking it (or `noflow`) in the `scripts` directory.

This also fixes what I believe to be a typo in one of the files.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75883851

fbshipit-source-id: 928b7a12a08269b6643379d46de888f2c61dcb29
2025-06-04 12:03:52 -07:00
Panos Vekris 0c70c0166e pre-suppress errors for natural inference rollout in xplat/js (#51524)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51524

Links in error suppressions will point to the announcement post in Flow FYI.

Changelog: [Internal]

drop-conflicts

Reviewed By: marcoww6

Differential Revision: D75188177

fbshipit-source-id: 27ea1fbee848e9371e679cf423e30bc9608edea0
2025-05-22 02:50:47 -07:00
Tim Yung 84de8a075e RN: Delete @oncall Annotations (#51416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51416

Deletes `oncall` annotations from the `facebook/react-native` repository.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D74902524

fbshipit-source-id: 32a6a5b2ff27281792d572f151e2b094d9a79029
2025-05-17 16:18:05 -07:00
Tim Yung ba092bfaba RN: Add Missing @format Annotations (#51415)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51415

Adds the `format` annotation to all files that were missing them.

Also, adds `noformat` to generated files, and removed it from files that no longer need them.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D74901034

fbshipit-source-id: 7e0b85ca8ee2de41278f3aa23cb03e9c266d9c28
2025-05-16 18:09:09 -07:00
Riccardo Cipolleschi 130fb7fd30 Fix set-rn-version to account for codegen snapshot test files (#51157)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51157

test-js jobs are failing because the codegen snapshot tests generates a Podspecs withan hardcoded version that does not matches the version we are about to release.

This fix updates the script that set the RN version to make sure it also updates the Codegen snapshots.

This is a porting to `main` of [this PR](https://github.com/facebook/react-native/pull/51156).

## Changelog:
[Internal] - Fix set-rn-version to account for codegen snapshot test files

Reviewed By: fabriziocucci, cortinico

Differential Revision: D74321590

fbshipit-source-id: 6837e60a0a2834030680f7ec0c7584bf2622f33e
2025-05-07 07:18:45 -07:00
Riccardo Cipolleschi 3f41fe2948 Make fmt and SocketRocket compatible with Swift (#50874)
Summary:
`SocketRocket` and `fmt` are part of React Native dependencies.
If a library is written in swift and depends on them, it will fail to install the pods because these pods are not compatible with Swift.

This change makes sure that the pods are installed in a way that is swift compatible.

## Changelog:
[iOS][Fixed] - Make fmt and SocketRocket Swift friendly

Pull Request resolved: https://github.com/facebook/react-native/pull/50874

Test Plan:
Tested locally in a nightly app.

### Before the change:

```
yarn add react-native-video
cd ios
bundle exec pod install
```

This script resulted in this error:

```
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `react-native-video` depends upon `fmt` and `SocketRocket`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```

### After the change

```
yarn add react-native-video
cd ios
bundle exec pod install
```

This script installed pods successfully.

Reviewed By: cortinico

Differential Revision: D73512109

Pulled By: cipolleschi

fbshipit-source-id: 222d85dba1cbdf4044e3c8459008a4083a720016
2025-04-23 12:07:20 -07:00
Christian Falch fd1e57b0c0 moved resources to correct location (#50101)
Summary:
In the final XCFramework we no longer need to place resource bundles in a subfolder called Resources - they should be located directly in the framework folder.

This commit fixes this by removing copying to the Resources folder. I also removed a few unneeded tests since we know that we are in a valid folder at this point.

bypass-github-export-checks

## Changelog:

[INTERNAL]  - Moved resource bundles up one level

Pull Request resolved: https://github.com/facebook/react-native/pull/50101

Test Plan: Run RNTester with RCT_USE_RN_DEP=1 and verify that it launches

Reviewed By: cortinico

Differential Revision: D71464608

Pulled By: cipolleschi

fbshipit-source-id: 6cfdda0c6785ffeb13c170f9fd2dd9f5b889d490
2025-03-19 05:07:36 -07:00
Christian Falch b7e046e345 change header structure rn deps in XCFrameworks (#50085)
Summary:
Headers are currently copied into each arch in the final xcframework. This is not necessary and will cause a lot of duplication since these files are the same for all archs.

This commit fixes this by only copying headers when we build the final XCFramework:

- ReactNativeDependencies.podspec: Changed the prepare script to be more resilient to different header structs, since we have multiple ways of packaging our tarballs locally and on the servers
- build.js: Removed copying headers when building frameworks
- compose-framework.js: Added copying headers once to the root of the XCFramework.
- rndependencies.rb: updated docs with correct ENV vars

bypass-github-export-checks

## Changelog:

[INTERNAL] - Changes the header structure in our XCFramework to avoid duplication

Pull Request resolved: https://github.com/facebook/react-native/pull/50085

Test Plan: Run RNTester with RCT_USE_RN_DEPS=1 to use prebuilt RN Deps.

Reviewed By: javache

Differential Revision: D71385183

Pulled By: cipolleschi

fbshipit-source-id: 160d56dea7f61d1b8d0a45b80f6c0789647358e6
2025-03-18 05:24:56 -07:00
Christian Falch 9cf138310d fixed inclusion of resources in swift package (#50050)
Summary:
We had some issues with the Swift package build step where we saw an error message when we included resources and couldn't find out why this was happening.

After systematically going through the generated swift package file and looking for a reason I found a mistake.

When we generate the Package.swift file we pass all compilerFlags from the configuration of the target to both cpp/c flags - which in the case of the folly target ends up being passed to the dependency scanner which isn't too happy about this c++ flag.

The solution was to split `compilerFlags` into `cCompilerFlags` and `cxxCompilerFlags`.

This commit fixes this by:
- split `compilerFlags` into `cCompilerFlags` and `cxxCompilerFlags`.
- Updated configuration with correct settings
- Updated Package.swift generation to use these new flags
- Fixed issue with the copy bundles step that didn't copy the directory in some cases.

## Changelog:

[INTERNAL]  - Fixed processing resources in the generated swift package for the RN Dependencies/prebuild

## Test-plan

Test by prebuilding RNDependencies, include the XCFramework in a new app and try to load resource bundles:

```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      [self loadBundle:framework bundleName:@"ReactNativeDependencies_glog"];
      [self loadBundle:framework bundleName:@"ReactNativeDependencies_boost"];
      [self loadBundle:framework bundleName:@"ReactNativeDependencies_folly"];
      break;
    }
  }
  return YES;
}

- (void) loadBundle:(NSBundle*)framework bundleName: (NSString*)bundleName {
  NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
  NSURL *bundleURL = [bundle URLForResource:bundleName withExtension:@"bundle"];
  NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
  NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
  if (url == nil) {
    LOG(ERROR) << "Could not find PrivacyInfo.xcprivacy in the " << [bundleName UTF8String] << " bundle";
  } else {
    LOG(INFO) << "Found PrivacyInfo.xcprivacy in " << [bundleName UTF8String] << ".";
  }
}
```

Pull Request resolved: https://github.com/facebook/react-native/pull/50050

Reviewed By: javache

Differential Revision: D71316215

Pulled By: cipolleschi

fbshipit-source-id: 53093f962874101f5618997fdac3dd4550768da5
2025-03-18 05:24:56 -07:00
Riccardo Cipolleschi a663731ddd Add Support for local tarball to ReactNativeDependencies (#49970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49970

This change add supports to pass a tarball from a local file to the ReactNativeDependencies podspec, so that we can build React Native using a local copy or the RNDependencies and we can use it also in CI.

## Changelog:

[INTERNAL] - Add support for local tarballs

Reviewed By: cortinico

Differential Revision: D71032641

fbshipit-source-id: d83c96c8c12f3add45f8f5ea15fa0eac06d0bedf
2025-03-13 08:40:14 -07:00
Christian Falch e876e4926f Improve RCT-Folly so that other dependencies don't have to specify the folly flags (#49969)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49969

Improved RCT-Folly podspec by configuring it as a prepare step, so that we don't need to forward the folly flags to all the others pods and to 3rd party dependencies.

## Changelog:

[INTERNAL] - Configure folly in a prepare step

Test Plan:
 Run Rn-Tester and  verify that it works as expected both building deps from source and using prebuilt tarballs
 Add third-party library (react-native-reanimated) and perform the same tests to verify that it works with the changed podspec and utilities

Reviewed By: javache

Differential Revision: D71032640

Pulled By: cipolleschi

fbshipit-source-id: a34a9b38fa5d5b37a0a193a73659f0d45dd3d660
2025-03-13 08:40:14 -07:00
Rob Hogan 0967a821b1 Test fixtures - don't reference Metro versions (#49895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49895

Minor thing, but the fact that these fixture `package.json`s for testing a release script reference real Metro packages and versions always trips me up when I'm updating Metro (grepping, etc).

There's no need for them to mention Metro - any non-RN package is sufficient to test that the script preserves other dependencies. This swaps them for dummy packages.

Changelog: [Internal]

Reviewed By: vzaidman

Differential Revision: D70789598

fbshipit-source-id: 32f394bf1f783534b76d260908538d7b5716ef1f
2025-03-07 10:29:38 -08:00
Riccardo Cipolleschi e23d7106d5 Add function to sign XCFramework (#49863)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49863

After the creation of the XCFramework, that needs to be signed. After the XCFramework is signed, no further modification can happen or they would break the signature.

## Changelog:
[Internal] - Add function to sign the XCFramework

Reviewed By: cortinico

Differential Revision: D70697279

fbshipit-source-id: c2411ca7d12d4679ba55f124cbb445367b15945a
2025-03-06 12:04:23 -08:00
Mateo Guzmán 71fbf51979 Migrate ReactNativeVersion Android template to Kotlin (#49758)
Summary:
Added a new template `ReactNativeVersion.kt-template.js` to be used to generate the Kotlin template for Android. Updating also the set-rn-artifacts-version script to use this template instead of the Java one.

## Changelog:

[INTERNAL] - Migrate ReactNativeVersion Android template to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/49758

Test Plan:
```bash
yarn test-android
yarn android
node ./scripts/releases/set-version.js 1000.0.0
```

Reviewed By: huntie, rshest

Differential Revision: D70486775

Pulled By: cortinico

fbshipit-source-id: 5dd1e0e2ecf4d848dc24e6c47df243a1259ab559
2025-03-04 07:38:18 -08:00
Pieter De Baets 3dc78f804a Update fast_float dependency to 8.0.0 (#49775)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49775

Upgrading this dependency to match folly and to enable using this for number parsing across Fabric.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D70482373

fbshipit-source-id: 64429595c1126e6a06436701a7562bdf6dd962d5
2025-03-04 07:25:59 -08:00
Riccardo Cipolleschi da88bf0030 Add job to build the slices for ios prebuilds (#49528)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49528

This change introduces a job to prebuild iOS slices.

## Changelog:
[Internal] - Create prepare artifacts workflows

Reviewed By: cortinico

Differential Revision: D69855542

fbshipit-source-id: 54d5b24b55f9e7bebdbb201073524dc4f3748e07
2025-02-28 09:05:37 -08:00
Riccardo Cipolleschi 9e64099df6 Cleanup script and move the index to release (#49666)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49666

This change moves the index.js file to the `releases` folder, giving it a meaningful name.

It also rename the prebuild folder to ios-prebuild to be more descriptive.

It finally removes the old scripts that this refactoring supersedes.

bypass-github-export-checks

## Changelog:

[INTERNAL] - Move the infdex.js to the prepare-ios-prebuilds script.

Reviewed By: cortinico

Differential Revision: D70176043

fbshipit-source-id: e0c3f3bd53adf97fa388c37a746d274fd678f690
2025-02-26 08:19:39 -08:00
Christian Falch 8b984ca2c4 Glue all the scripts together. (#49671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49671

This change refactors the script to prebuild ios dependencies by adding a script that glues all the steps together.

bypass-github-export-checks

## Changelog:

[INTERNAL] - Add script to orchestrate all the steps

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175842

Pulled By: cipolleschi

fbshipit-source-id: e4bb4ad5d12e7ceaaca0eeee7ce6dc7269aa7bad
2025-02-26 08:19:39 -08:00
Christian Falch 2fdb6c9832 Refactor compose-framework script (#49665)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49665

This change refactors the script to prebuild ios dependencies by factoring out the code that creates the XCFrameworks

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out flow types, constants and gitignore

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175797

Pulled By: cipolleschi

fbshipit-source-id: 8eb07fd3ff9f309d5f6e4b55156c5d5cbbd41235
2025-02-26 08:19:39 -08:00
Christian Falch 1cf751ed58 Refactor build script (#49669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49669

This change refactors the script to prebuild ios dependencies by factoring out the script that builds the frameworks

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out the script to build the frameworks.

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175778

Pulled By: cipolleschi

fbshipit-source-id: 987ea8922ab566c6601a77084226df2b6456243f
2025-02-26 08:19:39 -08:00
Christian Falch f7970cddf2 Add code to generate the Swift Package
Summary:
This change refactors the script to prebuild ios dependencies by:
- remove the manually maintained Package.swift
- add script to generate it starting from the configurations that we have
bypass-github-export-checks
## Changelog:

[INTERNAL] - Factor out script to generate  Package.swift file

Reviewed By: cortinico

Differential Revision: D70175760

Pulled By: cipolleschi

fbshipit-source-id: a1b0fc6dcdc1860b04ab260697f259c297338f41
2025-02-26 08:19:39 -08:00
Christian Falch 7aa5df32a4 Refactor setupDependencies script (#49670)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49670

This change refactors the script to prebuild ios dependencies by factoring out the code that setups native dependencies.

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out code to setup native dependencies

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175729

Pulled By: cipolleschi

fbshipit-source-id: 4e1c19b5482b4335ab66c2b605abcb9db47091d3
2025-02-26 08:19:39 -08:00
Christian Falch 339b0b5653 Add utils: CLI arg validation and folders utils (#49668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49668

This change refactors the script to prebuild ios dependencies by:
- factoring out CLI validation in a separate file
- factoring out the folder utilities in a separate file

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out CLI and folder utilities

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175663

Pulled By: cipolleschi

fbshipit-source-id: 5c6653aed7054658c5e265675766a28415da3918
2025-02-26 08:19:39 -08:00
Christian Falch 6eac2bd5b9 Configure all the third party dependencies we need (#49667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49667

This change refactors the script to prebuild ios dependencies by extracting all the dependencies' configurations in a separate file

bypass-github-export-checks

## Changelog:

[INTERNAL] - Factor out all the dependencies configurations in a separate file

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70175499

Pulled By: cipolleschi

fbshipit-source-id: c0eacb831e6551d39956c9835d15ab8d9e91d8f2
2025-02-26 08:19:39 -08:00
Christian Falch a860c55f38 Extract Flow types and constants (#49614)
Summary:
This change refactors the script to prebuild ios dependencies by:
- factoring out the constants
- factoring out the flow type definitions
- factoring out the .gitignore

bypass-github-export-check

## Changelog:

[INTERNAL] - Factor out flow types, constants and gitignore

Pull Request resolved: https://github.com/facebook/react-native/pull/49614

Test Plan:
Tested in this `AppDelegate.mm`:

Imports:

```obj-c
#import "AppDelegate.h"
#import <glog/logging.h>
#import <double-conversion.h>
#include <fmt/core.h>
#include <boost/assert.hpp>
#include <fast_float/fast_float.h>
#include <string>
#import <SocketRocket/SRWebSocket.h>
```

Code:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  std::string input = "3.1416 xyz ";
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
  LOG(INFO) << "Hello from GLOG";
  fmt::print("Hello, world from FMT!\n");
  BOOST_ASSERT(100 == 100);
  double result;
  fast_float::from_chars(input.data(), input.data() + input.size(), result);
  LOG(INFO) << "Answer :" << result;

  NSArray *frameworks = [NSBundle allFrameworks];

  for (NSBundle *framework in frameworks) {
    NSString *frameworkName = framework.bundleURL.lastPathComponent;
    if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
      NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
      NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"];
      NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
      NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
      if (url == nil) {
        throw [NSException exceptionWithName:@"ResourceNotFoundException"
                                       reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle"
                                     userInfo:nil];
      }
      break;
    }
  }
  return YES;
}
```

Reviewed By: cortinico

Differential Revision: D70172536

Pulled By: cipolleschi

fbshipit-source-id: 91589693fd24e2b0d6d67759fb9fbc86841f4d13
2025-02-26 08:19:39 -08:00
Riccardo Cipolleschi 3ab568d472 Add utility function to validate args (#49522)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49522

While testing the script, sometime I obtained undesired results because I was passing the wrong values for the arguments.

This change add a simple validation function to inform the user when the arguments that are passed are not valid.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D69851416

fbshipit-source-id: c378a3ca5db942cca5178274204a0d01d1eefdf7
2025-02-20 03:28:49 -08:00
Riccardo Cipolleschi 07f05cedd5 fix typo in configuration check (#49523)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49523

There was a typo when checking the configuration. The default parameter is `all`, not `All`.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D69851429

fbshipit-source-id: 7f16f5f89c90824ceb57f9980bc38a31be33ccfe
2025-02-20 03:28:49 -08:00
Riccardo Cipolleschi b8af3ad599 Cleanup old xcframework (#49524)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49524

If there is already an XCFramework in the current location. xcodebuild fails to create and override the xcframework.

This change allows us to override an old xcframework and to iterate more quickly.

## Changelog:
[Internal] -

Reviewed By: cortinico

Differential Revision: D69851428

fbshipit-source-id: 723b3035cec008e2bd177da4f960f2bb085ff493
2025-02-20 03:28:49 -08:00
Riccardo Cipolleschi 864d47822f Handle configurations and destinations in prepare-ios-prebuilds (#49498)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49498

This change handles the destinations and the configurations parameter when passed to the script.

## Changelog:
[Internal] - Handle `configuration` and `destination` parameters

Reviewed By: cortinico

Differential Revision: D69787469

fbshipit-source-id: 5c4ae766dad84640fbf5340efc296355c4944e1c
2025-02-19 06:19:48 -08:00
Riccardo Cipolleschi 601b2ec353 Honor the task provided to prepare-ios-prebuilds (#49497)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49497

This change honors the task provided as an argument.

If `all` is passed, we execute all the commands.
If a specific task is passed, we only execute that command.

## Changelog:
[Internal] - Honor the task passed to the preopare-ios-script

Reviewed By: cortinico

Differential Revision: D69787470

fbshipit-source-id: 0dec13ad0b5f2cc23cc72b4a899405ac1acf4f86
2025-02-19 04:59:37 -08:00
Riccardo Cipolleschi ca37f2b20a Add argument parsing and help function to prepare ios build (#49496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49496

This change prepare the argument parsing to the prepare-ios-prebuilds so we can customise the behavior to simplify usage in CI.

It also adds the --help command to provide.

##changelog:
[Internal] - adds the help mfunction and argument parsing

Reviewed By: cortinico

Differential Revision: D69779877

fbshipit-source-id: d66bc19ee556229eb7167f2075b77bacce2ad5c4
2025-02-19 04:59:37 -08:00
Riccardo Cipolleschi c0e43edd01 Extracted the dependencies array to separate file (#49495)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49495

This change extracts the dependencies array to a separate file. This is helpful because we can use this file as cache-key to determines whether we have to rebuild the artifacts or not.

This file is also bound to grow so it will make the script more manageable.

## Changelog:
[Internal] - Move the dependencies for ios prebuilds on a separate file

Reviewed By: cortinico

Differential Revision: D69779522

fbshipit-source-id: 7ce60e426d428859f6f759d8e7b1ea499c36eff9
2025-02-19 04:59:37 -08:00
Riccardo Cipolleschi 69a4d32028 Add function to package the xcframework (#49434)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49434

This change adds a function to create the xcframework sarting from the various .framework's slice built before.

## Changelog:
[Internal] - Add function to create the xcframework

Reviewed By: cortinico

Differential Revision: D69660662

fbshipit-source-id: f58034c75cce3d242910d0ec1512be28059771ca
2025-02-14 10:20:10 -08:00
Riccardo Cipolleschi f05ebd5d9d Add logic to copy headers to .framework (#49433)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49433

This change adds the logic to copy the Headers files from the dependency folder to the generated frameworks folder.

There is a slight possibility that this function will be implemented by the Swift PM build system, as I open [this question](https://forums.swift.org/t/xcodebuild-does-not-generate-headers-if-the-source-is-swift-pm/77856) on the Swift forums.

In that case, we would be able to drop this.

## Changelog:
[Internal] - Add function to copy headers over to the .frameworks

Reviewed By: cortinico

Differential Revision: D69656046

fbshipit-source-id: e9d4f0f53ea57bc0df86fc9194cdf9fc1f372730
2025-02-14 10:20:10 -08:00
Riccardo Cipolleschi dd0e1f24d1 Add build function to the prepare-ios-script (#49363)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49363

This change adds the `build()` function that calls xcodebuild to prepare the ReactNativeDependencies.framework

This functio creates the frameworks in the /react-native/third-party/.build folder

## Changelog:
[Internal] - Add build folder to the `prepare-ios-script`

Reviewed By: cortinico

Differential Revision: D69533218

fbshipit-source-id: edc9281e9270970084aa0f56b52ced4579df3473
2025-02-13 13:55:51 -08:00