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,332 @@
|
|
|
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
|
+
import com.facebook.hermes.helpers.internal.SerializeHermesCompilerPackageJson
|
|
9
|
+
import com.facebook.hermes.tasks.internal.CustomExecTask
|
|
10
|
+
import org.apache.tools.ant.taskdefs.condition.Os
|
|
11
|
+
|
|
12
|
+
plugins {
|
|
13
|
+
id("maven-publish")
|
|
14
|
+
id("signing")
|
|
15
|
+
alias(libs.plugins.nexus.publish)
|
|
16
|
+
alias(libs.plugins.android.library)
|
|
17
|
+
alias(libs.plugins.download)
|
|
18
|
+
id("publish")
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
group = "com.facebook.hermes"
|
|
22
|
+
|
|
23
|
+
version = project.findProperty("VERSION_NAME")?.toString()!!
|
|
24
|
+
|
|
25
|
+
val hermesReleaseVersion = SerializeHermesCompilerPackageJson(project).hermesReleaseVersion
|
|
26
|
+
|
|
27
|
+
val cmakeVersion = System.getenv("CMAKE_VERSION") ?: libs.versions.cmake.get()
|
|
28
|
+
val cmakePath = "${getSDKPath()}/cmake/$cmakeVersion"
|
|
29
|
+
val cmakeBinaryPath = "${cmakePath}/bin/cmake"
|
|
30
|
+
val sonatypeUsername = findProperty("SONATYPE_USERNAME")?.toString()
|
|
31
|
+
val sonatypePassword = findProperty("SONATYPE_PASSWORD")?.toString()
|
|
32
|
+
|
|
33
|
+
nexusPublishing {
|
|
34
|
+
repositories {
|
|
35
|
+
sonatype {
|
|
36
|
+
username.set(sonatypeUsername)
|
|
37
|
+
password.set(sonatypePassword)
|
|
38
|
+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
|
|
39
|
+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fun getSDKPath(): String {
|
|
45
|
+
val androidSdkRoot = System.getenv("ANDROID_SDK_ROOT")
|
|
46
|
+
val androidHome = System.getenv("ANDROID_HOME")
|
|
47
|
+
return when {
|
|
48
|
+
!androidSdkRoot.isNullOrBlank() -> androidSdkRoot
|
|
49
|
+
!androidHome.isNullOrBlank() -> androidHome
|
|
50
|
+
else -> throw IllegalStateException("Neither ANDROID_SDK_ROOT nor ANDROID_HOME is set.")
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
fun getSDKManagerPath(): String {
|
|
55
|
+
val metaSdkManagerPath = File("${getSDKPath()}/cmdline-tools/latest/bin/sdkmanager")
|
|
56
|
+
val ossSdkManagerPath = File("${getSDKPath()}/tools/bin/sdkmanager")
|
|
57
|
+
val windowsMetaSdkManagerPath = File("${getSDKPath()}/cmdline-tools/latest/bin/sdkmanager.bat")
|
|
58
|
+
val windowsOssSdkManagerPath = File("${getSDKPath()}/tools/bin/sdkmanager.bat")
|
|
59
|
+
val linuxSdkManagerPath = File("${getSDKPath()}/cmdline-tools/tools/bin/sdkmanager")
|
|
60
|
+
return when {
|
|
61
|
+
metaSdkManagerPath.exists() -> metaSdkManagerPath.absolutePath
|
|
62
|
+
windowsMetaSdkManagerPath.exists() -> windowsMetaSdkManagerPath.absolutePath
|
|
63
|
+
ossSdkManagerPath.exists() -> ossSdkManagerPath.absolutePath
|
|
64
|
+
windowsOssSdkManagerPath.exists() -> windowsOssSdkManagerPath.absolutePath
|
|
65
|
+
linuxSdkManagerPath.exists() -> linuxSdkManagerPath.absolutePath
|
|
66
|
+
else -> throw GradleException("Could not find sdkmanager executable.")
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
val hermesDir = project.projectDir.parentFile
|
|
71
|
+
val hermesBuildDir = File("$hermesDir/build")
|
|
72
|
+
|
|
73
|
+
project.layout.buildDirectory.set(hermesBuildDir)
|
|
74
|
+
|
|
75
|
+
val buildDir = project.layout.buildDirectory.get().asFile
|
|
76
|
+
val hermesCOutputBinary = File("$buildDir/hermes/bin/hermesc")
|
|
77
|
+
|
|
78
|
+
// This filetree represents the file of the Hermes build that we want as input/output
|
|
79
|
+
// of the buildHermesC task. Gradle will compute the hash of files in the file tree
|
|
80
|
+
// and won't rebuilt hermesc unless those files are changing.
|
|
81
|
+
val hermesBuildOutputFileTree =
|
|
82
|
+
fileTree(hermesBuildDir.toString())
|
|
83
|
+
.include("**/*.cmake", "**/*.marks", "**/compiler_depends.ts", "**/Makefile", "**/link.txt")
|
|
84
|
+
|
|
85
|
+
val ndkBuildJobs = Runtime.getRuntime().availableProcessors().toString()
|
|
86
|
+
val prefabHeadersDir = File("$buildDir/prefab-headers")
|
|
87
|
+
|
|
88
|
+
// We inject the JSI directory used inside the Hermes build with the -DJSI_DIR config.
|
|
89
|
+
val jsiDir = File("$hermesDir/API/jsi")
|
|
90
|
+
|
|
91
|
+
// NOTE: ideally, we would like CMake to be installed automatically by the `externalNativeBuild`
|
|
92
|
+
// below. To do that, we would need the various `ConfigureCMake*` tasks to run *before*
|
|
93
|
+
// `configureBuildForHermes` and `buildHermesC` so that CMake is available for their run. But the
|
|
94
|
+
// `ConfigureCMake*` tasks depend upon the `ImportHermesc.cmake` file which is actually generated by
|
|
95
|
+
// the two tasks mentioned before, so we install CMake manually to break the circular dependency.
|
|
96
|
+
val installCMake by
|
|
97
|
+
tasks.registering(CustomExecTask::class) {
|
|
98
|
+
onlyIfProvidedPathDoesNotExists.set(cmakePath)
|
|
99
|
+
commandLine(
|
|
100
|
+
windowsAwareCommandLine(getSDKManagerPath(), "--install", "cmake;${cmakeVersion}"),
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
val configureBuildForHermes by
|
|
105
|
+
tasks.registering(CustomExecTask::class) {
|
|
106
|
+
dependsOn(installCMake)
|
|
107
|
+
dependsOn("prepareLintJarForPublish")
|
|
108
|
+
dependsOn("generatePomFileForReleasePublication")
|
|
109
|
+
workingDir(hermesDir)
|
|
110
|
+
inputs.dir(hermesDir)
|
|
111
|
+
outputs.files(hermesBuildOutputFileTree)
|
|
112
|
+
var cmakeCommandLine = windowsAwareCommandLine(
|
|
113
|
+
cmakeBinaryPath,
|
|
114
|
+
// Suppress all warnings as this is the Hermes build and we can't fix them.
|
|
115
|
+
"--log-level=ERROR",
|
|
116
|
+
"-Wno-dev",
|
|
117
|
+
"-S",
|
|
118
|
+
".",
|
|
119
|
+
"-B",
|
|
120
|
+
hermesBuildDir.toString(),
|
|
121
|
+
"-DJSI_DIR=" + jsiDir.absolutePath,
|
|
122
|
+
"-DCMAKE_BUILD_TYPE=Debug",
|
|
123
|
+
)
|
|
124
|
+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
125
|
+
cmakeCommandLine = cmakeCommandLine + "-GNMake Makefiles"
|
|
126
|
+
}
|
|
127
|
+
commandLine(cmakeCommandLine)
|
|
128
|
+
standardOutputFile.set(project.file("$buildDir/configure-hermesc.log"))
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
val buildHermesC by
|
|
132
|
+
tasks.registering(CustomExecTask::class) {
|
|
133
|
+
dependsOn(configureBuildForHermes)
|
|
134
|
+
workingDir(hermesDir)
|
|
135
|
+
inputs.files(hermesBuildOutputFileTree)
|
|
136
|
+
outputs.file(hermesCOutputBinary)
|
|
137
|
+
commandLine(
|
|
138
|
+
cmakeBinaryPath,
|
|
139
|
+
"--build",
|
|
140
|
+
hermesBuildDir.toString(),
|
|
141
|
+
"--target",
|
|
142
|
+
"hermesc",
|
|
143
|
+
"-j",
|
|
144
|
+
ndkBuildJobs,
|
|
145
|
+
)
|
|
146
|
+
standardOutputFile.set(project.file("$buildDir/build-hermesc.log"))
|
|
147
|
+
errorOutputFile.set(project.file("$buildDir/build-hermesc.error.log"))
|
|
148
|
+
doFirst { println("Building hermesc with command: ${commandLine.joinToString(" ")}") }
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
val prepareHeadersForPrefab by
|
|
152
|
+
tasks.registering(Copy::class) {
|
|
153
|
+
dependsOn(buildHermesC)
|
|
154
|
+
from("$hermesDir/API")
|
|
155
|
+
from("$hermesDir/public")
|
|
156
|
+
include("**/*.h")
|
|
157
|
+
exclude("jsi/**")
|
|
158
|
+
into(prefabHeadersDir)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
val buildHermesLib by
|
|
162
|
+
tasks.registering(CustomExecTask::class) {
|
|
163
|
+
dependsOn(buildHermesC)
|
|
164
|
+
workingDir(hermesDir)
|
|
165
|
+
inputs.files(hermesBuildOutputFileTree)
|
|
166
|
+
commandLine(
|
|
167
|
+
cmakeBinaryPath,
|
|
168
|
+
"--build",
|
|
169
|
+
hermesBuildDir.toString(),
|
|
170
|
+
"--target",
|
|
171
|
+
"libhermes",
|
|
172
|
+
"-j",
|
|
173
|
+
ndkBuildJobs,
|
|
174
|
+
)
|
|
175
|
+
standardOutputFile.set(project.file("$buildDir/build-hermes-lib.log"))
|
|
176
|
+
errorOutputFile.set(project.file("$buildDir/build-hermes-lib.error.log"))
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
fun windowsAwareCommandLine(vararg commands: String): List<String> {
|
|
180
|
+
val result =
|
|
181
|
+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
182
|
+
mutableListOf("cmd", "/c")
|
|
183
|
+
} else {
|
|
184
|
+
mutableListOf()
|
|
185
|
+
}
|
|
186
|
+
result.addAll(commands)
|
|
187
|
+
return result
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
repositories {
|
|
191
|
+
mavenCentral()
|
|
192
|
+
google()
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
android {
|
|
196
|
+
compileSdk = libs.versions.compileSdk.get().toInt()
|
|
197
|
+
buildToolsVersion = libs.versions.buildTools.get()
|
|
198
|
+
namespace = "com.facebook.hermes"
|
|
199
|
+
|
|
200
|
+
// Used to override the NDK path/version on internal CI or by allowing
|
|
201
|
+
// users to customize the NDK path/version from their root project (e.g. for Apple Silicon
|
|
202
|
+
// support)
|
|
203
|
+
if (rootProject.hasProperty("ndkPath") && rootProject.properties["ndkPath"] != null) {
|
|
204
|
+
ndkPath = rootProject.properties["ndkPath"].toString()
|
|
205
|
+
}
|
|
206
|
+
if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
|
|
207
|
+
ndkVersion = rootProject.properties["ndkVersion"].toString()
|
|
208
|
+
} else {
|
|
209
|
+
ndkVersion = libs.versions.ndkVersion.get()
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
defaultConfig {
|
|
213
|
+
minSdk = libs.versions.minSdk.get().toInt()
|
|
214
|
+
|
|
215
|
+
externalNativeBuild {
|
|
216
|
+
cmake {
|
|
217
|
+
arguments(
|
|
218
|
+
"--log-level=ERROR",
|
|
219
|
+
"-Wno-dev",
|
|
220
|
+
"-DHERMES_IS_ANDROID=True",
|
|
221
|
+
"-DANDROID_STL=c++_shared",
|
|
222
|
+
"-DANDROID_PIE=True",
|
|
223
|
+
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
|
|
224
|
+
"-DIMPORT_HOST_COMPILERS=${File(hermesBuildDir, "ImportHostCompilers.cmake").toString()}",
|
|
225
|
+
"-DJSI_DIR=${jsiDir}",
|
|
226
|
+
"-DHERMES_BUILD_SHARED_JSI=True",
|
|
227
|
+
"-DHERMES_RELEASE_VERSION=${hermesReleaseVersion}",
|
|
228
|
+
"-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True",
|
|
229
|
+
"-DHERMESVM_HEAP_HV_MODE=HEAP_HV_PREFER32",
|
|
230
|
+
// We intentionally build Hermes with Intl support only. This is to simplify
|
|
231
|
+
// the build setup and to avoid overcomplicating the build-type matrix.
|
|
232
|
+
"-DHERMES_ENABLE_INTL=True",
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
targets("hermesvm")
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
compileOptions {
|
|
240
|
+
sourceCompatibility = JavaVersion.VERSION_17
|
|
241
|
+
targetCompatibility = JavaVersion.VERSION_17
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } }
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
externalNativeBuild {
|
|
248
|
+
cmake {
|
|
249
|
+
version = cmakeVersion
|
|
250
|
+
path = File("$hermesDir/CMakeLists.txt")
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
buildTypes {
|
|
255
|
+
debug {
|
|
256
|
+
externalNativeBuild {
|
|
257
|
+
cmake {
|
|
258
|
+
// JS developers aren't VM developers.
|
|
259
|
+
// Therefore we're passing as build type Release, to provide a faster build.
|
|
260
|
+
// This has the (unlucky) side effect of letting AGP call the build
|
|
261
|
+
// tasks `configureCMakeRelease` while is actually building the debug flavor.
|
|
262
|
+
arguments("-DCMAKE_BUILD_TYPE=Release", "-DHERMES_ENABLE_DEBUGGER=1")
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
release { externalNativeBuild { cmake { arguments("-DCMAKE_BUILD_TYPE=MinSizeRel") } } }
|
|
267
|
+
|
|
268
|
+
buildTypes {
|
|
269
|
+
create("debugOptimized") {
|
|
270
|
+
initWith(getByName("debug"))
|
|
271
|
+
externalNativeBuild { cmake { arguments("-DCMAKE_BUILD_TYPE=Release") } }
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
sourceSets {
|
|
277
|
+
getByName("main") {
|
|
278
|
+
manifest.srcFile("$hermesDir/android/hermes/src/main/AndroidManifest.xml")
|
|
279
|
+
java.directories.addAll(
|
|
280
|
+
listOf("$hermesDir/lib/Platform/Intl/java", "$hermesDir/lib/Platform/Unicode/java"),
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
buildFeatures {
|
|
286
|
+
prefab = true
|
|
287
|
+
prefabPublishing = true
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
dependencies {
|
|
291
|
+
implementation(libs.fbjni)
|
|
292
|
+
implementation(libs.yoga.proguard.annotations)
|
|
293
|
+
implementation(libs.androidx.annotation)
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
packaging {
|
|
297
|
+
jniLibs.excludes.add("**/libc++_shared.so")
|
|
298
|
+
jniLibs.excludes.add("**/libjsi.so")
|
|
299
|
+
jniLibs.excludes.add("**/libfbjni.so")
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
publishing {
|
|
303
|
+
multipleVariants {
|
|
304
|
+
withSourcesJar()
|
|
305
|
+
allVariants()
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
prefab { create("hermesvm") { headers = prefabHeadersDir.absolutePath } }
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
afterEvaluate {
|
|
313
|
+
tasks.getByName("preBuild").dependsOn(buildHermesC)
|
|
314
|
+
tasks.getByName("preBuild").dependsOn(prepareHeadersForPrefab)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
tasks.withType<JavaCompile>().configureEach {
|
|
318
|
+
options.compilerArgs.add("-Xlint:deprecation,unchecked")
|
|
319
|
+
options.compilerArgs.add("-Werror")
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
tasks.register("publishAndroidOnlyToMavenTempLocal") {
|
|
323
|
+
dependsOn(":publishAllPublicationsToMavenTempLocalRepository", ":build")
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
tasks.register("publishAndroidOnlyToSonatype") { dependsOn(":publishToSonatype") }
|
|
327
|
+
|
|
328
|
+
// We need to override the artifact ID as this project is called `hermes-engine` but
|
|
329
|
+
// the maven coordinates are on `hermes-android`.
|
|
330
|
+
publishing {
|
|
331
|
+
publications { getByName("release", MavenPublication::class) { artifactId = "hermes-android" } }
|
|
332
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
plugins {
|
|
9
|
+
id("com.android.library")
|
|
10
|
+
id("com.facebook.hermes.plugins.internal.hermesUtils")
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
repositories {
|
|
14
|
+
google()
|
|
15
|
+
mavenCentral()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
buildDir = "${hermesUtils.hermesWs}/build_android/cppruntime"
|
|
19
|
+
buildDir.mkdirs()
|
|
20
|
+
|
|
21
|
+
android {
|
|
22
|
+
namespace = "com.facebook.hermes.cppruntime"
|
|
23
|
+
compileSdk = hermesUtils.compileSdk
|
|
24
|
+
ndkVersion = hermesUtils.ndkVersion
|
|
25
|
+
|
|
26
|
+
defaultConfig {
|
|
27
|
+
minSdk = hermesUtils.minSdk
|
|
28
|
+
externalNativeBuild {
|
|
29
|
+
cmake {
|
|
30
|
+
arguments "-DANDROID_STL=c++_shared"
|
|
31
|
+
arguments "-DANDROID_PIE=True"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
ndk {
|
|
36
|
+
abiFilters (*hermesUtils.abis)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
externalNativeBuild {
|
|
41
|
+
cmake {
|
|
42
|
+
version = hermesUtils.cmakeVersion
|
|
43
|
+
path = "src/main/cpp/CMakeLists.txt"
|
|
44
|
+
buildStagingDirectory = "${hermesUtils.hermesWs}/staging/cppruntime"
|
|
45
|
+
buildStagingDirectory.mkdirs()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
packagingOptions {
|
|
50
|
+
exclude "**/libstub.so"
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
afterEvaluate {
|
|
54
|
+
// Gradle 4/5.0 outputs android-debug.aar and android-release.aar
|
|
55
|
+
// Gradle 5.1 outputs android.aar for both
|
|
56
|
+
// Unify the two by renaming the files afterwards.
|
|
57
|
+
// Neither appear to care whether the original filename actually exists.
|
|
58
|
+
def aarDir = "$buildDir/outputs/aar"
|
|
59
|
+
tasks.named("assembleDebug").configure {
|
|
60
|
+
doLast {
|
|
61
|
+
file("$aarDir/cppruntime-debug.aar").renameTo("${hermesUtils.outputDir}/hermes-cppruntime-debug.aar")
|
|
62
|
+
file("$aarDir/cppruntime.aar").renameTo("${hermesUtils.outputDir}/hermes-cppruntime-debug.aar")
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
tasks.named("assembleRelease").configure {
|
|
66
|
+
doLast {
|
|
67
|
+
file("$aarDir/cppruntime-release.aar").renameTo("${hermesUtils.outputDir}/hermes-cppruntime-release.aar")
|
|
68
|
+
file("$aarDir/cppruntime.aar").renameTo("${hermesUtils.outputDir}/hermes-cppruntime-release.aar")
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
#include <jni.h>
|
|
9
|
+
|
|
10
|
+
extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
|
11
|
+
return JNI_VERSION_1_6;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
diff --git a/build.sh b/build.sh
|
|
2
|
+
index 122f50e..b4df1cd 100755
|
|
3
|
+
--- a/build.sh
|
|
4
|
+
+++ b/build.sh
|
|
5
|
+
@@ -85,7 +85,7 @@ cd $BUILDDIR/$ARCH
|
|
6
|
+
|
|
7
|
+
# The ENVVAR LIBSUFFIX should add the suffix only to the libname and not to the symbols.
|
|
8
|
+
# ToDo: Find the right way in Swift to refer to an alternative library with symbol prefixing or any other method to remove this.
|
|
9
|
+
- if $[ -n "$LIBSUFFIX" ]; then
|
|
10
|
+
+ if [ -n "$LIBSUFFIX" ]; then
|
|
11
|
+
patch -p0 < ../patches/icu_suffix_only_on_libname.patch
|
|
12
|
+
fi
|
|
13
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
SET(CMAKE_SYSTEM_NAME Android)
|
|
7
|
+
SET(CMAKE_SYSTEM_VERSION 13)
|
|
8
|
+
|
|
9
|
+
SET(CMAKE_ANDROID_ARCH_ABI armeabi-v7a)
|
|
10
|
+
SET(CMAKE_ANDROID_NDK /opt/android_ndk/android-ndk-r13b)
|
|
11
|
+
SET(CMAKE_ANDROID_STL_TYPE gnustl_shared)
|
|
12
|
+
|
|
13
|
+
SET(CMAKE_POSITION_INDEPENDENT_CODE True)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
SET(CMAKE_SYSTEM_NAME Android)
|
|
7
|
+
SET(CMAKE_SYSTEM_VERSION 15)
|
|
8
|
+
|
|
9
|
+
SET(CMAKE_ANDROID_ARCH_ABI armeabi-v7a)
|
|
10
|
+
SET(CMAKE_ANDROID_NDK /opt/android_ndk/android-ndk-r15c)
|
|
11
|
+
SET(CMAKE_ANDROID_STL_TYPE gnustl_shared)
|
|
12
|
+
SET(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
|
|
13
|
+
|
|
14
|
+
SET(CMAKE_POSITION_INDEPENDENT_CODE True)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[versions]
|
|
2
|
+
# Android versions
|
|
3
|
+
minSdk = "24"
|
|
4
|
+
targetSdk = "36"
|
|
5
|
+
compileSdk = "36"
|
|
6
|
+
buildTools = "36.0.0"
|
|
7
|
+
ndkVersion = "28.2.13676358"
|
|
8
|
+
# CMake version
|
|
9
|
+
cmake = "3.31.6"
|
|
10
|
+
# Dependencies versions
|
|
11
|
+
agp = "9.2.1"
|
|
12
|
+
androidx-annotation = "1.6.0"
|
|
13
|
+
download = "5.4.0"
|
|
14
|
+
fbjni = "0.7.0"
|
|
15
|
+
kotlin = "2.2.0"
|
|
16
|
+
ktfmt = "0.22.0"
|
|
17
|
+
nexus-publish = "2.0.0"
|
|
18
|
+
yoga-proguard-annotations = "1.19.0"
|
|
19
|
+
|
|
20
|
+
[libraries]
|
|
21
|
+
androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" }
|
|
22
|
+
fbjni = { module = "com.facebook.fbjni:fbjni", version.ref = "fbjni" }
|
|
23
|
+
yoga-proguard-annotations = { module = "com.facebook.yoga:proguard-annotations", version.ref = "yoga-proguard-annotations" }
|
|
24
|
+
|
|
25
|
+
[plugins]
|
|
26
|
+
android-library = { id = "com.android.library", version.ref = "agp" }
|
|
27
|
+
download = { id = "de.undercouch.download", version.ref = "download" }
|
|
28
|
+
ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" }
|
|
29
|
+
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
|
|
30
|
+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|
Binary file
|