From eb0961105febd930812ea6753eca64df5ec23075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Wed, 8 Jun 2022 13:34:01 -0700 Subject: [PATCH] Hermes: Use pre-built Hermes runtime in iOS Template tests Differential Revision: D36989241 fbshipit-source-id: 5841a44d66e0461b53357fa9e645d4cc66303ad8 --- .circleci/config.yml | 17 +++++++++++++++-- scripts/react_native_pods.rb | 12 ++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d9aabf5c7e292..d9fafd447a25f9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -683,7 +683,16 @@ jobs: - run_yarn - attach_workspace: at: . - + - *attach_hermes_workspace + - run: + name: Set USE_HERMES=1 + command: echo "export USE_HERMES=1" >> $BASH_ENV + - run: + name: Set HERMES_ENGINE_TARBALL_PATH + command: echo "export HERMES_ENGINE_TARBALL_PATH=$HERMES_WS_DIR/hermes-runtime-darwin/hermes-runtime-darwin-$CIRCLE_TAG.tar.gz" >> $BASH_ENV + - run: + name: Set RCT_VERBOSE_POD_INSTALL=1 + command: echo "export RCT_VERBOSE_POD_INSTALL=1" >> $BASH_ENV - run: name: Create iOS template project command: | @@ -992,6 +1001,9 @@ jobs: 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 . + + 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/. - save_cache: key: *hermes_cache_key paths: @@ -1002,12 +1014,13 @@ jobs: - ~/react-native/hermes/build_macosx - ~/react-native/hermes/destroot - store_artifacts: - path: /tmp/hermes/output/ + path: /tmp/hermes/hermes-runtime-darwin/ - store_artifacts: path: /tmp/hermes/osx-bin/ - persist_to_workspace: root: /tmp/hermes/ paths: + - hermes-runtime-darwin - osx-bin build_hermesc_windows: diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 5040c90c03cf3f..e9f6f98e8bc7cb 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -83,6 +83,7 @@ def use_react_native! (options={}) pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec", :modular_headers => true if new_arch_enabled + puts_verbose("Using New Architecture.") app_path = options[:app_path] config_file_dir = options[:config_file_dir] use_react_native_codegen_discovery!({ @@ -101,11 +102,13 @@ def use_react_native! (options={}) pod 'React-Codegen', :path => $CODEGEN_OUTPUT_DIR, :modular_headers => true if fabric_enabled + puts_verbose("Fabric is enabled.") checkAndGenerateEmptyThirdPartyProvider!(prefix, new_arch_enabled, $CODEGEN_OUTPUT_DIR) setup_fabric!(prefix) end if hermes_enabled + puts_verbose("Hermes is enabled.") prepare_hermes = 'node scripts/hermes/prepare-hermes-for-build' react_native_dir = Pod::Config.instance.installation_root.join(prefix) prep_output, prep_status = Open3.capture2e(prepare_hermes, :chdir => react_native_dir) @@ -122,6 +125,7 @@ def use_react_native! (options={}) # Flipper doesn't currently compile for release https://github.com/facebook/react-native/issues/33764 # Setting the production flag to true when build for production make sure that we don't install Flipper in the app in the first place. if flipper_configuration.flipper_enabled && !production + puts_verbose("Flipper is enabled.") install_flipper_dependencies(prefix) use_flipper_pods(flipper_configuration.versions, :configurations => flipper_configuration.configurations) end @@ -148,6 +152,10 @@ def get_default_flags() flags[:hermes_enabled] = true end + if ENV['USE_HERMES'] == '1' + flags[:hermes_enabled] = true + end + return flags end @@ -654,3 +662,7 @@ def detect_changes_with_podfile(podfile) changes end end + +def puts_verbose(msg) + Pod::UI.puts(msg) if ENV['RCT_VERBOSE_POD_INSTALL'] +end