react-nitro-hermes 0.0.1-alpha.8 → 0.0.1-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hermes/CMakeLists.txt +874 -0
- package/hermes/android/HostObjectJniTest.cpp +178 -0
- package/hermes/android/build-logic/build.gradle.kts +31 -0
- package/hermes/android/build-logic/settings.gradle.kts +17 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/helpers/internal/SerializeHermesCompilerPackageJson.kt +33 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/plugins/internal/TestUtilsPlugin.kt +80 -0
- package/hermes/android/build-logic/src/main/kotlin/com/facebook/hermes/tasks/internal/CustomExecTask.kt +46 -0
- package/hermes/android/build-logic/src/main/kotlin/publish.gradle.kts +82 -0
- package/hermes/android/build.gradle.kts +332 -0
- package/hermes/android/cppruntime/build.gradle +72 -0
- package/hermes/android/cppruntime/src/main/AndroidManifest.xml +2 -0
- package/hermes/android/cppruntime/src/main/cpp/CMakeLists.txt +8 -0
- package/hermes/android/cppruntime/src/main/cpp/stub.cpp +12 -0
- package/hermes/android/cross-compile/swift-libicu.patch +13 -0
- package/hermes/android/cross-compile/toolchain-android-arm-api13-gnustl.cmake +13 -0
- package/hermes/android/cross-compile/toolchain-android-arm-api15-gnustl.cmake +14 -0
- package/hermes/android/gradle/libs.versions.toml +30 -0
- package/hermes/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/hermes/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/hermes/android/gradle.properties +3 -0
- package/hermes/android/gradlew +248 -0
- package/hermes/android/gradlew.bat +93 -0
- package/hermes/android/intltest/build.gradle +147 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/CMakeLists.txt +45 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.cpp +68 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.h +44 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogue.java +45 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesEpilogueTestData.java +32 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesInstrumentationTest.java +150 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlAndroidTest.java +147 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesIntlTest262.java +470 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/HermesRuntimeFactory.cpp +73 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.cpp +90 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.h +62 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/JSRuntime.java +155 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.cpp +48 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/MappedFileBuffer.h +36 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoad.cpp +13 -0
- package/hermes/android/intltest/java/com/facebook/hermes/test/OnLoadEpilogue.cpp +13 -0
- package/hermes/android/intltest/src/main/AndroidManifest.xml +2 -0
- package/hermes/android/ios-artifacts/build.gradle.kts +65 -0
- package/hermes/android/settings.gradle.kts +27 -0
- package/hermes/cmake/modules/Hermes.cmake +481 -0
- package/hermes/cmake/modules/Lit.cmake +96 -0
- package/hermes/doc/Branches.md +38 -0
- package/hermes/doc/BuildingAndRunning.md +121 -0
- package/hermes/doc/CodingStandards.md +112 -0
- package/hermes/doc/CrossCompilation.md +79 -0
- package/hermes/doc/Design.md +217 -0
- package/hermes/doc/Emscripten.md +156 -0
- package/hermes/doc/Features.md +143 -0
- package/hermes/doc/GCSafeCoding.md +563 -0
- package/hermes/doc/GenGC.md +300 -0
- package/hermes/doc/Hades.md +344 -0
- package/hermes/doc/HighLevelOptimizations.md +37 -0
- package/hermes/doc/IR.md +1306 -0
- package/hermes/doc/IntlAPIs.md +196 -0
- package/hermes/doc/JIT.md +999 -0
- package/hermes/doc/LazyEvalCompilation.md +84 -0
- package/hermes/doc/MemoryProfilers.md +316 -0
- package/hermes/doc/Modules.md +144 -0
- package/hermes/doc/Optimizer.md +83 -0
- package/hermes/doc/PerfProfiling.md +29 -0
- package/hermes/doc/ProhibitInvoke.md +329 -0
- package/hermes/doc/ReactNative.md +40 -0
- package/hermes/doc/ReactNativeIntegration.md +94 -0
- package/hermes/doc/RegExp.md +24 -0
- package/hermes/doc/SpecIncompat.md +85 -0
- package/hermes/doc/Strings.md +140 -0
- package/hermes/doc/TypedLanguage.md +432 -0
- package/hermes/doc/VM.md +174 -0
- package/hermes/doc/blog/2024-11-09-octane-benchmark-jit-progress.md +17 -0
- package/hermes/doc/blog/2024-12-19-static-hermes-update-dec-2024.md +47 -0
- package/hermes/doc/blog/2024-12-23-compiling-javascript-to-wasm.md +267 -0
- package/hermes/doc/blog/2025-06-09-jsi-runtime-data-apis.md +23 -0
- package/hermes/doc/blog/2025-07-15-static-h-performance-june-2025.md +18 -0
- package/hermes/doc/blog/2025-11-02-hermes-compilation-runtime-modes.md +23 -0
- package/hermes/doc/blog/2025-11-06-hermes-memory-modes.md +35 -0
- package/hermes/doc/blog/2025-11-24-json-parsing-performance.md +17 -0
- package/hermes/doc/blog/2025-12-02-iserialization.md +11 -0
- package/hermes/doc/blog/2025-12-12-new-way-to-contribute.md +68 -0
- package/hermes/doc/blog/2026-06-05-new-hermes-stable-release.md +51 -0
- package/hermes/doc/blog/README.md +25 -0
- package/hermes/doc/blog/images/2024-11-09-octane-pi3.jpeg +0 -0
- package/hermes/doc/blog/images/2024-11-09-octane-pi5.jpeg +0 -0
- package/hermes/doc/blog/images/2025-07-15-perf-hv32-interpreter.jpeg +0 -0
- package/hermes/doc/blog/images/2025-07-15-perf-hv32-jit.jpeg +0 -0
- package/hermes/doc/icu_license.txt +420 -0
- package/hermes/doc/img/heap_snapshot_retainers.png +0 -0
- package/hermes/doc/img/logo.svg +1 -0
- package/hermes/doc/img/object_captured_by_environment.png +0 -0
- package/hermes/doc/img/root_categories.png +0 -0
- package/hermes/doc/plans/ir-type/flow-type-system.md +324 -0
- package/hermes/doc/plans/ir-type/ir-type-system-v2-design.md +652 -0
- package/hermes/doc/plans/ir-type/ir-type-system.md +220 -0
- package/hermes/doc/plans/ir-type/ir-type-v2-implementation.md +1187 -0
- package/hermes/doc/plans/ir-type/memory.md +48 -0
- package/hermes/doc/plans/ir-type/phase1-steps.md +512 -0
- package/hermes/doc/plans/ir-type/progress.md +239 -0
- package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-design.md +203 -0
- package/hermes/doc/plans/ir-type/typeinference-primitive-fastpath-results.md +71 -0
- package/hermes/doc/superpowers/plans/2026-07-28-worker-arraybuffer-input.md +597 -0
- package/hermes/doc/superpowers/plans/2026-08-18-jitemitter-split.md +1149 -0
- package/hermes/doc/superpowers/plans/2026-08-20-jit-type-asserts.md +969 -0
- package/hermes/doc/superpowers/plans/2026-08-23-jit-shared-compiler-driver.md +478 -0
- package/hermes/doc/superpowers/plans/2026-08-23-x86-64-jit-skeleton.md +797 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-arith.md +444 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-calls.md +261 -0
- package/hermes/doc/superpowers/plans/2026-08-24-x86-64-jit-props.md +240 -0
- package/hermes/doc/superpowers/plans/2026-10-26-regexp-bytecode-sharing.md +2197 -0
- package/hermes/doc/superpowers/plans/2026-10-28-regexp-start-filter-and-exec-fast-paths.md +3981 -0
- package/hermes/doc/superpowers/specs/2026-07-28-worker-arraybuffer-input-design.md +206 -0
- package/hermes/doc/superpowers/specs/2026-08-18-jitemitter-split-design.md +530 -0
- package/hermes/doc/superpowers/specs/2026-08-20-jit-type-asserts-design.md +360 -0
- package/hermes/doc/superpowers/specs/2026-08-23-x86-64-jit-design.md +246 -0
- package/hermes/doc/superpowers/specs/2026-08-26-icu-free-normalize-design.md +355 -0
- package/hermes/doc/superpowers/specs/2026-08-27-icu-free-convert-to-case-design.md +305 -0
- package/hermes/doc/superpowers/specs/2026-08-27-icu-free-locale-compare-design.md +429 -0
- package/hermes/doc/superpowers/specs/2026-08-29-icu-free-date-format-design.md +297 -0
- package/hermes/doc/superpowers/specs/2026-10-26-regexp-bytecode-sharing-design.md +605 -0
- package/hermes/doc/superpowers/specs/2026-10-28-regexp-start-filter-and-exec-fast-paths-design.md +551 -0
- package/hermes/doc/typescript-stripping.md +90 -0
- package/hermes/external/CMakeLists.txt +20 -0
- package/hermes/utils/IntlGen/IntlGen.java +531 -0
- package/hermes/utils/bench_with_stats.py +827 -0
- package/hermes/utils/build-apple-framework.sh +323 -0
- package/hermes/utils/chrome_snapshot_parser.py +210 -0
- package/hermes/utils/cmake-dev-build.sh +18 -0
- package/hermes/utils/commons.sh +55 -0
- package/hermes/utils/dump-cpp-funcs.sh +3 -0
- package/hermes/utils/es5objects.js +198 -0
- package/hermes/utils/format.sh +145 -0
- package/hermes/utils/gen-promise-internal-bc.sh +66 -0
- package/hermes/utils/genUnicodeTable.py +2503 -0
- package/hermes/utils/hermes-lit/CMakeLists.txt +22 -0
- package/hermes/utils/hermes-lit/hermes-lit.in +15 -0
- package/hermes/utils/jit/README.md +134 -0
- package/hermes/utils/jit/jit-diff.sh +160 -0
- package/hermes/utils/jit/jit-dump.sh +193 -0
- package/hermes/utils/lit-expect-gen/generate.py +217 -0
- package/hermes/utils/promise/index.js +15 -0
- package/hermes/utils/promise/package.json +13 -0
- package/hermes/utils/promise/rollup.config.js +19 -0
- package/hermes/utils/promise/yarn.lock +247 -0
- package/hermes/utils/scripts/hermes/consts.js +26 -0
- package/hermes/utils/scripts/hermes/create-tarball.js +75 -0
- package/hermes/utils/scripts/hermes/get-hermes-version.js +57 -0
- package/hermes/utils/scripts/hermes/hermes-utils.js +122 -0
- package/hermes/utils/scripts/hermes/package.json +6 -0
- package/hermes/utils/scripts/hermes/prepare-artifacts.js +113 -0
- package/hermes/utils/scripts/hermes/publish-artifacts.js +109 -0
- package/hermes/utils/scripts/hermes/publish-npm.js +96 -0
- package/hermes/utils/scripts/hermes/scm-utils.js +41 -0
- package/hermes/utils/scripts/hermes/set-artifacts-version.js +64 -0
- package/hermes/utils/scripts/hermes/version-utils.js +98 -0
- package/hermes/utils/scripts/hermes/yarn.lock +240 -0
- package/hermes/utils/summarize_sizes.py +184 -0
- package/hermes/utils/symbolicate-nativecall-stats.py +112 -0
- package/hermes/utils/test_runner.py +13 -0
- package/hermes/utils/testsuite/README.facebook +3 -0
- package/hermes/utils/testsuite/README.md +69 -0
- package/hermes/utils/testsuite/cli.py +547 -0
- package/hermes/utils/testsuite/es_ast.py +337 -0
- package/hermes/utils/testsuite/external/LICENSE +28 -0
- package/hermes/utils/testsuite/external/README.facebook +8 -0
- package/hermes/utils/testsuite/external/__init__.py +0 -0
- package/hermes/utils/testsuite/external/_monkeyYaml.py +164 -0
- package/hermes/utils/testsuite/external/parse_test262.py +141 -0
- package/hermes/utils/testsuite/hermes.py +522 -0
- package/hermes/utils/testsuite/preprocess.py +365 -0
- package/hermes/utils/testsuite/progress.py +377 -0
- package/hermes/utils/testsuite/skiplist.json +4356 -0
- package/hermes/utils/testsuite/skiplist.py +270 -0
- package/hermes/utils/testsuite/test_run_defs.py +435 -0
- package/hermes/utils/testsuite/typing_defs.py +52 -0
- package/hermes/utils/testsuite/utils.py +214 -0
- package/hermes/utils/tidy.sh +22 -0
- package/hermes/utils/update-fbcode-hermes.sh +53 -0
- package/hermes/utils/updateErrorTest.py +193 -0
- package/hermes/utils/wasm-compile.sh +65 -0
- package/package.json +1 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
|
|
10
|
+
const { spawnSync } = require("child_process");
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
const os = require("os");
|
|
13
|
+
const path = require("path");
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Delegate execution to the supplied command.
|
|
17
|
+
*
|
|
18
|
+
* @param command Path to the command.
|
|
19
|
+
* @param args Array of arguments pass to the command.
|
|
20
|
+
* @param options child process options.
|
|
21
|
+
*/
|
|
22
|
+
function delegateSync(
|
|
23
|
+
command /*: string */,
|
|
24
|
+
args /*: (Array<string> | child_process$spawnSyncOpts) */,
|
|
25
|
+
options /*: ?child_process$spawnSyncOpts */
|
|
26
|
+
) {
|
|
27
|
+
return spawnSync(command, args, { stdio: "inherit", ...options });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getHermesPrebuiltArtifactsTarballName(
|
|
31
|
+
buildType /*:: ?: string */
|
|
32
|
+
) /*: string */ {
|
|
33
|
+
if (buildType == null) {
|
|
34
|
+
throw Error("Did not specify build type.");
|
|
35
|
+
}
|
|
36
|
+
return `hermes-ios-${buildType.toLowerCase()}.tar.gz`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a tarball with the contents of the supplied directory.
|
|
41
|
+
*/
|
|
42
|
+
function createTarballFromDirectory(
|
|
43
|
+
directory /*: string */,
|
|
44
|
+
filename /*: string */
|
|
45
|
+
) {
|
|
46
|
+
const args = ["-C", directory, "-czvf", filename, "."];
|
|
47
|
+
delegateSync("tar", args);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function createHermesPrebuiltArtifactsTarball(
|
|
51
|
+
hermesDir /*: string */,
|
|
52
|
+
buildType /*: string */,
|
|
53
|
+
tarballOutputDir /*: string */,
|
|
54
|
+
excludeDebugSymbols /*: boolean */
|
|
55
|
+
) /*: string */ {
|
|
56
|
+
validateHermesFrameworksExist(path.join(hermesDir, "destroot"));
|
|
57
|
+
|
|
58
|
+
if (!fs.existsSync(tarballOutputDir)) {
|
|
59
|
+
fs.mkdirSync(tarballOutputDir, { recursive: true });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let tarballTempDir;
|
|
63
|
+
try {
|
|
64
|
+
tarballTempDir = fs.mkdtempSync(
|
|
65
|
+
path.join(os.tmpdir(), "hermes-engine-destroot-")
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
let args = ["-a"];
|
|
69
|
+
if (excludeDebugSymbols) {
|
|
70
|
+
args.push("--exclude=dSYMs/");
|
|
71
|
+
args.push("--exclude=*.dSYM/");
|
|
72
|
+
}
|
|
73
|
+
args.push("./destroot");
|
|
74
|
+
args.push(tarballTempDir);
|
|
75
|
+
delegateSync("rsync", args, {
|
|
76
|
+
cwd: hermesDir,
|
|
77
|
+
});
|
|
78
|
+
if (fs.existsSync(path.join(hermesDir, "LICENSE"))) {
|
|
79
|
+
delegateSync("cp", ["LICENSE", tarballTempDir], { cwd: hermesDir });
|
|
80
|
+
}
|
|
81
|
+
} catch (error) {
|
|
82
|
+
throw new Error(`Failed to copy destroot to tempdir: ${error}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const tarballFilename = path.join(
|
|
86
|
+
tarballOutputDir,
|
|
87
|
+
getHermesPrebuiltArtifactsTarballName(buildType)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
createTarballFromDirectory(tarballTempDir, tarballFilename);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
throw new Error(`[Hermes] Failed to create tarball: ${error}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!fs.existsSync(tarballFilename)) {
|
|
97
|
+
throw new Error(
|
|
98
|
+
`Tarball creation failed, could not locate tarball at ${tarballFilename}`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return tarballFilename;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function validateHermesFrameworksExist(destrootDir /*: string */) {
|
|
106
|
+
if (
|
|
107
|
+
!fs.existsSync(
|
|
108
|
+
path.join(
|
|
109
|
+
destrootDir,
|
|
110
|
+
"Library/Frameworks/universal/hermesvm.xcframework"
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
"Error: Hermes universal XCFramework not found. Are you sure Hermes has been built?"
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
module.exports = {
|
|
121
|
+
createHermesPrebuiltArtifactsTarball,
|
|
122
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const fs = require('fs');
|
|
14
|
+
const path = require('path');
|
|
15
|
+
const {chmod, cp, echo, exit, ls, mkdir, test} = require('shelljs');
|
|
16
|
+
|
|
17
|
+
function copyHermesBinaries() {
|
|
18
|
+
const HERMES_WS_DIR = process.env.HERMES_WS_DIR || '/tmp/hermes';
|
|
19
|
+
|
|
20
|
+
echo('Copying Hermes binaries...');
|
|
21
|
+
|
|
22
|
+
// Create directories for npm/hermes-compiler/hermesc binaries
|
|
23
|
+
mkdir('-p', './npm/hermes-compiler/hermesc/osx-bin');
|
|
24
|
+
mkdir('-p', './npm/hermes-compiler/hermesc/linux64-bin');
|
|
25
|
+
mkdir('-p', './npm/hermes-compiler/hermesc/win64-bin');
|
|
26
|
+
|
|
27
|
+
const osxBinDir = path.join(HERMES_WS_DIR, 'osx-bin');
|
|
28
|
+
const osxReleaseDir = path.join(osxBinDir, 'Release');
|
|
29
|
+
const osxDebugDir = path.join(osxBinDir, 'Debug');
|
|
30
|
+
|
|
31
|
+
if (test('-d', osxReleaseDir)) {
|
|
32
|
+
echo('Copying macOS Release hermesc binary...');
|
|
33
|
+
cp(
|
|
34
|
+
'-r',
|
|
35
|
+
path.join(osxReleaseDir, 'hermesc'),
|
|
36
|
+
'./npm/hermes-compiler/hermesc/osx-bin/hermesc',
|
|
37
|
+
);
|
|
38
|
+
} else if (test('-d', osxDebugDir)) {
|
|
39
|
+
echo('Copying macOS Debug hermesc binary...');
|
|
40
|
+
cp(
|
|
41
|
+
'-r',
|
|
42
|
+
path.join(osxDebugDir, 'hermesc'),
|
|
43
|
+
'./npm/hermes-compiler/hermesc/osx-bin/hermesc',
|
|
44
|
+
);
|
|
45
|
+
} else {
|
|
46
|
+
if (test('-d', osxBinDir)) {
|
|
47
|
+
ls(osxBinDir);
|
|
48
|
+
} else {
|
|
49
|
+
echo('hermesc macOS artifacts directory missing.');
|
|
50
|
+
}
|
|
51
|
+
echo('Could not locate macOS hermesc binary.');
|
|
52
|
+
exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Sometimes, GHA creates artifacts with lowercase Debug/Release. Make sure that if it happen, we uppercase them.
|
|
56
|
+
const darwinDir = path.join(HERMES_WS_DIR, 'hermes-runtime-darwin');
|
|
57
|
+
const debugTarLower = path.join(darwinDir, 'hermes-ios-debug.tar.gz');
|
|
58
|
+
const debugTarUpper = path.join(darwinDir, 'hermes-ios-Debug.tar.gz');
|
|
59
|
+
const releaseTarLower = path.join(darwinDir, 'hermes-ios-release.tar.gz');
|
|
60
|
+
const releaseTarUpper = path.join(darwinDir, 'hermes-ios-Release.tar.gz');
|
|
61
|
+
|
|
62
|
+
if (test('-f', debugTarLower)) {
|
|
63
|
+
echo('Renaming debug tar to uppercase...');
|
|
64
|
+
fs.renameSync(debugTarLower, debugTarUpper);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (test('-f', releaseTarLower)) {
|
|
68
|
+
echo('Renaming release tar to uppercase...');
|
|
69
|
+
fs.renameSync(releaseTarLower, releaseTarUpper);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
echo('Copying Windows binaries...');
|
|
73
|
+
cp(
|
|
74
|
+
'-r',
|
|
75
|
+
path.join(HERMES_WS_DIR, 'win64-bin/*'),
|
|
76
|
+
'./npm/hermes-compiler/hermesc/win64-bin/.',
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
echo('Copying Linux binaries...');
|
|
80
|
+
cp(
|
|
81
|
+
'-r',
|
|
82
|
+
path.join(HERMES_WS_DIR, 'linux64-bin/*'),
|
|
83
|
+
'./npm/hermes-compiler/hermesc/linux64-bin/.',
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
echo('Making hermesc files executable...');
|
|
87
|
+
chmod('-R', '+x', 'npm/hermes-compiler/hermesc/*');
|
|
88
|
+
|
|
89
|
+
const iosArtifactsDir = path.join('android', 'ios-artifacts', 'artifacts');
|
|
90
|
+
mkdir('-p', iosArtifactsDir);
|
|
91
|
+
|
|
92
|
+
echo('Copying iOS artifacts...');
|
|
93
|
+
cp(debugTarUpper, path.join(iosArtifactsDir, 'hermes-ios-debug.tar.gz'));
|
|
94
|
+
cp(releaseTarUpper, path.join(iosArtifactsDir, 'hermes-ios-release.tar.gz'));
|
|
95
|
+
cp(
|
|
96
|
+
path.join(HERMES_WS_DIR, 'dSYM', 'Debug', 'hermesvm.framework.dSYM'),
|
|
97
|
+
path.join(iosArtifactsDir, 'hermes-framework-dSYM-debug.tar.gz'),
|
|
98
|
+
);
|
|
99
|
+
cp(
|
|
100
|
+
path.join(HERMES_WS_DIR, 'dSYM', 'Release', 'hermesvm.framework.dSYM'),
|
|
101
|
+
path.join(iosArtifactsDir, 'hermes-framework-dSYM-release.tar.gz'),
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
echo('Hermes binaries copied successfully!');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function main() {
|
|
108
|
+
copyHermesBinaries();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (require.main === module) {
|
|
112
|
+
void main();
|
|
113
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
/*::
|
|
14
|
+
import type {BuildType} from './version-utils';
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
getVersion,
|
|
19
|
+
updateGradlePropertiesFile,
|
|
20
|
+
validateBuildType,
|
|
21
|
+
} = require('./version-utils');
|
|
22
|
+
const {echo, exec, exit, popd, pushd} = require('shelljs');
|
|
23
|
+
const yargs = require('yargs');
|
|
24
|
+
|
|
25
|
+
async function main() {
|
|
26
|
+
const argv = yargs
|
|
27
|
+
.option('t', {
|
|
28
|
+
alias: 'builtType',
|
|
29
|
+
describe: 'The type of build you want to perform.',
|
|
30
|
+
choices: ['dry-run', 'release'],
|
|
31
|
+
default: 'dry-run',
|
|
32
|
+
})
|
|
33
|
+
.strict().argv;
|
|
34
|
+
|
|
35
|
+
// $FlowFixMe[prop-missing]
|
|
36
|
+
const buildType = argv.builtType;
|
|
37
|
+
|
|
38
|
+
if (!validateBuildType(buildType)) {
|
|
39
|
+
throw new Error(`Unsupported build type: ${buildType}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
await publishArtifacts(buildType);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function publishArtifacts(buildType /*: BuildType */) {
|
|
46
|
+
if (buildType === 'dry-run') {
|
|
47
|
+
console.log('Skipping publishing artifacts because --dry-run is set.');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const version = await getVersion(buildType);
|
|
52
|
+
await updateGradlePropertiesFile(version);
|
|
53
|
+
|
|
54
|
+
pushd('android');
|
|
55
|
+
await publishAndroidArtifactsToMaven(version, buildType);
|
|
56
|
+
await publishExternalArtifactsToMaven(version, buildType);
|
|
57
|
+
popd();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function publishAndroidArtifactsToMaven(
|
|
61
|
+
releaseVersion /*: string */,
|
|
62
|
+
buildType /*: BuildType */,
|
|
63
|
+
) {
|
|
64
|
+
if (buildType === 'release') {
|
|
65
|
+
// -------- For stable releases, we also need to close and release the staging repository.
|
|
66
|
+
if (
|
|
67
|
+
exec(
|
|
68
|
+
'./gradlew publishAndroidOnlyToSonatype closeAndReleaseSonatypeStagingRepository',
|
|
69
|
+
).code
|
|
70
|
+
) {
|
|
71
|
+
echo(
|
|
72
|
+
'Failed to close and release the staging repository on Sonatype (Maven Central) for Android artifacts',
|
|
73
|
+
);
|
|
74
|
+
exit(1);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
echo('Nothing to do as this is not a stable release');
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
echo('Finished publishing Android artifacts to Maven Central');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function publishExternalArtifactsToMaven(
|
|
84
|
+
releaseVersion /*: string */,
|
|
85
|
+
buildType /*: BuildType */,
|
|
86
|
+
) {
|
|
87
|
+
if (buildType === 'release') {
|
|
88
|
+
// -------- For stable releases, we do the publishing and close the staging repository.
|
|
89
|
+
// This can't be done earlier in build_android because this artifact are partially built by the iOS jobs.
|
|
90
|
+
if (
|
|
91
|
+
exec(
|
|
92
|
+
'./gradlew :ios-artifacts:publishToSonatype closeAndReleaseSonatypeStagingRepository',
|
|
93
|
+
).code
|
|
94
|
+
) {
|
|
95
|
+
echo(
|
|
96
|
+
'Failed to close and release the staging repository on Sonatype (Maven Central) for external artifacts',
|
|
97
|
+
);
|
|
98
|
+
exit(1);
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
echo('Nothing to do as this is not a stable release');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
echo('Finished publishing external artifacts to Maven Central');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (require.main === module) {
|
|
108
|
+
void main();
|
|
109
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
/*::
|
|
14
|
+
import type {BuildType} from './version-utils';
|
|
15
|
+
import type { ExecOptsSync, ShellString } from 'shelljs';
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const {REPO_ROOT} = require('./consts');
|
|
19
|
+
const {
|
|
20
|
+
getVersion,
|
|
21
|
+
updatePackageJsonVersion,
|
|
22
|
+
validateBuildType,
|
|
23
|
+
} = require('./version-utils');
|
|
24
|
+
const path = require('path');
|
|
25
|
+
const {exec} = require('shelljs');
|
|
26
|
+
const yargs = require('yargs');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This script prepares a release version of hermes-compiler and may publish to NPM.
|
|
30
|
+
* It is supposed to run in CI environment, not on a developer's machine.
|
|
31
|
+
*
|
|
32
|
+
* For a dry run, this script will:
|
|
33
|
+
* * Version the same as for the release
|
|
34
|
+
* * publish with a `--dry-run` flag
|
|
35
|
+
*
|
|
36
|
+
* For a release run, this script will:
|
|
37
|
+
* * Version the release by the version specified in the CMakeLists.txt
|
|
38
|
+
* * Publish to npm
|
|
39
|
+
* * without setting a tag
|
|
40
|
+
*/
|
|
41
|
+
async function main() {
|
|
42
|
+
const argv = yargs
|
|
43
|
+
.option('t', {
|
|
44
|
+
alias: 'builtType',
|
|
45
|
+
describe: 'The type of build you want to perform.',
|
|
46
|
+
choices: ['dry-run', 'release'],
|
|
47
|
+
default: 'dry-run',
|
|
48
|
+
})
|
|
49
|
+
.strict().argv;
|
|
50
|
+
|
|
51
|
+
// $FlowFixMe[prop-missing]
|
|
52
|
+
const buildType = argv.builtType;
|
|
53
|
+
|
|
54
|
+
if (!validateBuildType(buildType)) {
|
|
55
|
+
throw new Error(`Unsupported build type: ${buildType}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const result = await publishNpm(buildType);
|
|
59
|
+
|
|
60
|
+
if (result && result.code) {
|
|
61
|
+
const version = await getVersion(buildType);
|
|
62
|
+
throw new Error(`Failed to publish hermes-compiler@${version}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function publishNpm(
|
|
67
|
+
buildType /*: BuildType */,
|
|
68
|
+
) /*: Promise<ShellString | null> */ {
|
|
69
|
+
let tagFlag = '';
|
|
70
|
+
|
|
71
|
+
if (buildType === 'dry-run') {
|
|
72
|
+
// `--tag latest-v1` mirrors the real release command. It is also required
|
|
73
|
+
// here because the dry-run version below is a prerelease (contains a `-`),
|
|
74
|
+
// and npm refuses to publish a prerelease without an explicit `--tag`,
|
|
75
|
+
// even under `--dry-run`.
|
|
76
|
+
tagFlag = ` --dry-run --tag latest-v1`;
|
|
77
|
+
// For a dry run, publish a unique per-commit version
|
|
78
|
+
// (`${mainVersion}-${shortCommit}`) so the `npm publish --dry-run`
|
|
79
|
+
// validation does not collide with an already-published version (npm
|
|
80
|
+
// performs this check even with `--dry-run`). For a real release we keep
|
|
81
|
+
// the version declared in package.json untouched.
|
|
82
|
+
const version = await getVersion(buildType);
|
|
83
|
+
await updatePackageJsonVersion(version);
|
|
84
|
+
} else if (buildType === 'release') {
|
|
85
|
+
tagFlag = ` --tag latest-v1`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const packagePath = path.join(REPO_ROOT, 'npm', 'hermes-compiler');
|
|
89
|
+
const options /*: ExecOptsSync */ = {cwd: packagePath};
|
|
90
|
+
|
|
91
|
+
return exec(`npm publish${tagFlag}`, options);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (require.main === module) {
|
|
95
|
+
void main();
|
|
96
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
'use strict';
|
|
12
|
+
|
|
13
|
+
const {echo, exec} = require('shelljs');
|
|
14
|
+
|
|
15
|
+
function getCurrentCommit() /*: string */ {
|
|
16
|
+
return isGitRepo()
|
|
17
|
+
? exec('git rev-parse HEAD', {
|
|
18
|
+
silent: true,
|
|
19
|
+
}).stdout.trim()
|
|
20
|
+
: 'TEMP';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function isGitRepo() /*: boolean */ {
|
|
24
|
+
try {
|
|
25
|
+
return (
|
|
26
|
+
exec('git rev-parse --is-inside-work-tree', {
|
|
27
|
+
silent: true,
|
|
28
|
+
}).stdout.trim() === 'true'
|
|
29
|
+
);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
echo(
|
|
32
|
+
`It wasn't possible to check if we are in a git repository. Details: ${error}`,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = {
|
|
39
|
+
getCurrentCommit,
|
|
40
|
+
isGitRepo,
|
|
41
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/*::
|
|
12
|
+
import type {BuildType, Version} from './version-utils';
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const {ANDROID_DIR} = require('./consts');
|
|
16
|
+
const {
|
|
17
|
+
getVersion,
|
|
18
|
+
validateBuildType,
|
|
19
|
+
updateGradlePropertiesFile,
|
|
20
|
+
} = require('./version-utils');
|
|
21
|
+
const {promises: fs} = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const {parseArgs} = require('util');
|
|
24
|
+
|
|
25
|
+
const config = {
|
|
26
|
+
options: {
|
|
27
|
+
'build-type': {
|
|
28
|
+
type: 'string',
|
|
29
|
+
short: 'b',
|
|
30
|
+
},
|
|
31
|
+
help: {type: 'boolean'},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
async function main() {
|
|
36
|
+
const {
|
|
37
|
+
values: {'build-type': buildType, help},
|
|
38
|
+
/* $FlowFixMe[incompatible-call] Natural Inference rollout. See
|
|
39
|
+
* https://fburl.com/workplace/6291gfvu */
|
|
40
|
+
} = parseArgs(config);
|
|
41
|
+
|
|
42
|
+
if (help) {
|
|
43
|
+
console.log(`
|
|
44
|
+
Usage: node ./utils/scripts/hermes/set-artifacts-version.js [OPTIONS]
|
|
45
|
+
|
|
46
|
+
Updates version in gradle.proparties file.
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
--build-type One of ['dry-run', 'release'].
|
|
50
|
+
`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!validateBuildType(buildType)) {
|
|
55
|
+
throw new Error(`Unsupported build type: ${buildType}`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const version = await getVersion(buildType);
|
|
59
|
+
await updateGradlePropertiesFile(version);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (require.main === module) {
|
|
63
|
+
void main();
|
|
64
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/*::
|
|
12
|
+
export type BuildType = 'dry-run' | 'release';
|
|
13
|
+
export type Version = {
|
|
14
|
+
version: string,
|
|
15
|
+
major: string,
|
|
16
|
+
minor: string,
|
|
17
|
+
patch: string,
|
|
18
|
+
}
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const {ANDROID_DIR, REPO_ROOT} = require('./consts');
|
|
22
|
+
const {getCurrentCommit} = require('./scm-utils');
|
|
23
|
+
const {promises: fs} = require('fs');
|
|
24
|
+
const path = require('path');
|
|
25
|
+
|
|
26
|
+
const GRADLE_FILE_PATH = path.join(ANDROID_DIR, 'gradle.properties');
|
|
27
|
+
|
|
28
|
+
function validateBuildType(
|
|
29
|
+
buildType /*: string */,
|
|
30
|
+
// $FlowFixMe[incompatible-type-guard]
|
|
31
|
+
) /*: buildType is BuildType */ {
|
|
32
|
+
const validBuildTypes = new Set(['release', 'dry-run']);
|
|
33
|
+
|
|
34
|
+
// $FlowFixMe[incompatible-return]
|
|
35
|
+
// $FlowFixMe[incompatible-type-guard]
|
|
36
|
+
return validBuildTypes.has(buildType);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function getVersion(buildType /*: BuildType */) /*: Promise<string> */ {
|
|
40
|
+
const mainVersion = await getMainVersion();
|
|
41
|
+
|
|
42
|
+
if (buildType === 'dry-run') {
|
|
43
|
+
const currentCommit = getCurrentCommit();
|
|
44
|
+
const shortCommit = currentCommit.slice(0, 9);
|
|
45
|
+
return `${mainVersion}-${shortCommit}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return mainVersion;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function getMainVersion() /*: Promise<string> */ {
|
|
52
|
+
const hermesCompilerPackageJsonPath = path.join(
|
|
53
|
+
REPO_ROOT,
|
|
54
|
+
'npm',
|
|
55
|
+
'hermes-compiler',
|
|
56
|
+
'package.json',
|
|
57
|
+
);
|
|
58
|
+
const packageJson = JSON.parse(
|
|
59
|
+
await fs.readFile(hermesCompilerPackageJsonPath, 'utf-8'),
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return packageJson.version;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function updateGradlePropertiesFile(
|
|
66
|
+
version /*: string */,
|
|
67
|
+
) /*: Promise<void> */ {
|
|
68
|
+
const contents = await fs.readFile(GRADLE_FILE_PATH, 'utf-8');
|
|
69
|
+
|
|
70
|
+
return fs.writeFile(
|
|
71
|
+
GRADLE_FILE_PATH,
|
|
72
|
+
contents.replace(/^VERSION_NAME=.*/, `VERSION_NAME=${version}`),
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function updatePackageJsonVersion(
|
|
77
|
+
version /*: string */,
|
|
78
|
+
) /*: Promise<void> */ {
|
|
79
|
+
const hermesCompilerPackageJsonPath = path.join(
|
|
80
|
+
REPO_ROOT,
|
|
81
|
+
'npm',
|
|
82
|
+
'hermes-compiler',
|
|
83
|
+
'package.json',
|
|
84
|
+
);
|
|
85
|
+
const contents = await fs.readFile(hermesCompilerPackageJsonPath, 'utf-8');
|
|
86
|
+
|
|
87
|
+
return fs.writeFile(
|
|
88
|
+
hermesCompilerPackageJsonPath,
|
|
89
|
+
contents.replace(/"version": ".*"/, `"version": "${version}"`),
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
module.exports = {
|
|
94
|
+
validateBuildType,
|
|
95
|
+
getVersion,
|
|
96
|
+
updateGradlePropertiesFile,
|
|
97
|
+
updatePackageJsonVersion,
|
|
98
|
+
};
|