forked from eclipse-lemminx/lemminx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GraalVM's `native-image` feature to generate a executable. Run `./mvnw package -Pnative -DskipTests` in order to generate an executable under `org.eclipse.lemminx/target`. Also includes two CI/CD strategies for the native image: * Jenkinsfile * Github Action Adopted from [PR 673](eclipse-lemminx#673) A part of eclipse-lemminx#314. Signed-off-by: Fred Bricon <[email protected]> Signed-off-by: David Thompson <[email protected]>
- Loading branch information
Showing
14 changed files
with
1,850 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
root = true | ||
|
||
[*.jenkins] | ||
indent_size = 2 | ||
indent_style = space | ||
|
||
[*.java] | ||
indent_style = tab | ||
indent_size = 4 | ||
|
||
[*] | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: native-image | ||
on: [push, pull_request] | ||
jobs: | ||
build-binary-unix: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [macos-latest, ubuntu-latest] | ||
include: | ||
- os: macos-latest | ||
label: 'darwin' | ||
- os: ubuntu-latest | ||
label: 'linux' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: DeLaGuardo/setup-graalvm@8bbfe44ef9c6f5c07e5af036a1bffd561c037d18 | ||
with: | ||
graalvm-version: '20.2.0.java8' | ||
- run: ./mvnw package -Dnative -DskipTests -Dcbi.jarsigner.skip=true | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: lemminx-${{ matrix.label }} | ||
path: org.eclipse.lemminx/target/lemminx-* | ||
if-no-files-found: error | ||
build-binary-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ilammy/[email protected] | ||
- uses: DeLaGuardo/setup-graalvm@8bbfe44ef9c6f5c07e5af036a1bffd561c037d18 | ||
with: | ||
graalvm-version: '20.2.0.java11' | ||
- run: Invoke-Expression -Command "$Env:JAVA_HOME/bin/gu install native-image" | ||
- run: .\mvnw.cmd package -Dnative -DskipTests -Dcbi.jarsigner.skip=true | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: lemminx-win32 | ||
path: org.eclipse.lemminx/target/lemminx-*.exe | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
pipeline { | ||
agent{ | ||
none | ||
} | ||
stages { | ||
stage("native-image") { | ||
parallel { | ||
stage("Linux native-image") { | ||
agent { | ||
docker "oracle/graalvm-ce:latest" | ||
} | ||
environment { | ||
MAVEN_HOME = "$WORKSPACE/.m2/" | ||
MAVEN_USER_HOME = "$MAVEN_HOME" | ||
} | ||
steps { | ||
sh "./mvnw package -Dnative -DskipTests" | ||
archiveArtifacts artifacts: 'org.eclipse.lemminx/target/lemminx-linux*', fingerprint: true | ||
sh "sha256sum org.eclipse.lemminx/target/lemminx-linux* > lemminx-linux-hash" | ||
archiveArtifacts artifacts: 'lemminx-linux-hash', fingerprint: false | ||
} | ||
} | ||
stage("Windows native-image") { | ||
agent { | ||
label "win10" | ||
} | ||
steps { | ||
powershell "Invoke-WebRequest https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.2.0/graalvm-ce-java11-windows-amd64-20.2.0.zip -OutFile graalvm-windows.zip" | ||
powershell "Expand-Archive graalvm-windows.zip" | ||
powershell ".\\graalvm-windows\\graalvm-ce-java11-20.2.0\\bin\\gu install native-image" | ||
bat "set JAVA_HOME=%WORKSPACE%\\graalvm-windows\\graalvm-ce-java11-20.2.0&& echo %JAVA_HOME% && \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat\" && .\\mvnw.cmd package -Dnative -DskipTests" | ||
archiveArtifacts artifacts: 'org.eclipse.lemminx/target/*.exe', fingerprint: true | ||
powershell "Get-FileHash org.eclipse.lemminx\\target\\*.exe | Select -ExpandProperty Hash > lemminx-windows-hash" | ||
archiveArtifacts artifacts: 'lemminx-windows-hash', fingerprint: false | ||
} | ||
} | ||
stage("macOS native-image") { | ||
agent { | ||
label "mac" | ||
} | ||
steps { | ||
sh "curl https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.2.0/graalvm-ce-java8-darwin-amd64-20.2.0.tar.gz --output graalvm-darwin.tar.gz" | ||
sh "tar -xzf graalvm-darwin.tar.gz" | ||
sh "./graalvm-darwin/graalvm-ce-java8-20.2.0/bin/gu install native-image" | ||
sh "JAVA_HOME=./graalvm-darwin/graalvm-ce-java8-20.2.0 ./mvnw package -Dnative -DskipTests" | ||
archiveArtifacts artifacts: 'org.eclipse.lemminx/target/lemminx-darwin*', fingerprint: true | ||
sh "sha256sum org.eclipse.lemminx/target/lemminx-darwin* > lemminx-darwin-hash" | ||
archiveArtifacts artifacts: 'lemminx-darwin-hash', fingerprint: false | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.