Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GraalVM Community Edition & GraalVM Native Image #2330

Merged
merged 25 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions images/linux/scripts/SoftwareReport/SoftwareReport.Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -284,3 +284,18 @@ function Get-PipxVersion {
$pipxVersion = $Matches.Version
return "Pipx $pipxVersion"
}

function Get-GraalVMVersion {
$version = & "$env:GRAALVM_11_BIN\java" --version | Select-String -Pattern "GraalVM" | Take-OutputPart -Part 5
return $version
}

function Build-GraalVMTable {
$version = Get-GraalVMVersion
$envVariables = "`GRAALVM_11_BIN=$env:GRAALVM_11_BIN` <br> `JAVA_HOME_GRAALVM_11=$env:JAVA_HOME_GRAALVM_11` "
nikita-bykov marked this conversation as resolved.
Show resolved Hide resolved

return [PSCustomObject] @{
"Version" = $version
"Environment variables" = $envVariables
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ $markdown += New-MDHeader "Java" -Level 3
$markdown += Get-JavaVersions | New-MDTable
$markdown += New-MDNewLine

if (Test-IsUbuntu20) {
$markdown += New-MDHeader "GraalVM" -Level 3
$markdown += Build-GraalVMTable | New-MDTable
$markdown += New-MDNewLine
}

$markdown += New-MDHeader "PHP" -Level 3
$markdown += Build-PHPTable | New-MDTable
$markdown += New-MDNewLine
Expand Down
20 changes: 20 additions & 0 deletions images/linux/scripts/installers/graalvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash -e

source $HELPER_SCRIPTS/install.sh

# Install GraalVM
GRAALVM_ROOT=/usr/local/graalvm
export JAVA_HOME_GRAALVM_11=$GRAALVM_ROOT/graalvm-ce-java11*
export GRAALVM_11_BIN=$GRAALVM_ROOT/graalvm-ce-java11*/bin
nikita-bykov marked this conversation as resolved.
Show resolved Hide resolved

url=$(curl -s https://api.github.com/repos/graalvm/graalvm-ce-builds/releases/latest | jq -r '.assets[].browser_download_url | select(contains("graalvm-ce-java11-linux-amd64"))')
download_with_retries "$url" "/tmp" "graalvm-archive.tar.gz"
mkdir $GRAALVM_ROOT
tar -xzf "/tmp/graalvm-archive.tar.gz" -C $GRAALVM_ROOT

# Set two variables as described here: https://www.graalvm.org/docs/getting-started/linux/
nikita-bykov marked this conversation as resolved.
Show resolved Hide resolved
setEtcEnvironmentVariable "GRAALVM_11_BIN" $GRAALVM_11_BIN
setEtcEnvironmentVariable "JAVA_HOME_GRAALVM_11" $JAVA_HOME_GRAALVM_11

# Install Native Image
$GRAALVM_11_BIN/gu install native-image
nikita-bykov marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions images/linux/scripts/tests/Tools.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -344,3 +344,13 @@ Describe "Haveged" {
"systemctl status haveged | grep 'active (running)'" | Should -ReturnZeroExitCode
}
}

Describe "GraalVM" {
nikita-bykov marked this conversation as resolved.
Show resolved Hide resolved
It "graalvm" {
"& "$env:GRAALVM_11_BIN\java" --version" | Should -ReturnZeroExitCode
}

It "native-image" {
"& "$env:GRAALVM_11_BIN\native-image" --version" | Should -ReturnZeroExitCode
}
}
3 changes: 2 additions & 1 deletion images/linux/ubuntu2004.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@
"{{template_dir}}/scripts/installers/netlify.sh",
"{{template_dir}}/scripts/installers/android.sh",
"{{template_dir}}/scripts/installers/pypy.sh",
"{{template_dir}}/scripts/installers/python.sh"
"{{template_dir}}/scripts/installers/python.sh",
"{{template_dir}}/scripts/installers/graalvm.sh"
],
"environment_vars": [
"HELPER_SCRIPTS={{user `helper_script_folder`}}",
Expand Down