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 23 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_ROOT\bin\java" --version | Select-String -Pattern "GraalVM" | Take-OutputPart -Part 5,6
return $version
}

function Build-GraalVMTable {
$version = Get-GraalVMVersion
$envVariables = "GRAALVM_11_ROOT"

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
21 changes: 21 additions & 0 deletions images/linux/scripts/installers/graalvm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -e

source $HELPER_SCRIPTS/install.sh
source $HELPER_SCRIPTS/etc-environment.sh

# Install GraalVM
GRAALVM_ROOT=/usr/local/graalvm
export GRAALVM_11_ROOT=$GRAALVM_ROOT/graalvm-ce-java11*

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_ROOT " $GRAALVM_11_ROOT
nikita-bykov marked this conversation as resolved.
Show resolved Hide resolved

# Install Native Image
$GRAALVM_11_ROOT/bin/gu install native-image

invoke_tests "Tools" "GraalVM"
12 changes: 11 additions & 1 deletion images/linux/scripts/tests/Tools.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@ Describe "Phantomjs" {
}
}

Describe "GraalVM" -Skip:(-not (Test-IsUbuntu20)) {
It "graalvm" {
'$GRAALVM_11_ROOT/bin/java -version' | Should -ReturnZeroExitCode
}

It "native-image" {
'$GRAALVM_11_ROOT/bin/native-image --version' | Should -ReturnZeroExitCode
}
}

Describe "Containers" -Skip:(Test-IsUbuntu16) {
$testCases = @("podman", "buildah", "skopeo") | ForEach-Object { @{ContainerCommand = $_} }

Expand Down Expand Up @@ -339,4 +349,4 @@ Describe "Python" {

"$PythonCommand --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 @@ -230,7 +230,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