Граф коммитов

16 Коммитов

Автор SHA1 Сообщение Дата
Riccardo Cipolleschi e36c492ace Remove version from the tarball (#35285)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35285

While doing the release 0f 0.71.0-RC0, we noticed that having the RN version in the hermes tarball was causing more harm than good.

With the version in the name, we ended up with multiple tarballs for debug and release and we were not able to explicitly pick the right tarball given a build.

This change remove the version from the tarball name.

## Changelog
[General][Changed] - Remove React Native version from Hermes tarball name

Reviewed By: lunaleaps

Differential Revision: D41156353

fbshipit-source-id: 8899d5e1e1555bc728d923f3b78d1261e6ff09c7
2022-11-14 08:31:30 -08:00
Héctor Ramos 358b7a4458 hermes-utils.js: Add test coverage
Summary:
Improving test coverage in anticipation of some changes being made to `hermes-utils.js`.

Moved test scripts to `hermes/__tests__` and grouped related tests.

We have been delegating some of the work to local binaries via `execSync`, which can be hard to mock or test.  We now use a proxy `delegateSync` method that uses `spawnSync` internally to break down the invocation into `command`, `arguments`, `options`. Instead of simply mocking based on the command being executed, we can now conditionally mock based on the arguments being passed.

Added a `createTarballFromDirectory` method. This can be used later when creating different tarballs.

Added `populateMockFilesystemWithHermesBuildArtifacts()` to mock the filesystem state after Hermes has been built.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40871802

fbshipit-source-id: 4348d3c38926ec7eb13d794040a9040010879f58
2022-11-01 18:27:39 -07:00
Héctor Ramos d71d0db51d hermes-utils: Strip debug symbols during tarball creation (#35162)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35162

The dSYMs for Apple will not be distributed as part of the prebuilts tarball. They can still be included in the tarball by passing a `-d` flag to the create-tarball script.

Changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D40813679

fbshipit-source-id: 26dee8251684c5ecad649ccd27ce688cfe88ec8f
2022-11-01 16:02:21 -07:00
Héctor Ramos 8f124be40e Hermes scripts: rename tarball methods to distinguish between source code and prebuilt artifacts (#35156)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35156

There are two tarballs: the source code for Hermes that is downloaded from GitHub, and the hermes-runtime-darwin-{}-v{}.tar.gz tarball with prebuilt artifacts that is built in CI.
Renamed some methods to make it clearer which tarball they work with.

Changelog: [internal]

Reviewed By: cipolleschi, dmytrorykun

Differential Revision: D40812290

fbshipit-source-id: a2c865e1d1461829fe8d468f52deeb55f3565cb0
2022-10-31 15:30:02 -07:00
Riccardo Cipolleschi 1546666a6d Consume Tarball from Maven (#35034)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35034

Currently, when creating an app using the command:
`npx react-native init MyApp --version nightly`
iOS fails to install the dependencies because it does not find a proper tarball to run Hermes.

This diff solve the problem by fetching the Hermes tarball that is created by the CI while building the nightly.

## Changelog:
[iOS][Fixed] - Make the nightly work with the  proper Hermes tarball

Reviewed By: cortinico

Differential Revision: D40512418

fbshipit-source-id: f510f84be9f19807236091687df5e13961103318
2022-10-20 10:43:31 -07:00
Héctor Ramos 31bedd9815 Add hermes/create-tarball.js script (#34875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34875

Create common script for generating a Hermes tarball after Hermes is built from source.

Use after building Hermes from source to create a tarball of the resulting build artifacts. The path to the tarball can be passed to CocoaPods via a `HERMES_ENGINE_TARBALL_PATH` envvar in order to use these pre-built Hermes artifacts when installing the `hermes-engine` pod with `pod install`.

Use in Circle CI when creating a Hermes tarball for caching and for use in stable React Native releases.

Usage:

```
pod install

# When Hermes is built from source via CocoaPods, the build artifacts will be located in the Pods directory for hermes-engine

node ./scripts/hermes/create-tarball.js \
  --inputDir ./sdks/hermes \
  --buildType Debug \
  --releaseVersion 1000.0.0 \
  --outputDir .
```

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D40124378

fbshipit-source-id: f9712e87526ccc737afac4599b0ab0a7bb3f3956
2022-10-07 10:21:25 -07:00
Riccardo Cipolleschi 4b51207735 Simplify logic to choose if we need to build hermes from source or not. (#34232)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34232

This diff simplify the logic to decide whether we want to build hermes from source or not.

The requirement we have is that we don't want our users to build hermes.
So, we don't want to build hermes when there is a precompiled tarball available, while we want to build hermes in CI.

## Changelog

[General][Changed] - Build hermes when in CI and not when there is a tarball

Reviewed By: cortinico

Differential Revision: D37999748

fbshipit-source-id: 7d9cab51c37fb47db216055c057a22081e10df07
2022-07-22 02:13:47 -07:00
Riccardo Cipolleschi 361d939afd Build Hermes in CI also when it is against stable branch (#34224)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34224

This Diff is a copy of this [PR](https://github.com/facebook/react-native/pull/34228) that we have against 0.69-stable.

This Diff makes sure we can build Hermes also in PR that are created against a stable branch

## Changelog

[General] [Changed] - Make sure we can build Hermes from source when PR are opened agains -stable

Reviewed By: cortinico

Differential Revision: D37961092

fbshipit-source-id: 65577fcc69f0e2a68377cbd46e3bd3a6af24e7c3
2022-07-20 08:53:38 -07:00
Héctor Ramos 6154cb7512 Hermes: Use arbitrary path to hermes-runtime-darwin if ENV set
Summary:
Allow an arbitrary path to hermes-runtime-darwin-vX.Y.Z.tgz to be specified. This can be used in CI or in local e2e tests to test with Hermes enabled without having a matching GitHub release.

Usage:

```
HERMES_ENGINE_TARBALL_PATH=~/Downloads/hermes- runtime-darwin-v0.69.0.tar.gz \
  USE_HERMES=1 \
  pod install
```

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36985477

fbshipit-source-id: 853829c89e6f0ac3f63781c7f290cf3994b8e0cd
2022-06-09 11:18:30 -07:00
Nicola Corti bffad4351c Backports fixes on the 0.69 release branch to main (#33938)
Summary:
This PR includes a set of changes that landed only on the 0.69-stable release branch and need to be backported to main:

- a72d1960ff
- 659b693fcd
- 2a6832a7e3
- 0ca6e41059
- f50936bef2

Most of the fixes are working around the assumption that
`version != 1000.0.0 => Build Hermes From Source`.

That is not true in the release branch as the version is named (e.g. 0.69.0-rc4) and we need to build Hermes there.

## Changelog

[Internal] - Backports fixes on the 0.69 release branch to main

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

Test Plan: Tested that those commits are working fine on the release branch.

Reviewed By: hramos

Differential Revision: D36776291

Pulled By: cortinico

fbshipit-source-id: 66e28232d80054fab4a2a97c8d2de12e3c1cf392
2022-05-31 10:37:12 -07:00
Héctor Ramos 38b70653b2 Hermes: Use pre-built artifacts in hermes-engine
Summary:
Update `hermes-engine.podspec` to use pre-built Hermes artifacts from the corresponding React Native GitHub Release when targeting a specific React Native release.
Otherwise, fallback to building Hermes from source.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D36609257

fbshipit-source-id: 6179c9e255558c7eaf1417ff46a2e7db120295f0
2022-05-25 03:30:57 -07:00
Héctor Ramos 004b8609d9 Hermes: Add scripts to package, remove shelljs
Summary:
The new Hermes scripts need to be included in the `react-native` npm.

The `shelljs` dependency that was used by the Hermes scripts is a dev dependency, so instead of adding to the `react-native` npm size, we refactored its use out of hermes-utils.js.

Changelog:
[General][Added] - Add Hermes scripts to package

Reviewed By: cortinico

Differential Revision: D36387135

fbshipit-source-id: 12d0bc29d365c4cb18d33a0d390e6e7d34864b7a
2022-05-24 14:08:48 -07:00
Héctor Ramos 644fe430fd iOS: Use pre-built hermesc if available (#33827)
Summary:
Use pre-built hermesc if available by generating a ImportHermesc.cmake file that points to the hermesc binary. Recent `react-native` releases should have hermesc available in sdks/hermesc.

Hermes build scripts have been updated to support a `HERMES_OVERRIDE_HERMESC_PATH` envvar which can point to this generated ImportHermesc.cmake file.

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

Changelog:
[iOS] [Changed] - Use pre-built HermesC if available in current React Native release

Reviewed By: cortinico

Differential Revision: D36024615

fbshipit-source-id: 476569f73309f9bd142f28cb02d1f7d57b6cbc6a
2022-05-13 14:43:14 -07:00
Héctor Ramos 5dae5936fc Hermes: Add tests for hermes-utils.js
Summary:
Add test coverage for the new `scripts/hermes/hermes-utils.js` consolidated Hermes scripts.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D36334652

fbshipit-source-id: e9570d1232c21e36da4e6be8c67d80f4ec224326
2022-05-13 11:29:08 -07:00
Héctor Ramos 6c2e34be0b Hermes: Create prepare-hermes-for-build.js script
Summary:
Adds a script that uses the new hermes-utils.js functions to prepare the local filesystem for Hermes to be built from source (e.g. download the Hermes source code tarball and extract it into its final location).

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36334624

fbshipit-source-id: 012f758ecda07931bdb0ab1728b87733bf5af16a
2022-05-12 20:11:59 -07:00
Héctor Ramos 3412f067a5 Hermes: Consolidate Hermes build scripts into scripts/hermes/hermes-utils.js
Summary:
Currently, the tasks for downloading, expanding, and preparing Hermes to be built for Apple targets are split across the Circle CI and CocoaPods configs.

This diff sets out to consolidate these tasks into a single hermes-utils.js script that can be reused across CI and build systems.

The release script that is used to assign the Hermes tag for a given React Native version has been moved into `scripts/hermes`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D36329356

fbshipit-source-id: 0222070adf201fa533b607a183471396d45c6caf
2022-05-12 20:11:59 -07:00