diff options
| author | Stefan Bodewig <bodewig@apache.org> | 2020-08-10 18:12:53 +0200 |
|---|---|---|
| committer | Stefan Bodewig <bodewig@apache.org> | 2020-08-10 18:12:53 +0200 |
| commit | ca08301cf26b5bd2cf047cf59572ca901c5f78ba (patch) | |
| tree | dfeff85c3dd93f5684564af81a16d71973b53c15 /manual/Tasks/script.html | |
| parent | 6022806ecd6a47c8034713303db97a3c1a2b7f0c (diff) | |
| download | ant-ca08301cf26b5bd2cf047cf59572ca901c5f78ba.tar.gz | |
add some documentation about GraalVM JavaScript
Diffstat (limited to 'manual/Tasks/script.html')
| -rw-r--r-- | manual/Tasks/script.html | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/manual/Tasks/script.html b/manual/Tasks/script.html index 7cb6a477c..e029cd9db 100644 --- a/manual/Tasks/script.html +++ b/manual/Tasks/script.html @@ -274,11 +274,25 @@ with <code>importClass</code>/<code>importPackage</code>. For other packages you full classified name with <strong>Packages</strong>. For example Ant's <code class="code">FileUtils</code> class can be imported with <code class="code">importClass(<strong>Packages</strong>.org.apache.tools.ant.util.FileUtils)</code></p> -<p>In Java 8+, you may use the built-in Nashorn JavaScript engine rather than Rhino (which is +<p>In Java 8 up until Java 14, you may use the built-in Nashorn JavaScript engine rather than Rhino (which is available in Java 7 runtime). Then, use <code>Java.type</code> as import statement for any Java class or <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/prog_guide/javascript.html#A1147207">the compatibility script</a>: <code>load("nashorn:mozilla_compat.js");</code>.</p> + +<p>Starting with Java 15 Nashorn has been removed again and you need + to provide an external JavaScript engine. Your best option probably + is <a href="https://github.com/graalvm/graaljs">GraalVM + JavaScript</a> which requires you to add a lot of extra jars. For + GraalVM JavaScript 20.1 you'll + need <code>org.graalvm.js:js</code>, <code>org.graalvm.js:js-engine</code> + which in turn + require <code>org.graalvm.regex:regex</code>, <code>org.graalvm.truffle:truffle-api</code>, <code>org.graalvm.sdk:graal-sdk</code>, + and <code>com.ibm.icu:icu4j</code>. GraalVM JavaScript is not a + drop-in replacement for Nashorn, see + Graal's <a href="https://github.com/graalvm/graaljs/blob/master/docs/user/NashornMigrationGuide.md">Nashorn + Migration Guide</a> for more details.</p> + <p>The <code><script></code> task populates the Project instance under the name <code class="code">project</code>, so we can use that reference. Another way is to use its given name or getting its reference from the task itself. The Project provides methods for accessing |
