palantir / gradle-graal

A plugin for Gradle that adds tasks to download, extract and interact with GraalVM tooling.
Apache License 2.0
228 stars 27 forks source link

DownloadGraalTask generates incorrect download url causing FileNotFoundException #337

Open mingfai opened 4 years ago

mingfai commented 4 years ago

it seems the graalvm binary file naming and url are changed. when I configure the project with the following configuration:

graal {
    graalVersion '20.0.0'
    downloadBaseUrl 'https://github.com/graalvm/graalvm-ce-builds/releases/download'
}

on mac, it generates the following url: https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.0.0/graalvm-ce-darwin-amd64-20.0.0.tar.gz

the correct url is: https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.0.0/graalvm-ce-java11-darwin-amd64-20.0.0.tar.gz

so, there is "-java11" tag in the file name. I checked DownloadGraalTask.java, the FILENAME_PATTERN should need one more variable to determine java8 or java11.

mingfai commented 4 years ago

well, same issue as #239 and there is PR already #255

javapapo commented 4 years ago

+1 on the above.

matwjones commented 4 years ago

A minor (albeit, hacky) workaround for this is to manually download graal, move it into the correct directory and rename the files, so when running the nativeImage task, it finds the correct version.

(I'm runnig on a Mac, so the windows instructions will be slightly different)

  1. Download the .tar.gz file from the new graal repository (found on their github page).

    • For me it was graalvm-ce-java11-darwin-amd64-19.3.2.tar.gz
  2. Either: a) Install per the instructions documented in order to run gu install native-image b) cd & run gu to install directly by:

    cd graalvm-ce-java11-19.3.2/Contents/Home/bin/
    ./gu install native-image

    (For newer macbooks / OS, you may get a security restriction which will prevent gu from running, in this case run xattr -d com.apple.quarantine/graalvm-ce-java11-19.3.2`, then try again)

  3. Copy the folder & the .tar.gz to the correct directory & rename it to the pattern the download task looks for

    
    mkdir ~/.gradle/caches/com.palantir.graal/19.3.2/
    cp -r /Library/Java/JavaVirtualMachines/graalvm-ce-java11-19.3.2 ~/.gradle/caches/com.palantir.graal/19.3.2/graalvm-ce-19.3.2

cp ~/Downloads/graalvm-ce-java11-darwin-amd64-19.3.2.tar.gz ~/.gradle/caches/com.palantir.graal/19.3.2/graalvm-ce-19.3.2-amd64.tar.gz

(note the name change during the copy)

4. Update the plugin config to use the new version

graal { graalVersion "19.3.2" mainClass "..." outputName "..." }



Unfortunately, you have to use `gu` to install `nativ-image` before performing the copy, so the `native-image` script exists in the `Contents/Home/bin/` directory.

What you're doing is pretty much mocking what the download & extract tasks do.
This isnt a long term solution by any means, but should help until the next release.
saboya commented 4 years ago

Should be fixed by #255?

phreed commented 3 years ago

The following configuration works for me.

graal {
    graalVersion("21.1.0")
    downloadBaseUrl("https://github.com/graalvm/graalvm-ce-builds/releases/download")
    javaVersion("11")
// resulting in "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.1.0/graalvm-ce-java11-windows-amd64-21.1.0.zip

    windowsVsVersion("2019")
    windowsVsEdition("Community")
//    windowsVsVarsPath("%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat")
}

The default downloadBaseUrl("https://github.com/oracle/graal/releases/download") does not exist. There is a https://github.com/oracle/graal/releases/tags but no download.