Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/build-apple-slices-hermes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ runs:
mv build_"$SLICE" "$FINAL_PATH"

# check whether everything is there
if [[ -d "$FINAL_PATH/API/hermes/hermes.framework" ]]; then
if [[ -d "$FINAL_PATH/lib/hermes.framework" ]]; then
echo "Successfully built hermes.framework for $SLICE in $FLAVOR"
else
echo "Failed to built hermes.framework for $SLICE in $FLAVOR"
exit 1
fi

if [[ -d "$FINAL_PATH/API/hermes/hermes.framework.dSYM" ]]; then
if [[ -d "$FINAL_PATH/lib/hermes.framework.dSYM" ]]; then
echo "Successfully built hermes.framework.dSYM for $SLICE in $FLAVOR"
else
echo "Failed to built hermes.framework.dSYM for $SLICE in $FLAVOR"
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/build-hermes-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ runs:

cd ./packages/react-native/sdks/hermes || exit 1

DSYM_FILE_PATH=API/hermes/hermes.framework.dSYM
DSYM_FILE_PATH=lib/hermes.framework.dSYM
cp -r build_macosx/$DSYM_FILE_PATH "$WORKING_DIR/macosx/"
cp -r build_catalyst/$DSYM_FILE_PATH "$WORKING_DIR/catalyst/"
cp -r build_iphoneos/$DSYM_FILE_PATH "$WORKING_DIR/iphoneos/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ internal object NdkConfiguratorUtils {
hermesEnabled -> {
excludes.add("**/libjsc.so")
excludes.add("**/libjsctooling.so")
includes.add("**/libhermes.so")
includes.add("**/libhermesvm.so")
includes.add("**/libhermestooling.so")
}
useThirdPartyJSC -> {
excludes.add("**/libhermes.so")
excludes.add("**/libhermesvm.so")
excludes.add("**/libhermestooling.so")
excludes.add("**/libjsctooling.so")
includes.add("**/libjsc.so")
}
else -> {
excludes.add("**/libhermes.so")
excludes.add("**/libhermesvm.so")
excludes.add("**/libhermestooling.so")
includes.add("**/libjsc.so")
includes.add("**/libjsctooling.so")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class NdkConfiguratorUtilsTest {
assertThat(excludes).containsExactly("**/libjsc.so", "**/libjsctooling.so")
assertThat(includes).doesNotContain("**/libjsc.so", "**/libjsctooling.so")

assertThat(includes).containsExactly("**/libhermes.so", "**/libhermestooling.so")
assertThat(excludes).doesNotContain("**/libhermes.so", "**/libhermestooling.so")
assertThat(includes).containsExactly("**/libhermesvm.so", "**/libhermestooling.so")
assertThat(excludes).doesNotContain("**/libhermesvm.so", "**/libhermestooling.so")
}

@Test
Expand All @@ -39,8 +39,8 @@ class NdkConfiguratorUtilsTest {
assertThat(excludes).containsExactly("**/libjsc.so", "**/libjsctooling.so")
assertThat(includes).doesNotContain("**/libjsc.so", "**/libjsctooling.so")

assertThat(includes).containsExactly("**/libhermes.so", "**/libhermestooling.so")
assertThat(excludes).doesNotContain("**/libhermes.so", "**/libhermestooling.so")
assertThat(includes).containsExactly("**/libhermesvm.so", "**/libhermestooling.so")
assertThat(excludes).doesNotContain("**/libhermesvm.so", "**/libhermestooling.so")
}

@Test
Expand All @@ -51,8 +51,8 @@ class NdkConfiguratorUtilsTest {
useThirdPartyJSC = false,
)

assertThat(excludes).containsExactly("**/libhermes.so", "**/libhermestooling.so")
assertThat(includes).doesNotContain("**/libhermes.so", "**/libhermestooling.so")
assertThat(excludes).containsExactly("**/libhermesvm.so", "**/libhermestooling.so")
assertThat(includes).doesNotContain("**/libhermesvm.so", "**/libhermestooling.so")

assertThat(includes).containsExactly("**/libjsc.so", "**/libjsctooling.so")
assertThat(excludes).doesNotContain("**/libjsc.so", "**/libjsctooling.so")
Expand All @@ -68,6 +68,6 @@ class NdkConfiguratorUtilsTest {

assertThat(includes).containsExactly("**/libjsc.so")
assertThat(excludes)
.containsExactly("**/libhermes.so", "**/libhermestooling.so", "**/libjsctooling.so")
.containsExactly("**/libhermesvm.so", "**/libhermestooling.so", "**/libjsctooling.so")
}
}
2 changes: 1 addition & 1 deletion packages/react-native/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let reactNativeDependencies = BinaryTarget(

let hermesPrebuilt = BinaryTarget(
name: .hermesPrebuilt,
path: ".build/artifacts/hermes/destroot/Library/Frameworks/universal/hermes.xcframework",
path: ".build/artifacts/hermes/destroot/Library/Frameworks/universal/hermesvm.xcframework",
searchPaths: [".build/artifacts/hermes/destroot/include"]
)

Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ android {
// we produce. The reason behind this is that we want to allow users to pick the
// JS engine by specifying a dependency on either `hermes-engine` or other engines
// that will include the necessary .so files to load.
jniLibs.excludes.add("**/libhermes.so")
jniLibs.excludes.add("**/libhermesvm.so")
}

buildFeatures {
Expand Down
16 changes: 6 additions & 10 deletions packages/react-native/ReactAndroid/hermes-engine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ val unzipHermes by
// NOTE: ideally, we would like CMake to be installed automatically by the `externalNativeBuild`
// below. To do that, we would need the various `ConfigureCMake*` tasks to run *before*
// `configureBuildForHermes` and `buildHermesC` so that CMake is available for their run. But the
// `ConfigureCMake*` tasks depend upon the `ImportHermesc.cmake` file which is actually generated by
// `ConfigureCMake*` tasks depend upon the `ImportHostCompilers.cmake` file which is actually
// generated by
// the two tasks mentioned before, so we install CMake manually to break the circular dependency.

val installCMake by
Expand Down Expand Up @@ -197,7 +198,7 @@ val buildHermesLib by
"--build",
hermesBuildDir.toString(),
"--target",
"libhermes",
"hermesvm",
"-j",
ndkBuildJobs,
)
Expand Down Expand Up @@ -258,7 +259,7 @@ android {
"-DANDROID_STL=c++_shared",
"-DANDROID_PIE=True",
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON",
"-DIMPORT_HERMESC=${File(hermesBuildDir, "ImportHermesc.cmake").toString()}",
"-DIMPORT_HOST_COMPILERS=${File(hermesBuildDir, "ImportHostCompilers.cmake").toString()}",
"-DJSI_DIR=${jsiDir}",
"-DHERMES_BUILD_SHARED_JSI=True",
"-DHERMES_RELEASE_VERSION=for RN ${version}",
Expand All @@ -268,7 +269,7 @@ android {
"-DHERMES_ENABLE_INTL=True",
)

targets("libhermes")
targets("hermesvm")
}
}
ndk { abiFilters.addAll(reactNativeArchitectures()) }
Expand Down Expand Up @@ -346,12 +347,7 @@ android {
}
}

