mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Change hermes atrifact names (#53094)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53094 Changelog: [General][Changed] - Changed names of hermes binaries Reviewed By: cipolleschi, cortinico Differential Revision: D79163127 fbshipit-source-id: 54be34ba1f6ce90067768394ca9a6e9c4048be90
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3d1d81cddc
commit
776fca1e7c
@@ -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"
|
||||
|
||||
@@ -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/"
|
||||
|
||||
+3
-3
@@ -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")
|
||||
|
||||
+7
-7
@@ -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
|
||||
@@ -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
|
||||
@@ -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")
|
||||
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"]
|
||||
)
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
@@ -197,7 +198,7 @@ val buildHermesLib by
|
||||
"--build",
|
||||
hermesBuildDir.toString(),
|
||||
"--target",
|
||||
"libhermes",
|
||||
"hermesvm",
|
||||
"-j",
|
||||
ndkBuildJobs,
|
||||
)
|
||||
@@ -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}",
|
||||
@@ -268,7 +269,7 @@ android {
|
||||
"-DHERMES_ENABLE_INTL=True",
|
||||
)
|
||||
|
||||
targets("libhermes")
|
||||
targets("hermesvm")
|
||||
}
|
||||
}
|
||||
ndk { abiFilters.addAll(reactNativeArchitectures()) }
|
||||
@@ -346,12 +347,7 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
prefab {
|
||||
create("libhermes") {
|
||||
headers = prefabHeadersDir.absolutePath
|
||||
libraryName = "libhermes"
|
||||
}
|
||||
}
|
||||
prefab { create("hermesvm") { headers = prefabHeadersDir.absolutePath } }
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
+2
-2
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ target_include_directories(jsijniprofiler PRIVATE .)
|
||||
|
||||
target_link_libraries(
|
||||
jsijniprofiler
|
||||
hermes-engine::libhermes
|
||||
hermes-engine::hermesvm
|
||||
jsi
|
||||
reactnative
|
||||
)
|
||||
|
||||
+1
-1
@@ -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
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ target_link_libraries(hermestooling
|
||||
PUBLIC
|
||||
reactnative
|
||||
jsi
|
||||
hermes-engine::libhermes
|
||||
hermes-engine::hermesvm
|
||||
)
|
||||
target_include_directories(hermestooling
|
||||
PUBLIC
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
+11
-5
@@ -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',
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -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}`,
|
||||
@@ -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(
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ function checkExistingVersion(
|
||||
'Library',
|
||||
'Frameworks',
|
||||
'universal',
|
||||
'hermes.xcframework',
|
||||
'hermesvm.xcframework',
|
||||
);
|
||||
|
||||
if (fs.existsSync(versionFilePath) && fs.existsSync(hermesXCFramework)) {
|
||||
|
||||
@@ -45,10 +45,10 @@ 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
|
||||
|
||||
@@ -56,10 +56,10 @@ Pod::Spec.new do |spec|
|
||||
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
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
CURR_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||
|
||||
IMPORT_HERMESC_PATH=${HERMES_OVERRIDE_HERMESC_PATH:-$PWD/build_host_hermesc/ImportHermesc.cmake}
|
||||
IMPORT_HOST_COMPILERS_PATH=${HERMES_OVERRIDE_HERMESC_PATH:-$PWD/build_host_hermesc/ImportHostCompilers.cmake}
|
||||
BUILD_TYPE=${BUILD_TYPE:-Debug}
|
||||
|
||||
HERMES_PATH="$CURR_SCRIPT_DIR/.."
|
||||
@@ -104,7 +104,7 @@ function configure_apple_framework {
|
||||
-DHERMES_BUILD_SHARED_JSI:BOOLEAN=false \
|
||||
-DCMAKE_CXX_FLAGS:STRING="-gdwarf" \
|
||||
-DCMAKE_C_FLAGS:STRING="-gdwarf" \
|
||||
-DIMPORT_HERMESC:PATH="$IMPORT_HERMESC_PATH" \
|
||||
-DIMPORT_HOST_COMPILERS:PATH="$IMPORT_HOST_COMPILERS_PATH" \
|
||||
-DJSI_DIR="$JSI_PATH" \
|
||||
-DHERMES_RELEASE_VERSION="for RN $(get_release_version)" \
|
||||
-DCMAKE_BUILD_TYPE="$cmake_build_type"
|
||||
@@ -112,20 +112,20 @@ function configure_apple_framework {
|
||||
}
|
||||
|
||||
function build_host_hermesc_if_needed {
|
||||
if [[ ! -f "$IMPORT_HERMESC_PATH" ]]; then
|
||||
if [[ ! -f "$IMPORT_HOST_COMPILERS_PATH" ]]; then
|
||||
build_host_hermesc
|
||||
else
|
||||
echo "[HermesC] Skipping! Found an existent hermesc already at: $IMPORT_HERMESC_PATH"
|
||||
echo "[HermesC] Skipping! Found an existent hermesc already at: $IMPORT_HOST_COMPILERS_PATH"
|
||||
fi
|
||||
}
|
||||
|
||||
# Utility function to build an Apple framework
|
||||
function build_apple_framework {
|
||||
# Only build host HermesC if no file found at $IMPORT_HERMESC_PATH
|
||||
# Only build host HermesC if no file found at $IMPORT_HOST_COMPILERS_PATH
|
||||
build_host_hermesc_if_needed
|
||||
|
||||
# Confirm ImportHermesc.cmake is now available.
|
||||
[ ! -f "$IMPORT_HERMESC_PATH" ] &&
|
||||
# Confirm ImportHostCompilers.cmake is now available.
|
||||
[ ! -f "$IMPORT_HOST_COMPILERS_PATH" ] &&
|
||||
echo "Host hermesc is required to build apple frameworks!"
|
||||
|
||||
# $1: platform, $2: architectures, $3: deployment target
|
||||
@@ -134,10 +134,10 @@ function build_apple_framework {
|
||||
|
||||
pushd "$HERMES_PATH" > /dev/null || exit 1
|
||||
mkdir -p "destroot/Library/Frameworks/$1"
|
||||
cmake --build "./build_$1" --target libhermes -j "${NUM_CORES}"
|
||||
cmake --build "./build_$1" --target hermesvm -j "${NUM_CORES}"
|
||||
# Produce the dSYM.
|
||||
xcrun dsymutil "./build_$1/API/hermes/hermes.framework/hermes" -o "./build_$1/API/hermes/hermes.framework.dSYM"
|
||||
cp -R "./build_$1"/API/hermes/hermes.framework* "destroot/Library/Frameworks/$1"
|
||||
xcrun dsymutil "./build_$1/lib/hermesvm.framework/hermesvm" -o "./build_$1/lib/hermesvm.framework.dSYM"
|
||||
cp -R "./build_$1"/lib/hermesvm.framework* "destroot/Library/Frameworks/$1"
|
||||
|
||||
# In a MacOS build, also produce the hermes and hermesc CLI tools.
|
||||
if [[ $1 == macosx ]]; then
|
||||
@@ -171,7 +171,7 @@ function prepare_dest_root_for_ci {
|
||||
mkdir -p "destroot/bin"
|
||||
for platform in "${PLATFORMS[@]}"; do
|
||||
mkdir -p "destroot/Library/Frameworks/$platform"
|
||||
cp -R "./build_$platform/API/hermes/hermes.framework"* "destroot/Library/Frameworks/$platform"
|
||||
cp -R "./build_$platform/lib/hermesvm.framework"* "destroot/Library/Frameworks/$platform"
|
||||
done
|
||||
|
||||
cp "./build_macosx/bin/"* "destroot/bin"
|
||||
@@ -209,15 +209,15 @@ function create_universal_framework {
|
||||
|
||||
for i in "${!platforms[@]}"; do
|
||||
local platform="${platforms[$i]}"
|
||||
local hermes_framework_path="${platform}/hermes.framework"
|
||||
local hermes_framework_path="${platform}/hermesvm.framework"
|
||||
args+="-framework $hermes_framework_path "
|
||||
done
|
||||
|
||||
mkdir -p universal
|
||||
# shellcheck disable=SC2086
|
||||
if xcodebuild -create-xcframework $args -output "universal/hermes.xcframework"
|
||||
if xcodebuild -create-xcframework $args -output "universal/hermesvm.xcframework"
|
||||
then
|
||||
# # Remove the thin iOS hermes.frameworks that are now part of the universal
|
||||
# # Remove the thin iOS hermesvm.frameworks that are now part of the universal
|
||||
# XCFramework
|
||||
for platform in "${platforms[@]}"; do
|
||||
rm -r "$platform"
|
||||
|
||||
@@ -80,7 +80,7 @@ echo "Configure Apple framework"
|
||||
-DHERMES_BUILD_SHARED_JSI:BOOLEAN=false \
|
||||
-DCMAKE_CXX_FLAGS:STRING="-gdwarf" \
|
||||
-DCMAKE_C_FLAGS:STRING="-gdwarf" \
|
||||
-DIMPORT_HERMESC:PATH="${hermesc_path}" \
|
||||
-DIMPORT_HOST_COMPILERS:PATH="${hermesc_path}" \
|
||||
-DJSI_DIR="$jsi_path" \
|
||||
-DHERMES_RELEASE_VERSION="for RN $release_version" \
|
||||
-DCMAKE_BUILD_TYPE="$cmake_build_type"
|
||||
@@ -89,7 +89,7 @@ echo "Build Apple framework"
|
||||
|
||||
"$CMAKE_BINARY" \
|
||||
--build "${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}" \
|
||||
--target libhermes \
|
||||
--target hermesvm \
|
||||
-j "$(sysctl -n hw.ncpu)"
|
||||
|
||||
echo "Copy Apple framework to destroot/Library/Frameworks"
|
||||
@@ -97,5 +97,5 @@ echo "Copy Apple framework to destroot/Library/Frameworks"
|
||||
platform_copy_destination=$(get_platform_copy_destination $PLATFORM_NAME)
|
||||
|
||||
cp -pfR \
|
||||
"${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}/API/hermes/hermes.framework" \
|
||||
"${PODS_ROOT}/hermes-engine/build/${PLATFORM_NAME}/lib/hermesvm.framework" \
|
||||
"${PODS_ROOT}/hermes-engine/destroot/Library/Frameworks/${platform_copy_destination}"
|
||||
|
||||
@@ -39,7 +39,7 @@ function get_deployment_target {
|
||||
# build a single framework
|
||||
# $1 is the target to build
|
||||
function build_framework {
|
||||
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
|
||||
if [ ! -d destroot/Library/Frameworks/universal/hermesvm.xcframework ]; then
|
||||
deployment_target=$(get_deployment_target "$1")
|
||||
|
||||
architecture=$(get_architecture "$1")
|
||||
@@ -52,7 +52,7 @@ function build_framework {
|
||||
|
||||
# group the frameworks together to create a universal framework
|
||||
function build_universal_framework {
|
||||
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
|
||||
if [ ! -d destroot/Library/Frameworks/universal/hermesvm.xcframework ]; then
|
||||
create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator" "appletvos" "appletvsimulator"
|
||||
else
|
||||
echo "Skipping; Clean \"destroot\" to rebuild".
|
||||
@@ -62,7 +62,7 @@ function build_universal_framework {
|
||||
# single function that builds sequentially iphoneos, iphonesimulator and catalyst
|
||||
# this is used to preserve backward compatibility
|
||||
function create_framework {
|
||||
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
|
||||
if [ ! -d destroot/Library/Frameworks/universal/hermesvm.xcframework ]; then
|
||||
build_framework "iphoneos"
|
||||
build_framework "iphonesimulator"
|
||||
build_framework "appletvos"
|
||||
|
||||
@@ -21,10 +21,10 @@ echo '' > dummy.c
|
||||
|
||||
platforms=( "macosx" "ios" "xros" ) # Add other platforms here if needed
|
||||
|
||||
for platform in "${platforms[@]}"
|
||||
do
|
||||
mkdir -p "${platform}/hermes.framework"
|
||||
clang dummy.c -dynamiclib -o "${platform}/hermes.framework/hermes"
|
||||
for platform in "${platforms[@]}"
|
||||
do
|
||||
mkdir -p "${platform}/hermesvm.framework"
|
||||
clang dummy.c -dynamiclib -o "${platform}/hermesvm.framework/hermesvm"
|
||||
done
|
||||
|
||||
rm dummy.c
|
||||
|
||||
@@ -18,12 +18,11 @@ include_directories(${REACT_ANDROID_DIR}/hermes-engine/build/prefab-headers)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/")
|
||||
include(Deps)
|
||||
|
||||
find_library(LIB_HERMES libhermes
|
||||
NAMES hermes
|
||||
HINTS ${REACT_ANDROID_DIR}/hermes-engine/build/hermes/API/hermes
|
||||
find_library(LIB_HERMES hermesvm
|
||||
HINTS ${REACT_ANDROID_DIR}/hermes-engine/build/hermes/lib
|
||||
REQUIRED)
|
||||
add_library(hermes-engine::libhermes INTERFACE IMPORTED)
|
||||
set_target_properties(hermes-engine::libhermes PROPERTIES
|
||||
add_library(hermes-engine::hermesvm INTERFACE IMPORTED)
|
||||
set_target_properties(hermes-engine::hermesvm PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES ${LIB_HERMES})
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
@@ -151,7 +150,7 @@ target_link_libraries(fantom_tester
|
||||
glog
|
||||
|
||||
# hermes
|
||||
hermes-engine::libhermes
|
||||
hermes-engine::hermesvm
|
||||
|
||||
# codegen
|
||||
react_codegen_rncore
|
||||
|
||||
Reference in New Issue
Block a user