Skip to content

Commit fadd7fe

Browse files
committed
feat: build visionos hermes binary on the CI
1 parent 352d4b1 commit fadd7fe

File tree

8 files changed

+38
-15
lines changed

8 files changed

+38
-15
lines changed

.circleci/configurations/test_workflows/testAll.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
matrix:
2626
parameters:
2727
flavor: ["Debug", "Release"]
28-
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
28+
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
2929
- build_hermes_macos:
3030
requires:
3131
- build_apple_slices_hermes

.circleci/configurations/test_workflows/testAndroid.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
matrix:
2626
parameters:
2727
flavor: ["Debug", "Release"]
28-
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
28+
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
2929
- build_hermes_macos:
3030
requires:
3131
- build_apple_slices_hermes

.circleci/configurations/test_workflows/testIOS.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
matrix:
2626
parameters:
2727
flavor: ["Debug", "Release"]
28-
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst"]
28+
slice: ["macosx", "iphoneos", "iphonesimulator", "catalyst", "xros", "xrsimulator"]
2929
- build_hermes_macos:
3030
requires:
3131
- build_apple_slices_hermes

packages/react-native/sdks/hermes-engine/hermes-engine.podspec

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Pod::Spec.new do |spec|
2424
spec.license = package['license']
2525
spec.author = "Facebook"
2626
spec.source = source
27-
spec.platforms = { :osx => "10.13", :ios => "13.4" }
27+
spec.platforms = { :osx => "10.13", :ios => "13.4", :visionos => "1.0" }
2828

2929
spec.preserve_paths = '**/*.*'
3030
spec.source_files = ''
@@ -44,6 +44,7 @@ Pod::Spec.new do |spec|
4444
ss.source_files = "destroot/include/hermes/**/*.h"
4545
ss.header_mappings_dir = "destroot/include"
4646
ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
47+
ss.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework"
4748
ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
4849
end
4950

packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh

+11-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ REACT_NATIVE_PATH=${REACT_NATIVE_PATH:-$CURR_SCRIPT_DIR/../../..}
1717

1818
NUM_CORES=$(sysctl -n hw.ncpu)
1919

20+
PLATFORMS=("macosx" "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator")
21+
2022
if [[ -z "$JSI_PATH" ]]; then
2123
JSI_PATH="$REACT_NATIVE_PATH/ReactCommon/jsi"
2224
fi
@@ -37,6 +39,10 @@ function get_ios_deployment_target {
3739
use_env_var_or_ruby_prop "${IOS_DEPLOYMENT_TARGET}" "deployment_target('ios')"
3840
}
3941

42+
function get_visionos_deployment_target {
43+
use_env_var_or_ruby_prop "${XROS_DEPLOYMENT_TARGET}" "deployment_target('visionos')"
44+
}
45+
4046
function get_mac_deployment_target {
4147
use_env_var_or_ruby_prop "${MAC_DEPLOYMENT_TARGET}" "deployment_target('osx')"
4248
}
@@ -150,12 +156,12 @@ function build_apple_framework {
150156
}
151157

