Debian Codegraph @

third_party/rust/wasi/ci/regenerate.sh

raw
1 #!/bin/sh
2
3 set -ex
4
5 generate() {
6 file="$1"
7 shift
8 wit-bindgen rust wit --async none --out-dir src --std-feature "$@" --format \
9 --runtime-path wit_bindgen_rt
10 }
11
12 # Generate the main body of the bindings which includes all imports from the two
13 # worlds below.
14 generate src/bindings.rs --type-section-suffix rust-wasi-from-crates-io \
15 --generate-all
16
17 # Generate bindings for the `wasi:cli/command` world specifically, namely the
18 # macro `export_command`.
19 #
20 # Note that `--with` is used to point at the previously generated bindings.
21 with="wasi:cli/[email protected]=crate::cli::environment"
22 with="$with,wasi:cli/[email protected]=crate::cli::exit"
23 with="$with,wasi:cli/[email protected]=crate::cli::stdin"
24 with="$with,wasi:cli/[email protected]=crate::cli::stdout"
25 with="$with,wasi:cli/[email protected]=crate::cli::stderr"
26 with="$with,wasi:cli/[email protected]=crate::cli::terminal_input"
27 with="$with,wasi:cli/[email protected]=crate::cli::terminal_output"
28 with="$with,wasi:cli/[email protected]=crate::cli::terminal_stdin"
29 with="$with,wasi:cli/[email protected]=crate::cli::terminal_stdout"
30 with="$with,wasi:cli/[email protected]=crate::cli::terminal_stderr"
31 with="$with,wasi:clocks/[email protected]=crate::clocks::monotonic_clock"
32 with="$with,wasi:clocks/[email protected]=crate::clocks::wall_clock"
33 with="$with,wasi:filesystem/[email protected]=crate::filesystem::types"
34 with="$with,wasi:filesystem/[email protected]=crate::filesystem::preopens"
35 with="$with,wasi:io/[email protected]=crate::io::error"
36 with="$with,wasi:io/[email protected]=crate::io::poll"
37 with="$with,wasi:io/[email protected]=crate::io::streams"
38 with="$with,wasi:random/[email protected]=crate::random::random"
39 with="$with,wasi:random/[email protected]=crate::random::insecure"
40 with="$with,wasi:random/[email protected]=crate::random::insecure_seed"
41 with="$with,wasi:sockets/[email protected]=crate::sockets::network"
42 with="$with,wasi:sockets/[email protected]=crate::sockets::instance_network"
43 with="$with,wasi:sockets/[email protected]=crate::sockets::tcp"
44 with="$with,wasi:sockets/[email protected]=crate::sockets::tcp_create_socket"
45 with="$with,wasi:sockets/[email protected]=crate::sockets::udp"
46 with="$with,wasi:sockets/[email protected]=crate::sockets::udp_create_socket"
47 with="$with,wasi:sockets/[email protected]=crate::sockets::ip_name_lookup"
48 generate src/command.rs \
49 --world wasi:cli/command \
50 --with "$with" \
51 --type-section-suffix rust-wasi-from-crates-io-command-world \
52 --default-bindings-module wasi \
53 --pub-export-macro \
54 --export-macro-name _export_command
55
56 # Same as the `command` world, but for the proxy world.
57 with="wasi:cli/[email protected]=crate::cli::stdin"
58 with="$with,wasi:cli/[email protected]=crate::cli::stdout"
59 with="$with,wasi:cli/[email protected]=crate::cli::stderr"
60 with="$with,wasi:clocks/[email protected]=crate::clocks::monotonic_clock"
61 with="$with,wasi:clocks/[email protected]=crate::clocks::wall_clock"
62 with="$with,wasi:io/[email protected]=crate::io::error"
63 with="$with,wasi:io/[email protected]=crate::io::poll"
64 with="$with,wasi:io/[email protected]=crate::io::streams"
65 with="$with,wasi:random/[email protected]=crate::random::random"
66 with="$with,wasi:http/[email protected]=crate::http::types"
67 with="$with,wasi:http/[email protected]=crate::http::outgoing_handler"
68 generate src/proxy.rs \
69 --world wasi:http/proxy \
70 --with "$with" \
71 --type-section-suffix rust-wasi-from-crates-io-proxy-world \
72 --default-bindings-module wasi \
73 --pub-export-macro \
74 --export-macro-name _export_proxy