This is an automated email from the ASF dual-hosted git repository.

bodewig pushed a commit to branch graal.js
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/graal.js by this push:
     new f031e37  this seems to be enough to make graal.js work
f031e37 is described below

commit f031e37c1624a136c8de2e8c193fcc66c6ae962b
Author: Stefan Bodewig <[email protected]>
AuthorDate: Wed May 27 09:04:05 2020 +0200

    this seems to be enough to make graal.js work
    
    The concrete scriptdef test still fails as compilation doesn't seem to
    help as much as it did on Nashorn (will try to gather some numbers).
---
 build.xml                                                          | 1 -
 src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/build.xml b/build.xml
index 829e829..4e157d6 100644
--- a/build.xml
+++ b/build.xml
@@ -1749,7 +1749,6 @@ ${antunit.reports}
                failureproperty="junit.failed"
                errorproperty="junit.failed"
                filtertrace="${junit.filtertrace}">
-          <sysproperty key="polyglot.js.nashorn-compat" value="true"/>
           <sysproperty key="ant.home" value="${ant.home}"/>
           <sysproperty key="build.classes.value" 
value="${build.classes.value}"/>
           <sysproperty key="build.tests.value" value="${build.tests.value}"/>
diff --git a/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java 
b/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
index d55a5b3..cf9c4e2 100644
--- a/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
+++ b/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
@@ -26,6 +26,7 @@ import java.util.stream.Collectors;
 import javax.script.Bindings;
 import javax.script.Compilable;
 import javax.script.CompiledScript;
+import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 import javax.script.SimpleBindings;
@@ -144,6 +145,10 @@ public class JavaxScriptRunner extends ScriptRunnerBase {
                     "Unable to create javax script engine for "
                         + getLanguage());
             }
+            if (getLanguage().startsWith("graal.")) {
+                engine.getBindings(ScriptContext.ENGINE_SCOPE)
+                    .put("polyglot.js.allowAllAccess", true);
+            }
 
             applyBindings(engine::put);
 

Reply via email to