Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static io.roastedroot.proxywasm.Helpers.len;

import com.dylibso.chicory.experimental.aot.AotMachine;
import com.dylibso.chicory.runtime.ByteArrayMemory;
import com.dylibso.chicory.runtime.HostFunction;
import com.dylibso.chicory.runtime.ImportMemory;
Expand Down Expand Up @@ -324,7 +323,7 @@ public ProxyWasm build(Instance.Builder instanceBuilder) throws StartException {
var imports = ImportValues.builder();

if (this.machineFactory != null) {
instanceBuilder.withMachineFactory(AotMachine::new);
instanceBuilder.withMachineFactory(this.machineFactory);
}

imports.addMemory(Objects.requireNonNullElseGet(memory, this::defaultImportMemory));
Expand Down
17 changes: 17 additions & 0 deletions quarkus-x-kuadrant-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.dylibso.chicory</groupId>
<artifactId>aot-maven-plugin-experimental</artifactId>
<executions>
<execution>
<id>wasm-shim</id>
<goals>
<goal>wasm-aot-gen</goal>
</goals>
<configuration>
<name>io.roastedroot.proxywasm.kuadrant.example.WasmShim</name>
<wasmFile>src/main/wasm/wasm_shim.wasm</wasmFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.roastedroot.proxywasm.kuadrant.example;

import com.dylibso.chicory.wasm.Parser;
import com.dylibso.chicory.wasm.WasmModule;
import io.roastedroot.proxywasm.LogHandler;
import io.roastedroot.proxywasm.StartException;
import io.roastedroot.proxywasm.plugin.Plugin;
Expand All @@ -19,9 +17,6 @@
@ApplicationScoped
public class App {

private static WasmModule module =
Parser.parse(App.class.getResourceAsStream("wasm_shim.wasm"));

static final String CONFIG;

static {
Expand All @@ -42,10 +37,11 @@ public PluginFactory kuadrant() throws StartException {
return () ->
Plugin.builder()
.withName("kuadrant")
.withMachineFactory(WasmShimModule::create)
.withLogger(DEBUG ? LogHandler.SYSTEM : null)
.withPluginConfig(CONFIG)
.withUpstreams(Map.of("limitador", limitadorUrl))
.withMetricsHandler(new SimpleMetricsHandler())
.build(module);
.build(WasmShimModule.load());
}
}

This file was deleted.

Binary file not shown.
19 changes: 19 additions & 0 deletions quarkus-x-kuadrant-example/src/main/wasm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Attribution

The wasm_shim.wasm plugin comes from:

https://github.com/Kuadrant/wasm-shim

add to `Cargo.toml`:

```toml
[profile.release]
opt-level = "s"
debug = false
```

to build run:

```bash
cargo build --release --target wasm32-unknown-unknown
```
Binary file not shown.