Skip to content

Commit 2d51ce9

Browse files
jirkamarsikfniephaus
authored andcommitted
Add missing steps to GraalWasm Rust embedding guide
1 parent b6265d4 commit 2d51ce9

File tree

1 file changed

+32
-3
lines changed
  • graalwasm/graalwasm-embed-rust-code-guide

1 file changed

+32
-3
lines changed

graalwasm/graalwasm-embed-rust-code-guide/README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ Add the following set of dependencies to the `<dependencies>` section of your pr
4747
<!-- </dependencies> -->
4848
```
4949

50+
Be sure to add a `graal.languages.version` property with the version of GraalWasm you would like to use:
51+
52+
```xml
53+
<properties>
54+
<graal.languages.version>24.2.2</graal.languages.version>
55+
<!-- more properties -->
56+
</properties>
57+
```
58+
5059
## 2. Set Up Rust Code
5160

5261
Next, create a Rust project, write Rust code, and compile it into a WebAssembly module.
@@ -205,11 +214,31 @@ public class App {
205214

206215
## 4. Build and Test the Application
207216

217+
If you want to run the application using the `exec-maven-plugin`, add the following as a default configuration:
218+
219+
```xml
220+
<plugin>
221+
<groupId>org.codehaus.mojo</groupId>
222+
<artifactId>exec-maven-plugin</artifactId>
223+
<configuration>
224+
<executable>java</executable>
225+
<arguments>
226+
<argument>-classpath</argument>
227+
<classpath/>
228+
<argument>--enable-native-access=ALL-UNNAMED</argument>
229+
<argument>--sun-misc-unsafe-memory-access=allow</argument>
230+
<argument>com.example.App</argument>
231+
</arguments>
232+
</configuration>
233+
<!-- Execution for build-rust (see 2.3.) -->
234+
</plugin>
235+
```
236+
208237
Compile and run the Java application with Maven:
209238

210239
```shell
211-
./mvnw package
212-
./mvnw exec:exec
240+
mvn package
241+
mvn exec:exec
213242
```
214243

215244
The expected output should look like this:
@@ -259,7 +288,7 @@ Afterward, add a new profile using the `native-maven-plugin` to your _pom.xml_:
259288
To build the native executable, run:
260289

261290
```bash
262-
./mvnw -Pnative package
291+
mvn -Pnative package
263292
```
264293

265294
Finally, you can run the native executable:

0 commit comments

Comments
 (0)