Skip to content

Commit

Permalink
Resolved review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
tzezula committed Jun 19, 2024
1 parent 0f5eb4b commit 947dd03
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 21 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ https://www.graalvm.org/latest/reference-manual/embed-languages/

Download Maven or import as Maven project into your IDE.

* `mvn package` build using javac
* `mvn package` build using `javac`. Starting from GraalVM Polyglot API version 24.1.0, you can use `mvn -Pisolated package` to build with the native isolate version of a guest language. By default, only the native isolate library for the current platform is installed. To install native isolate libraries for all supported platforms, use `mvn -Pisolated -Disolated.all.platforms package`.
* `mvn test` to run the tests
* `mvn exec:exec` to run the Main application
* `mvn exec:exec` to run the application. Starting from GraalVM Polyglot API version 24.1.0, you can use `mvn -Pisolated exec:exec` to embed the native isolate version of a guest language.
* `mvn -Pnative package` to build a native-image
* `mvn -Passembly package` to build an uber JAR containing all dependencies using the Maven Assembly Plugin. The resulting JAR can be executed using `java -jar embedding-1.0-SNAPSHOT-jar-with-dependencies.jar`. We do recommend not using shading whenever possible.
* `mvn -Pshade package` to build an uber JAR containing all dependencies using the Maven Shade Plugin. The resulting JAR can be executed using `java -jar embedding-1.0-SNAPSHOT.jar`. We do recommend not using shading whenever possible.
* `mvn -Pisolated package` to install native isolate versions of languages for the current platform

Please see the [pom.xml](./pom.xml) file for further details on the configuration.

Expand Down
136 changes: 118 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
Switch to community licenses by adding a `-community` suffix to the artefact id (e.g. `js-communtiy`).
Switch to native isolate versions of languages by adding a `-isolate` suffix. (`js-isolate`).
Since Polyglot version 24.1, native isolate versions of languages for specific platforms are supported.
Starting from GraalVM Polyglot API version 24.1.0, native isolate versions of languages for specific platforms are supported.
Refer to the `isolate` profiles for instructions on how to activate them.
Any dependency in the org.graalvm.polyglot group is intended for use by polyglot embeddings.
Expand Down Expand Up @@ -108,8 +108,10 @@
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<!-- We recommend running from the module-path by default.
But you can also switch to the class-path here.-->
<!--
We recommend running from the module path by default.
You can also switch to the classpath here.
-->
<argument>--module-path</argument>
<modulepath/>
<argument>-m</argument>
Expand All @@ -121,8 +123,10 @@
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<!-- We recommend running from the module-path by default.
But you can also switch to the class-path here.-->
<!--
We recommend running from the module path by default.
You can also switch to the classpath here.
-->
<argument>--module-path</argument>
<modulepath/>
<argument>-m</argument>
Expand Down Expand Up @@ -225,7 +229,7 @@
<executions>
<!--
Copies compiler dependencies to the target/compiler folder. In order to run with an
optimizing runtime on other JDKs than GraalVM we need to put the compiler on the upgrade-module-path.
optimizing runtime on other JDKs than GraalVM we need to put the compiler on the upgrade module path.
-->
<execution>
<id>copy-dependencies</id>
Expand Down Expand Up @@ -411,7 +415,7 @@
-->
<!-- Linux AMD64 -->
<profile>
<id>isolate-linux-amd64</id>
<id>isolated-linux-amd64</id>
<activation>
<os>
<family>unix</family>
Expand All @@ -420,12 +424,12 @@
</os>
</activation>
<properties>
<isolate.platform>linux-amd64</isolate.platform>
<isolate.platform.suffix>-linux-amd64</isolate.platform.suffix>
</properties>
</profile>
<!-- Linux AARCH64 -->
<profile>
<id>isolate-linux-aarch64</id>
<id>isolated-linux-aarch64</id>
<activation>
<os>
<family>unix</family>
Expand All @@ -434,59 +438,155 @@
</os>
</activation>
<properties>
<isolate.platform>linux-aarch64</isolate.platform>
<isolate.platform.suffix>-linux-aarch64</isolate.platform.suffix>
</properties>
</profile>
<!-- macOS AMD64 -->
<profile>
<id>isolate-darwin-amd64</id>
<id>isolated-darwin-amd64</id>
<activation>
<os>
<family>mac</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<isolate.platform>darwin-amd64</isolate.platform>
<isolate.platform.suffix>-darwin-amd64</isolate.platform.suffix>
</properties>
</profile>
<!-- macOS AARCH64 -->
<profile>
<id>isolate-darwin-aarch64</id>
<id>isolated-darwin-aarch64</id>
<activation>
<os>
<family>mac</family>
<arch>aarch64</arch>
</os>
</activation>
<properties>
<isolate.platform>darwin-aarch64</isolate.platform>
<isolate.platform.suffix>-darwin-aarch64</isolate.platform.suffix>
</properties>
</profile>
<!-- Windows AMD64 -->
<profile>
<id>isolate-windows-amd64</id>
<id>isolated-windows-amd64</id>
<activation>
<os>
<family>windows</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<isolate.platform>windows-amd64</isolate.platform>
<isolate.platform.suffix>-windows-amd64</isolate.platform.suffix>
</properties>
</profile>
<!--
Profile to package polyglot isolate libraries for all supported platforms.
The profile is activated using `mvn -Pisolated -Disolated.all.platforms`
-->
<profile>
<id>isolated-all-platforms</id>
<activation>
<property>
<name>isolated.all.platforms</name>
</property>
</activation>
<properties>
<isolate.platform.suffix></isolate.platform.suffix>
</properties>
</profile>
<!--
Profile for using isolated version of a guest language.
The profile is activated by `mvn -Pisolated`.
-->
<profile>
<id>isolated</id>
<properties>
<isolated.language.id>js</isolated.language.id>
</properties>
<dependencies>
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js-isolate-${isolate.platform}</artifactId>
<artifactId>js-isolate${isolate.platform.suffix}</artifactId>
<version>${graalvm.version}</version>
<type>pom</type>
</dependency>
<!--
Including the non-isolated language as a provided dependency ensures that the non-isolated language
included in the project dependencies is excluded from the Java module path.
-->
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js</artifactId>
<version>${graalvm.version}</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<systemPropertyVariables>
<!--
The Maven Surefire plugin sets the `polyglot.engine.SpawnIsolate=<language>`
system property to utilize the isolated version of the language during unit tests.
-->
<polyglot.engine.SpawnIsolate>${isolated.language.id}</polyglot.engine.SpawnIsolate>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>no-runtime-compilation</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<argument>-Dpolyglot.engine.SpawnIsolate=${isolated.language.id}</argument>
<!--
We recommend running from the module path by default.
You can also switch to the classpath here.
-->
<argument>--module-path</argument>
<modulepath/>
<argument>-m</argument>
<argument>embedding/org.example.embedding.Main</argument>
</arguments>
</configuration>
</execution>
</executions>
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<argument>-Dpolyglot.engine.SpawnIsolate=${isolated.language.id}</argument>
<!--
We recommend running from the module path by default.
You can also switch to the classpath here.
-->
<argument>--module-path</argument>
<modulepath/>
<argument>-m</argument>
<argument>embedding/org.example.embedding.Main</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>

0 comments on commit 947dd03

Please sign in to comment.