[x3d-public] X3DJSAIL updates: Patches to X3DJSAIL and build.xml, plus test.bat and nashorn additions

John Carlson yottzumm at gmail.com
Sun Dec 17 14:31:52 PST 2017


You can remove this section of build.xml script:

                <script language="nashorn">
                        <classpath>
                                <fileset dir="${saxon.dir}" includes="${saxon.jar}" />
                                <fileset dir="${java.jars.dir}" includes="${jsai.classes.archive.jar.name}" />
                                <fileset dir="${java.lib.dir}" includes="${exificient.jar}"/>
                                <fileset dir="${java.lib.dir}" includes="${openexi.jar}"/>
                        </classpath>
                        load('nashorn/jvm-npm.js');
                        load('nashorn/repeatPolyfill.js');
                        load('nashorn/examples/HelloWorldProgramOutput.js.intermediate.js');
                        load('nashorn/examples/HelloWorldProgramOutput.js');
                </script>

I am running:  apache-ant-1.10.1/  I am not sure what you can run with Java 8, but please check.  You may be able to support nashorn scripting inside ant, with Java 8, not sure.

What we can do once JSON conversions are working is run this script from Java, instead of ant.  I will work towards getting nashorn under java.

It sounds like you want a close integration.  Ok.

John

With a newer ant, I get this far:

$ ~/apache-ant-1.10.1/bin/ant test.nashorn
Buildfile: C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml

test.nashorn:
     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] HelloWorldProgramOutput self-validation test results: success
     [java] Warning: toFileStylesheetConversion(X3dToJson.xslt) is overwriting prior file nashorn/examples/HelloWorldProgramOutput.json
     [java] Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
     [java] Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" modeHelloWorldProgramOutput self-validation test results: success
     [java]
     [java] Warning: toFileX3D() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.x3d
     [java] HelloWorldProgramOutput self-validation test results: success

BUILD FAILED
C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml:1602: javax.script.ScriptException: SyntaxError: nashorn/examples/HelloWorldProgramOutput.js.intermediate.js:333:96 Expected comma but found ident
                                      "@value":["escaped quotation marks example 1: He said, \\"Immel did it!\\""]
                                                                                                ^ in <eval> at line number 5
        at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:469)


Sent from Mail for Windows 10

From: Don Brutzman
Sent: Sunday, December 17, 2017 4:58 PM
To: John Carlson
Cc: X3D Graphics public mailing list
Subject: Re: [x3d-public] X3DJSAIL updates: Patches to X3DJSAIL and build.xml,plus test.bat and nashorn additions

On 12/16/2017 11:40 PM, John Carlson wrote:
> Patch to X3DJSAIL and build.xml
> attached: x3d.stylesheets.patch

OK, was able to get Netbeans to partially apply the patch (for build.xml only).

Have modified stylesheets/build.xml as indicated.  renamed ant target test-nashorn to test.nashorn for consistency with other targets.  checked in.

The patch for CreateX3dSceneAccessInterfaceJava.xslt didn't get applied by Netbeans... so I did it manually.  Checked in.

*Please confirm* manual patch to CreateX3dSceneAccessInterfaceJava.xslt was applied OK.

On 12/16/2017 11:50 PM, John Carlson wrote:
> Corresponding zip file with nashorn source code:
> 
> https://coderextreme.net/X3DJSONLD/x3d.stylesheets.zip

OK the content there (test.bat and nashorn) has been extracted into stylesheets directory.  Looks like you wanted it in stylesheets/nashorn, which is a peer of stylesheets/java (where X3DJSAIL gets autogenerated).

Everything from before (including smoke tests) still builds and runs OK.

Everything is checked in.

However, *also please advise* about location: am thinking that the nashorn directory tree needs to get moved from stylesheets/ level down inside stylesheets/java/ so that it can be included in x3djail.full.jar

Further, the test.nashorn target isn't working happily, ant is having with your nashorn script.  Console follows.

=================================================================
ant -f C:\\x3d-code\\www.web3d.org\\x3d\\stylesheets test.nashorn
test.nashorn:
Compiling 1 source file to C:\x3d-code\www.web3d.org\x3d\stylesheets\java\classes
Warning: toFileJavaScript() is overwriting prior file nashorn/examples/HelloWorldProgramOutput.js
Script DEF=colorTypeConversionScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
Script DEF=MaterialModulatorScript contains CDATA source-code text, copied as "#sourceText" using "strings" mode
HelloWorldProgramOutput self-validation test results: success
C:\x3d-code\www.web3d.org\x3d\stylesheets\build.xml:1594:
org.apache.bsf.BSFException: unsupported language: nashorn
	at org.apache.bsf.BSFManager.loadScriptingEngine(BSFManager.java:686)
	at org.apache.bsf.BSFManager.exec(BSFManager.java:485)
	at org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.java:98)
	at org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:53)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
	at sun.reflect.GeneratedMethodAccessor175.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:435)
	at org.apache.tools.ant.Target.performTasks(Target.java:456)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
	at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
	at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
	at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 3 seconds)
=================================================================

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20171217/0d118c7d/attachment-0001.html>


More information about the x3d-public mailing list