diff --git a/settings.gradle.kts b/settings.gradle.kts index f95772560..6c62d028c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -49,6 +49,7 @@ include("tools:ide-deps") include("tools:idea") include("tools:maven:plugin") include("tools:maven:webapp") +include("tools:maven:webapp-wasm-gc") include("tools:classlib-comparison-gen") include("tools:wasm-disassembly") include("tests") diff --git a/tools/maven/webapp-wasm-gc/build.gradle.kts b/tools/maven/webapp-wasm-gc/build.gradle.kts new file mode 100644 index 000000000..27797a9ba --- /dev/null +++ b/tools/maven/webapp-wasm-gc/build.gradle.kts @@ -0,0 +1,34 @@ +/* + * Copyright 2023 Alexey Andreev. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + java + publishing + `teavm-publish` +} + +description = "An archetype that creates a simple Wasm GC web application" + +tasks.processResources { + expand( + "teavmVersion" to version, + ) +} + +teavmPublish { + artifactId = "teavm-maven-webapp-wasm-gc" + packaging = "maven-archetype" +} \ No newline at end of file diff --git a/tools/maven/webapp-wasm-gc/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/maven/webapp-wasm-gc/src/main/resources/META-INF/maven/archetype-metadata.xml new file mode 100644 index 000000000..8c7fce9d5 --- /dev/null +++ b/tools/maven/webapp-wasm-gc/src/main/resources/META-INF/maven/archetype-metadata.xml @@ -0,0 +1,20 @@ + + + + src/main/java + + + . + + pom.xml + + + + src/main/webapp + + + \ No newline at end of file diff --git a/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/pom.xml b/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/pom.xml new file mode 100644 index 000000000..d645aaa5c --- /dev/null +++ b/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/pom.xml @@ -0,0 +1,122 @@ + + 4.0.0 + + \${groupId} + \${artifactId} + \${version} + war + + + 11 + ${teavmVersion} + UTF-8 + + + + + + org.teavm + teavm-classlib + \${teavm.version} + provided + + + + + org.teavm + teavm-jso-apis + \${teavm.version} + provided + + + + + jakarta.servlet + jakarta.servlet-api + 6.0.0 + provided + + + + + + + + maven-compiler-plugin + 3.13.0 + + \${java.version} + \${java.version} + + + + + + maven-war-plugin + 3.4.0 + + + + \${project.build.directory}/generated/wasm + + + + + + + + org.teavm + teavm-maven-plugin + \${teavm.version} + + + web-client-wasm + + compile + + + + \${project.build.directory}/generated/wasm/teavm + + WEBASSEMBLY_GC + + + \${package}.Client + + + ADVANCED + + + true + + + true + + --> + true + + + true + + + + web-client-runtime + + copy-webassembly-gc-runtime + + + \${project.build.directory}/generated/wasm/teavm + + + + + + + \ No newline at end of file diff --git a/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/src/main/java/Client.java b/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/src/main/java/Client.java new file mode 100644 index 000000000..3ffcb3c72 --- /dev/null +++ b/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/src/main/java/Client.java @@ -0,0 +1,12 @@ +package \${package}; + +import org.teavm.jso.dom.html.HTMLDocument; + +public class Client { + public static void main(String[] args) { + var document = HTMLDocument.current(); + var div = document.createElement("div"); + div.appendChild(document.createTextNode("TeaVM generated element")); + document.getBody().appendChild(div); + } +} diff --git a/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/src/main/webapp/index.html b/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/src/main/webapp/index.html new file mode 100644 index 000000000..ecd381f11 --- /dev/null +++ b/tools/maven/webapp-wasm-gc/src/main/resources/archetype-resources/src/main/webapp/index.html @@ -0,0 +1,24 @@ + + + + Main page + + + + + + + + \ No newline at end of file diff --git a/tools/maven/webapp/src/main/resources/archetype-resources/pom.xml b/tools/maven/webapp/src/main/resources/archetype-resources/pom.xml index 9a10b4bd7..612d83964 100644 --- a/tools/maven/webapp/src/main/resources/archetype-resources/pom.xml +++ b/tools/maven/webapp/src/main/resources/archetype-resources/pom.xml @@ -44,7 +44,7 @@ maven-compiler-plugin - 3.1 + 3.13.0 \${java.version} \${java.version} @@ -54,7 +54,7 @@ maven-war-plugin - 3.3.2 + 3.4.0