mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
31bedd9815
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
76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const fs = require('fs');
|
|
const os = require('os');
|
|
const path = require('path');
|
|
|
|
/**
|
|
* This script creates a Hermes prebuilt artifacts tarball.
|
|
* Must be invoked after Hermes has been built.
|
|
*/
|
|
const yargs = require('yargs');
|
|
const {createHermesTarball} = require('./hermes-utils');
|
|
|
|
let argv = yargs
|
|
.option('i', {
|
|
alias: 'inputDir',
|
|
describe: 'Path to directory where Hermes build artifacts were generated.',
|
|
})
|
|
.option('b', {
|
|
alias: 'buildType',
|
|
type: 'string',
|
|
describe: 'Specifies whether Hermes was built for Debug or Release.',
|
|
default: 'Debug',
|
|
})
|
|
.option('v', {
|
|
alias: 'releaseVersion',
|
|
type: 'string',
|
|
describe: 'The version of React Native that will use this tarball.',
|
|
default: '1000.0.0',
|
|
})
|
|
.option('o', {
|
|
alias: 'outputDir',
|
|
describe: 'Location where the tarball will be saved to.',
|
|
}).argv;
|
|
|
|
async function main() {
|
|
const hermesDir = argv.inputDir;
|
|
const buildType = argv.buildType;
|
|
const releaseVersion = argv.releaseVersion;
|
|
let tarballOutputDir = argv.outputDir;
|
|
|
|
if (!tarballOutputDir) {
|
|
try {
|
|
tarballOutputDir = fs.mkdtempSync(
|
|
path.join(os.tmpdir(), 'hermes-engine-tarball-'),
|
|
);
|
|
} catch (error) {
|
|
throw new Error(
|
|
`[Hermes] Failed to create temporary output directory: ${error}`,
|
|
);
|
|
}
|
|
}
|
|
|
|
const tarballOutputPath = createHermesTarball(
|
|
hermesDir,
|
|
buildType,
|
|
releaseVersion,
|
|
tarballOutputDir,
|
|
);
|
|
console.log(tarballOutputPath);
|
|
return tarballOutputPath;
|
|
}
|
|
|
|
main().then(() => {
|
|
process.exit(0);
|
|
});
|