Skip to content

Commit 10fdf45

Browse files
committed
Use Native Build Tools
1 parent 982f76d commit 10fdf45

File tree

4 files changed

+67
-19
lines changed

4 files changed

+67
-19
lines changed

.github/workflows/native-image-wasm-javac.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ jobs:
4040
- name: Run 'native-image/wasm-javac'
4141
run: |
4242
cd native-image/wasm-javac
43-
./build-webpage.sh
44-
./run.sh
43+
mvn --no-transfer-progress -Pnative package
44+
mvn --no-transfer-progress -Pjavacweb package
45+
node target/javac.js HelloWorld.java
46+
java HelloWorld

native-image/wasm-javac/build-webpage.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

native-image/wasm-javac/pom.xml

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
53
<modelVersion>4.0.0</modelVersion>
64

75
<groupId>org.example</groupId>
@@ -16,6 +14,31 @@
1614
</properties>
1715

1816
<build>
17+
<pluginManagement>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.graalvm.buildtools</groupId>
21+
<artifactId>native-maven-plugin</artifactId>
22+
<version>0.10.6</version>
23+
<extensions>true</extensions>
24+
<executions>
25+
<execution>
26+
<id>build-native</id>
27+
<goals>
28+
<goal>compile-no-fork</goal>
29+
</goals>
30+
<phase>package</phase>
31+
</execution>
32+
</executions>
33+
<configuration>
34+
<buildArgs>
35+
<buildArg>--tool:svm-wasm</buildArg>
36+
<buildArg>-g</buildArg>
37+
</buildArgs>
38+
</configuration>
39+
</plugin>
40+
</plugins>
41+
</pluginManagement>
1942
<plugins>
2043
<plugin>
2144
<groupId>org.apache.maven.plugins</groupId>
@@ -29,7 +52,9 @@
2952
<configuration>
3053
<compilerArgs>
3154
<arg>-parameters</arg>
32-
<arg>--add-exports=jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED</arg>
55+
<arg>
56+
--add-exports=jdk.jdeps/com.sun.tools.javap=ALL-UNNAMED
57+
</arg>
3358
<arg>--add-modules=jdk.jdeps</arg>
3459
</compilerArgs>
3560
</configuration>
@@ -43,8 +68,41 @@
4368
<groupId>someGroupId</groupId>
4469
<version>1.0</version>
4570
<scope>system</scope>
46-
<systemPath>${java.home}/lib/svm/tools/svm-wasm/builder/svm-wasm-api.jar</systemPath>
71+
<systemPath>
72+
${java.home}/lib/svm/tools/svm-wasm/builder/svm-wasm-api.jar
73+
</systemPath>
4774
</dependency>
4875
</dependencies>
4976

77+
<profiles>
78+
<profile>
79+
<id>native</id>
80+
<build>
81+
<plugins>
82+
<plugin>
83+
<groupId>org.graalvm.buildtools</groupId>
84+
<artifactId>native-maven-plugin</artifactId>
85+
<configuration>
86+
<mainClass>com.example.JavacMain</mainClass>
87+
</configuration>
88+
</plugin>
89+
</plugins>
90+
</build>
91+
</profile>
92+
<profile>
93+
<id>javacweb</id>
94+
<build>
95+
<plugins>
96+
<plugin>
97+
<groupId>org.graalvm.buildtools</groupId>
98+
<artifactId>native-maven-plugin</artifactId>
99+
<configuration>
100+
<mainClass>com.example.WebMain</mainClass>
101+
<imageName>../web/javac</imageName>
102+
</configuration>
103+
</plugin>
104+
</plugins>
105+
</build>
106+
</profile>
107+
</profiles>
50108
</project>

native-image/wasm-javac/run.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)