Skip to content

Commit d298df8

Browse files
Revise JS support for regular JVM (#3989)
* Revise JS support for regular JVM Turns out that we just need to have `org.graalvm.sdk:graal-sdk` and `org.graalvm.js:js` dependencies for regular JVM to enable JavaScript support for Spring Integration Scripting module * Add respective `providedImplementation` dependencies * Remove `@EnabledIfSystemProperty` from unit tests * Mention those dependencies in the doc * Rework sentence in the doc for better English Co-authored-by: Gary Russell <grussell@vmware.com> Co-authored-by: Gary Russell <grussell@vmware.com>
1 parent 7432038 commit d298df8

File tree

5 files changed

+5
-10
lines changed

5 files changed

+5
-10
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,7 @@ project('spring-integration-scripting') {
872872
}
873873
optionalApi 'org.jetbrains.kotlin:kotlin-compiler-embeddable'
874874
providedImplementation "org.graalvm.sdk:graal-sdk:$graalvmVersion"
875+
providedImplementation "org.graalvm.js:js:$graalvmVersion"
875876

876877
testImplementation "org.jruby:jruby-complete:$jrubyVersion"
877878
testImplementation 'org.apache.groovy:groovy-jsr223'

spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223HeaderEnricherTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
1717
package org.springframework.integration.scripting.config.jsr223;
1818

1919
import org.junit.jupiter.api.Test;
20-
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
2120

2221
import org.springframework.beans.factory.annotation.Autowired;
2322
import org.springframework.integration.channel.QueueChannel;
@@ -35,7 +34,6 @@
3534
*
3635
* @since 2.1
3736
*/
38-
@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$")
3937
@SpringJUnitConfig
4038
public class Jsr223HeaderEnricherTests {
4139

spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223InboundChannelAdapterTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2013-2022 the original author or authors.
2+
* Copyright 2013-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
import java.util.Date;
2020

2121
import org.junit.jupiter.api.Test;
22-
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
2322

2423
import org.springframework.beans.factory.annotation.Autowired;
2524
import org.springframework.beans.factory.annotation.Qualifier;
@@ -36,7 +35,6 @@
3635
*
3736
* @since 2.0
3837
*/
39-
@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$")
4038
@SpringJUnitConfig
4139
@DirtiesContext
4240
public class Jsr223InboundChannelAdapterTests {

spring-integration-scripting/src/test/java/org/springframework/integration/scripting/config/jsr223/Jsr223TransformerTests.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
2020
import java.util.Set;
2121

2222
import org.junit.jupiter.api.Test;
23-
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
2423

2524
import org.springframework.beans.factory.annotation.Autowired;
2625
import org.springframework.integration.channel.QueueChannel;
@@ -39,7 +38,6 @@
3938
*
4039
* @since 2.0
4140
*/
42-
@EnabledIfSystemProperty(named = "org.graalvm.language.js.home", matches = ".+js$")
4341
@SpringJUnitConfig
4442
public class Jsr223TransformerTests {
4543

src/reference/asciidoc/scripting.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,4 @@ By default, the framework sets `allowAllAccess` to `true` on the shared Polyglot
295295

296296
This can be customized via overloaded `PolyglotScriptExecutor` constructor which accepts a `org.graalvm.polyglot.Context.Builder`.
297297

298-
The usage of JavaScript in the framework components remains the same, on ly the difference that now it is going to work only on GraalVM with installed `js` component.
298+
To enable this JavaScript support, GraalVM with the `js` component installed has to be used or, when using a regular JVM, the `org.graalvm.sdk:graal-sdk` and `org.graalvm.js:js` dependencies must be included.

0 commit comments

Comments
 (0)