152158
function prepare_dest_root_for_ci {
153-
mkdir -p "destroot/Library/Frameworks/macosx" "destroot/bin" "destroot/Library/Frameworks/iphoneos" "destroot/Library/Frameworks/iphonesimulator" "destroot/Library/Frameworks/catalyst"
159+
mkdir -p "destroot/bin"
160+
for platform in "${PLATFORMS[@]}"; do
161+
mkdir -p "destroot/Library/Frameworks/$platform"
162+
cp -R "./build_$platform/API/hermes/hermes.framework"* "destroot/Library/Frameworks/$platform"
163+
done
154164

155-
cp -R "./build_macosx/API/hermes/hermes.framework"* "destroot/Library/Frameworks/macosx"
156-
cp -R "./build_iphoneos/API/hermes/hermes.framework"* "destroot/Library/Frameworks/iphoneos"
157-
cp -R "./build_iphonesimulator/API/hermes/hermes.framework"* "destroot/Library/Frameworks/iphonesimulator"
158-
cp -R "./build_catalyst/API/hermes/hermes.framework"* "destroot/Library/Frameworks/catalyst"
159165
cp "./build_macosx/bin/"* "destroot/bin"
160166

161167
# Copy over Hermes and JSI API headers.

packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ function get_platform_copy_destination {
1616
if [[ $1 == "macosx" ]]; then
1717
echo "macosx"
1818
return
19+
elif [[ $1 == "xros" || $1 == "xrsimulator" ]]; then
20+
echo "xros"
21+
return
1922
fi
2023

2124
echo "ios"
@@ -25,6 +28,9 @@ function get_deployment_target {
2528
if [[ $1 == "macosx" ]]; then
2629
echo ${MACOSX_DEPLOYMENT_TARGET}
2730
return
31+
elif [[ $1 == "xrsimulator" || $1 == "xros" ]]; then
32+
echo ${XROS_DEPLOYMENT_TARGET}
33+
return
2834
fi
2935

3036
echo ${IPHONEOS_DEPLOYMENT_TARGET}

packages/react-native/sdks/hermes-engine/utils/build-ios-framework.sh

+15-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ fi
1010
set -e
1111

1212
# Given a specific target, retrieve the right architecture for it
13-
# $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst
13+
# $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst, xros, xrsimulator
1414
function get_architecture {
15-
if [[ $1 == "iphoneos" ]]; then
15+
if [[ $1 == "iphoneos" || $1 == "xros" || $1 == "xrsimulator" ]]; then
1616
echo "arm64"
1717
elif [[ $1 == "iphonesimulator" ]]; then
1818
echo "x86_64;arm64"
@@ -24,15 +24,23 @@ function get_architecture {
2424
fi
2525
}
2626

27+
function get_deployment_target {
28+
if [[ $1 == "xros" || $1 == "xrsimulator" ]]; then
29+
echo "$(get_visionos_deployment_target)"
30+
else
31+
echo "$(get_ios_deployment_target)"
32+
fi
33+
}
34+
2735
# build a single framework
2836
# $1 is the target to build
2937
function build_framework {
3038
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
31-
ios_deployment_target=$(get_ios_deployment_target)
39+
deployment_target=$(get_deployment_target "$1")
3240

3341
architecture=$(get_architecture "$1")
3442

35-
build_apple_framework "$1" "$architecture" "$ios_deployment_target"
43+
build_apple_framework "$1" "$architecture" "$deployment_target"
3644
else
3745
echo "Skipping; Clean \"destroot\" to rebuild".
3846
fi
@@ -41,7 +49,7 @@ function build_framework {
4149
# group the frameworks together to create a universal framework
4250
function build_universal_framework {
4351
if [ ! -d destroot/Library/Frameworks/universal/hermes.xcframework ]; then
44-
create_universal_framework "iphoneos" "iphonesimulator" "catalyst"
52+
create_universal_framework "iphoneos" "iphonesimulator" "catalyst" "xros" "xrsimulator"
4553
else
4654
echo "Skipping; Clean \"destroot\" to rebuild".
4755
fi
@@ -56,6 +64,8 @@ function create_framework {
5664
build_framework "iphoneos"
5765
build_framework "iphonesimulator"
5866
build_framework "catalyst"
67+
build_framework "xros"
68+
build_framework "xrsimulator"
5969

6070
build_universal_framework
6171
else

packages/react-native/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pushd destroot/Library/Frameworks > /dev/null || exit 1
1919

2020
echo '' > dummy.c
2121

22-
platforms=( "macosx" "ios" ) # Add other platforms here if needed
22+
platforms=( "macosx" "ios" "xros" ) # Add other platforms here if needed
2323

2424
for platform in "${platforms[@]}"
2525
do

0 commit comments

Comments
 (0)