Skip to content

Commit 422e7d4

Browse files
committed
feat: move hello_world example to self contained package
Signed-off-by: Martijn Swaagman <[email protected]>
1 parent 592e433 commit 422e7d4

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/bazel-*
2-
/target
3-
/Cargo.lock
2+
target
3+
Cargo.lock

Cargo.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ hashbrown = "0.12"
1616
log = "0.4"
1717
wee_alloc = { version = "0.4", optional = true }
1818

19-
[dev-dependencies]
20-
cfg-if = "1.0"
21-
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
22-
23-
[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies]
24-
getrandom = "0.2"
25-
2619
[profile.release]
2720
lto = true
2821
opt-level = 3
@@ -35,7 +28,7 @@ genmode = "Remote"
3528

3629
[[example]]
3730
name = "hello_world"
38-
path = "examples/hello_world/main.rs"
31+
path = "examples/hello_world/lib.rs"
3932
crate-type = ["cdylib"]
4033

4134
[[example]]

examples/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ load("@rules_rust//rust:defs.bzl", "rust_binary")
22

33
rust_binary(
44
name = "hello_world",
5-
srcs = ["hello_world/main.rs"],
5+
srcs = ["hello_world/src/lib.rs"],
66
crate_type = "cdylib",
77
edition = "2018",
88
out_binary = True,

examples/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ services:
2020
- "10000:10000"
2121
volumes:
2222
- ./${EXAMPLE:-hello_world}/envoy.yaml:/etc/envoy/envoy.yaml
23-
- ../target/wasm32-wasi/debug/examples:/etc/envoy/filters
23+
- ./${EXAMPLE:-hello_world}/target/wasm32-wasi/debug:/etc/envoy/filters
2424
networks:
2525
- envoymesh
2626

examples/hello_world/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
publish = false
3+
name = "proxy-wasm-hello-world"
4+
version = "0.0.1"
5+
authors = ["Piotr Sikora <[email protected]>"]
6+
description = "Proxy-Wasm plugin example: hello world"
7+
license = "Apache-2.0"
8+
edition = "2018"
9+
10+
[lib]
11+
crate-type = ["cdylib"]
12+
13+
[dependencies]
14+
log = "0.4"
15+
chrono = { version = "0.4", default-features = false, features = ["clock", "std"] }
16+
wee_alloc = { version = "0.4", optional = true }
17+
cfg-if = "1.0"
18+
proxy-wasm = { path = "../../" }
19+
20+
[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dependencies]
21+
getrandom = "0.2"

examples/hello_world/envoy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ static_resources:
4242
vm_id: "hello_world_vm"
4343
code:
4444
local:
45-
filename: "/etc/envoy/filters/hello_world.wasm"
45+
filename: "/etc/envoy/filters/proxy_wasm_hello_world.wasm"
4646
- name: envoy.filters.http.router
File renamed without changes.

0 commit comments

Comments
 (0)