Use PRODUCTION envvar directly in hermes-engine Pod to determine build type (#34776)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/34776 CocoaPods is not used when Hermes is built in Circle CI, so we cannot rely on the React Native CocoaPods scripts to be loaded. The get_hermes_build_type function is removed from the RN CocoaPods scripts and in its place, the ENV['PRODUCTION'] envvar is accessed directly. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D39778190 fbshipit-source-id: 12083b7b4533b4ad7bb7a08612883983a0583616
This commit is contained in:
Родитель
1d7080264e
Коммит
c557f25648
|
@ -22,7 +22,6 @@ class HermesTests < Test::Unit::TestCase
|
|||
Pod::Config.reset()
|
||||
Pod::UI.reset()
|
||||
podSpy_cleanUp()
|
||||
ENV['PRODUCTION'] = '0'
|
||||
end
|
||||
|
||||
# ============================= #
|
||||
|
@ -84,55 +83,4 @@ class HermesTests < Test::Unit::TestCase
|
|||
assert_equal($podInvocation["libevent"][:version], "~> 2.1.12")
|
||||
assert_equal($podInvocation["hermes-engine"][:podspec], "../../sdks/hermes/hermes-engine.podspec")
|
||||
end
|
||||
|
||||
# ========================= #
|
||||
# TEST - getHermesBuildType #
|
||||
# ========================= #
|
||||
def test_getHermesBuildType_whenNotInProduction
|
||||
# Arrange
|
||||
ENV['PRODUCTION'] = '0'
|
||||
|
||||
# Act
|
||||
build_type = get_hermes_build_type
|
||||
|
||||
# Assert
|
||||
assert_equal(build_type, :debug)
|
||||
end
|
||||
|
||||
def test_getHermesBuildType_whenInProduction
|
||||
# Arrange
|
||||
ENV['PRODUCTION'] = '1'
|
||||
|
||||
# Act
|
||||
build_type = get_hermes_build_type
|
||||
|
||||
# Assert
|
||||
assert_equal(build_type, :release)
|
||||
end
|
||||
|
||||
def test_getHermesBuildType_whenProductionIsNotSet
|
||||
# Arrange
|
||||
ENV.delete 'PRODUCTION'
|
||||
|
||||
# Act
|
||||
build_type = get_hermes_build_type
|
||||
|
||||
# Assert
|
||||
assert_equal(build_type, :debug)
|
||||
end
|
||||
|
||||
def test_getHermesBuildType_symbolsMatchStrings
|
||||
# Arrange
|
||||
ENV['PRODUCTION'] = '0'
|
||||
|
||||
# Act
|
||||
build_type = get_hermes_build_type
|
||||
|
||||
# Assert
|
||||
assert_equal(build_type, :debug)
|
||||
assert_equal(build_type.to_s, "debug")
|
||||
assert_equal(build_type.to_s.capitalize, "Debug")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -18,7 +18,3 @@ def install_hermes_if_enabled(hermes_enabled, react_native_path)
|
|||
pod 'libevent', '~> 2.1.12'
|
||||
pod 'hermes-engine', :podspec => "#{react_native_path}/sdks/hermes/hermes-engine.podspec"
|
||||
end
|
||||
|
||||
def get_hermes_build_type()
|
||||
return ENV['PRODUCTION'] == "1" ? :release : :debug
|
||||
end
|
||||
|
|
|
@ -7,6 +7,9 @@ require "json"
|
|||
|
||||
react_native_path = File.join(__dir__, "..", "..")
|
||||
|
||||
# Whether Hermes is built for Release or Debug is determined by the PRODUCTION envvar.
|
||||
build_type = ENV['PRODUCTION'] == "1" ? :release : :debug
|
||||
|
||||
# package.json
|
||||
package_file = File.join(react_native_path, "package.json")
|
||||
package = JSON.parse(File.read(package_file))
|
||||
|
@ -35,7 +38,7 @@ elsif File.exists?(hermestag_file) && isInCI
|
|||
source[:git] = git
|
||||
source[:tag] = hermestag
|
||||
else
|
||||
source[:http] = "https://github.com/facebook/react-native/releases/download/v#{version}/hermes-runtime-darwin-#{get_hermes_build_type.to_s}-v#{version}.tar.gz"
|
||||
source[:http] = "https://github.com/facebook/react-native/releases/download/v#{version}/hermes-runtime-darwin-#{build_type.to_s}-v#{version}.tar.gz"
|
||||
end
|
||||
|
||||
Pod::Spec.new do |spec|
|
||||
|
@ -49,7 +52,7 @@ Pod::Spec.new do |spec|
|
|||
spec.source = source
|
||||
spec.platforms = { :osx => "10.13", :ios => "12.4" }
|
||||
|
||||
spec.preserve_paths = ["destroot/bin/*"].concat(get_hermes_build_type == :debug ? ["**/*.{h,c,cpp}"] : [])
|
||||
spec.preserve_paths = ["destroot/bin/*"].concat(build_type == :debug ? ["**/*.{h,c,cpp}"] : [])
|
||||
spec.source_files = "destroot/include/**/*.h"
|
||||
spec.header_mappings_dir = "destroot/include"
|
||||
|
||||
|
@ -59,12 +62,12 @@ Pod::Spec.new do |spec|
|
|||
spec.xcconfig = {
|
||||
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
||||
"CLANG_CXX_LIBRARY" => "compiler-default",
|
||||
"GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=#{get_hermes_build_type == :debug ? "1" : "0"}"
|
||||
"GCC_PREPROCESSOR_DEFINITIONS" => "HERMES_ENABLE_DEBUGGER=#{build_type == :debug ? "1" : "0"}"
|
||||
}
|
||||
|
||||
if source[:git] then
|
||||
spec.prepare_command = <<-EOS
|
||||
BUILD_TYPE=#{get_hermes_build_type.to_s.capitalize}
|
||||
BUILD_TYPE=#{build_type.to_s.capitalize}
|
||||
|
||||
# Set HERMES_OVERRIDE_HERMESC_PATH if pre-built HermesC is available
|
||||
#{File.exist?(import_hermesc_file) ? "export HERMES_OVERRIDE_HERMESC_PATH=#{import_hermesc_file}" : ""}
|
||||
|
|
Загрузка…
Ссылка в новой задаче