Skip to content

Commit 5e7d2fc

Browse files
authored
[jsscripting] Upgrade GraalJS from 22.0.0.2 to 24.1.1 (openhab#17720)
* [jsscripting] Upgrade GraalJS to 23.0.6 Signed-off-by: Florian Hotze <[email protected]>
1 parent 62cdb14 commit 5e7d2fc

File tree

3 files changed

+30
-23
lines changed

3 files changed

+30
-23
lines changed

bundles/org.openhab.automation.jsscripting/pom.xml

+28-19
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,37 @@
2323
!jdk.vm.ci.services
2424
</bnd.importpackage>
2525
<!-- Remember to check if the fix https://github.com/openhab/openhab-core/pull/4437 still works when upgrading GraalJS -->
26-
<graal.version>22.0.0.2</graal.version> <!-- DO NOT UPGRADE: 22.0.0.2 is the latest version working on armv7l / OpenJDK 11.0.16 & armv7l / Zulu 17.0.5+8 -->
26+
<graaljs.version>24.1.1</graaljs.version>
2727
<oh.version>${project.version}</oh.version>
2828
<ohjs.version>[email protected]</ohjs.version>
2929
</properties>
3030

3131
<build>
3232
<plugins>
33-
<!-- exclude META-INF/services/com.oracle.truffle.api.TruffleLanguage$Provider when unpacking dependencies -->
33+
<!-- bundle the modular dependencies into an uber-JAR -->
3434
<plugin>
3535
<groupId>org.apache.maven.plugins</groupId>
36-
<artifactId>maven-dependency-plugin</artifactId>
36+
<artifactId>maven-shade-plugin</artifactId>
37+
<version>3.6.0</version>
3738
<executions>
3839
<execution>
39-
<id>embed-dependencies</id>
40+
<phase>package</phase>
4041
<goals>
41-
<goal>unpack-dependencies</goal>
42+
<goal>shade</goal>
4243
</goals>
4344
<configuration>
44-
<excludes>META-INF/services/com.oracle.truffle.api.TruffleLanguage$Provider</excludes> <!-- we'll provide this -->
45+
<artifactSet>
46+
<excludes>
47+
<exclude>org.lastnpe.eea:eea-all</exclude>
48+
<exclude>org.apache.karaf.features:framework</exclude>
49+
</excludes>
50+
</artifactSet>
51+
<createDependencyReducedPom>false</createDependencyReducedPom>
52+
<transformers>
53+
<!-- Transformer to merge module-info.class files, if needed -->
54+
<transformer
55+
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
56+
</transformers>
4557
</configuration>
4658
</execution>
4759
</executions>
@@ -130,32 +142,29 @@
130142

131143
<dependencies>
132144
<dependency>
133-
<groupId>org.graalvm.sdk</groupId>
134-
<artifactId>graal-sdk</artifactId>
135-
<version>${graal.version}</version>
136-
</dependency>
137-
<dependency>
138-
<groupId>org.graalvm.truffle</groupId>
139-
<artifactId>truffle-api</artifactId>
140-
<version>${graal.version}</version>
145+
<groupId>org.graalvm.polyglot</groupId>
146+
<artifactId>polyglot</artifactId>
147+
<version>${graaljs.version}</version>
141148
</dependency>
142149
<!-- Graal JavaScript ScriptEngine JSR 223 support -->
143150
<dependency>
144151
<groupId>org.graalvm.js</groupId>
145152
<artifactId>js-scriptengine</artifactId>
146-
<version>${graal.version}</version>
153+
<version>${graaljs.version}</version>
147154
</dependency>
148155
<!-- Graal TRegex engine (internally used by Graal JavaScript engine) -->
149156
<dependency>
150157
<groupId>org.graalvm.regex</groupId>
151158
<artifactId>regex</artifactId>
152-
<version>${graal.version}</version>
159+
<version>${graaljs.version}</version>
153160
</dependency>
154161
<!-- Graal JavaScript engine (depends on Graal TRegex engine, must be added after it) -->
155162
<dependency>
156-
<groupId>org.graalvm.js</groupId>
157-
<artifactId>js</artifactId>
158-
<version>${graal.version}</version>
163+
<groupId>org.graalvm.polyglot</groupId>
164+
<artifactId>js-community</artifactId>
165+
<version>${graaljs.version}</version>
166+
<type>pom</type>
167+
<scope>runtime</scope>
159168
</dependency>
160169
</dependencies>
161170
</project>

bundles/org.openhab.automation.jsscripting/src/main/java/org/openhab/automation/jsscripting/internal/OpenhabGraalJSScriptEngine.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ public OpenhabGraalJSScriptEngine(boolean injectionEnabled, boolean injectionCac
163163
.option("js.nashorn-compat", "true") // Enable Nashorn compat mode as openhab-js relies on
164164
// accessors, see
165165
// https://github.com/oracle/graaljs/blob/master/docs/user/NashornMigrationGuide.md#accessors
166-
.option("js.ecmascript-version", "2022") // If Nashorn compat is enabled, it will enforce ES5
167-
// compatibility, we want ECMA2022
166+
.option("js.ecmascript-version", "2024") // If Nashorn compat is enabled, it will enforce ES5
167+
// compatibility, we want ECMA2024
168168
.option("js.commonjs-require", "true") // Enable CommonJS module support
169169
.hostClassLoader(getClass().getClassLoader())
170170
.fileSystem(new DelegatingFileSystem(FileSystems.getDefault().provider()) {

bundles/org.openhab.automation.jsscripting/src/main/resources/META-INF/services/com.oracle.truffle.api.TruffleLanguage$Provider

-2
This file was deleted.

0 commit comments

Comments
 (0)