Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ end
# package.json
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
# [macOS
rn_version = package['version']
version = findLatestVersionWithArtifact(rn_version) || rn_version
version = findLatestVersionWithArtifact(package) || package['version']
# macOS]

source_type = hermes_source_type(version, react_native_path)
Expand Down
12 changes: 4 additions & 8 deletions packages/react-native/sdks/hermes-engine/hermes-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,14 @@ def resolve_url_redirects(url)

# [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 findLatestVersionWithArtifact(version)
if version == "1000.0.0"
def findLatestVersionWithArtifact(package)
if package['version'] == "1000.0.0"
# The main branch builds from source, so skip the artifact check
return nil
end

# See https://central.sonatype.org/search/rest-api-guide/ for details on query params
versionWithoutPatch = "#{version.match(/^(\d+\.\d+)/)}"
res, = Open3.capture3("curl -s https://search.maven.org/solrsearch/select?q=g:com.facebook.react+AND+a:react-native-artifacts+AND+v:#{versionWithoutPatch}.*&core=gav&rows=1&wt=json")
wt = JSON.parse(res)
response = wt['response']
return response['docs'][0]['v'] unless response['numFound'] == 0
# This assumes that whatever peer dependency we specify has an artifact
return package['peerDependencies']['react-native']
end
# macOS]

Expand Down
Loading