Skip to content

Commit

Permalink
Check if it works in GitHub Actions
Browse files Browse the repository at this point in the history
Signed-off-by: David Thompson <[email protected]>
  • Loading branch information
datho7561 committed Dec 10, 2020
1 parent ca8baeb commit ea4deed
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 63 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/native-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: DeLaGuardo/setup-graalvm@8bbfe44ef9c6f5c07e5af036a1bffd561c037d18
with:
graalvm-version: '20.2.0.java8'
- run: ./mvnw package -Dnative -DskipTests -Dcbi.jarsigner.skip=true
- run: ./mvnw package -Dnative -DskipTests $([ $(uname -s) = Linux ] && echo "-Dgraalvm.static=--static") -Dcbi.jarsigner.skip=true
- run: mv org.eclipse.lemminx/target/lemminx-* lemminx-$(git rev-parse --short "$GITHUB_SHA")-${{ matrix.label }}
- uses: actions/upload-artifact@v2
with:
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,28 @@ To generate a native binary:
- [Install GraalVM 20.2.0](https://www.graalvm.org/docs/getting-started/#install-graalvm)
- In a terminal, run `gu install native-image`
- Execute a Maven build that sets the flag `native`: `./mvnw clean package -Dnative -DskipTests`
- On Linux, compile with `./mvnw clean package -Dnative -DskipTests -Dgraalvm.static=--static`
in order to support distributions that don't use `glibc`, such as Alpine Linux
- It will generate a native binary in `org.eclipse.lemminx/target/lemminx-{os.name}-{architecture}-{version}`

OS specific instructions:
- __Linux__:
- Make sure that you have installed the static versions of the C++ standard library
- Make sure that you have installed the static versions of the C++ standard library
- For instance, on Fedora Linux, install `glibc-static`, `libstdc++-static`, and `zlib-static`
- __Windows__:
- When installing native-image, please note that `gu` is an existing alias in PowerShell.
Remove the alias with `Remote-Item alias:gu -Force`, refer to `gu` with the absolute path, or use `gu` under `cmd.exe`.
- Make sure to run the Maven wrapper in the "Native Tools Command Prompt".
This command prompt can be obtained through installing the Windows SDK or Visual Studio, as
mentioned in the [GraalVM installation instructions](https://www.graalvm.org/docs/getting-started-with-graalvm/windows/).
- When installing native-image, please note that `gu` is an existing alias in PowerShell.
Remove the alias with `Remote-Item alias:gu -Force`, refer to `gu` with the absolute path, or use `gu` under `cmd.exe`.
- Make sure to run the Maven wrapper in the "Native Tools Command Prompt".
This command prompt can be obtained through installing the Windows SDK or Visual Studio, as
mentioned in the [GraalVM installation instructions](https://www.graalvm.org/docs/getting-started-with-graalvm/windows/).

`native-image` Development Instructions:
- Reflection:
- If you need to use reflection to access a private field/method, simply register the field/methods that you access in `reflect-config.json`
- If you need to parse some JSON using Gson, make sure to register the fields and methods of the class that you are parsing into in `reflect-config.json`
- Recursively, for all classes that it has, including `enum`s
- Settings are all deserialized, so whenever a setting is added, this must be done and tested
- Manually test the binary and check the logs for reflection errors/NPEs
- If you need to use reflection to access a private field/method, simply register the field/methods that you access in `reflect-config.json`
- If you need to parse some JSON using Gson, make sure to register the fields and methods of the class that you are parsing into in `reflect-config.json`
- This needs to be done recursively, for all classes that it has member variables of, including `enum`s
- Settings are all deserialized, so whenever a setting is added, make sure to register the classes
- Manually test the binary and check the logs for reflection errors/NPEs

Maven coordinates:
------------------
Expand Down
53 changes: 2 additions & 51 deletions org.eclipse.lemminx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<dev.build.timestamp>${maven.build.timestamp}</dev.build.timestamp>
<cbi.jarsigner.skip>true</cbi.jarsigner.skip>
<graalvm.version>20.2.0</graalvm.version>
<graalvm.static></graalvm.static>
</properties>
<build>
<resources>
Expand Down Expand Up @@ -168,57 +169,7 @@
<buildArgs>
--no-fallback
-H:EnableURLProtocols=https,http
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>staticNative</id>
<activation>
<property>
<name>native</name>
<value>true</value>
</property>
<os>
<name>Linux</name>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.6.1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>${graalvm.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<skip>false</skip>
<imageName>lemminx-${os.detected.classifier}-${project.version}</imageName>
<buildArgs>
--no-fallback
--static
-H:EnableURLProtocols=https,http
${graalvm.static}
</buildArgs>
</configuration>
</plugin>
Expand Down

0 comments on commit ea4deed

Please sign in to comment.