diff --git a/.circleci/config.yml b/.circleci/config.yml index 2cc6315c5fc3ee..78d6bd5eccb036 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -252,6 +252,9 @@ commands: set_tarball_path: type: boolean default: False + flavor: + type: string + default: "Debug" steps: - restore_cache: keys: @@ -260,15 +263,21 @@ commands: condition: << parameters.set_tarball_path >> steps: - run: - name: Set HERMES_TARBALL_PATH if present + name: Set HERMES_ENGINE_TARBALL_PATH if present command: | BASE_PATH=/tmp/hermes/hermes-runtime-darwin/ if [ ! -d $BASE_PATH ]; then echo "Hermes tarball base path not present ($BASE_PATH). Build it from source." exit 0 fi - TARBALL=$(ls /tmp/hermes/hermes-runtime-darwin/) - TARBALL_PATH=$BASE_PATH$TARBALL + if [[ << parameters.flavor >> == "Release" ]]; then + TARBALL_FILENAME=hermes-runtime-darwin-release-*.tar.gz + else + TARBALL_FILENAME=hermes-runtime-darwin-debug-*.tar.gz + fi + # /tmp/hermes/hermes-runtime-darwin/hermes-runtime-darwin-debug-v0.70.0.tar.gz + # /tmp/hermes/hermes-runtime-darwin/hermes-runtime-darwin-release-v0.70.0.tar.gz + TARBALL_PATH=$(ls $BASE_PATH$TARBALL_FILENAME) if [ ! -f $TARBALL_PATH ]; then echo "Hermes tarball not present ($TARBALL_PATH). Build it from source." exit 0 @@ -1042,6 +1051,10 @@ jobs: - linux64-bin build_hermes_macos: + parameters: + flavor: + type: string + default: "Release" executor: reactnativeios environment: - HERMES_WS_DIR: *hermes_workspace_root @@ -1061,7 +1074,12 @@ jobs: command: | brew install cmake - with_hermes_tarball_cache_span: + flavor: << parameters.flavor >> steps: + - run: + name: Configure Environment Variables + command: | + export BUILD_TYPE="<< parameters.flavor >>" - run: name: Build the Hermes iOS frameworks command: | @@ -1084,10 +1102,20 @@ jobs: cp -R ./destroot /tmp/cocoapods-package-root cp LICENSE /tmp/cocoapods-package-root - tar -C /tmp/cocoapods-package-root/ -czvf /tmp/hermes/output/hermes-runtime-darwin-v$(get_release_version).tar.gz . + if [[ $BUILD_TYPE == "Release" ]]; then + TARBALL_FILENAME=hermes-runtime-darwin-release-v$(get_release_version).tar.gz + else + TARBALL_FILENAME=hermes-runtime-darwin-debug-v$(get_release_version).tar.gz + fi + tar -C /tmp/cocoapods-package-root/ -czvf /tmp/hermes/output/$TARBALL_FILENAME . mkdir -p /tmp/hermes/hermes-runtime-darwin - cp /tmp/hermes/output/hermes-runtime-darwin-v$(get_release_version).tar.gz /tmp/hermes/hermes-runtime-darwin/. + cp /tmp/hermes/output/$TARBALL_FILENAME /tmp/hermes/hermes-runtime-darwin/. + + # TODO: Remove this once the client side is aware of -release and -debug tarballs + if [[ $BUILD_TYPE == "Release" ]]; then + cp /tmp/hermes/hermes-runtime-darwin/hermes-runtime-darwin-release-v$(get_release_version).tar.gz /tmp/hermes/hermes-runtime-darwin/hermes-runtime-darwin-v$(get_release_version).tar.gz + fi - save_cache: key: *hermes_cache_key paths: @@ -1435,6 +1463,9 @@ workflows: filters: *only_release_tags requires: - prepare_hermes_workspace + matrix: + parameters: + flavor: ["Debug", "Release"] - build_hermesc_windows: filters: *only_release_tags requires: diff --git a/sdks/hermes-engine/hermes-engine.podspec b/sdks/hermes-engine/hermes-engine.podspec index 430ab9e7639a6c..82d670c557b9c1 100644 --- a/sdks/hermes-engine/hermes-engine.podspec +++ b/sdks/hermes-engine/hermes-engine.podspec @@ -67,9 +67,7 @@ Pod::Spec.new do |spec| if source[:git] then spec.prepare_command = <<-EOS - # When true, debug build will be used. - # See `build-apple-framework.sh` for details - DEBUG=#{HermesHelper::BUILD_TYPE == :debug} + BUILD_TYPE=#{HermesHelper::BUILD_TYPE == :release ? "Release" : "Debug"} # Set HERMES_OVERRIDE_HERMESC_PATH if pre-built HermesC is available #{File.exist?(import_hermesc_file) ? "export HERMES_OVERRIDE_HERMESC_PATH=#{import_hermesc_file}" : ""} diff --git a/sdks/hermes-engine/utils/build-apple-framework.sh b/sdks/hermes-engine/utils/build-apple-framework.sh index f1f1e421023e12..af853d3370a600 100755 --- a/sdks/hermes-engine/utils/build-apple-framework.sh +++ b/sdks/hermes-engine/utils/build-apple-framework.sh @@ -4,12 +4,6 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -if [ "$DEBUG" = true ]; then - BUILD_TYPE="Debug" -else - BUILD_TYPE="Release" -fi - NUM_CORES=$(sysctl -n hw.ncpu) IMPORT_HERMESC_PATH=${HERMES_OVERRIDE_HERMESC_PATH:-$PWD/build_host_hermesc/ImportHermesc.cmake} REACT_NATIVE_PATH=${REACT_NATIVE_PATH:-$PWD/../..} @@ -35,7 +29,7 @@ function build_host_hermesc { # Utility function to configure an Apple framework function configure_apple_framework { - local build_cli_tools enable_bitcode + local build_cli_tools enable_bitcode enable_debugger if [[ $1 == iphoneos || $1 == catalyst ]]; then enable_bitcode="true" @@ -47,12 +41,17 @@ function configure_apple_framework { else build_cli_tools="false" fi + if [[ $BUILD_TYPE == "Debug" ]]; then + enable_debugger="true" + else + enable_debugger="false" + fi cmake -S . -B "build_$1" \ -DHERMES_APPLE_TARGET_PLATFORM:STRING="$1" \ -DCMAKE_OSX_ARCHITECTURES:STRING="$2" \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING="$3" \ - -DHERMES_ENABLE_DEBUGGER:BOOLEAN=true \ + -DHERMES_ENABLE_DEBUGGER:BOOLEAN="$enable_debugger" \ -DHERMES_ENABLE_INTL:BOOLEAN=true \ -DHERMES_ENABLE_LIBFUZZER:BOOLEAN=false \ -DHERMES_ENABLE_FUZZILLI:BOOLEAN=false \