Graal VM plugin
Parent: DITA-OT Plugins
org.jung.graal is a plugin for the DITA-OT and is providing the Graal VM for executing JavaScript with Apache Ant.
GraalVM is a high-performance JDK distribution designed to accelerate the execution of applications written in Java and other JVM languages along with support for JavaScript, Ruby, Python, and a number of other popular languages.
Installation
Install this plugin with the dita
command.
dita install https://github.com/stefan-jung/org.jung.graal/archive/refs/heads/main.zip
Usage
You can use the Apache Ant <script>
task.
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" basedir="." default="main">
<target name="main">
<script language="javascript"> <![CDATA[
// create and use a Task via Ant API
echo = MyProject.createTask("echo");
echo.setMessage("Hello World!");
echo.perform();
]]></script>
</target>
</project>
As an alternative, you can also use the <scriptdef>
task to create custom Ant tasks.
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyProject" basedir="." default="main">
<scriptdef name="custom-echo" language="javascript">
<attribute name="msg"/>
<![CDATA[
self.log(attributes.get("msg"));
]]>
</scriptdef>
<target name="main">
<custom-echo msg="Hello World!"/>
</target>
</project>
Libraries
The libraries used in this plugin can be obtained from:
Library | Maven Repository |
---|---|
commons-io | https://mvnrepository.com/artifact/commons-io/commons-io |
js | https://mvnrepository.com/artifact/org.graalvm.js/js |
js-scriptengine | https://mvnrepository.com/artifact/org.graalvm.js/js-scriptengine |
graal-sdk | https://mvnrepository.com/artifact/org.graalvm.sdk/graal-sdk |
truffle-api | https://mvnrepository.com/artifact/org.graalvm.truffle/truffle-api |
icu4j | https://mvnrepository.com/artifact/com.ibm.icu/icu4j |
License
GraalVM Community Edition is open source and distributed under version 2 of the GNU General Public License with the “Classpath” Exception, which are the same terms as for Java. The licenses of the individual GraalVM components are generally derivative of the license of a particular language (see the table below). GraalVM Community is free to use for any purpose - no strings attached.
Component(s) | License |
---|---|
GraalVM Compiler, SubstrateVM, Tools, VM | GPL 2 with Classpath Exception |
GraalVM SDK, GraalWasm, Truffle Framework, TRegex | Universal Permissive License |