Skip to content

Commit

Permalink
Rename BUILD_FROM_SOURCE to RCT_BUILD_HERMES_FROM_SOURCE
Browse files Browse the repository at this point in the history
Summary:
In OSS we have reports like [this one](#43241) where env variables from different settings might clash together, making react native apps fail to build hermes.

For example, a team might have defined a BUILD_FROM_SOURCE env variable to build their specific project from source and that will clash with how react native apps installs Hermes.

This change disambiguate the BUILD_FROM_SOURCE flag we have internally, moving to a less likely to clash RCT_BUILD_HERMES_FROM_SOURCE.

## Changelog:
[iOS][Breaking] - Rename BUILD_FROM_SOURCE to RCT_BUILD_HERMES_FROM_SOURCE

Reviewed By: huntie

Differential Revision: D54356337

fbshipit-source-id: 1115e3c22cbcf1d64b7edae30da614d52423123b
  • Loading branch information
cipolleschi authored and facebook-github-bot committed Feb 29, 2024
1 parent 6204ea3 commit 6a1509f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .circleci/configurations/executors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ executors:
xcode: *xcode_version
resource_class: macos.x86.medium.gen2
environment:
- BUILD_FROM_SOURCE: true
- RCT_BUILD_HERMES_FROM_SOURCE: true
reactnativeios-lts:
<<: *defaults
macos:
xcode: '14.3.1'
resource_class: macos.x86.medium.gen2
environment:
- BUILD_FROM_SOURCE: true
- RCT_BUILD_HERMES_FROM_SOURCE: true
2 changes: 1 addition & 1 deletion .circleci/configurations/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ jobs:
environment:
- HERMES_WS_DIR: *hermes_workspace_root
- HERMES_VERSION_FILE: "packages/react-native/sdks/.hermesversion"
- BUILD_FROM_SOURCE: true
- RCT_BUILD_HERMES_FROM_SOURCE: true
steps:
- run:
name: Install dependencies
Expand Down
7 changes: 4 additions & 3 deletions packages/react-native/sdks/hermes-engine/hermes-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require 'rexml/document'

HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"

module HermesEngineSourceType
LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
Expand All @@ -30,7 +31,7 @@ def HermesEngineSourceType.isFromSource(source_type)
# - To use a specific tarball, install the dependencies with:
# `HERMES_ENGINE_TARBALL_PATH=<path_to_tarball> bundle exec pod install`
# - To force a build from source, install the dependencies with:
# `BUILD_FROM_SOURCE=true bundle exec pod install`
# `RCT_BUILD_HERMES_FROM_SOURCE=true bundle exec pod install`
# If none of the two are provided, Cocoapods will check whether there is a tarball for the current version
# (either release or nightly). If not, it will fall back to building from source (the latest commit on main).
#
Expand Down Expand Up @@ -85,11 +86,11 @@ def hermes_commit_envvar_defined()
end

def force_build_from_tag(react_native_path)
return ENV['BUILD_FROM_SOURCE'] === 'true' && File.exist?(hermestag_file(react_native_path))
return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && File.exist?(hermestag_file(react_native_path))
end

def force_build_from_main(react_native_path)
return ENV['BUILD_FROM_SOURCE'] === 'true' && !File.exist?(hermestag_file(react_native_path))
return ENV[ENV_BUILD_FROM_SOURCE] === 'true' && !File.exist?(hermestag_file(react_native_path))
end

def release_artifact_exists(version)
Expand Down

0 comments on commit 6a1509f

Please sign in to comment.