-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn all GraalVM Languages artifacts into standard Maven dependencies for Polyglot Embedders #6852
Comments
We’re looking for feedback from Java developers who utilize the org.graalvm.polyglot API to embed languages such as JavaScript, Python, Ruby, Espresso, WebAssembly, LLVM, etc. within Java. Version 23.1 (September release) is set to introduce some significant changes to how embedding in Java applications works. To clarify how this will work, here’s a brief example for a new Maven configuration that includes Python. <?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yourcorp.yourapp</groupId>
<artifactId>yourartefact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency> <!-- We also move from graal-sdk => polyglot -->
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>23.1.0</version>
</dependency>
<dependency> <!-- you can also depend on org.graalvm.polyglot:languages for all languages -->
<groupId>org.graalvm.python</groupId>
<artifactId>python</artifactId>
<version>23.1.0</version>
<type>pom</type>
</dependency>
<dependency> <!-- all tools we include in Oracle GraalVM -->
<groupId>org.graalvm.polyglot</groupId>
<artifactId>tools</artifactId>
<version>23.1.0</version>
<type>pom</type>
</dependency>
</dependencies>
</project> Note: If you want Open Source versions of all these components you need to change the artefact names to python-community and tools-community. Note: We also broke the org.graalvm.sdk module (graal-sdk.jar) into several parts: nativeimage, polyglot, word and collections. We will still deploy a deprecated version of this module in the next release to not break your code. I think there are some advantages to moving to Maven dependencies:
And there are also some disadvantages:
We’d appreciate your thoughts on this change, in particular on the following points: Question 1) In order to run with optimized/compiled Truffle, you’ll need to download all language modules from Maven and put them on the module-path. If you put them on the classpath, the “optimized” mode will no longer function. Question 2) For users who build native images of their Java embedding, the previous --macro:truffle and --language:python flags will no longer be available. You’ll need to put the languages on the module-path for them to be included, just like when running the Java application. If you were using those flags, this change might disrupt your build process. Question 3) For users deploying their own class-loaders: At present, you can only load the optimized/compiled Truffle runtime modules once per JVM, even if they are in completely separate class loaders. Attempting to load the optimized Truffle runtime twice per JVM will result in a failed boot. This is due to a current limitation in how our newly decoupled integration with the compiler works. We plan to remove this restriction in the future, but it’s unlikely to happen by 23.1. You can still use interpreter-only Truffle or share the Truffle/polyglot modules in a common parent class loader. For more details, please also see the slack conversation: |
@chumer we are trying this new style in Github Actions, with the It's warning us that we can't install via
Are Maven coordinates up yet? I searched and couldn't find any yet |
@sgammon Maven coordinates go up today with the release of 23.1. |
We have implemented this for the GraalVM for JDK 21 / Polyglot 23.1 release. |
What happened to R? We used to be able to use gu to add it (which the documentation still states). I have not found any jar to install R. |
Also it appears there is a service name collision when trying to implement multiple languages in an uber jar. I can run scripts successfully within an IDE, but when I create an uber jar, and run the same script it throws an error a language was not implemented
|
Putting multiple modular JAR files into single uber JAR has an obvious problem:
I interpret it as a sign of missing |
Since 23.0 Oracle is no longer providing builds of FastR. The community is welcome to pick this effort up and provide builds for it. Internally we are still maintaining it to keep building and provide limited testing with the latest release. For 23.1 there is still more work to be done to make it compatible again with Truffle Unchained. |
@sbkohel I wrote a comment on uber jars here: oracle/graaljs#764 (comment) |
Can java be used as a scripting language in Graalvm If I add
When I create a Context I get "Could not find internal resources for configuration native." when getting the bindings. bindings = context.getBindings(languageId); Is that normal? |
TL;DR
Currently, to use GraalVM languages as a polyglot embedder, you have to install languages using the GraalVM Updater tool (
gu
).In the future, we want to ship GraalPy, Graal.js, TruffleRuby, and other GraalVM languages entirely as Maven artifacts.
Polyglot embedders will need to depend on those artifacts using the application module path.
Goals
jlink
work and are tested with GraalVM languages.Non-Goals
gu
(see [GR-46219] Remove the GraalVM Updater #6855).The text was updated successfully, but these errors were encountered: