Skip to content

Commit 947dd03

Browse files
committed
Resolved review comments.
1 parent 0f5eb4b commit 947dd03

File tree

2 files changed

+120
-21
lines changed

2 files changed

+120
-21
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ https://www.graalvm.org/latest/reference-manual/embed-languages/
1616

1717
Download Maven or import as Maven project into your IDE.
1818

19-
* `mvn package` build using javac
19+
* `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`.
2020
* `mvn test` to run the tests
21-
* `mvn exec:exec` to run the Main application
21+
* `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.
2222
* `mvn -Pnative package` to build a native-image
2323
* `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.
2424
* `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.
25-
* `mvn -Pisolated package` to install native isolate versions of languages for the current platform
2625

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

pom.xml

Lines changed: 118 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
4545
Switch to community licenses by adding a `-community` suffix to the artefact id (e.g. `js-communtiy`).
4646
Switch to native isolate versions of languages by adding a `-isolate` suffix. (`js-isolate`).
47-
Since Polyglot version 24.1, native isolate versions of languages for specific platforms are supported.
47+
Starting from GraalVM Polyglot API version 24.1.0, native isolate versions of languages for specific platforms are supported.
4848
Refer to the `isolate` profiles for instructions on how to activate them.
4949
5050
Any dependency in the org.graalvm.polyglot group is intended for use by polyglot embeddings.
@@ -108,8 +108,10 @@
108108
<configuration>
109109
<executable>${java.home}/bin/java</executable>
110110
<arguments>
111-
<!-- We recommend running from the module-path by default.
112-
But you can also switch to the class-path here.-->
111+
<!--
112+
We recommend running from the module path by default.
113+
You can also switch to the classpath here.
114+
-->
113115
<argument>--module-path</argument>
114116
<modulepath/>
115117
<argument>-m</argument>
@@ -121,8 +123,10 @@
121123
<configuration>
122124
<executable>${java.home}/bin/java</executable>
123125
<arguments>
124-
<!-- We recommend running from the module-path by default.
125-
But you can also switch to the class-path here.-->
126+
<!--
127+
We recommend running from the module path by default.
128+
You can also switch to the classpath here.
129+
-->
126130
<argument>--module-path</argument>
127131
<modulepath/>
128132
<argument>-m</argument>
@@ -225,7 +229,7 @@
225229
<executions>
226230
<!--
227231
Copies compiler dependencies to the target/compiler folder. In order to run with an
228-
optimizing runtime on other JDKs than GraalVM we need to put the compiler on the upgrade-module-path.
232+
optimizing runtime on other JDKs than GraalVM we need to put the compiler on the upgrade module path.
229233
-->
230234
<execution>
231235
<id>copy-dependencies</id>
@@ -411,7 +415,7 @@
411415
-->
412416
<!-- Linux AMD64 -->
413417
<profile>
414-
<id>isolate-linux-amd64</id>
418+
<id>isolated-linux-amd64</id>
415419
<activation>
416420
<os>
417421
<family>unix</family>
@@ -420,12 +424,12 @@
420424
</os>
421425
</activation>
422426
<properties>
423-
<isolate.platform>linux-amd64</isolate.platform>
427+
<isolate.platform.suffix>-linux-amd64</isolate.platform.suffix>
424428
</properties>
425429
</profile>
426430
<!-- Linux AARCH64 -->
427431
<profile>
428-
<id>isolate-linux-aarch64</id>
432+
<id>isolated-linux-aarch64</id>
429433
<activation>
430434
<os>
431435
<family>unix</family>
@@ -434,59 +438,155 @@
434438
</os>
435439
</activation>
436440
<properties>
437-
<isolate.platform>linux-aarch64</isolate.platform>
441+
<isolate.platform.suffix>-linux-aarch64</isolate.platform.suffix>
438442
</properties>
439443
</profile>
440444
<!-- macOS AMD64 -->
441445
<profile>
442-
<id>isolate-darwin-amd64</id>
446+
<id>isolated-darwin-amd64</id>
443447
<activation>
444448
<os>
445449
<family>mac</family>
446450
<arch>x86_64</arch>
447451
</os>
448452
</activation>
449453
<properties>
450-
<isolate.platform>darwin-amd64</isolate.platform>
454+
<isolate.platform.suffix>-darwin-amd64</isolate.platform.suffix>
451455
</properties>
452456
</profile>
453457
<!-- macOS AARCH64 -->
454458
<profile>
455-
<id>isolate-darwin-aarch64</id>
459+
<id>isolated-darwin-aarch64</id>
456460
<activation>
457461
<os>
458462
<family>mac</family>
459463
<arch>aarch64</arch>
460464
</os>
461465
</activation>
462466
<properties>
463-
<isolate.platform>darwin-aarch64</isolate.platform>
467+
<isolate.platform.suffix>-darwin-aarch64</isolate.platform.suffix>
464468
</properties>
465469
</profile>
466470
<!-- Windows AMD64 -->
467471
<profile>
468-
<id>isolate-windows-amd64</id>
472+
<id>isolated-windows-amd64</id>
469473
<activation>
470474
<os>
471475
<family>windows</family>
472476
<arch>x86_64</arch>
473477
</os>
474478
</activation>
475479
<properties>
476-
<isolate.platform>windows-amd64</isolate.platform>
480+
<isolate.platform.suffix>-windows-amd64</isolate.platform.suffix>
477481
</properties>
478482
</profile>
483+
<!--
484+
Profile to package polyglot isolate libraries for all supported platforms.
485+
The profile is activated using `mvn -Pisolated -Disolated.all.platforms`
486+
-->
487+
<profile>
488+
<id>isolated-all-platforms</id>
489+
<activation>
490+
<property>
491+
<name>isolated.all.platforms</name>
492+
</property>
493+
</activation>
494+
<properties>
495+
<isolate.platform.suffix></isolate.platform.suffix>
496+
</properties>
497+
</profile>
498+
<!--
499+
Profile for using isolated version of a guest language.
500+
The profile is activated by `mvn -Pisolated`.
501+
-->
479502
<profile>
480503
<id>isolated</id>
504+
<properties>
505+
<isolated.language.id>js</isolated.language.id>
506+
</properties>
481507
<dependencies>
482508
<dependency>
483509
<groupId>org.graalvm.polyglot</groupId>
484-
<artifactId>js-isolate-${isolate.platform}</artifactId>
510+
<artifactId>js-isolate${isolate.platform.suffix}</artifactId>
511+
<version>${graalvm.version}</version>
512+
<type>pom</type>
513+
</dependency>
514+
<!--
515+
Including the non-isolated language as a provided dependency ensures that the non-isolated language
516+
included in the project dependencies is excluded from the Java module path.
517+
-->
518+
<dependency>
519+
<groupId>org.graalvm.polyglot</groupId>
520+
<artifactId>js</artifactId>
485521
<version>${graalvm.version}</version>
486522
<type>pom</type>
523+
<scope>provided</scope>
487524
</dependency>
488525
</dependencies>
526+
<build>
527+
<plugins>
528+
<plugin>
529+
<groupId>org.apache.maven.plugins</groupId>
530+
<artifactId>maven-surefire-plugin</artifactId>
531+
<version>3.1.2</version>
532+
<configuration>
533+
<systemPropertyVariables>
534+
<!--
535+
The Maven Surefire plugin sets the `polyglot.engine.SpawnIsolate=<language>`
536+
system property to utilize the isolated version of the language during unit tests.
537+
-->
538+
<polyglot.engine.SpawnIsolate>${isolated.language.id}</polyglot.engine.SpawnIsolate>
539+
</systemPropertyVariables>
540+
</configuration>
541+
</plugin>
542+
<plugin>
543+
<groupId>org.codehaus.mojo</groupId>
544+
<artifactId>exec-maven-plugin</artifactId>
545+
<version>3.1.0</version>
546+
<executions>
547+
<execution>
548+
<goals>
549+
<goal>exec</goal>
550+
</goals>
551+
</execution>
552+
<execution>
553+
<id>no-runtime-compilation</id>
554+
<goals>
555+
<goal>exec</goal>
556+
</goals>
557+
<configuration>
558+
<executable>${java.home}/bin/java</executable>
559+
<arguments>
560+
<argument>-Dpolyglot.engine.SpawnIsolate=${isolated.language.id}</argument>
561+
<!--
562+
We recommend running from the module path by default.
563+
You can also switch to the classpath here.
564+
-->
565+
<argument>--module-path</argument>
566+
<modulepath/>
567+
<argument>-m</argument>
568+
<argument>embedding/org.example.embedding.Main</argument>
569+
</arguments>
570+
</configuration>
571+
</execution>
572+
</executions>
573+
<configuration>
574+
<executable>${java.home}/bin/java</executable>
575+
<arguments>
576+
<argument>-Dpolyglot.engine.SpawnIsolate=${isolated.language.id}</argument>
577+
<!--
578+
We recommend running from the module path by default.
579+
You can also switch to the classpath here.
580+
-->
581+
<argument>--module-path</argument>
582+
<modulepath/>
583+
<argument>-m</argument>
584+
<argument>embedding/org.example.embedding.Main</argument>
585+
</arguments>
586+
</configuration>
587+
</plugin>
588+
</plugins>
589+
</build>
489590
</profile>
490591
</profiles>
491-
492592
</project>

0 commit comments

Comments
 (0)