From b6238124c7352a10aea971266d55f9d015a04cae Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 7 Jun 2020 12:00:40 +0200 Subject: [PATCH] Replace gradle node plugin and switch to V8 canary. --- build.gradle | 22 ------------------- .../binary/BinaryModuleWriter.java | 2 +- .../jwebassembly/ScriptEngine.java | 2 +- .../inetsoftware/jwebassembly/WasmRule.java | 13 ++++++++--- 4 files changed, 12 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index ad2037e..ad790ae 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,4 @@ plugins { - id "com.github.node-gradle.node" version "2.2.3" id 'com.github.kt3k.coveralls' version '2.8.2' // Coverage id "com.jfrog.bintray" version "1.8.4" } @@ -83,27 +82,6 @@ artifacts { archives javadocJar } -node { - version = '14.0.0' -// version = '+' - download = true -} - -task nodeVersion(type: NodeTask) { - test.dependsOn it - options = ['-v'] - script = file("$buildDir/tmp/scriptDoesNotExists.js") - script.parentFile.mkdirs() - script.text = '' - doLast { - if( node.download ) { - def nodeDir = nodeSetup.getNodeDir() // dir is only valid if downloaded - println nodeDir - test.systemProperty 'node.dir', nodeDir - } - } -} - test { systemProperty "file.encoding", "UTF-8" testLogging { diff --git a/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java b/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java index a2bedd5..8254f02 100644 --- a/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java +++ b/src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java @@ -125,8 +125,8 @@ public class BinaryModuleWriter extends ModuleWriter implements InstructionOpcod writeSection( SectionType.Function, functions.values() ); writeTableSection(); writeMemorySection(); + writeEventSection(); writeSection( SectionType.Global, globals.values() ); - writeEventSection(); // TODO event section before global section writeSection( SectionType.Export, exports ); writeStartSection(); writeElementSection(); diff --git a/test/de/inetsoftware/jwebassembly/ScriptEngine.java b/test/de/inetsoftware/jwebassembly/ScriptEngine.java index eaa7bff..f056446 100644 --- a/test/de/inetsoftware/jwebassembly/ScriptEngine.java +++ b/test/de/inetsoftware/jwebassembly/ScriptEngine.java @@ -44,7 +44,7 @@ public enum ScriptEngine { public static ScriptEngine[] testEngines() { ScriptEngine[] val = { // SpiderMonkey, // - //TODO NodeJS, // + NodeJS, // //TODO NodeWat, // SpiderMonkeyWat,// //TODO Wat2Wasm, // diff --git a/test/de/inetsoftware/jwebassembly/WasmRule.java b/test/de/inetsoftware/jwebassembly/WasmRule.java index b8a5017..180c402 100644 --- a/test/de/inetsoftware/jwebassembly/WasmRule.java +++ b/test/de/inetsoftware/jwebassembly/WasmRule.java @@ -57,6 +57,8 @@ public class WasmRule extends TemporaryFolder { private static final SpiderMonkey spiderMonkey = new SpiderMonkey(); + private static final Node node = new Node(); + private static final Wat2Wasm wat2Wasm = new Wat2Wasm(); private static boolean npmWabtNightly; @@ -619,10 +621,12 @@ public class WasmRule extends TemporaryFolder { * The executable of the node command. * * @return the node executable + * @throws IOException + * if any I/O error occur */ @Nonnull - private static String nodeExecuable() { - String command = System.getProperty( "node.dir" ); + private static String nodeExecuable() throws IOException { + String command = node.getNodeDir(); if( command == null ) { command = "node"; } else { @@ -641,14 +645,17 @@ public class WasmRule extends TemporaryFolder { * @param script * the path to the script that should be executed * @return the value from the script + * @throws IOException + * if any I/O error occur */ - private static ProcessBuilder nodeJsCommand( File script ) { + private static ProcessBuilder nodeJsCommand( File script ) throws IOException { String command = nodeExecuable(); // details see with command: node --v8-options ProcessBuilder processBuilder = new ProcessBuilder( command, // "--experimental-wasm-mv", // multi value "--experimental-wasm-eh", // exception handling "--experimental-wasm-anyref", // + "--experimental-wasm-gc", // "--experimental-wasm-bigint", // "--experimental-wasm-bulk-memory", // bulk memory for WABT version 1.0.13, https://github.com/WebAssembly/wabt/issues/1311 script.getName() );