Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldonadel committed Jan 14, 2024
1 parent 5020675 commit cd495fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ react_native_path = File.join(__dir__, "..", "..")

# package.json
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
# [macOS
rn_version = package['version']
version = findLastestVersionWithArtifact(rn_version) || rn_version
# macOS]

source_type = hermes_source_type(version, react_native_path)
source = podspec_source(source_type, version, react_native_path)
Expand Down
8 changes: 4 additions & 4 deletions packages/react-native/sdks/hermes-engine/hermes-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
require 'open3'

HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
REACT_NATIVE_ARTIFACTS_MAVEN_URL = "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts"

module HermesEngineSourceType
LOCAL_PREBUILT_TARBALL = :local_prebuilt_tarball
Expand Down Expand Up @@ -205,7 +204,7 @@ def hermestag_file(react_native_path)
def release_tarball_url(version, build_type)
# Sample url from Maven:
# https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.71.0/react-native-artifacts-0.71.0-hermes-ios-debug.tar.gz
return "#{REACT_NATIVE_ARTIFACTS_MAVEN_URL}/#{version}/react-native-artifacts-#{version}-hermes-ios-#{build_type.to_s}.tar.gz"
return "https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/#{version}/react-native-artifacts-#{version}-hermes-ios-#{build_type.to_s}.tar.gz"
end

def download_stable_hermes(react_native_path, version, configuration)
Expand Down Expand Up @@ -235,11 +234,11 @@ def resolve_url_redirects(url)
return (`curl -Ls -o /dev/null -w %{url_effective} \"#{url}\"`)
end

# react-native-macos does not publish macos specific hermes artifacts
# [macOS react-native-macos does not publish macos specific hermes artifacts
# so we attempt to find the latest patch version of the iOS artifacts and use that
def findLastestVersionWithArtifact(version)
versionWithoutPatch = version.match(/^(\d+\.\d+)/)
xml_data, = Open3.capture3("curl -s #{REACT_NATIVE_ARTIFACTS_MAVEN_URL}/maven-metadata.xml")
xml_data, = Open3.capture3("curl -s https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/maven-metadata.xml")

metadata = REXML::Document.new(xml_data)
versions = metadata.elements.to_a('//metadata/versioning/versions/version')
Expand All @@ -255,6 +254,7 @@ def findLastestVersionWithArtifact(version)

return sorted_versions.last
end
# macOS]

# This function checks that Hermes artifact exists.
# As of now it should check it on the Maven repo.
Expand Down

0 comments on commit cd495fc

Please sign in to comment.