-
Notifications
You must be signed in to change notification settings - Fork 12
/
pom.xml
594 lines (577 loc) · 26.5 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>embedding</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<!--
Uncomment to use builds from snapshot repository. This is typically not necessary as all require artefacts are used on Maven
central.
-->
<!--
<repository>
<id>graalvm-snapshot-repo</id>
<name>graalvm-snapshot-repo</name>
<url>file:///path/to/snapshot/repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
-->
</repositories>
<properties>
<!-- Select the GraalVM version to use. -->
<graalvm.version>24.0.1</graalvm.version>
</properties>
<dependencies>
<!--
The polyglot dependency is always required for Java embeddings.
It contains the polyglot embedding APIs to include any polyglot language. -->
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>${graalvm.version}</version>
<type>jar</type>
</dependency>
<!--
Choose here which languages should be used.
Available languages in the polyglot group are:
js, ruby, python, wasm, llvm, llvm-native, java
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`).
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.
-->
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js</artifactId>
<version>${graalvm.version}</version>
<type>pom</type>
</dependency>
<!-- Uncomment to include language tooling like a sampling profiler and the chrome inspector support. -->
<!--
<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>tools</artifactId>
<version>${graalvm.version}</version>
<type>pom</type>
</dependency>
-->
<!-- Use the JUnit version of your choice. -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</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>
<!--
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>
<!--
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>
<plugin>
<artifactId>maven-jlink-plugin</artifactId>
<version>3.1.0</version>
<extensions>true</extensions>
<configuration>
<ignoreSigningInformation>true</ignoreSigningInformation>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!--
Run native image build with: mvn -Pnative package.
This profile may be removed if no native-image builds are needed.
-->
<id>native</id>
<properties>
<image.name>${project.artifactId}</image.name>
<image.path>${project.build.directory}/${image.name}</image.path>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.2</version>
<extensions>true</extensions>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>${image.name}</imageName>
<mainClass>org.example.embedding.Main</mainClass>
<buildArgs>
<buildArg>--no-fallback</buildArg>
<buildArg>-J-Xmx20g</buildArg>
</buildArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${image.path}</executable>
<arguments/>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!--
Profile used when running on a different JDK than GraalVM.
This profile may be removed if you are always running with a
GraalVM JDK or if you don't want to use the optimizing runtime.
Note: Using this configuration unlocks experimental options and is therefore
not recommended for production use.
-->
<id>not-graalvm-jdk</id>
<activation>
<file>
<!-- Detect if we are not running with a GraalVM JDK. -->
<missing>${java.home}/lib/graalvm</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.6.0</version>
<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.
-->
<execution>
<id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/compiler
</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<artifactItems>
<!--
Unfortunately Maven does not support resolving transitive dependencies
here automatically. So the list of dependencies might need to be updated when upgrading
to new versions of GraalVM.
-->
<artifactItem>
<groupId>org.graalvm.sdk</groupId>
<artifactId>collections</artifactId>
<version>${graalvm.version}</version>
<type>jar</type>
<destFileName>collections.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.graalvm.sdk</groupId>
<artifactId>word</artifactId>
<version>${graalvm.version}</version>
<type>jar</type>
<destFileName>word.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.graalvm.truffle</groupId>
<artifactId>truffle-compiler</artifactId>
<version>${graalvm.version}</version>
<type>jar</type>
<destFileName>truffle-compiler.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.graalvm.compiler</groupId>
<artifactId>compiler</artifactId>
<version>${graalvm.version}</version>
<type>jar</type>
<destFileName>compiler.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<argLine>
-XX:+UnlockExperimentalVMOptions
-XX:+EnableJVMCI
--upgrade-module-path=${project.build.directory}/compiler
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<argument>--module-path</argument>
<modulepath/>
<argument>-XX:+UnlockExperimentalVMOptions</argument>
<argument>-XX:+EnableJVMCI</argument>
<argument>--upgrade-module-path=${project.build.directory}/compiler/</argument>
<argument>-m</argument>
<argument>embedding/org.example.embedding.Main</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>no-runtime-compilation</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<arguments>
<argument>--module-path</argument>
<modulepath/>
<argument>-m</argument>
<argument>embedding/org.example.embedding.Main</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>assembly</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>org.example.embedding.Main</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>shade</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.example.embedding.Main</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*:*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!--
Profiles for using a native isolate language version for a specific platform.
Native isolate versions of languages for a specific platforms are supported since
Polyglot version 24.1 for JavaScript (js) and Python (python).
These profiles may be removed if you are not using native isolate versions of languages.
-->
<!-- Linux AMD64 -->
<profile>
<id>isolated-linux-amd64</id>
<activation>
<os>
<family>unix</family>
<name>linux</name>
<arch>amd64</arch>
</os>
</activation>
<properties>
<isolate.platform.suffix>-linux-amd64</isolate.platform.suffix>
</properties>
</profile>
<!-- Linux AARCH64 -->
<profile>
<id>isolated-linux-aarch64</id>
<activation>
<os>
<family>unix</family>
<name>linux</name>
<arch>aarch64</arch>
</os>
</activation>
<properties>
<isolate.platform.suffix>-linux-aarch64</isolate.platform.suffix>
</properties>
</profile>
<!-- macOS AMD64 -->
<profile>
<id>isolated-darwin-amd64</id>
<activation>
<os>
<family>mac</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<isolate.platform.suffix>-darwin-amd64</isolate.platform.suffix>
</properties>
</profile>
<!-- macOS AARCH64 -->
<profile>
<id>isolated-darwin-aarch64</id>
<activation>
<os>
<family>mac</family>
<arch>aarch64</arch>
</os>
</activation>
<properties>
<isolate.platform.suffix>-darwin-aarch64</isolate.platform.suffix>
</properties>
</profile>
<!-- Windows AMD64 -->
<profile>
<id>isolated-windows-amd64</id>
<activation>
<os>
<family>windows</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<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.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>