-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathMakefile
More file actions
119 lines (102 loc) · 3.62 KB
/
Makefile
File metadata and controls
119 lines (102 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Default to using regular `cargo`. CI targets may override this.
VICEROY_CARGO=cargo
.PHONY: format
format:
$(VICEROY_CARGO) fmt
cd wasm_abi/adapter && $(VICEROY_CARGO) fmt
.PHONY: format-check
format-check:
$(VICEROY_CARGO) fmt -- --check
.PHONY: clippy
clippy:
$(VICEROY_CARGO) clippy --all -- -D warnings
.PHONY: test
test: test-crates trap-test
.PHONY: test-crates
test-crates: fix-build
RUST_BACKTRACE=1 $(VICEROY_CARGO) test --all
.PHONY: fix-build
fix-build:
cd test-fixtures && $(VICEROY_CARGO) build --target=wasm32-wasip1
.PHONY: trap-test
trap-test: fix-build
cd cli/tests/trap-test && RUST_BACKTRACE=1 $(VICEROY_CARGO) test fatal_error_traps -- --nocapture
# The `trap-test` is its own top-level target for CI in order to achieve better build parallelism.
.PHONY: trap-test-ci
trap-test-ci: VICEROY_CARGO=cargo --locked
trap-test-ci: trap-test
# The main `ci` target runs everything except `trap-test`.
.PHONY: ci
ci: VICEROY_CARGO=cargo --locked
ci: format-check test-crates
.PHONY: clean
clean:
$(VICEROY_CARGO) clean
cd cli/tests/trap-test/ && $(VICEROY_CARGO) clean
# Open the documentation for the workspace in a browser.
.PHONY: doc
doc:
$(VICEROY_CARGO) doc --workspace --open
# Open the documentation for the workspace in a browser.
#
# Note: This includes private items, which can be useful for development.
.PHONY: doc-dev
doc-dev:
$(VICEROY_CARGO) doc --no-deps --document-private-items --workspace --open
# Run `cargo generate-lockfile` for all of the crates in the project.
.PHONY: generate-lockfile
generate-lockfile:
$(VICEROY_CARGO) generate-lockfile
$(VICEROY_CARGO) generate-lockfile --manifest-path=test-fixtures/Cargo.toml
$(VICEROY_CARGO) generate-lockfile --manifest-path=cli/tests/trap-test/Cargo.toml
# Regenerate the adapter, and move it into `wasm_abi/data`
.PHONY: build-adapter
build-adapter:
# Build the component adapter for adapting the host-call abi to the
# component model. This version uses `--no-default-features` to disable
# the default "exports" feature, to build the imports-only "library"
# version of the adapter.
( \
cd wasm_abi/adapter && \
cargo build \
--package viceroy-component-adapter \
--target wasm32-unknown-unknown \
--no-default-features \
--profile release-library \
)
# Build the non-shift "library" version of the adapter.
( \
cd wasm_abi/adapter && \
cargo build \
--package viceroy-component-adapter \
--target wasm32-unknown-unknown \
--no-default-features \
--profile release-library-noshift \
--features noshift \
)
# Build the component adapter for adapting the host-call abi to the
# component model. This is the normal version that includes the exports.
( \
cd wasm_abi/adapter && \
cargo build \
--package viceroy-component-adapter \
--target wasm32-unknown-unknown \
--release \
)
# Build the non-shift normal version of the adapter.
( \
cd wasm_abi/adapter && \
cargo build \
--package viceroy-component-adapter \
--target wasm32-unknown-unknown \
--profile release-noshift \
--features noshift \
)
cp wasm_abi/adapter/target/wasm32-unknown-unknown/release/viceroy_component_adapter.wasm \
wasm_abi/data/viceroy-component-adapter.wasm
cp wasm_abi/adapter/target/wasm32-unknown-unknown/release-noshift/viceroy_component_adapter.wasm \
wasm_abi/data/viceroy-component-adapter.noshift.wasm
cp wasm_abi/adapter/target/wasm32-unknown-unknown/release-library/viceroy_component_adapter.wasm \
wasm_abi/data/viceroy-component-adapter.library.wasm
cp wasm_abi/adapter/target/wasm32-unknown-unknown/release-library-noshift/viceroy_component_adapter.wasm \
wasm_abi/data/viceroy-component-adapter.library.noshift.wasm