Skip to content

Commit 528c66c

Browse files
committed
feat(build)!: switch from wasip1 to wasip2 - Pterodactyl driver currently broken because of servo/rust-url#960
1 parent 13c744c commit 528c66c

File tree

8 files changed

+25
-23
lines changed

8 files changed

+25
-23
lines changed

.github/workflows/rust_cli.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- name: Set Rust Toolchain
3030
uses: dtolnay/rust-toolchain@stable
3131
with:
32+
toolchain: nightly
3233
targets: ${{ matrix.target.platform }}
3334

3435
- name: Install Protobuf and MinGW (for Windows build)

.github/workflows/rust_clippy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
- name: Set Rust Toolchain
1717
uses: dtolnay/rust-toolchain@stable
1818
with:
19+
toolchain: nightly
1920
components: clippy
2021

2122
- name: Install Protobuf

.github/workflows/rust_controller.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
- name: Set Rust Toolchain
3333
uses: dtolnay/rust-toolchain@stable
3434
with:
35+
toolchain: nightly
3536
targets: ${{ matrix.target.platform }}
3637

3738
- name: Install Protobuf and MinGW (for Windows build)

.github/workflows/rust_pterodactyl.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,24 @@ jobs:
1717
- name: Checkout Repository
1818
uses: actions/checkout@v4
1919

20+
- name: Install wasi-sdk
21+
run: |
22+
mkdir tools/
23+
cd tools/
24+
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-24/wasi-sdk-24.0-x86_64-linux.deb
25+
sudo dpkg -i wasi-sdk-24.0-x86_64-linux.deb
26+
2027
- name: Set Rust Toolchain
2128
uses: dtolnay/rust-toolchain@stable
2229
with:
2330
toolchain: nightly
24-
targets: wasm32-wasip1
25-
26-
- name: Install wasm-tools
27-
run: |
28-
mkdir tools/
29-
cd tools/
30-
wget https://github.com/bytecodealliance/wasm-tools/releases/download/v1.209.0/wasm-tools-1.209.0-x86_64-linux.tar.gz
31-
tar -xvf wasm-tools-1.209.0-x86_64-linux.tar.gz
32-
mv wasm-tools-1.209.0-x86_64-linux/* .
31+
targets: wasm32-wasip2
3332

3433
- name: Build Driver
3534
run: |
3635
export RUSTFLAGS="-Z wasi-exec-model=reactor"
37-
cargo +nightly build -p pterodactyl --target wasm32-wasip1 --release
38-
./tools/wasm-tools component new ./target/wasm32-wasip1/release/pterodactyl.wasm \
39-
-o ./pterodactyl.wasm --adapt ./drivers/files/wasi_snapshot_preview1.reactor.wasm
36+
cargo build -p pterodactyl --target wasm32-wasip2 --release
37+
mv ./target/wasm32-wasip2/release/pterodactyl.wasm ./pterodactyl.wasm
4038
env:
4139
CURRENT_COMMIT: ${{ steps.commit.outputs.short }}
4240
CURRENT_BUILD: ${{ github.run_number }}

.github/workflows/rust_wrapper.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- name: Set Rust Toolchain
3030
uses: dtolnay/rust-toolchain@stable
3131
with:
32+
toolchain: nightly
3233
targets: ${{ matrix.target.platform }}
3334

3435
- name: Install Protobuf and MinGW (for Windows build)

Makefile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
.PHONY: run run-controller build build-controller build-wrapper build-drivers create-components clean fix
1+
.PHONY: run run-controller build build-controller build-wrapper build-drivers clean fix
22

33
# Configuration
44
WASM_RUSTFLAGS = -Z wasi-exec-model=reactor
5-
WASM_TARGET = wasm32-wasip1
6-
WASM_COMPONENT = target/wasm32-wasip1/release/pterodactyl.wasm
7-
WASM_ADAPT_COMPONENT = drivers/files/wasi_snapshot_preview1.reactor.wasm
5+
WASM_TARGET = wasm32-wasip2
6+
WASM_COMPONENT = target/wasm32-wasip2/release/pterodactyl.wasm
87

98
# Directories
109
RUN_DIR = run
@@ -43,7 +42,7 @@ fix:
4342
cargo clippy --fix --allow-dirty --allow-staged --all-targets --all-features
4443

4544
## Build target
46-
build: build-controller build-wrapper build-drivers create-components
45+
build: build-controller build-wrapper build-drivers
4746

4847
## Run target
4948
run: build run-controller
@@ -63,11 +62,7 @@ build-wrapper:
6362
## Build drivers target
6463
build-drivers:
6564
$(SETENV) RUSTFLAGS="$(WASM_RUSTFLAGS)"
66-
cargo +nightly build -p pterodactyl --target $(WASM_TARGET) --release
67-
68-
## Component target
69-
create-components: $(DRIVER_DIR)
70-
wasm-tools component new $(WASM_COMPONENT) -o $(DRIVER_DIR)/pterodactyl.wasm --adapt $(WASM_ADAPT_COMPONENT)
65+
cargo build -p pterodactyl --target $(WASM_TARGET) --release
7166

7267
# Create driver directory if it doesn't exist
7368
$(DRIVER_DIR):

controller/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ prost = "0.13.1"
3838
tonic = "0.12.2"
3939

4040
# Drivers
41-
wasmtime = { version = "24.0.0", default-features = false, features = ["runtime", "component-model", "cranelift", "parallel-compilation", "cache"], optional = true }
41+
# TODO: Disable gc when wasmtime 25 is released
42+
wasmtime = { version = "24.0.0", default-features = false, features = ["runtime", "component-model", "cranelift", "parallel-compilation", "cache", "gc"], optional = true }
4243
wasmtime-wasi = { version = "24.0.0", optional = true }
4344
minreq = { version = "2.12.0", features = ["https-rustls"], optional = true }
4445

rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "nightly"
3+
components = ["rustfmt", "clippy"]
4+
targets = ["wasm32-wasip2"]

0 commit comments

Comments
 (0)