prefab {
create("libhermes") {
headers = prefabHeadersDir.absolutePath
libraryName = "libhermes"
}
}
prefab { create("hermesvm") { headers = prefabHeadersDir.absolutePath } }
}

afterEvaluate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public class HermesExecutor internal constructor(enableDebugger: Boolean, debugg
@Throws(UnsatisfiedLinkError::class)
public fun loadLibrary() {
if (mode == null) {
// libhermes must be loaded explicitly to invoke its JNI_OnLoad.
SoLoader.loadLibrary("hermes")
// libhermesvm must be loaded explicitly to invoke its JNI_OnLoad.
SoLoader.loadLibrary("hermesvm")
SoLoader.loadLibrary("hermes_executor")
// libhermes_executor is built differently for Debug & Release so we load the proper mode.
mode = if (ReactBuildConfig.DEBUG) "Debug" else "Release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ add_library(hermes SHARED IMPORTED GLOBAL)
set_target_properties(hermes
PROPERTIES
IMPORTED_LOCATION
${CMAKE_CURRENT_SOURCE_DIR}/jni/${ANDROID_ABI}/libhermes.so)
${CMAKE_CURRENT_SOURCE_DIR}/jni/${ANDROID_ABI}/libhermesvm.so)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ target_include_directories(jsijniprofiler PRIVATE .)

target_link_libraries(
jsijniprofiler
hermes-engine::libhermes
hermes-engine::hermesvm
jsi
reactnative
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ target_include_directories(hermes_executor PRIVATE .)
target_link_libraries(
hermes_executor
hermes_executor_common
hermes-engine::libhermes
hermes-engine::hermesvm
jsi
reactnative
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ target_link_libraries(hermestooling
PUBLIC
reactnative
jsi
hermes-engine::libhermes
hermes-engine::hermesvm
)
target_include_directories(hermestooling
PUBLIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target_include_directories(hermesinstancejni PRIVATE .)
target_merge_so(hermesinstancejni)

target_link_libraries(hermesinstancejni
hermes-engine::libhermes
hermes-engine::hermesvm
jsitooling
fbjni
bridgelesshermes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ add_library(
target_include_directories(hermes_executor_common PUBLIC .)
react_native_android_selector(reactnative reactnative "")
target_link_libraries(hermes_executor_common
hermes-engine::libhermes
hermes-engine::hermesvm
hermes_inspector_modern
jsi
jsireact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ endif()
target_include_directories(hermes_inspector_modern PUBLIC ${REACT_COMMON_DIR})
react_native_android_selector(reactnative reactnative "")
target_link_libraries(hermes_inspector_modern
hermes-engine::libhermes
hermes-engine::hermesvm
jsi
jsinspector
${reactnative})
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target_include_directories(bridgelesshermes PUBLIC .)

react_native_android_selector(reactnative reactnative "")
target_link_libraries(bridgelesshermes
hermes-engine::libhermes
hermes-engine::hermesvm
hermes_executor_common
hermes_inspector_modern
jsi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,15 @@ function populateMockFilesystemWithHermesBuildArtifacts() {
fs.mkdirSync(path.join(frameworksDir, 'macosx/hermes.framework'), {
recursive: true,
});
fs.mkdirSync(path.join(frameworksDir, 'universal/hermes.xcframework'), {
fs.mkdirSync(path.join(frameworksDir, 'universal/hermesvm.xcframework'), {
recursive: true,
});

const dsymsDirs = [
'macosx',
'universal/hermes.xcframework/ios-arm64/dSYMs',
'universal/hermes.xcframework/ios-arm64_x86_64-simulator/dSYMs',
'universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs',
'universal/hermesvm.xcframework/ios-arm64/dSYMs',
'universal/hermesvm.xcframework/ios-arm64_x86_64-simulator/dSYMs',
'universal/hermesvm.xcframework/ios-arm64_x86_64-maccatalyst/dSYMs',
];

for (const dsymsDir of dsymsDirs) {
Expand Down Expand Up @@ -354,7 +354,7 @@ describe('hermes-utils', () => {
configureMakeForPrebuiltHermesC();
expect(
fs.existsSync(
path.join(SDKS_DIR, 'hermesc/osx-bin/ImportHermesc.cmake'),
path.join(SDKS_DIR, 'hermesc/osx-bin/ImportHostCompilers.cmake'),
),
).toBe(true);
});
Expand Down
16 changes: 11 additions & 5 deletions packages/react-native/scripts/hermes/hermes-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const HERMES_SOURCE_TARBALL_BASE_URL =
const HERMES_TARBALL_DOWNLOAD_DIR = path.join(SDKS_DIR, 'download');
const MACOS_BIN_DIR = path.join(SDKS_DIR, 'hermesc', 'osx-bin');
const MACOS_HERMESC_PATH = path.join(MACOS_BIN_DIR, 'hermesc');
const MACOS_IMPORT_HERMESC_PATH = path.join(
const MACOS_IMPORT_HOST_COMPILERS_PATH = path.join(
MACOS_BIN_DIR,
'ImportHermesc.cmake',
'ImportHostCompilers.cmake',
);

/**
Expand Down Expand Up @@ -208,14 +208,17 @@ function shouldUsePrebuiltHermesC(
}

function configureMakeForPrebuiltHermesC() {
const IMPORT_HERMESC_TEMPLATE = `add_executable(native-hermesc IMPORTED)
const IMPORT_HOST_COMPILERS_TEMPLATE = `add_executable(native-hermesc IMPORTED)
set_target_properties(native-hermesc PROPERTIES
IMPORTED_LOCATION "${MACOS_HERMESC_PATH}"
)`;

try {
fs.mkdirSync(MACOS_BIN_DIR, {recursive: true});
fs.writeFileSync(MACOS_IMPORT_HERMESC_PATH, IMPORT_HERMESC_TEMPLATE);
fs.writeFileSync(
MACOS_IMPORT_HOST_COMPILERS_PATH,
IMPORT_HOST_COMPILERS_TEMPLATE,
);
} catch (error) {
console.warn(
`[Hermes] Re-compiling hermesc. Unable to configure make: ${error}`,
Expand Down Expand Up @@ -310,7 +313,10 @@ function validateHermesFrameworksExist(destrootDir /*: string */) {
}
if (
!fs.existsSync(
path.join(destrootDir, 'Library/Frameworks/universal/hermes.xcframework'),
path.join(
destrootDir,
'Library/Frameworks/universal/hermesvm.xcframework',
),
)
) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/scripts/ios-prebuild/hermes.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function checkExistingVersion(
'Library',
'Frameworks',
'universal',
'hermes.xcframework',
'hermesvm.xcframework',
);

if (fs.existsSync(versionFilePath) && fs.existsSync(hermesXCFramework)) {
Expand Down
24 changes: 12 additions & 12 deletions packages/react-native/sdks/hermes-engine/hermes-engine.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ Pod::Spec.new do |spec|
"GCC_WARN_INHIBIT_ALL_WARNINGS" => "YES" # Disable warnings because we don't control this library
}

spec.ios.vendored_frameworks = "destroot/Library/Frameworks/ios/hermes.framework"
spec.tvos.vendored_frameworks = "destroot/Library/Frameworks/tvos/hermes.framework"
spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/xros/hermes.framework"
spec.ios.vendored_frameworks = "destroot/Library/Frameworks/ios/hermesvm.framework"
spec.tvos.vendored_frameworks = "destroot/Library/Frameworks/tvos/hermesvm.framework"
spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermesvm.framework"
spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/xros/hermesvm.framework"

if HermesEngineSourceType::isPrebuilt(source_type) then

spec.subspec 'Pre-built' do |ss|
ss.preserve_paths = ["destroot/bin/*"].concat(["**/*.{h,c,cpp}"])
ss.source_files = "destroot/include/hermes/**/*.h"
ss.header_mappings_dir = "destroot/include"
ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
ss.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
ss.tvos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework"
ss.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework"
ss.tvos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermesvm.xcframework"
ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermesvm.framework"
end


Expand Down Expand Up @@ -139,7 +139,7 @@ Pod::Spec.new do |spec|
{
:name => '[RN] [1] Build Hermesc',
:output_files => [
"#{hermesc_path}/ImportHermesc.cmake"
"#{hermesc_path}/ImportHostCompilers.cmake"
],
:script => <<-EOS
. "${REACT_NATIVE_PATH}/scripts/xcode/with-environment.sh"
Expand All @@ -149,14 +149,14 @@ Pod::Spec.new do |spec|
},
{
:name => '[RN] [2] Build Hermes',
:input_files => ["#{hermesc_path}/ImportHermesc.cmake"],
:input_files => ["#{hermesc_path}/ImportHostCompilers.cmake"],
:output_files => [
"${PODS_ROOT}/hermes-engine/build/iphonesimulator/API/hermes/hermes.framework/hermes"
"${PODS_ROOT}/hermes-engine/build/iphonesimulator/API/hermes/hermesvm.framework/hermesvm"
],
:script => <<-EOS
. "${REACT_NATIVE_PATH}/scripts/xcode/with-environment.sh"
export CMAKE_BINARY=${CMAKE_BINARY:-#{CMAKE_BINARY}}
. ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/build-hermes-xcode.sh #{version} #{hermesc_path}/ImportHermesc.cmake ${REACT_NATIVE_PATH}/ReactCommon/jsi
. ${REACT_NATIVE_PATH}/sdks/hermes-engine/utils/build-hermes-xcode.sh #{version} #{hermesc_path}/ImportHostCompilers.cmake ${REACT_NATIVE_PATH}/ReactCommon/jsi
EOS
}
]
Expand Down
Loading
Loading