Skip to content

Commit

Permalink
Derive javaVersion from downloadUrl.
Browse files Browse the repository at this point in the history
This ensures that `latest-ea` and `22-ea` can be cached based on the actual version number (e.g., `22.0.0`).
  • Loading branch information
fniephaus committed Feb 22, 2024
1 parent 1065053 commit 4a6d7d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 7 additions & 1 deletion dist/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/graalvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@ export async function setUpGraalVMJDK(
if (javaVersionOrDev === c.VERSION_DEV) {
return setUpGraalVMJDKDevBuild()
}
const javaVersion = javaVersionOrDev
let javaVersion = javaVersionOrDev
const toolName = determineToolName(javaVersion, false)
let downloadName = toolName
let downloadUrl: string
if (javaVersion.endsWith('-ea')) {
downloadUrl = await findLatestEABuildDownloadUrl(javaVersion)
const filename = basename(downloadUrl)
const resolvedVersion = semver.valid(semver.coerce(filename))
if (!resolvedVersion) {
throw new Error(
`Unable to determine resolved version based on '${filename}'. ${c.ERROR_REQUEST}`
)
}
javaVersion = resolvedVersion
} else if (javaVersion.includes('.')) {
if (semver.valid(javaVersion)) {
const majorJavaVersion = semver.major(javaVersion)
Expand Down

0 comments on commit 4a6d7d1

Please sign in to comment.