diff --git a/README.md b/README.md index 7b2c284cdb0ad2..d6b0de3aeba78f 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,8 @@ This project is still at an early stage of development and is not ready for prod 1. Download latest Xcode beta [here](https://developer.apple.com/xcode/). 2. Install visionOS Simulator runtime. -3. Follow the same steps as for running iOS defined in [packages/rn-tester/README.md](./packages/rn-tester/README.md) +3. (Optional) Using Hermes - Install latest version of CMake (3.28) from `main` branch: +```sh +brew install cmake --HEAD +``` +4. Follow the same steps as for running iOS defined in [packages/rn-tester/README.md](./packages/rn-tester/README.md) diff --git a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec index bf57138877a973..b563b6102f6877 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec +++ b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec @@ -12,7 +12,8 @@ react_native_path = File.join(__dir__, "..", "..") package = JSON.parse(File.read(File.join(react_native_path, "package.json"))) version = package['version'] -source_type = hermes_source_type(version, react_native_path) +# Temporaily build from source until visionOS supports prebuilt binaries +source_type = HermesEngineSourceType::BUILD_FROM_GITHUB_MAIN # hermes_source_type(version, react_native_path) source = podspec_source(source_type, version, react_native_path) Pod::Spec.new do |spec| @@ -35,7 +36,7 @@ Pod::Spec.new do |spec| } spec.ios.vendored_frameworks = "destroot/Library/Frameworks/ios/hermes.framework" - spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/visionos/hermes.framework" + spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/xros/hermes.framework" spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework" if HermesEngineSourceType::isPrebuilt(source_type) then @@ -133,7 +134,7 @@ Pod::Spec.new do |spec| :name => '[RN] [2] Build Hermes', :input_files => ["#{hermesc_path}/ImportHermesc.cmake"], :output_files => [ - "${PODS_ROOT}/hermes-engine/build/iphonesimulator/API/hermes/hermes.framework/hermes" + "${PODS_ROOT}/hermes-engine/build/xrsimulator/API/hermes/hermes.framework/hermes", ], :script => <<-EOS . "${REACT_NATIVE_PATH}/scripts/xcode/with-environment.sh" diff --git a/packages/react-native/sdks/hermes-engine/hermes-utils.rb b/packages/react-native/sdks/hermes-engine/hermes-utils.rb index 8c2f4f6c665a83..e5684da73ece29 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-utils.rb +++ b/packages/react-native/sdks/hermes-engine/hermes-utils.rb @@ -6,7 +6,7 @@ require 'net/http' require 'rexml/document' -HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git" +HERMES_GITHUB_URL = "https://github.com/callstack/hermes-visionos.git" module HermesEngineSourceType LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball diff --git a/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh b/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh index 5bc340a1288460..1cdc84140cfa4e 100755 --- a/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh +++ b/packages/react-native/sdks/hermes-engine/utils/build-hermes-xcode.sh @@ -16,8 +16,14 @@ function get_platform_copy_destination { if [[ $1 == "macosx" ]]; then echo "macosx" return + elif [[ $1 == "xros" ]]; then + echo "xros" + return + elif [[ $1 == "xrsimulator" ]]; then + echo "xros" + return fi - + echo "ios" } diff --git a/packages/react-native/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh b/packages/react-native/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh index aa4482270ae983..4419de96bac7bc 100644 --- a/packages/react-native/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh +++ b/packages/react-native/sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh @@ -19,7 +19,7 @@ pushd destroot/Library/Frameworks > /dev/null || exit 1 echo '' > dummy.c -platforms=( "macosx" "ios" ) # Add other platforms here if needed +platforms=( "macosx" "ios" "xros" ) # Add other platforms here if needed for platform in "${platforms[@]}" do diff --git a/packages/rn-tester/Podfile b/packages/rn-tester/Podfile index 6b0cada920c055..a022f536a276b1 100644 --- a/packages/rn-tester/Podfile +++ b/packages/rn-tester/Podfile @@ -40,7 +40,7 @@ def pods(target_name, options = {}) # Hermes is now enabled by default. # The following line will only disable Hermes if the USE_HERMES envvar is SET to a value other than 1 (e.g. USE_HERMES=0). # TODO: Make hermes work - hermes_enabled = false # !ENV.has_key?('USE_HERMES') || ENV['USE_HERMES'] == '1' + hermes_enabled = !ENV.has_key?('USE_HERMES') || ENV['USE_HERMES'] == '1' puts "Configuring #{target_name} with Fabric #{fabric_enabled ? "enabled" : "disabled"}.#{hermes_enabled ? " Using Hermes engine." : ""}" use_react_native!( diff --git a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj index 5ac7883390f36f..edabc79ca0dc9c 100644 --- a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj +++ b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj @@ -378,6 +378,7 @@ 68CD48B71D2BCB2C007E06A9 /* Build JS Bundle */, 79E8BE2B119D4C5CCD2F04B3 /* [RN] Copy Hermes Framework */, 5625E703156DD564DE9175B0 /* [CP] Copy Pods Resources */, + FA9D5B1EDCCF1279A1157A2D /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -397,6 +398,7 @@ E7DB209C22B2BA84005AC45F /* Frameworks */, E7DB209D22B2BA84005AC45F /* Resources */, 01934C30687B8C926E4F59CD /* [CP] Copy Pods Resources */, + B3A406D440F7F60A503B9652 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -417,6 +419,7 @@ E7DB215022B2F332005AC45F /* Frameworks */, E7DB215122B2F332005AC45F /* Resources */, E446637427ECD101CAACE52B /* [CP] Copy Pods Resources */, + 9263EBF9AC248C00975C6F74 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -588,6 +591,23 @@ shellPath = /bin/sh; shellScript = ". ../react-native/sdks/hermes-engine/utils/copy-hermes-xcode.sh\n"; }; + 9263EBF9AC248C00975C6F74 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; ABDE2A52ACD1B95E14790B5E /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -610,6 +630,23 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + B3A406D440F7F60A503B9652 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; B7EB74515CDE78D98087DD53 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -649,6 +686,23 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; + FA9D5B1EDCCF1279A1157A2D /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -901,15 +955,17 @@ OTHER_LDFLAGS = ( "-ObjC", "-lc++", + "-Wl", + "-ld_classic", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../react-native"; - SDKROOT = iphoneos; - USE_HERMES = false; + SDKROOT = xros; WARNING_CFLAGS = ( "-Wextra", "-Wall", "-Wno-semicolon-before-method-body", ); + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Debug; }; @@ -995,16 +1051,18 @@ OTHER_LDFLAGS = ( "-ObjC", "-lc++", + "-Wl", + "-ld_classic", ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../react-native"; - SDKROOT = iphoneos; - USE_HERMES = false; + SDKROOT = xros; VALIDATE_PRODUCT = YES; WARNING_CFLAGS = ( "-Wextra", "-Wall", "-Wno-semicolon-before-method-body", ); + XROS_DEPLOYMENT_TARGET = 1.0; }; name = Release; };