Skip to content

Commit

Permalink
Remove the cargo workspace as it breaks Docker builds -- Docker canno…
Browse files Browse the repository at this point in the history
…t include files from a parent directory into an image. I would also like each project to stay independent (not connected through a parent).

Signed-off-by: Michael Yuan <michael@secondstate.io>
  • Loading branch information
juntao committed May 19, 2023
1 parent ebbbf7a commit 9fc89d4
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 142 deletions.
53 changes: 0 additions & 53 deletions .github/workflows/release.yml

This file was deleted.

21 changes: 0 additions & 21 deletions Cargo.toml

This file was deleted.

13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Simple Rust applications that run in WasmEdge. They also serve as a good learnin

You can just [install Docker Desktop](https://www.docker.com/products/docker-desktop/).

Or, you could install [Rust](https://www.rust-lang.org/tools/install) and [WasmEdge](https://wasmedge.org/book/en/quick_start/install.html) as follows.
Or, you could install [Rust](https://www.rust-lang.org/tools/install) and [WasmEdge](https://wasmedge.org/docs/develop/build-and-run/install) as follows.

```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Expand All @@ -16,8 +16,6 @@ rustup target add wasm32-wasi
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -p /usr/local
```

**Note**: Running `cargo build` in any package directory the output will get stored at parent directory of folder because of Cargo Workspace.

```
├── Cargo.lock
├── Cargo.toml
Expand All @@ -29,7 +27,6 @@ curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/insta
├── server
├── string
├── struct
├── target # Your Build files
└── wasi
```

Expand All @@ -48,14 +45,6 @@ This set of examples demonstrate Rust apps that each has a `main()` function and
* [Use OS system libraries](wasi/)
* [Create an HTTP server](server/)

## Library examples

This set of examples demonstrate Rust library functions that can be called from outside of the WasmEdge Runtime (i.e., in a host application).

* [Add two numbers](add/)
* [Pass a string to the function](string/)
* [Parse JSON](json/)

## More examples

For Rust apps that compile to Wasm and run inside WasmEdge.
Expand Down
9 changes: 3 additions & 6 deletions control/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "control"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "control"
Expand Down
2 changes: 1 addition & 1 deletion control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge ../target/wasm32-wasi/release/control.wasm
$ wasmedge target/wasm32-wasi/release/control.wasm
Hello WasmEdge!
Howdy WasmEdge!
Hola WasmEdge!
Expand Down
9 changes: 3 additions & 6 deletions function/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "function"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "function"
Expand Down
2 changes: 1 addition & 1 deletion function/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge ../target/wasm32-wasi/release/function.wasm
$ wasmedge target/wasm32-wasi/release/function.wasm
Hello WasmEdge!
Howdy WasmEdge!
Hola WasmEdge!
Expand Down
9 changes: 3 additions & 6 deletions hello/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "hello"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "hello"
Expand Down
2 changes: 1 addition & 1 deletion hello/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge ../target/wasm32-wasi/release/hello.wasm
$ wasmedge target/wasm32-wasi/release/hello.wasm
Hello WasmEdge!
```

Expand Down
9 changes: 3 additions & 6 deletions move/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "move"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "move"
Expand Down
2 changes: 1 addition & 1 deletion move/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge ../target/wasm32-wasi/release/move.wasm
$ wasmedge target/wasm32-wasi/release/move.wasm
```

## Build and publish on Docker
Expand Down
9 changes: 3 additions & 6 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "server"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "server"
Expand Down
2 changes: 1 addition & 1 deletion server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge ../target/wasm32-wasi/release/server.wasm
$ wasmedge target/wasm32-wasi/release/server.wasm
Listening on http://0.0.0.0:8080
```

Expand Down
9 changes: 3 additions & 6 deletions string/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "string"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "string"
Expand Down
2 changes: 1 addition & 1 deletion string/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge ../target/wasm32-wasi/release/string.wasm
$ wasmedge target/wasm32-wasi/release/string.wasm
... ART ...
Hello WasmEdge!
Howdy WasmEdge!
Expand Down
9 changes: 3 additions & 6 deletions struct/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "struct"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "struct"
Expand Down
2 changes: 1 addition & 1 deletion struct/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge ../target/wasm32-wasi/release/struct.wasm
$ wasmedge target/wasm32-wasi/release/struct.wasm
English Hello WasmEdge!
Spanish Hola WasmEdge!
Texan Howdy WasmEdge!
Expand Down
9 changes: 3 additions & 6 deletions wasi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[package]
name = "wasi"
edition.workspace = true
version.workspace = true
authors.workspace = true
description.workspace = true
homepage.workspace = true
documentation.workspace = true
version = "0.1.0"
authors = ["ubuntu"]
edition = "2018"

[[bin]]
name = "wasi"
Expand Down
2 changes: 1 addition & 1 deletion wasi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $ cargo build --target wasm32-wasi --release
Run the Wasm bytecode file in WasmEdge CLI.

```
$ wasmedge --dir .:. ../target/wasm32-wasi/release/wasi.wasm
$ wasmedge --dir .:. target/wasm32-wasi/release/wasi.wasm
Random number: -1157533356
Random bytes: [159, 159, 9, 119, 106, 172, 207, 82, 173, 145, 233, 214, 104, 35, 23, 53, 155, 12, 102, 231, 117, 67, 192, 215, 207, 202, 128, 198, 213, 41, 235, 57, 89, 223, 138, 70, 185, 137, 74, 162, 42, 20, 226, 177, 114, 170, 172, 39, 149, 99, 122, 68, 115, 205, 155, 202, 4, 48, 178, 224, 124, 42, 24, 56, 215, 90, 203, 150, 106, 128, 127, 201, 177, 187, 20, 195, 172, 56, 72, 28, 53, 163, 59, 36, 129, 160, 69, 203, 196, 72, 113, 61, 46, 249, 81, 134, 94, 134, 159, 51, 233, 247, 253, 116, 202, 210, 100, 75, 74, 95, 197, 44, 81, 87, 89, 115, 20, 226, 143, 139, 50, 60, 196, 59, 206, 105, 161, 226]
Printed from wasi: This is from a main function
Expand Down

0 comments on commit 9fc89d4

Please sign in to comment.