From 6689afad8c384ca4bec373014f6cae8522e3f44a Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Thu, 21 Dec 2023 15:09:32 -0800 Subject: [PATCH] chore(*) split the Cargo workspace between lib/ and t/lib/ To better manage automated dependencies and security updates, and help distinguish high-priority vs low-priority alerts. --- .github/workflows/ci.yml | 4 +- Cargo.toml | 18 - auto/cargo | 16 +- lib/Cargo.lock | 331 ++++++++++++++++++ lib/Cargo.toml | 5 + lib/ngx-wasm-rs/Cargo.toml | 4 - .../rust-toolchain.toml | 0 Cargo.lock => t/lib/Cargo.lock | 38 +- t/lib/Cargo.toml | 14 + util/clean.sh | 3 +- util/release.sh | 1 - util/test.sh | 4 +- 12 files changed, 386 insertions(+), 52 deletions(-) delete mode 100644 Cargo.toml create mode 100644 lib/Cargo.lock create mode 100644 lib/Cargo.toml rename rust-toolchain.toml => lib/rust-toolchain.toml (100%) rename Cargo.lock => t/lib/Cargo.lock (95%) create mode 100644 t/lib/Cargo.toml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 88853a6be..f71d59678 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -235,8 +235,8 @@ jobs: - name: 'Rust lint' if: ${{ !env.ACT }} run: | - cargo clippy --all-features - cd lib/ngx-wasm-rs && cargo clippy --all-features + cargo clippy --all-features --manifest-path lib/Cargo.toml + cargo clippy --all-features --manifest-path t/lib/Cargo.toml - run: | if [[ $(make reindex 2>&1 | tee reindex.out | grep -c done) -gt 0 ]]; then cat reindex.out >&2 diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index e005eb0ec..000000000 --- a/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[workspace] -members = [ - "lib/ngx-rust", - "t/lib/ngx-rust-tests", - "t/lib/ngx-lua-tests", - "t/lib/wasi-vm-tests", - "t/lib/wasi-host-tests", - "t/lib/proxy-wasm-tests/on-tick", - "t/lib/proxy-wasm-tests/on-phases", - "t/lib/proxy-wasm-tests/hostcalls", - "t/lib/proxy-wasm-tests/rust-sdk-ver-zero-one", - "t/lib/proxy-wasm-tests/benchmarks", - "t/lib/proxy-wasm-tests/instance-lifecycle", - "t/lib/proxy-wasm-tests/context-checks", -] -exclude = [ - "lib/ngx-wasm-rs", -] diff --git a/auto/cargo b/auto/cargo index 0e9aeca5f..3fa4c0d79 100644 --- a/auto/cargo +++ b/auto/cargo @@ -16,6 +16,7 @@ fi ngx_wasm_cargo_feature_path="$ngx_wasm_runtime_path" ngx_wasm_push_dir=$(pwd) + cd $ngx_wasm_cargo_lib_dir if [ "$NGX_WASM_CARGO_PROFILE" = "debug" ]; then @@ -27,7 +28,12 @@ else ngx_wasm_cargo_profile_flag=--release fi -cargo build $ngx_wasm_cargo_profile_flag $ngx_wasm_cargo_flags +cargo build \ + --lib \ + --target-dir $ngx_wasm_cargo_lib_dir/target \ + $ngx_wasm_cargo_profile_flag \ + $ngx_wasm_cargo_flags + ngx_wasm_rc=$? ngx_wasm_cargo_target_dir=$ngx_wasm_cargo_lib_dir/target/$ngx_wasm_cargo_profile @@ -44,13 +50,13 @@ if [ $ngx_wasm_rc = 0 ]; then -L$ngx_wasm_cargo_target_dir \ -l$ngx_wasm_cargo_lib_name" - if [ "$NGX_RPATH" = YES ]; then + if [ "$NGX_RPATH" = YES ]; then ngx_feature_libs="\ -R $ngx_wasm_cargo_target_dir \ -R $NGX_PREFIX/lib \ $ngx_feature_libs" - elif [ "$NGX_WASM_RUNTIME_NO_RPATH" != 1 ]; then + elif [ "$NGX_WASM_RUNTIME_NO_RPATH" != 1 ]; then ngx_feature_libs="\ -Wl,-rpath=$ngx_wasm_cargo_target_dir \ -Wl,-rpath=$NGX_PREFIX/lib \ @@ -105,9 +111,7 @@ if [ $ngx_found = no ]; then exit 1 fi - echo "$0: warning: the following functionality is not available for $ngx_addon_name:" - echo " $ngx_wasm_cargo_defines" - echo + echo "$0: warning: the following functionality is not available for $ngx_addon_name: $ngx_wasm_cargo_defines" have=NGX_WASM_CARGO_FAILED value=1 . auto/define fi diff --git a/lib/Cargo.lock b/lib/Cargo.lock new file mode 100644 index 000000000..c7b8d6410 --- /dev/null +++ b/lib/Cargo.lock @@ -0,0 +1,331 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +dependencies = [ + "memchr", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "glob" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "itoa" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[package]] +name = "ngx" +version = "0.1.0" + +[[package]] +name = "ngx-wasm-backtrace" +version = "0.1.0" +dependencies = [ + "ngx-wasm-c-api", + "rustc-demangle", + "wasmparser", +] + +[[package]] +name = "ngx-wasm-c-api" +version = "0.1.0" + +[[package]] +name = "ngx-wasm-rs" +version = "0.1.0" +dependencies = [ + "ngx-wasm-backtrace", + "ngx-wasm-wat", +] + +[[package]] +name = "ngx-wasm-wat" +version = "0.1.0" +dependencies = [ + "lazy_static", + "libc", + "ngx-wasm-c-api", + "regex", + "unescape", + "wabt", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "proc-macro2" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "ryu" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" + +[[package]] +name = "serde" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.193" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "syn" +version = "2.0.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "unescape" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccb97dac3243214f8d8507998906ca3e2e0b900bf9bf4870477f125b82e68f6e" + +[[package]] +name = "unicode-bidi" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "wabt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00bef93d5e6c81a293bccf107cf43aa47239382f455ba14869d36695d8963b9c" +dependencies = [ + "serde", + "serde_derive", + "serde_json", + "wabt-sys", +] + +[[package]] +name = "wabt-sys" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a4e043159f63e16986e713e9b5e1c06043df4848565bf672e27c523864c7791" +dependencies = [ + "cc", + "cmake", + "glob", +] + +[[package]] +name = "wasmparser" +version = "0.102.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" +dependencies = [ + "indexmap", + "url", +] diff --git a/lib/Cargo.toml b/lib/Cargo.toml new file mode 100644 index 000000000..a2a2658ee --- /dev/null +++ b/lib/Cargo.toml @@ -0,0 +1,5 @@ +[workspace] +members = [ + "ngx-rust", + "ngx-wasm-rs", +] diff --git a/lib/ngx-wasm-rs/Cargo.toml b/lib/ngx-wasm-rs/Cargo.toml index 70a027956..017db83e7 100644 --- a/lib/ngx-wasm-rs/Cargo.toml +++ b/lib/ngx-wasm-rs/Cargo.toml @@ -14,7 +14,3 @@ wat = ["dep:ngx-wasm-wat"] [lib] name = "ngx_wasm_rs" crate-type = ["staticlib", "cdylib"] - -[workspace] -# not in a workspace - diff --git a/rust-toolchain.toml b/lib/rust-toolchain.toml similarity index 100% rename from rust-toolchain.toml rename to lib/rust-toolchain.toml diff --git a/Cargo.lock b/t/lib/Cargo.lock similarity index 95% rename from Cargo.lock rename to t/lib/Cargo.lock index 234a21316..dcb9dadac 100644 --- a/Cargo.lock +++ b/t/lib/Cargo.lock @@ -329,9 +329,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" @@ -344,9 +344,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.150" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "log" @@ -425,9 +425,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "percent-encoding" @@ -437,9 +437,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] @@ -511,9 +511,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" dependencies = [ "proc-macro2", "quote", @@ -537,9 +537,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -622,7 +622,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", "wasm-bindgen-shared", ] @@ -644,7 +644,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -723,20 +723,20 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "zerocopy" -version = "0.7.28" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.28" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.42", ] diff --git a/t/lib/Cargo.toml b/t/lib/Cargo.toml new file mode 100644 index 000000000..8ccd47079 --- /dev/null +++ b/t/lib/Cargo.toml @@ -0,0 +1,14 @@ +[workspace] +members = [ + "ngx-rust-tests", + "ngx-lua-tests", + "wasi-vm-tests", + "wasi-host-tests", + "proxy-wasm-tests/on-tick", + "proxy-wasm-tests/on-phases", + "proxy-wasm-tests/hostcalls", + "proxy-wasm-tests/rust-sdk-ver-zero-one", + "proxy-wasm-tests/benchmarks", + "proxy-wasm-tests/instance-lifecycle", + "proxy-wasm-tests/context-checks", +] diff --git a/util/clean.sh b/util/clean.sh index 3aa3550b3..e100024bc 100755 --- a/util/clean.sh +++ b/util/clean.sh @@ -32,7 +32,8 @@ if [[ "$1" == "--all" || "$1" == "--more" ]]; then $DIR_DIST_OUT \ $DIR_DIST_WORK \ remove_luarocks - cargo clean + cargo clean --manifest-path lib/Cargo.toml + cargo clean --manifest-path t/lib/Cargo.toml fi if [[ "$1" == "--all" ]]; then diff --git a/util/release.sh b/util/release.sh index 4232f2af5..ddc6fd259 100755 --- a/util/release.sh +++ b/util/release.sh @@ -465,7 +465,6 @@ pushd $DIR_DIST_WORK rm -rf $DIR_DIST_SRC/* cp -R \ - $NGX_WASM_DIR/rust-toolchain.toml \ $NGX_WASM_DIR/Makefile \ $NGX_WASM_DIR/LICENSE \ $NGX_WASM_DIR/NOTICE \ diff --git a/util/test.sh b/util/test.sh index 4350cbaff..f121907e5 100755 --- a/util/test.sh +++ b/util/test.sh @@ -89,7 +89,8 @@ if [[ "$TEST_NGINX_CLEAN_LOG" == 1 ]]; then fi if [[ "$CI" == 'true' ]]; then - cargo clean + cargo clean --manifest-path lib/Cargo.toml + cargo clean --manifest-path t/lib/Cargo.toml export NGX_BUILD_FORCE=1 fi @@ -101,6 +102,7 @@ fi export RUSTFLAGS="$TEST_NGINX_CARGO_RUSTFLAGS" eval cargo build \ + --manifest-path t/lib/Cargo.toml \ --lib \ "${args[@]}" \ --target wasm32-wasi