renatoathaydes / wasm-on-jvm

A Gradle Plugin to compile WASM to JVM easily
BSD 2-Clause "Simplified" License
23 stars 1 forks source link

Example fails to be built. #1

Open vi opened 2 years ago

vi commented 2 years ago
wasm-on-jvm/examples/hello-world$ gradle compileJava
Starting a Gradle Daemon (subsequent builds will be faster)
Download https://plugins.gradle.org/m2/gradle/plugin/com/athaydes/wasm/wasm-gradle-plugin/1.0/wasm-gradle-plugin-1.0.pom
Download https://plugins.gradle.org/m2/com/github/cretz/asmble/asmble-compiler/0.3.0/asmble-compiler-0.3.0.pom
Download https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.2.51/kotlin-stdlib-1.2.51.pom.pom
Download https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-reflect/1.2.51/kotlin-reflect-1.2.51.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-util/5.2/asm-util-5.2.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-tree/5.2/asm-tree-5.2.pom
Download https://plugins.gradle.org/m2/com/github/cretz/asmble/asmble-annotations/0.3.0/asmble-annotations-0.3.0.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-parent/5.2/asm-parent-5.2.pom
Download https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.2.51/kotlin-stdlib-common-1.2.51.pom
Download https://plugins.gradle.org/m2/org/ow2/asm/asm/5.2/asm-5.2.pom
Download https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib/1.2.51/kotlin-stdlib-1.2.51.jar
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-util/5.2/asm-util-5.2.jar
Download https://plugins.gradle.org/m2/org/ow2/asm/asm/5.2/asm-5.2.jar
Download https://plugins.gradle.org/m2/gradle/plugin/com/athaydes/wasm/wasm-gradle-plugin/1.0/wasm-gradle-plugin-1.0.jar
Download https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-common/1.2.51/kotlin-stdlib-common-1.2.51.jar
Download https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-reflect/1.2.51/kotlin-reflect-1.2.51.jar
Download https://plugins.gradle.org/m2/org/ow2/asm/asm-tree/5.2/asm-tree-5.2.jar
Download https://plugins.gradle.org/m2/com/github/cretz/asmble/asmble-compiler/0.3.0/asmble-compiler-0.3.0.jar
Download https://plugins.gradle.org/m2/com/github/cretz/asmble/asmble-annotations/0.3.0/asmble-annotations-0.3.0.jar

FAILURE: Build failed with an exception.

* Where:
Build file '/mnt/bkel/vi/src/wasm-on-jvm/examples/configured-c-to-wasm/build.gradle' line: 17

* What went wrong:
A problem occurred evaluating project ':configured-c-to-wasm'.
> Failed to apply plugin [id 'com.athaydes.wasm']
   > Extension of type 'SourceSetContainer' does not exist. Currently registered extension types: [ExtraPropertiesExtension, DefaultArtifactPublicationSet, ReportingExtension, WasmExtension]

* 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 11s

$ gradle --version

------------------------------------------------------------
Gradle 4.4.1
renatoathaydes commented 2 years ago

Why are you using such old Gradle version?

As you can see in gradle.properties this project uses Gradle 5.2.1 (which is also old, but should work with Gradle 6 and maybe even 7).

Gradle 4 is very old and the upgrade to Gradle 5 broke lots of stuff.

To make sure the project works, don't use gradle, use ./gradlew.

vi commented 2 years ago

Indeed, using gradle wrapper make complication successful:

$ ../../gradlew compileJava
Downloading https://services.gradle.org/distributions/gradle-5.2.1-all.zip
..............................................................................................................................

Welcome to Gradle 5.2.1!

Here are the highlights of this release:
 - Define sets of dependencies that work together with Java Platform plugin
 - New C++ plugins with dependency management built-in
 - New C++ project types for gradle init
 - Service injection into plugins and project extensions

For more details see https://docs.gradle.org/5.2.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Task :hello-world:compileWasm
Compiling wasm file /mnt/bkel/vi/src/wasm-on-jvm/examples/hello-world/src/main/wasm/HelloWasm.wast to class HelloWasm

> Task :hello-world:compileJava
warning: unknown enum constant WasmExternalKind.FUNCTION
  reason: class file for asmble.annotation.WasmExternalKind not found
1 warning

BUILD SUCCESSFUL in 40s
2 actionable tasks: 2 executed
$ java -cp build/classes/java/main:build/classes/wasm/main Hello
WASM says 42

Maybe hello-world's README should mention Gradle version, or ../../gradlew instead of just gradle, so that it would be clear that there is specific Gradle version?

4.4.1 is gradle version in current's Debian stable.