JWebAssembly icon indicating copy to clipboard operation
JWebAssembly copied to clipboard

no output

Open john5634 opened this issue 1 year ago • 1 comments

Hi! Again very excited to see this work.

I run a build and no wasm is generated? How do I get it to make the wasm? and where does it go?

I have the following build script: `buildscript { repositories { maven { url uri('https://jitpack.io') } } dependencies { classpath 'com.github.i-net-software:jwebassembly-gradle:master-SNAPSHOT' } } apply plugin: 'de.inetsoftware.jwebassembly' repositories { maven { url 'https://jitpack.io' } } dependencies { implementation 'com.github.i-net-software:jwebassembly-api:master-SNAPSHOT' } sourceSets { main { java { srcDir 'src/main/java' } } }

wasm { //Get more debug information if there are problems. //logging.level = LogLevel.DEBUG //logging.levelInternal = LogLevel.DEBUG

//Change the output format to the text format *.wat.
//This can be helpful to understand the problems if you see the generated code as text format.
//format = 'text'

//The used JWebAssembly compiler version. The default is the latest release '+'.
//You can set any valid Gradle version string or a full dependency string.
//The snapshot version is recommended until a stable release.
//compilerVersion = 0.2
compilerVersion = 'com.github.i-net-software:jwebassembly:master-SNAPSHOT'

//Write method and parameter names into the output *.wasm file.
//The file will be approximate 10% larger. And it generate a source map.
//With a source map you can see in the debugger of the browser your source code if available.
debugNames = true

//Set an absolute or relative path between the final wasm file location and the source files location.
///This is needed for debugging in the browser. It work only if debugNames = true.
//sourceMapBase = '../../src/main/java/'
sourceMapBase = '/src/main/java/'

//set the destination dir
//destinationDir = file( 'targetDir' )

//ignore all referenced native methods without declared replacement in a library and replace them with a stub that throws an exception at runtime
//ignoreNative = true

}`

And java: `import de.inetsoftware.jwebassembly.api.annotation.Export; import de.inetsoftware.jwebassembly.web.dom.Document; import de.inetsoftware.jwebassembly.web.dom.HTMLElement; import de.inetsoftware.jwebassembly.web.dom.Text; import de.inetsoftware.jwebassembly.web.dom.Window;

public class HelloWorld {

@Export
public static void main() {
    Document document = Window.document();
    HTMLElement div = document.createElement("div");
    Text text = document.createTextNode("Hello World, this text come from WebAssembly.");
    div.appendChild( text );
    document.body().appendChild( div );
}

}`

john5634 avatar Jul 18 '23 03:07 john5634