JWebAssembly icon indicating copy to clipboard operation
JWebAssembly copied to clipboard

Documentation on the Gradle Task is outdated/incomplete

Open manticore-projects opened this issue 2 years ago • 6 comments

Greetings.

Thank you for providing this project, I have an high interest in it. Although I have had a hard time to even follow the most basic Getting Started instructions. The information seems to be outdated. Below is the Gradle 7.4 configuration, which seems to work:

plugins {
    id 'java'

    // Web Assembly Compiler
    id "de.inetsoftware.jwebassembly" version "0.4"
}

repositories {
    mavenCentral()
    maven { url = uri('https://jitpack.io') }
}

dependencies {
    // Web Assembly Compiler
    implementation 'com.github.i-net-software:JWebAssembly:v0.4'
    implementation 'com.github.i-net-software:jwebassembly-api:master-SNAPSHOT'
}

Putting this into build gradle I have been able to import the Export annotation and to annotate my Java Method.

import de.inetsoftware.jwebassembly.api.annotation.Export;

  @Export
  public static String format(String sqlStr, String... options) throws Exception {
  ...
  }

manticore-projects avatar May 28 '22 13:05 manticore-projects

Also, you mention Java-8 as a requirement. However, this seems to be misleading as it yields into a java.lang.UnsupportedClassVersionError:

are@archlinux ~/d/s/J/JSQLFormatter (main) [1]> JAVA_HOME=/usr/lib/jvm/java-8-openjdk gradle --no-build-cache wasm

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.UnsupportedClassVersionError: de/inetsoftware/jwebassembly/gradle/WasmPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
> de/inetsoftware/jwebassembly/gradle/WasmPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 355ms
<-------------> 0% WAITING

manticore-projects avatar May 28 '22 14:05 manticore-projects

This is strange. I will check this out. Shouldn't be. Must have been an error when deploying the Gradle plugin.

Horcrux7 avatar May 28 '22 20:05 Horcrux7

buildscript { repositories { maven { url uri('https://jitpack.io') } maven { url 'https://repo.spongepowered.org/maven' } } dependencies { classpath 'com.github.i-net-software:jwebassembly-gradle:master-SNAPSHOT' } }

apply plugin: 'de.inetsoftware.jwebassembly'

group 'org.pepperoni' version '1.0'

repositories { maven { url 'https://jitpack.io' } maven { url 'https://repo.spongepowered.org/maven' } mavenCentral() } dependencies { // https://mvnrepository.com/artifact/de.inetsoftware/jwebassembly-api implementation 'com.github.i-net-software:jwebassembly-api:master-SNAPSHOT' // https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305 implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'

}

sourceSets { main.java.srcDirs += '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' )

}

pepperoni42069 avatar May 28 '22 21:05 pepperoni42069

Working build.gradle, java 8, also so this

pepperoni42069 avatar May 28 '22 21:05 pepperoni42069

@Eskerepvp you have a typo on the "this" link above. (it has an extra 'l' at the end).

The corrected link is: https://github.com/Eskerepvp/JWebAssembly-HelloWorld

Thanks for sharing that I was actually looking for it, I guess it was a good Idea for me to start tinkering with JWebAssembly today since I have been postponing that for a while now, and you just provided that yesterday hahaha.

I was noticing that apparently the project is lacking maintainers, based on the Question you opened. Would you mind sharing any info you have found to get started? I would also like contributing to this.

Greetings

Ordiel avatar May 30 '22 03:05 Ordiel

1 : Oops also thats outdated...

2: I haven't actually looked at the source code of JWebAssembly itself, only the API. But I have found some issues, the biggest one being that Kotlin doesn't work :(

I made a web framework for JWebAssembly-API if you would like to check it out!

Contributing would be nice, fixing my spaghetti code, and adding some of the features in the todo list would be greatly appreciated.

pepperoni42069 avatar May 30 '22 09:05 pepperoni42069