Skip to content

Commit

Permalink
Clean up hermes-engine Pod
Browse files Browse the repository at this point in the history
Summary:
Aside from the log output, these changes do not change the behavior of the hermes-engine Pod.

Removed unused git branch checks.
Use react_native_path var to build filepaths.
Edit Hermes build from source log message to be consistent with other logs.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D39699165

fbshipit-source-id: 7e389eb5315fc5a2510b84eddac2f499a3e65157
  • Loading branch information
hramos authored and facebook-github-bot committed Sep 22, 2022
1 parent ce4aa93 commit 3046ce2
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions sdks/hermes-engine/hermes-engine.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@
# LICENSE file in the root directory of this source tree.

require "json"
require "open3"

# sdks/hermesc/osx-bin/ImportHermesc.cmake
import_hermesc_file=File.join(__dir__, "..", "hermesc", "osx-bin", "ImportHermesc.cmake")
module HermesHelper
BUILD_TYPE = :debug
# BUILD_TYPE = :release
end

react_native_path = File.join(__dir__, "..", "..")

# package.json
package_file = File.join(__dir__, "..", "..", "package.json")
package_file = File.join(react_native_path, "package.json")
package = JSON.parse(File.read(package_file))
version = package['version']

# sdks/.hermesversion
hermestag_file = File.join(react_native_path, "sdks", ".hermesversion")
isInCI = ENV['CI'] == true
hermestag_file = File.join(__dir__, "..", ".hermesversion")

# We need to check the current git branch/remote to verify if
# we're on a React Native release branch to actually build Hermes.
currentbranch, err = Open3.capture3("git rev-parse --abbrev-ref HEAD")
currentremote, err = Open3.capture3("git config --get remote.origin.url")
# sdks/hermesc/osx-bin/ImportHermesc.cmake
import_hermesc_file=File.join(react_native_path, "sdks", "hermesc", "osx-bin", "ImportHermesc.cmake")

source = {}
git = "https://github.com/facebook/hermes.git"
Expand All @@ -28,7 +31,7 @@ if ENV.has_key?('HERMES_ENGINE_TARBALL_PATH')
Pod::UI.puts '[Hermes] Using pre-built Hermes binaries from local path.' if Object.const_defined?("Pod::UI")
source[:http] = "file://#{ENV['HERMES_ENGINE_TARBALL_PATH']}"
elsif version == '1000.0.0'
Pod::UI.puts '[Hermes] Hermes needs to be compiled, installing hermes-engine may take a while...'.yellow if Object.const_defined?("Pod::UI")
Pod::UI.puts '[Hermes] Installing hermes-engine may take a while, building Hermes from source...'.yellow if Object.const_defined?("Pod::UI")
source[:git] = git
source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip
elsif File.exists?(hermestag_file) && isInCI
Expand All @@ -40,18 +43,13 @@ else
source[:http] = "https://github.com/facebook/react-native/releases/download/v#{version}/hermes-runtime-darwin-v#{version}.tar.gz"
end

module HermesHelper
BUILD_TYPE = :debug
# BUILD_TYPE = :release
end

Pod::Spec.new do |spec|
spec.name = "hermes-engine"
spec.version = version
spec.summary = "Hermes is a small and lightweight JavaScript engine optimized for running React Native."
spec.description = "Hermes is a JavaScript engine optimized for fast start-up of React Native apps. It features ahead-of-time static optimization and compact bytecode."
spec.homepage = "https://hermesengine.dev"
spec.license = package["license"]
spec.license = package['license']
spec.author = "Facebook"
spec.source = source
spec.platforms = { :osx => "10.13", :ios => "12.4" }
Expand Down

0 comments on commit 3046ce2

Please sign in to comment.