Skip to content

Commit

Permalink
[jsscripting] Upgrade GraalJS to 24.1.1
Browse files Browse the repository at this point in the history
The packaging had to be changed to building an uber-JAR because of
https://github.com/oracle/graaljs/blob/master/CHANGELOG.md#version-2310.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
  • Loading branch information
florian-h05 committed Nov 8, 2024
1 parent ad042aa commit 602b43a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 28 deletions.
52 changes: 28 additions & 24 deletions bundles/org.openhab.automation.jsscripting/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,37 @@
!jdk.vm.ci.services
</bnd.importpackage>
<!-- Remember to check if the fix https://github.com/openhab/openhab-core/pull/4437 still works when upgrading GraalJS -->
<graal.version>23.0.6</graal.version>
<graaljs.version>24.1.1</graaljs.version>
<oh.version>${project.version}</oh.version>
<ohjs.version>openhab@5.8.0</ohjs.version>
</properties>

<build>
<plugins>
<!-- exclude META-INF/services/com.oracle.truffle.api.TruffleLanguage$Provider when unpacking dependencies -->
<!-- bundle the modular dependencies into an uber-JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>embed-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
<goal>shade</goal>
</goals>
<configuration>
<excludes>META-INF/services/com.oracle.truffle.api.TruffleLanguage$Provider</excludes> <!-- we'll provide this -->
<artifactSet>
<excludes>
<exclude>org.lastnpe.eea:eea-all</exclude>
<exclude>org.apache.karaf.features:framework</exclude>
</excludes>
</artifactSet>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<!-- Transformer to merge module-info.class files, if needed -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -130,37 +142,29 @@

<dependencies>
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>${graal.version}</version>
</dependency>
<dependency>
<groupId>org.graalvm.truffle</groupId>
<artifactId>truffle-api</artifactId>
<version>${graal.version}</version>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>polyglot</artifactId>
<version>${graaljs.version}</version>
</dependency>
<!-- Graal JavaScript ScriptEngine JSR 223 support -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>${graal.version}</version>
<version>${graaljs.version}</version>
</dependency>
<!-- Graal TRegex engine (internally used by Graal JavaScript engine) -->
<dependency>
<groupId>org.graalvm.regex</groupId>
<artifactId>regex</artifactId>
<version>${graal.version}</version>
<version>${graaljs.version}</version>
</dependency>
<!-- Graal JavaScript engine (depends on Graal TRegex engine, must be added after it) -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>${graal.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>76.1</version>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>js-community</artifactId>
<version>${graaljs.version}</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ public OpenhabGraalJSScriptEngine(boolean injectionEnabled, boolean injectionCac
.option("js.nashorn-compat", "true") // Enable Nashorn compat mode as openhab-js relies on
// accessors, see
// https://github.com/oracle/graaljs/blob/master/docs/user/NashornMigrationGuide.md#accessors
.option("js.ecmascript-version", "2022") // If Nashorn compat is enabled, it will enforce ES5
// compatibility, we want ECMA2022
.option("js.ecmascript-version", "2024") // If Nashorn compat is enabled, it will enforce ES5
// compatibility, we want ECMA2024
.option("js.commonjs-require", "true") // Enable CommonJS module support
.hostClassLoader(getClass().getClassLoader())
.fileSystem(new DelegatingFileSystem(FileSystems.getDefault().provider()) {
Expand Down

This file was deleted.

0 comments on commit 602b43a

Please sign in to comment.