From a7f810b3796207d01548f619ef31c0924b2ab5ce Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 31 Jul 2020 20:49:45 -0700 Subject: [PATCH 01/42] Use Rust toolchains with working components. (#16) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2ac3e067..d399a122 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -34,7 +34,7 @@ jobs: - name: Update Rust run: | - rustup update + rustup toolchain install stable --component clippy --component rustfmt rustup target add wasm32-unknown-unknown - name: Build @@ -73,8 +73,8 @@ jobs: - name: Update Rust run: | - rustup toolchain install nightly - rustup target add --toolchain nightly wasm32-unknown-unknown + rustup toolchain install nightly --component clippy --component rustfmt + rustup +nightly target add wasm32-unknown-unknown - name: Build env: From 02ee188603a2f0503864a632cd648fbbf68ca96e Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 31 Jul 2020 21:26:22 -0700 Subject: [PATCH 02/42] Split licenses check into a separate test target. (#17) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d399a122..3830828b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,6 +26,18 @@ on: jobs: + licenses: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Check licenses + run: | + go get -u github.com/google/addlicense + export PATH=$PATH:$(go env GOPATH)/bin + addlicense -check . + stable: runs-on: ubuntu-latest @@ -53,12 +65,6 @@ jobs: - name: Format (manifest) run: cargo verify-project - - name: Format (addlicense) - run: | - go get -u github.com/google/addlicense - export PATH=$PATH:$(go env GOPATH)/bin - addlicense -check . - - name: Package (docs) run: cargo doc --no-deps --target=wasm32-unknown-unknown @@ -92,12 +98,6 @@ jobs: - name: Format (manifest) run: cargo +nightly verify-project - - name: Format (addlicense) - run: | - go get -u github.com/google/addlicense - export PATH=$PATH:$(go env GOPATH)/bin - addlicense -check . - - name: Package (docs) run: cargo +nightly doc --no-deps --target=wasm32-unknown-unknown From 3f46b8f4bda67583f29c8936510c8a7670c3604c Mon Sep 17 00:00:00 2001 From: Daz Wilkin Date: Tue, 4 Aug 2020 12:35:50 -0700 Subject: [PATCH 03/42] Help other developers get started using this SDK. (#15) Signed-off-by: DazWilkin --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 8ee40bce..c2823fe7 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,14 @@ [docs-link]: https://docs.rs/proxy-wasm [license-badge]: https://img.shields.io/github/license/proxy-wasm/proxy-wasm-rust-sdk [license-link]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/blob/master/LICENSE + +## Examples + ++ [Hello World](./examples/hello_world.rs) ++ [HTTP Auth random](./examples/http_auth_random.rs) ++ [HTTP Headers](./examples/http_headers.rs) + +## Articles & blog posts from the community + ++ [Extending Envoy with WASM and Rust](https://antweiss.com/blog/extending-envoy-with-wasm-and-rust/) ++ [Extending Istio with Rust and WebAssembly](https://blog.red-badger.com/extending-istio-with-rust-and-webassembly) From a7c35a0a2df7b0ee46b330ab8d16bd4e282a9b5e Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Tue, 4 Aug 2020 12:42:02 -0700 Subject: [PATCH 04/42] Add Bazel support. (#18) Signed-off-by: Shikugawa Signed-off-by: Piotr Sikora --- .bazelrc | 2 + .bazelversion | 1 + .github/workflows/rust.yml | 39 +++++ .gitignore | 3 +- BUILD | 13 ++ Cargo.toml | 8 + WORKSPACE | 37 +++++ cargo/BUILD | 30 ++++ cargo/Cargo.lock | 134 +++++++++++++++ cargo/crates.bzl | 153 ++++++++++++++++++ cargo/remote/BUILD | 0 cargo/remote/ahash-0.3.8.BUILD | 48 ++++++ cargo/remote/autocfg-1.0.0.BUILD | 48 ++++++ cargo/remote/cfg-if-0.1.10.BUILD | 44 +++++ cargo/remote/chrono-0.4.13.BUILD | 53 ++++++ cargo/remote/hashbrown-0.7.2.BUILD | 52 ++++++ cargo/remote/libc-0.2.74.BUILD | 47 ++++++ cargo/remote/log-0.4.11.BUILD | 48 ++++++ cargo/remote/memory_units-0.4.0.BUILD | 43 +++++ cargo/remote/num-integer-0.1.43.BUILD | 50 ++++++ cargo/remote/num-traits-0.2.12.BUILD | 45 ++++++ cargo/remote/time-0.1.43.BUILD | 44 +++++ cargo/remote/wee_alloc-0.4.5.BUILD | 48 ++++++ cargo/remote/winapi-0.3.9.BUILD | 54 +++++++ .../winapi-i686-pc-windows-gnu-0.4.0.BUILD | 44 +++++ .../winapi-x86_64-pc-windows-gnu-0.4.0.BUILD | 44 +++++ examples/BUILD | 38 +++++ 27 files changed, 1169 insertions(+), 1 deletion(-) create mode 100644 .bazelrc create mode 100644 .bazelversion create mode 100644 BUILD create mode 100644 WORKSPACE create mode 100644 cargo/BUILD create mode 100644 cargo/Cargo.lock create mode 100644 cargo/crates.bzl create mode 100644 cargo/remote/BUILD create mode 100644 cargo/remote/ahash-0.3.8.BUILD create mode 100644 cargo/remote/autocfg-1.0.0.BUILD create mode 100644 cargo/remote/cfg-if-0.1.10.BUILD create mode 100644 cargo/remote/chrono-0.4.13.BUILD create mode 100644 cargo/remote/hashbrown-0.7.2.BUILD create mode 100644 cargo/remote/libc-0.2.74.BUILD create mode 100644 cargo/remote/log-0.4.11.BUILD create mode 100644 cargo/remote/memory_units-0.4.0.BUILD create mode 100644 cargo/remote/num-integer-0.1.43.BUILD create mode 100644 cargo/remote/num-traits-0.2.12.BUILD create mode 100644 cargo/remote/time-0.1.43.BUILD create mode 100644 cargo/remote/wee_alloc-0.4.5.BUILD create mode 100644 cargo/remote/winapi-0.3.9.BUILD create mode 100644 cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD create mode 100644 cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD create mode 100644 examples/BUILD diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..800bf8f4 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,2 @@ +# Force Bazel to use --target=wasm32-unknown-unknown. +build --platforms=@io_bazel_rules_rust//rust/platform:wasm diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 00000000..47b322c9 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +3.4.1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3830828b..50f015e5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -103,3 +103,42 @@ jobs: - name: Package (publish) run: cargo +nightly publish --dry-run --target=wasm32-unknown-unknown + + bazel: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.cache/bazel + ~/.cache/bazelisk + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin + ~/.cargo/registry + key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'cargo/Cargo.lock') }} + + - name: Build + run: | + bazelisk build //... + + - name: Format (buildifier) + run: | + GO111MODULE=on go get -u github.com/bazelbuild/buildtools/buildifier@3.4.0 + export PATH=$PATH:$(go env GOPATH)/bin + buildifier -mode=check WORKSPACE + buildifier -mode=check BUILD + buildifier -mode=check examples/BUILD + + - name: Format (cargo raze) + run: | + cargo install cargo-raze --version 0.3.8 + cp -p cargo/Cargo.lock . + rm -rf cargo/ + cargo raze --output=cargo + mv Cargo.lock cargo/ + git diff --exit-code diff --git a/.gitignore b/.gitignore index 96ef6c0b..baee4113 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +/bazel-* /target -Cargo.lock +/Cargo.lock diff --git a/BUILD b/BUILD new file mode 100644 index 00000000..1df187e8 --- /dev/null +++ b/BUILD @@ -0,0 +1,13 @@ +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") + +rust_library( + name = "proxy_wasm", + srcs = glob(["src/*.rs"]), + edition = "2018", + visibility = ["//visibility:public"], + deps = [ + "//cargo:hashbrown", + "//cargo:log", + "//cargo:wee_alloc", + ], +) diff --git a/Cargo.toml b/Cargo.toml index 73c7afaa..1d6418a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,6 +21,14 @@ lto = true opt-level = 3 panic = "abort" +[raze] +workspace_path = "//cargo" +target = "wasm32-unknown-unknown" +genmode = "Remote" + +[raze.crates.log.'0.4.11'] +additional_flags = ["--cfg=atomic_cas"] + [[example]] name = "hello_world" path = "examples/hello_world.rs" diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000..98a223a8 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,37 @@ +workspace(name = "proxy_wasm_rust_sdk") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "bazel_skylib", + sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", + ], +) + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + +http_archive( + name = "io_bazel_rules_rust", + sha256 = "484a2b2b67cd2d1fa1054876de7f8d291c4b203fd256bc8cbea14d749bb864ce", + # Last commit where "out_binary = True" works. + # See: https://github.com/bazelbuild/rules_rust/issues/386 + strip_prefix = "rules_rust-fda9a1ce6482973adfda022cadbfa6b300e269c3", + url = "https://github.com/bazelbuild/rules_rust/archive/fda9a1ce6482973adfda022cadbfa6b300e269c3.tar.gz", +) + +load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") + +rust_repositories() + +load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") + +bazel_version(name = "bazel_version") + +load("//cargo:crates.bzl", "raze_fetch_remote_crates") + +raze_fetch_remote_crates() diff --git a/cargo/BUILD b/cargo/BUILD new file mode 100644 index 00000000..a8639e57 --- /dev/null +++ b/cargo/BUILD @@ -0,0 +1,30 @@ +""" +cargo-raze workspace build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = ["//visibility:public"]) + +licenses([ + "notice" # See individual crates for specific licenses +]) +alias( + name = "chrono", + actual = "@raze__chrono__0_4_13//:chrono", + tags = ["cargo-raze"], +) +alias( + name = "hashbrown", + actual = "@raze__hashbrown__0_7_2//:hashbrown", + tags = ["cargo-raze"], +) +alias( + name = "log", + actual = "@raze__log__0_4_11//:log", + tags = ["cargo-raze"], +) +alias( + name = "wee_alloc", + actual = "@raze__wee_alloc__0_4_5//:wee_alloc", + tags = ["cargo-raze"], +) diff --git a/cargo/Cargo.lock b/cargo/Cargo.lock new file mode 100644 index 00000000..48156717 --- /dev/null +++ b/cargo/Cargo.lock @@ -0,0 +1,134 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" + +[[package]] +name = "autocfg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "chrono" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" +dependencies = [ + "num-integer", + "num-traits", + "time", +] + +[[package]] +name = "hashbrown" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf" +dependencies = [ + "ahash", + "autocfg", +] + +[[package]] +name = "libc" +version = "0.2.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10" + +[[package]] +name = "log" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memory_units" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" + +[[package]] +name = "num-integer" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proxy-wasm" +version = "0.1.0" +dependencies = [ + "chrono", + "hashbrown", + "log", + "wee_alloc", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "wee_alloc" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" +dependencies = [ + "cfg-if", + "libc", + "memory_units", + "winapi", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/cargo/crates.bzl b/cargo/crates.bzl new file mode 100644 index 00000000..79ae70f5 --- /dev/null +++ b/cargo/crates.bzl @@ -0,0 +1,153 @@ +""" +cargo-raze crate workspace functions + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") + +def _new_http_archive(name, **kwargs): + if not native.existing_rule(name): + http_archive(name=name, **kwargs) + +def _new_git_repository(name, **kwargs): + if not native.existing_rule(name): + new_git_repository(name=name, **kwargs) + +def raze_fetch_remote_crates(): + + _new_http_archive( + name = "raze__ahash__0_3_8", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/ahash/ahash-0.3.8.crate", + type = "tar.gz", + sha256 = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217", + strip_prefix = "ahash-0.3.8", + build_file = Label("//cargo/remote:ahash-0.3.8.BUILD"), + ) + + _new_http_archive( + name = "raze__autocfg__1_0_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/autocfg/autocfg-1.0.0.crate", + type = "tar.gz", + sha256 = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d", + strip_prefix = "autocfg-1.0.0", + build_file = Label("//cargo/remote:autocfg-1.0.0.BUILD"), + ) + + _new_http_archive( + name = "raze__cfg_if__0_1_10", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/cfg-if/cfg-if-0.1.10.crate", + type = "tar.gz", + sha256 = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822", + strip_prefix = "cfg-if-0.1.10", + build_file = Label("//cargo/remote:cfg-if-0.1.10.BUILD"), + ) + + _new_http_archive( + name = "raze__chrono__0_4_13", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/chrono/chrono-0.4.13.crate", + type = "tar.gz", + sha256 = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6", + strip_prefix = "chrono-0.4.13", + build_file = Label("//cargo/remote:chrono-0.4.13.BUILD"), + ) + + _new_http_archive( + name = "raze__hashbrown__0_7_2", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/hashbrown/hashbrown-0.7.2.crate", + type = "tar.gz", + sha256 = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf", + strip_prefix = "hashbrown-0.7.2", + build_file = Label("//cargo/remote:hashbrown-0.7.2.BUILD"), + ) + + _new_http_archive( + name = "raze__libc__0_2_74", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.74.crate", + type = "tar.gz", + sha256 = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10", + strip_prefix = "libc-0.2.74", + build_file = Label("//cargo/remote:libc-0.2.74.BUILD"), + ) + + _new_http_archive( + name = "raze__log__0_4_11", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/log/log-0.4.11.crate", + type = "tar.gz", + sha256 = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b", + strip_prefix = "log-0.4.11", + build_file = Label("//cargo/remote:log-0.4.11.BUILD"), + ) + + _new_http_archive( + name = "raze__memory_units__0_4_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/memory_units/memory_units-0.4.0.crate", + type = "tar.gz", + sha256 = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3", + strip_prefix = "memory_units-0.4.0", + build_file = Label("//cargo/remote:memory_units-0.4.0.BUILD"), + ) + + _new_http_archive( + name = "raze__num_integer__0_1_43", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-integer/num-integer-0.1.43.crate", + type = "tar.gz", + sha256 = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b", + strip_prefix = "num-integer-0.1.43", + build_file = Label("//cargo/remote:num-integer-0.1.43.BUILD"), + ) + + _new_http_archive( + name = "raze__num_traits__0_2_12", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-traits/num-traits-0.2.12.crate", + type = "tar.gz", + sha256 = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611", + strip_prefix = "num-traits-0.2.12", + build_file = Label("//cargo/remote:num-traits-0.2.12.BUILD"), + ) + + _new_http_archive( + name = "raze__time__0_1_43", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/time/time-0.1.43.crate", + type = "tar.gz", + sha256 = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438", + strip_prefix = "time-0.1.43", + build_file = Label("//cargo/remote:time-0.1.43.BUILD"), + ) + + _new_http_archive( + name = "raze__wee_alloc__0_4_5", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/wee_alloc/wee_alloc-0.4.5.crate", + type = "tar.gz", + sha256 = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e", + strip_prefix = "wee_alloc-0.4.5", + build_file = Label("//cargo/remote:wee_alloc-0.4.5.BUILD"), + ) + + _new_http_archive( + name = "raze__winapi__0_3_9", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi/winapi-0.3.9.crate", + type = "tar.gz", + sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", + strip_prefix = "winapi-0.3.9", + build_file = Label("//cargo/remote:winapi-0.3.9.BUILD"), + ) + + _new_http_archive( + name = "raze__winapi_i686_pc_windows_gnu__0_4_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-i686-pc-windows-gnu/winapi-i686-pc-windows-gnu-0.4.0.crate", + type = "tar.gz", + sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", + strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0", + build_file = Label("//cargo/remote:winapi-i686-pc-windows-gnu-0.4.0.BUILD"), + ) + + _new_http_archive( + name = "raze__winapi_x86_64_pc_windows_gnu__0_4_0", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-x86_64-pc-windows-gnu/winapi-x86_64-pc-windows-gnu-0.4.0.crate", + type = "tar.gz", + sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", + strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0", + build_file = Label("//cargo/remote:winapi-x86_64-pc-windows-gnu-0.4.0.BUILD"), + ) + diff --git a/cargo/remote/BUILD b/cargo/remote/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/cargo/remote/ahash-0.3.8.BUILD b/cargo/remote/ahash-0.3.8.BUILD new file mode 100644 index 00000000..e63b4074 --- /dev/null +++ b/cargo/remote/ahash-0.3.8.BUILD @@ -0,0 +1,48 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "ahash" with type "bench" omitted + +rust_library( + name = "ahash", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.3.8", + tags = ["cargo-raze"], + crate_features = [ + ], +) + +# Unsupported target "bench" with type "test" omitted +# Unsupported target "map" with type "bench" omitted +# Unsupported target "map_tests" with type "test" omitted +# Unsupported target "nopanic" with type "test" omitted diff --git a/cargo/remote/autocfg-1.0.0.BUILD b/cargo/remote/autocfg-1.0.0.BUILD new file mode 100644 index 00000000..0369819e --- /dev/null +++ b/cargo/remote/autocfg-1.0.0.BUILD @@ -0,0 +1,48 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "autocfg", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.0", + tags = ["cargo-raze"], + crate_features = [ + ], +) + +# Unsupported target "integers" with type "example" omitted +# Unsupported target "paths" with type "example" omitted +# Unsupported target "rustflags" with type "test" omitted +# Unsupported target "traits" with type "example" omitted +# Unsupported target "versions" with type "example" omitted diff --git a/cargo/remote/cfg-if-0.1.10.BUILD b/cargo/remote/cfg-if-0.1.10.BUILD new file mode 100644 index 00000000..2f657921 --- /dev/null +++ b/cargo/remote/cfg-if-0.1.10.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "cfg_if", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.10", + tags = ["cargo-raze"], + crate_features = [ + ], +) + +# Unsupported target "xcrate" with type "test" omitted diff --git a/cargo/remote/chrono-0.4.13.BUILD b/cargo/remote/chrono-0.4.13.BUILD new file mode 100644 index 00000000..87aad760 --- /dev/null +++ b/cargo/remote/chrono-0.4.13.BUILD @@ -0,0 +1,53 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "chrono" with type "bench" omitted + +rust_library( + name = "chrono", + crate_type = "lib", + deps = [ + "@raze__num_integer__0_1_43//:num_integer", + "@raze__num_traits__0_2_12//:num_traits", + "@raze__time__0_1_43//:time", + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.13", + tags = ["cargo-raze"], + crate_features = [ + "clock", + "default", + "std", + "time", + ], +) + +# Unsupported target "serde" with type "bench" omitted +# Unsupported target "wasm" with type "test" omitted diff --git a/cargo/remote/hashbrown-0.7.2.BUILD b/cargo/remote/hashbrown-0.7.2.BUILD new file mode 100644 index 00000000..c693cbf1 --- /dev/null +++ b/cargo/remote/hashbrown-0.7.2.BUILD @@ -0,0 +1,52 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "bench" with type "bench" omitted +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "hashbrown", + crate_type = "lib", + deps = [ + "@raze__ahash__0_3_8//:ahash", + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.7.2", + tags = ["cargo-raze"], + crate_features = [ + "ahash", + "inline-more", + ], +) + +# Unsupported target "hasher" with type "test" omitted +# Unsupported target "rayon" with type "test" omitted +# Unsupported target "serde" with type "test" omitted +# Unsupported target "set" with type "test" omitted diff --git a/cargo/remote/libc-0.2.74.BUILD b/cargo/remote/libc-0.2.74.BUILD new file mode 100644 index 00000000..d1a4a658 --- /dev/null +++ b/cargo/remote/libc-0.2.74.BUILD @@ -0,0 +1,47 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "const_fn" with type "test" omitted + +rust_library( + name = "libc", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.2.74", + tags = ["cargo-raze"], + crate_features = [ + "default", + "std", + ], +) + diff --git a/cargo/remote/log-0.4.11.BUILD b/cargo/remote/log-0.4.11.BUILD new file mode 100644 index 00000000..ec0b13c5 --- /dev/null +++ b/cargo/remote/log-0.4.11.BUILD @@ -0,0 +1,48 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "filters" with type "test" omitted + +rust_library( + name = "log", + crate_type = "lib", + deps = [ + "@raze__cfg_if__0_1_10//:cfg_if", + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + "--cfg=atomic_cas", + ], + version = "0.4.11", + tags = ["cargo-raze"], + crate_features = [ + ], +) + +# Unsupported target "macros" with type "test" omitted diff --git a/cargo/remote/memory_units-0.4.0.BUILD b/cargo/remote/memory_units-0.4.0.BUILD new file mode 100644 index 00000000..e9c2994c --- /dev/null +++ b/cargo/remote/memory_units-0.4.0.BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "reciprocal", # MPL-2.0 from expression "MPL-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "memory_units", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.0", + tags = ["cargo-raze"], + crate_features = [ + ], +) + diff --git a/cargo/remote/num-integer-0.1.43.BUILD b/cargo/remote/num-integer-0.1.43.BUILD new file mode 100644 index 00000000..e07c6afc --- /dev/null +++ b/cargo/remote/num-integer-0.1.43.BUILD @@ -0,0 +1,50 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "average" with type "bench" omitted +# Unsupported target "average" with type "test" omitted +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "gcd" with type "bench" omitted + +rust_library( + name = "num_integer", + crate_type = "lib", + deps = [ + "@raze__num_traits__0_2_12//:num_traits", + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.43", + tags = ["cargo-raze"], + crate_features = [ + ], +) + +# Unsupported target "roots" with type "bench" omitted +# Unsupported target "roots" with type "test" omitted diff --git a/cargo/remote/num-traits-0.2.12.BUILD b/cargo/remote/num-traits-0.2.12.BUILD new file mode 100644 index 00000000..5a8faf8d --- /dev/null +++ b/cargo/remote/num-traits-0.2.12.BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "cast" with type "test" omitted + +rust_library( + name = "num_traits", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.2.12", + tags = ["cargo-raze"], + crate_features = [ + ], +) + diff --git a/cargo/remote/time-0.1.43.BUILD b/cargo/remote/time-0.1.43.BUILD new file mode 100644 index 00000000..7c9954db --- /dev/null +++ b/cargo/remote/time-0.1.43.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "time", + crate_type = "lib", + deps = [ + "@raze__libc__0_2_74//:libc", + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.43", + tags = ["cargo-raze"], + crate_features = [ + ], +) + diff --git a/cargo/remote/wee_alloc-0.4.5.BUILD b/cargo/remote/wee_alloc-0.4.5.BUILD new file mode 100644 index 00000000..7013b298 --- /dev/null +++ b/cargo/remote/wee_alloc-0.4.5.BUILD @@ -0,0 +1,48 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "reciprocal", # MPL-2.0 from expression "MPL-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "wee_alloc", + crate_type = "lib", + deps = [ + "@raze__cfg_if__0_1_10//:cfg_if", + "@raze__memory_units__0_4_0//:memory_units", + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.5", + tags = ["cargo-raze"], + crate_features = [ + "default", + "size_classes", + ], +) + diff --git a/cargo/remote/winapi-0.3.9.BUILD b/cargo/remote/winapi-0.3.9.BUILD new file mode 100644 index 00000000..377e38bb --- /dev/null +++ b/cargo/remote/winapi-0.3.9.BUILD @@ -0,0 +1,54 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "winapi", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.3.9", + tags = ["cargo-raze"], + crate_features = [ + "memoryapi", + "minwinbase", + "minwindef", + "ntdef", + "profileapi", + "std", + "synchapi", + "sysinfoapi", + "timezoneapi", + "winbase", + ], +) + diff --git a/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD b/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD new file mode 100644 index 00000000..bd0921c1 --- /dev/null +++ b/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "winapi_i686_pc_windows_gnu", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.0", + tags = ["cargo-raze"], + crate_features = [ + ], +) + diff --git a/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD b/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD new file mode 100644 index 00000000..6770f841 --- /dev/null +++ b/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD @@ -0,0 +1,44 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "winapi_x86_64_pc_windows_gnu", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.0", + tags = ["cargo-raze"], + crate_features = [ + ], +) + diff --git a/examples/BUILD b/examples/BUILD new file mode 100644 index 00000000..dee0ce59 --- /dev/null +++ b/examples/BUILD @@ -0,0 +1,38 @@ +load("@io_bazel_rules_rust//rust:rust.bzl", "rust_binary") + +rust_binary( + name = "hello_world", + srcs = ["hello_world.rs"], + crate_type = "cdylib", + edition = "2018", + out_binary = True, + deps = [ + "//:proxy_wasm", + "//cargo:chrono", + "//cargo:log", + ], +) + +rust_binary( + name = "http_auth_random", + srcs = ["http_auth_random.rs"], + crate_type = "cdylib", + edition = "2018", + out_binary = True, + deps = [ + "//:proxy_wasm", + "//cargo:log", + ], +) + +rust_binary( + name = "http_headers", + srcs = ["http_headers.rs"], + crate_type = "cdylib", + edition = "2018", + out_binary = True, + deps = [ + "//:proxy_wasm", + "//cargo:log", + ], +) From 998ce82dca245c609bfc828c77c01573fe8bfd4b Mon Sep 17 00:00:00 2001 From: Greg Brail Date: Tue, 4 Aug 2020 20:47:23 -0700 Subject: [PATCH 05/42] Add support for setting HTTP bodies. (#2) Signed-off-by: Gregory Brail --- Cargo.toml | 5 +++ examples/BUILD | 12 ++++++++ examples/http_body.rs | 72 +++++++++++++++++++++++++++++++++++++++++++ src/hostcalls.rs | 24 +++++++++++++++ src/traits.rs | 8 +++++ 5 files changed, 121 insertions(+) create mode 100644 examples/http_body.rs diff --git a/Cargo.toml b/Cargo.toml index 1d6418a2..91d77997 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,3 +43,8 @@ crate-type = ["cdylib"] name = "http_headers" path = "examples/http_headers.rs" crate-type = ["cdylib"] + +[[example]] +name = "http_body" +path = "examples/http_body.rs" +crate-type = ["cdylib"] diff --git a/examples/BUILD b/examples/BUILD index dee0ce59..4bd527a9 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -36,3 +36,15 @@ rust_binary( "//cargo:log", ], ) + +rust_binary( + name = "http_body", + srcs = ["http_body.rs"], + crate_type = "cdylib", + edition = "2018", + out_binary = True, + deps = [ + "//:proxy_wasm", + "//cargo:log", + ], +) diff --git a/examples/http_body.rs b/examples/http_body.rs new file mode 100644 index 00000000..a4242f86 --- /dev/null +++ b/examples/http_body.rs @@ -0,0 +1,72 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use proxy_wasm::traits::*; +use proxy_wasm::types::*; + +#[no_mangle] +pub fn _start() { + proxy_wasm::set_log_level(LogLevel::Trace); + proxy_wasm::set_http_context(|_, _| -> Box { Box::new(HttpBody::new()) }); +} + +#[derive(Default)] +struct HttpBody { + total_body_size: usize, +} + +impl HttpBody { + fn new() -> HttpBody { + Default::default() + } +} + +impl Context for HttpBody {} + +impl HttpContext for HttpBody { + fn on_http_response_headers(&mut self, _: usize) -> Action { + // If there is a Content-Length header and we change the length of + // the body later, then clients will break. So remove it. + // We must do this here, because once we exit this function we + // can no longer modify the response headers. + self.set_http_response_header("content-length", None); + // Don't continue to the next callout in the chain because we might + // modify the body. + Action::Pause + } + + fn on_http_response_body(&mut self, body_size: usize, end_of_stream: bool) -> Action { + self.total_body_size += body_size; + if !end_of_stream { + // Wait -- we'll be called again when the complete body is buffered + // at the host side. + return Action::Pause; + } + + // Replace the message body if it contains the text "secret". + // Since we returned "Pause" previuously, this will return the whole body. + // However, we have to calculate the size ourselves. + if let Some(body_bytes) = self.get_http_response_body(0, self.total_body_size) { + let body_str = String::from_utf8(body_bytes).unwrap(); + if body_str.find("secret").is_some() { + let new_body = format!( + "Original message body ({} bytes) redacted.", + self.total_body_size + ); + self.set_http_response_body(0, self.total_body_size, &new_body.into_bytes()); + } + } + Action::Continue + } +} diff --git a/src/hostcalls.rs b/src/hostcalls.rs index 0b770a0f..1d7509d7 100644 --- a/src/hostcalls.rs +++ b/src/hostcalls.rs @@ -127,6 +127,30 @@ pub fn get_buffer( } } +extern "C" { + fn proxy_set_buffer_bytes( + buffer_type: BufferType, + start: usize, + size: usize, + buffer_data: *const u8, + buffer_size: usize, + ) -> Status; +} + +pub fn set_buffer( + buffer_type: BufferType, + start: usize, + size: usize, + value: &[u8], +) -> Result<(), Status> { + unsafe { + match proxy_set_buffer_bytes(buffer_type, start, size, value.as_ptr(), value.len()) { + Status::Ok => Ok(()), + status => panic!("unexpected status: {}", status as u32), + } + } +} + extern "C" { fn proxy_get_header_map_pairs( map_type: MapType, diff --git a/src/traits.rs b/src/traits.rs index ffad21a4..268ef39c 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -184,6 +184,10 @@ pub trait HttpContext: Context { hostcalls::get_buffer(BufferType::HttpRequestBody, start, max_size).unwrap() } + fn set_http_request_body(&self, start: usize, size: usize, value: &[u8]) { + hostcalls::set_buffer(BufferType::HttpRequestBody, start, size, value).unwrap() + } + fn on_http_request_trailers(&mut self, _num_trailers: usize) -> Action { Action::Continue } @@ -244,6 +248,10 @@ pub trait HttpContext: Context { hostcalls::get_buffer(BufferType::HttpResponseBody, start, max_size).unwrap() } + fn set_http_response_body(&self, start: usize, size: usize, value: &[u8]) { + hostcalls::set_buffer(BufferType::HttpResponseBody, start, size, value).unwrap() + } + fn on_http_response_trailers(&mut self, _num_trailers: usize) -> Action { Action::Continue } From 8f7a993b87dced36a600f744054dde08dc090c36 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Wed, 5 Aug 2020 09:12:55 -0700 Subject: [PATCH 06/42] Release v0.1.1. (#20) Signed-off-by: Piotr Sikora --- CHANGELOG.md | 6 ++++++ Cargo.toml | 2 +- cargo/Cargo.lock | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90a7c213..e38355f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Changelog +## [0.1.1] - 2020-08-05 + +- Added support for building with Bazel. +- Added support for setting HTTP bodies. + ## [0.1.0] - 2020-02-29 - Initial release. +[0.1.1]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.1 [0.1.0]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.0 diff --git a/Cargo.toml b/Cargo.toml index 91d77997..3bdb661b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "proxy-wasm" -version = "0.1.0" +version = "0.1.1" authors = ["Piotr Sikora "] description = "WebAssembly for Proxies" readme = "README.md" diff --git a/cargo/Cargo.lock b/cargo/Cargo.lock index 48156717..f97e4058 100644 --- a/cargo/Cargo.lock +++ b/cargo/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "proxy-wasm" -version = "0.1.0" +version = "0.1.1" dependencies = [ "chrono", "hashbrown", From efe3483156522eaad306656b7f9d3724a4786e79 Mon Sep 17 00:00:00 2001 From: Yaroslav Skopets Date: Wed, 5 Aug 2020 19:27:41 +0200 Subject: [PATCH 07/42] Update MapType values to match updated Proxy-Wasm ABI v0.1.0. (#7) Signed-off-by: Yaroslav Skopets --- src/types.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types.rs b/src/types.rs index 362e3c1b..ba9749c3 100644 --- a/src/types.rs +++ b/src/types.rs @@ -64,8 +64,8 @@ pub enum MapType { HttpRequestTrailers = 1, HttpResponseHeaders = 2, HttpResponseTrailers = 3, - HttpCallResponseHeaders = 7, - HttpCallResponseTrailers = 8, + HttpCallResponseHeaders = 6, + HttpCallResponseTrailers = 7, } #[repr(u32)] From aa67a50fc6897c357b75a40508388ce9fc662151 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Wed, 5 Aug 2020 10:38:25 -0700 Subject: [PATCH 08/42] Release v0.1.2. (#21) Signed-off-by: Piotr Sikora --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- cargo/Cargo.lock | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e38355f7..c7ae8da4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [0.1.2] - 2020-08-05 + +- Updated MapType values to match updated Proxy-Wasm ABI v0.1.0. + ## [0.1.1] - 2020-08-05 - Added support for building with Bazel. @@ -10,5 +14,6 @@ - Initial release. +[0.1.2]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.2 [0.1.1]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.1 [0.1.0]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.0 diff --git a/Cargo.toml b/Cargo.toml index 3bdb661b..a142010c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "proxy-wasm" -version = "0.1.1" +version = "0.1.2" authors = ["Piotr Sikora "] description = "WebAssembly for Proxies" readme = "README.md" diff --git a/cargo/Cargo.lock b/cargo/Cargo.lock index f97e4058..9d9a2b8a 100644 --- a/cargo/Cargo.lock +++ b/cargo/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "proxy-wasm" -version = "0.1.1" +version = "0.1.2" dependencies = [ "chrono", "hashbrown", From feaf1339ca4c3e0eba230e2dd8cb1d8d5852bb83 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 10 Aug 2020 19:12:18 -0700 Subject: [PATCH 09/42] Update hashbrown to v0.8.2. (#22) Signed-off-by: Piotr Sikora --- Cargo.toml | 2 +- cargo/BUILD | 2 +- cargo/Cargo.lock | 4 ++-- cargo/crates.bzl | 10 +++++----- .../{hashbrown-0.7.2.BUILD => hashbrown-0.8.2.BUILD} | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) rename cargo/remote/{hashbrown-0.7.2.BUILD => hashbrown-0.8.2.BUILD} (98%) diff --git a/Cargo.toml b/Cargo.toml index a142010c..9ae93ff4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/proxy-wasm/proxy-wasm-rust-sdk" edition = "2018" [dependencies] -hashbrown = { version = "0.7", default-features = false, features = ["ahash", "inline-more"] } +hashbrown = { version = "0.8", default-features = false, features = ["ahash", "inline-more"] } log = "0.4" wee_alloc = "0.4" diff --git a/cargo/BUILD b/cargo/BUILD index a8639e57..39f442c5 100644 --- a/cargo/BUILD +++ b/cargo/BUILD @@ -15,7 +15,7 @@ alias( ) alias( name = "hashbrown", - actual = "@raze__hashbrown__0_7_2//:hashbrown", + actual = "@raze__hashbrown__0_8_2//:hashbrown", tags = ["cargo-raze"], ) alias( diff --git a/cargo/Cargo.lock b/cargo/Cargo.lock index 9d9a2b8a..034709b0 100644 --- a/cargo/Cargo.lock +++ b/cargo/Cargo.lock @@ -31,9 +31,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.7.2" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf" +checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" dependencies = [ "ahash", "autocfg", diff --git a/cargo/crates.bzl b/cargo/crates.bzl index 79ae70f5..653a3021 100644 --- a/cargo/crates.bzl +++ b/cargo/crates.bzl @@ -53,12 +53,12 @@ def raze_fetch_remote_crates(): ) _new_http_archive( - name = "raze__hashbrown__0_7_2", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/hashbrown/hashbrown-0.7.2.crate", + name = "raze__hashbrown__0_8_2", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/hashbrown/hashbrown-0.8.2.crate", type = "tar.gz", - sha256 = "96282e96bfcd3da0d3aa9938bedf1e50df3269b6db08b4876d2da0bb1a0841cf", - strip_prefix = "hashbrown-0.7.2", - build_file = Label("//cargo/remote:hashbrown-0.7.2.BUILD"), + sha256 = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25", + strip_prefix = "hashbrown-0.8.2", + build_file = Label("//cargo/remote:hashbrown-0.8.2.BUILD"), ) _new_http_archive( diff --git a/cargo/remote/hashbrown-0.7.2.BUILD b/cargo/remote/hashbrown-0.8.2.BUILD similarity index 98% rename from cargo/remote/hashbrown-0.7.2.BUILD rename to cargo/remote/hashbrown-0.8.2.BUILD index c693cbf1..7a073640 100644 --- a/cargo/remote/hashbrown-0.7.2.BUILD +++ b/cargo/remote/hashbrown-0.8.2.BUILD @@ -38,7 +38,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.7.2", + version = "0.8.2", tags = ["cargo-raze"], crate_features = [ "ahash", From b5ec8ddb230be2724823cf3150d70b431931351f Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 10 Aug 2020 19:18:09 -0700 Subject: [PATCH 10/42] Add cargo audit and cargo outdated checks. (#23) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 50f015e5..953fc234 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -24,6 +24,9 @@ on: branches: - master + schedule: + - cron: '0 0 * * *' + jobs: licenses: @@ -38,6 +41,32 @@ jobs: export PATH=$PATH:$(go env GOPATH)/bin addlicense -check . + audit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run cargo audit + run: | + cp -p cargo/Cargo.lock . + cargo audit + + outdated: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Run cargo outdated + run: cargo outdated --exit-code 1 + + - name: Check freshness of cargo/Cargo.lock + run: | + cargo generate-lockfile + mv Cargo.lock cargo/ + git diff --exit-code + stable: runs-on: ubuntu-latest From 00782e2e39908a24dfa6666288a4e41e736fb063 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Sat, 15 Aug 2020 02:06:31 -0700 Subject: [PATCH 11/42] Update chrono to v0.4.15. (#33) Signed-off-by: Piotr Sikora --- cargo/BUILD | 2 +- cargo/Cargo.lock | 4 ++-- cargo/crates.bzl | 10 +++++----- .../{chrono-0.4.13.BUILD => chrono-0.4.15.BUILD} | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) rename cargo/remote/{chrono-0.4.13.BUILD => chrono-0.4.15.BUILD} (97%) diff --git a/cargo/BUILD b/cargo/BUILD index 39f442c5..1683f612 100644 --- a/cargo/BUILD +++ b/cargo/BUILD @@ -10,7 +10,7 @@ licenses([ ]) alias( name = "chrono", - actual = "@raze__chrono__0_4_13//:chrono", + actual = "@raze__chrono__0_4_15//:chrono", tags = ["cargo-raze"], ) alias( diff --git a/cargo/Cargo.lock b/cargo/Cargo.lock index 034709b0..a9421c7a 100644 --- a/cargo/Cargo.lock +++ b/cargo/Cargo.lock @@ -20,9 +20,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chrono" -version = "0.4.13" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" +checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b" dependencies = [ "num-integer", "num-traits", diff --git a/cargo/crates.bzl b/cargo/crates.bzl index 653a3021..d6bc3b06 100644 --- a/cargo/crates.bzl +++ b/cargo/crates.bzl @@ -44,12 +44,12 @@ def raze_fetch_remote_crates(): ) _new_http_archive( - name = "raze__chrono__0_4_13", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/chrono/chrono-0.4.13.crate", + name = "raze__chrono__0_4_15", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/chrono/chrono-0.4.15.crate", type = "tar.gz", - sha256 = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6", - strip_prefix = "chrono-0.4.13", - build_file = Label("//cargo/remote:chrono-0.4.13.BUILD"), + sha256 = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b", + strip_prefix = "chrono-0.4.15", + build_file = Label("//cargo/remote:chrono-0.4.15.BUILD"), ) _new_http_archive( diff --git a/cargo/remote/chrono-0.4.13.BUILD b/cargo/remote/chrono-0.4.15.BUILD similarity index 97% rename from cargo/remote/chrono-0.4.13.BUILD rename to cargo/remote/chrono-0.4.15.BUILD index 87aad760..0847c2ba 100644 --- a/cargo/remote/chrono-0.4.13.BUILD +++ b/cargo/remote/chrono-0.4.15.BUILD @@ -39,7 +39,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.4.13", + version = "0.4.15", tags = ["cargo-raze"], crate_features = [ "clock", From b2ad59c52634ca24b96a45620d641d01ef145b31 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Sat, 15 Aug 2020 02:13:31 -0700 Subject: [PATCH 12/42] Move optional checks to the end. (#28) While there, align style with the test framework. Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 106 ++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 953fc234..7b669c70 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -41,29 +41,41 @@ jobs: export PATH=$PATH:$(go env GOPATH)/bin addlicense -check . - audit: + bazel: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Run cargo audit - run: | - cp -p cargo/Cargo.lock . - cargo audit - - outdated: - runs-on: ubuntu-latest + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.cache/bazel + ~/.cache/bazelisk + ~/.cargo/.crates.toml + ~/.cargo/.crates2.json + ~/.cargo/bin + ~/.cargo/registry + key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'cargo/Cargo.lock') }} - steps: - - uses: actions/checkout@v2 + - name: Build + run: bazelisk build //... - - name: Run cargo outdated - run: cargo outdated --exit-code 1 + - name: Format (buildifier) + run: | + GO111MODULE=on go get -u github.com/bazelbuild/buildtools/buildifier@3.4.0 + export PATH=$PATH:$(go env GOPATH)/bin + buildifier -mode=check WORKSPACE + buildifier -mode=check BUILD + buildifier -mode=check examples/BUILD - - name: Check freshness of cargo/Cargo.lock + - name: Format (cargo raze) run: | - cargo generate-lockfile + cargo install cargo-raze --version 0.3.8 + cp -p cargo/Cargo.lock . + rm -rf cargo/ + cargo raze --output=cargo mv Cargo.lock cargo/ git diff --exit-code @@ -80,13 +92,13 @@ jobs: - name: Build env: - RUSTFLAGS: -C link-args=-S -D warnings - run: cargo build --target=wasm32-unknown-unknown --release --all-targets + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo build --release --all-targets --target=wasm32-unknown-unknown - name: Format (clippy) env: - RUSTFLAGS: -C link-args=-S -D warnings - run: cargo clippy --target=wasm32-unknown-unknown --release --all-targets + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo clippy --release --all-targets --target=wasm32-unknown-unknown - name: Format (rustfmt) run: cargo fmt -- --check @@ -110,64 +122,52 @@ jobs: run: | rustup toolchain install nightly --component clippy --component rustfmt rustup +nightly target add wasm32-unknown-unknown + rustup default nightly - name: Build env: - RUSTFLAGS: -C link-args=-S -D warnings - run: cargo +nightly build --target=wasm32-unknown-unknown --release --all-targets + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo build --release --all-targets --target=wasm32-unknown-unknown - name: Format (clippy) env: - RUSTFLAGS: -C link-args=-S -D warnings - run: cargo +nightly clippy --target=wasm32-unknown-unknown --release --all-targets + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo clippy --release --all-targets --target=wasm32-unknown-unknown - name: Format (rustfmt) - run: cargo +nightly fmt -- --check + run: cargo fmt -- --check - name: Format (manifest) - run: cargo +nightly verify-project + run: cargo verify-project - name: Package (docs) - run: cargo +nightly doc --no-deps --target=wasm32-unknown-unknown + run: cargo doc --no-deps --target=wasm32-unknown-unknown - name: Package (publish) - run: cargo +nightly publish --dry-run --target=wasm32-unknown-unknown + run: cargo publish --dry-run --target=wasm32-unknown-unknown - bazel: + outdated: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Cache - uses: actions/cache@v2 - with: - path: | - ~/.cache/bazel - ~/.cache/bazelisk - ~/.cargo/.crates.toml - ~/.cargo/.crates2.json - ~/.cargo/bin - ~/.cargo/registry - key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'cargo/Cargo.lock') }} + - name: Run cargo outdated + run: cargo outdated --exit-code 1 - - name: Build + - name: Check freshness of cargo/Cargo.lock run: | - bazelisk build //... + cargo generate-lockfile + mv Cargo.lock cargo/ + git diff --exit-code - - name: Format (buildifier) - run: | - GO111MODULE=on go get -u github.com/bazelbuild/buildtools/buildifier@3.4.0 - export PATH=$PATH:$(go env GOPATH)/bin - buildifier -mode=check WORKSPACE - buildifier -mode=check BUILD - buildifier -mode=check examples/BUILD + audit: + runs-on: ubuntu-latest - - name: Format (cargo raze) + steps: + - uses: actions/checkout@v2 + + - name: Run cargo audit run: | - cargo install cargo-raze --version 0.3.8 cp -p cargo/Cargo.lock . - rm -rf cargo/ - cargo raze --output=cargo - mv Cargo.lock cargo/ - git diff --exit-code + cargo audit From f352a8d5f3033b521f6321664eb60fd71e29f409 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Sat, 15 Aug 2020 02:28:20 -0700 Subject: [PATCH 13/42] Move Bazel to //bazel. (#29) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 16 +++++----- BUILD | 6 ++-- Cargo.toml | 2 +- WORKSPACE | 2 +- {cargo => bazel/cargo}/BUILD | 0 {cargo => bazel/cargo}/Cargo.lock | 0 {cargo => bazel/cargo}/crates.bzl | 30 +++++++++---------- {cargo => bazel/cargo}/remote/BUILD | 0 .../cargo}/remote/ahash-0.3.8.BUILD | 2 +- .../cargo}/remote/autocfg-1.0.0.BUILD | 2 +- .../cargo}/remote/cfg-if-0.1.10.BUILD | 2 +- .../cargo}/remote/chrono-0.4.15.BUILD | 2 +- .../cargo}/remote/hashbrown-0.8.2.BUILD | 2 +- .../cargo}/remote/libc-0.2.74.BUILD | 2 +- .../cargo}/remote/log-0.4.11.BUILD | 2 +- .../cargo}/remote/memory_units-0.4.0.BUILD | 2 +- .../cargo}/remote/num-integer-0.1.43.BUILD | 2 +- .../cargo}/remote/num-traits-0.2.12.BUILD | 2 +- .../cargo}/remote/time-0.1.43.BUILD | 2 +- .../cargo}/remote/wee_alloc-0.4.5.BUILD | 2 +- .../cargo}/remote/winapi-0.3.9.BUILD | 2 +- .../winapi-i686-pc-windows-gnu-0.4.0.BUILD | 2 +- .../winapi-x86_64-pc-windows-gnu-0.4.0.BUILD | 2 +- examples/BUILD | 10 +++---- 24 files changed, 48 insertions(+), 48 deletions(-) rename {cargo => bazel/cargo}/BUILD (100%) rename {cargo => bazel/cargo}/Cargo.lock (100%) rename {cargo => bazel/cargo}/crates.bzl (83%) rename {cargo => bazel/cargo}/remote/BUILD (100%) rename {cargo => bazel/cargo}/remote/ahash-0.3.8.BUILD (93%) rename {cargo => bazel/cargo}/remote/autocfg-1.0.0.BUILD (94%) rename {cargo => bazel/cargo}/remote/cfg-if-0.1.10.BUILD (92%) rename {cargo => bazel/cargo}/remote/chrono-0.4.15.BUILD (94%) rename {cargo => bazel/cargo}/remote/hashbrown-0.8.2.BUILD (94%) rename {cargo => bazel/cargo}/remote/libc-0.2.74.BUILD (93%) rename {cargo => bazel/cargo}/remote/log-0.4.11.BUILD (93%) rename {cargo => bazel/cargo}/remote/memory_units-0.4.0.BUILD (91%) rename {cargo => bazel/cargo}/remote/num-integer-0.1.43.BUILD (94%) rename {cargo => bazel/cargo}/remote/num-traits-0.2.12.BUILD (93%) rename {cargo => bazel/cargo}/remote/time-0.1.43.BUILD (92%) rename {cargo => bazel/cargo}/remote/wee_alloc-0.4.5.BUILD (93%) rename {cargo => bazel/cargo}/remote/winapi-0.3.9.BUILD (94%) rename {cargo => bazel/cargo}/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD (92%) rename {cargo => bazel/cargo}/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD (92%) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 7b669c70..79776ffe 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,7 +57,7 @@ jobs: ~/.cargo/.crates2.json ~/.cargo/bin ~/.cargo/registry - key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'cargo/Cargo.lock') }} + key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock') }} - name: Build run: bazelisk build //... @@ -73,10 +73,10 @@ jobs: - name: Format (cargo raze) run: | cargo install cargo-raze --version 0.3.8 - cp -p cargo/Cargo.lock . - rm -rf cargo/ - cargo raze --output=cargo - mv Cargo.lock cargo/ + cp -p bazel/cargo/Cargo.lock . + rm -rf bazel/cargo/ + cargo raze --output=bazel/cargo + mv Cargo.lock bazel/cargo/ git diff --exit-code stable: @@ -155,10 +155,10 @@ jobs: - name: Run cargo outdated run: cargo outdated --exit-code 1 - - name: Check freshness of cargo/Cargo.lock + - name: Check freshness of bazel/cargo/Cargo.lock run: | cargo generate-lockfile - mv Cargo.lock cargo/ + mv Cargo.lock bazel/cargo/ git diff --exit-code audit: @@ -169,5 +169,5 @@ jobs: - name: Run cargo audit run: | - cp -p cargo/Cargo.lock . + cp -p bazel/cargo/Cargo.lock . cargo audit diff --git a/BUILD b/BUILD index 1df187e8..f323a4bf 100644 --- a/BUILD +++ b/BUILD @@ -6,8 +6,8 @@ rust_library( edition = "2018", visibility = ["//visibility:public"], deps = [ - "//cargo:hashbrown", - "//cargo:log", - "//cargo:wee_alloc", + "//bazel/cargo:hashbrown", + "//bazel/cargo:log", + "//bazel/cargo:wee_alloc", ], ) diff --git a/Cargo.toml b/Cargo.toml index 9ae93ff4..e47b572f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ opt-level = 3 panic = "abort" [raze] -workspace_path = "//cargo" +workspace_path = "//bazel/cargo" target = "wasm32-unknown-unknown" genmode = "Remote" diff --git a/WORKSPACE b/WORKSPACE index 98a223a8..5e586280 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -32,6 +32,6 @@ load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") bazel_version(name = "bazel_version") -load("//cargo:crates.bzl", "raze_fetch_remote_crates") +load("//bazel/cargo:crates.bzl", "raze_fetch_remote_crates") raze_fetch_remote_crates() diff --git a/cargo/BUILD b/bazel/cargo/BUILD similarity index 100% rename from cargo/BUILD rename to bazel/cargo/BUILD diff --git a/cargo/Cargo.lock b/bazel/cargo/Cargo.lock similarity index 100% rename from cargo/Cargo.lock rename to bazel/cargo/Cargo.lock diff --git a/cargo/crates.bzl b/bazel/cargo/crates.bzl similarity index 83% rename from cargo/crates.bzl rename to bazel/cargo/crates.bzl index d6bc3b06..5b60b01e 100644 --- a/cargo/crates.bzl +++ b/bazel/cargo/crates.bzl @@ -22,7 +22,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217", strip_prefix = "ahash-0.3.8", - build_file = Label("//cargo/remote:ahash-0.3.8.BUILD"), + build_file = Label("//bazel/cargo/remote:ahash-0.3.8.BUILD"), ) _new_http_archive( @@ -31,7 +31,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d", strip_prefix = "autocfg-1.0.0", - build_file = Label("//cargo/remote:autocfg-1.0.0.BUILD"), + build_file = Label("//bazel/cargo/remote:autocfg-1.0.0.BUILD"), ) _new_http_archive( @@ -40,7 +40,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822", strip_prefix = "cfg-if-0.1.10", - build_file = Label("//cargo/remote:cfg-if-0.1.10.BUILD"), + build_file = Label("//bazel/cargo/remote:cfg-if-0.1.10.BUILD"), ) _new_http_archive( @@ -49,7 +49,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b", strip_prefix = "chrono-0.4.15", - build_file = Label("//cargo/remote:chrono-0.4.15.BUILD"), + build_file = Label("//bazel/cargo/remote:chrono-0.4.15.BUILD"), ) _new_http_archive( @@ -58,7 +58,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25", strip_prefix = "hashbrown-0.8.2", - build_file = Label("//cargo/remote:hashbrown-0.8.2.BUILD"), + build_file = Label("//bazel/cargo/remote:hashbrown-0.8.2.BUILD"), ) _new_http_archive( @@ -67,7 +67,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10", strip_prefix = "libc-0.2.74", - build_file = Label("//cargo/remote:libc-0.2.74.BUILD"), + build_file = Label("//bazel/cargo/remote:libc-0.2.74.BUILD"), ) _new_http_archive( @@ -76,7 +76,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b", strip_prefix = "log-0.4.11", - build_file = Label("//cargo/remote:log-0.4.11.BUILD"), + build_file = Label("//bazel/cargo/remote:log-0.4.11.BUILD"), ) _new_http_archive( @@ -85,7 +85,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3", strip_prefix = "memory_units-0.4.0", - build_file = Label("//cargo/remote:memory_units-0.4.0.BUILD"), + build_file = Label("//bazel/cargo/remote:memory_units-0.4.0.BUILD"), ) _new_http_archive( @@ -94,7 +94,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b", strip_prefix = "num-integer-0.1.43", - build_file = Label("//cargo/remote:num-integer-0.1.43.BUILD"), + build_file = Label("//bazel/cargo/remote:num-integer-0.1.43.BUILD"), ) _new_http_archive( @@ -103,7 +103,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611", strip_prefix = "num-traits-0.2.12", - build_file = Label("//cargo/remote:num-traits-0.2.12.BUILD"), + build_file = Label("//bazel/cargo/remote:num-traits-0.2.12.BUILD"), ) _new_http_archive( @@ -112,7 +112,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438", strip_prefix = "time-0.1.43", - build_file = Label("//cargo/remote:time-0.1.43.BUILD"), + build_file = Label("//bazel/cargo/remote:time-0.1.43.BUILD"), ) _new_http_archive( @@ -121,7 +121,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e", strip_prefix = "wee_alloc-0.4.5", - build_file = Label("//cargo/remote:wee_alloc-0.4.5.BUILD"), + build_file = Label("//bazel/cargo/remote:wee_alloc-0.4.5.BUILD"), ) _new_http_archive( @@ -130,7 +130,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", strip_prefix = "winapi-0.3.9", - build_file = Label("//cargo/remote:winapi-0.3.9.BUILD"), + build_file = Label("//bazel/cargo/remote:winapi-0.3.9.BUILD"), ) _new_http_archive( @@ -139,7 +139,7 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0", - build_file = Label("//cargo/remote:winapi-i686-pc-windows-gnu-0.4.0.BUILD"), + build_file = Label("//bazel/cargo/remote:winapi-i686-pc-windows-gnu-0.4.0.BUILD"), ) _new_http_archive( @@ -148,6 +148,6 @@ def raze_fetch_remote_crates(): type = "tar.gz", sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0", - build_file = Label("//cargo/remote:winapi-x86_64-pc-windows-gnu-0.4.0.BUILD"), + build_file = Label("//bazel/cargo/remote:winapi-x86_64-pc-windows-gnu-0.4.0.BUILD"), ) diff --git a/cargo/remote/BUILD b/bazel/cargo/remote/BUILD similarity index 100% rename from cargo/remote/BUILD rename to bazel/cargo/remote/BUILD diff --git a/cargo/remote/ahash-0.3.8.BUILD b/bazel/cargo/remote/ahash-0.3.8.BUILD similarity index 93% rename from cargo/remote/ahash-0.3.8.BUILD rename to bazel/cargo/remote/ahash-0.3.8.BUILD index e63b4074..56f7acd7 100644 --- a/cargo/remote/ahash-0.3.8.BUILD +++ b/bazel/cargo/remote/ahash-0.3.8.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/autocfg-1.0.0.BUILD b/bazel/cargo/remote/autocfg-1.0.0.BUILD similarity index 94% rename from cargo/remote/autocfg-1.0.0.BUILD rename to bazel/cargo/remote/autocfg-1.0.0.BUILD index 0369819e..34c629ae 100644 --- a/cargo/remote/autocfg-1.0.0.BUILD +++ b/bazel/cargo/remote/autocfg-1.0.0.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/cfg-if-0.1.10.BUILD b/bazel/cargo/remote/cfg-if-0.1.10.BUILD similarity index 92% rename from cargo/remote/cfg-if-0.1.10.BUILD rename to bazel/cargo/remote/cfg-if-0.1.10.BUILD index 2f657921..a3b94083 100644 --- a/cargo/remote/cfg-if-0.1.10.BUILD +++ b/bazel/cargo/remote/cfg-if-0.1.10.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/chrono-0.4.15.BUILD b/bazel/cargo/remote/chrono-0.4.15.BUILD similarity index 94% rename from cargo/remote/chrono-0.4.15.BUILD rename to bazel/cargo/remote/chrono-0.4.15.BUILD index 0847c2ba..f19c711c 100644 --- a/cargo/remote/chrono-0.4.15.BUILD +++ b/bazel/cargo/remote/chrono-0.4.15.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/hashbrown-0.8.2.BUILD b/bazel/cargo/remote/hashbrown-0.8.2.BUILD similarity index 94% rename from cargo/remote/hashbrown-0.8.2.BUILD rename to bazel/cargo/remote/hashbrown-0.8.2.BUILD index 7a073640..f3416b79 100644 --- a/cargo/remote/hashbrown-0.8.2.BUILD +++ b/bazel/cargo/remote/hashbrown-0.8.2.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/libc-0.2.74.BUILD b/bazel/cargo/remote/libc-0.2.74.BUILD similarity index 93% rename from cargo/remote/libc-0.2.74.BUILD rename to bazel/cargo/remote/libc-0.2.74.BUILD index d1a4a658..3fc249c0 100644 --- a/cargo/remote/libc-0.2.74.BUILD +++ b/bazel/cargo/remote/libc-0.2.74.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/log-0.4.11.BUILD b/bazel/cargo/remote/log-0.4.11.BUILD similarity index 93% rename from cargo/remote/log-0.4.11.BUILD rename to bazel/cargo/remote/log-0.4.11.BUILD index ec0b13c5..0d08d313 100644 --- a/cargo/remote/log-0.4.11.BUILD +++ b/bazel/cargo/remote/log-0.4.11.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/memory_units-0.4.0.BUILD b/bazel/cargo/remote/memory_units-0.4.0.BUILD similarity index 91% rename from cargo/remote/memory_units-0.4.0.BUILD rename to bazel/cargo/remote/memory_units-0.4.0.BUILD index e9c2994c..a8964bfa 100644 --- a/cargo/remote/memory_units-0.4.0.BUILD +++ b/bazel/cargo/remote/memory_units-0.4.0.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/num-integer-0.1.43.BUILD b/bazel/cargo/remote/num-integer-0.1.43.BUILD similarity index 94% rename from cargo/remote/num-integer-0.1.43.BUILD rename to bazel/cargo/remote/num-integer-0.1.43.BUILD index e07c6afc..45c79ea3 100644 --- a/cargo/remote/num-integer-0.1.43.BUILD +++ b/bazel/cargo/remote/num-integer-0.1.43.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/num-traits-0.2.12.BUILD b/bazel/cargo/remote/num-traits-0.2.12.BUILD similarity index 93% rename from cargo/remote/num-traits-0.2.12.BUILD rename to bazel/cargo/remote/num-traits-0.2.12.BUILD index 5a8faf8d..d870bc23 100644 --- a/cargo/remote/num-traits-0.2.12.BUILD +++ b/bazel/cargo/remote/num-traits-0.2.12.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/time-0.1.43.BUILD b/bazel/cargo/remote/time-0.1.43.BUILD similarity index 92% rename from cargo/remote/time-0.1.43.BUILD rename to bazel/cargo/remote/time-0.1.43.BUILD index 7c9954db..e3a046b0 100644 --- a/cargo/remote/time-0.1.43.BUILD +++ b/bazel/cargo/remote/time-0.1.43.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/wee_alloc-0.4.5.BUILD b/bazel/cargo/remote/wee_alloc-0.4.5.BUILD similarity index 93% rename from cargo/remote/wee_alloc-0.4.5.BUILD rename to bazel/cargo/remote/wee_alloc-0.4.5.BUILD index 7013b298..26e2bc58 100644 --- a/cargo/remote/wee_alloc-0.4.5.BUILD +++ b/bazel/cargo/remote/wee_alloc-0.4.5.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/winapi-0.3.9.BUILD b/bazel/cargo/remote/winapi-0.3.9.BUILD similarity index 94% rename from cargo/remote/winapi-0.3.9.BUILD rename to bazel/cargo/remote/winapi-0.3.9.BUILD index 377e38bb..49b1e59a 100644 --- a/cargo/remote/winapi-0.3.9.BUILD +++ b/bazel/cargo/remote/winapi-0.3.9.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD b/bazel/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD similarity index 92% rename from cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD rename to bazel/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD index bd0921c1..b6841433 100644 --- a/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD +++ b/bazel/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD b/bazel/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD similarity index 92% rename from cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD rename to bazel/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD index 6770f841..c8a62c4f 100644 --- a/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD +++ b/bazel/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD @@ -6,7 +6,7 @@ DO NOT EDIT! Replaced on runs of cargo-raze package(default_visibility = [ # Public for visibility by "@raze__crate__version//" targets. # - # Prefer access through "//cargo", which limits external + # Prefer access through "//bazel/cargo", which limits external # visibility to explicit Cargo.toml dependencies. "//visibility:public", ]) diff --git a/examples/BUILD b/examples/BUILD index 4bd527a9..4901dd94 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -8,8 +8,8 @@ rust_binary( out_binary = True, deps = [ "//:proxy_wasm", - "//cargo:chrono", - "//cargo:log", + "//bazel/cargo:chrono", + "//bazel/cargo:log", ], ) @@ -21,7 +21,7 @@ rust_binary( out_binary = True, deps = [ "//:proxy_wasm", - "//cargo:log", + "//bazel/cargo:log", ], ) @@ -33,7 +33,7 @@ rust_binary( out_binary = True, deps = [ "//:proxy_wasm", - "//cargo:log", + "//bazel/cargo:log", ], ) @@ -45,6 +45,6 @@ rust_binary( out_binary = True, deps = [ "//:proxy_wasm", - "//cargo:log", + "//bazel/cargo:log", ], ) From 8d1dd06125be7594a74233d96e5037e0f6aaa2ca Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Sat, 15 Aug 2020 02:35:50 -0700 Subject: [PATCH 14/42] Fix HTTP body example. (#32) Signed-off-by: Piotr Sikora --- examples/http_body.rs | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/examples/http_body.rs b/examples/http_body.rs index a4242f86..5db8ed8f 100644 --- a/examples/http_body.rs +++ b/examples/http_body.rs @@ -18,19 +18,10 @@ use proxy_wasm::types::*; #[no_mangle] pub fn _start() { proxy_wasm::set_log_level(LogLevel::Trace); - proxy_wasm::set_http_context(|_, _| -> Box { Box::new(HttpBody::new()) }); + proxy_wasm::set_http_context(|_, _| -> Box { Box::new(HttpBody) }); } -#[derive(Default)] -struct HttpBody { - total_body_size: usize, -} - -impl HttpBody { - fn new() -> HttpBody { - Default::default() - } -} +struct HttpBody; impl Context for HttpBody {} @@ -41,13 +32,10 @@ impl HttpContext for HttpBody { // We must do this here, because once we exit this function we // can no longer modify the response headers. self.set_http_response_header("content-length", None); - // Don't continue to the next callout in the chain because we might - // modify the body. - Action::Pause + Action::Continue } fn on_http_response_body(&mut self, body_size: usize, end_of_stream: bool) -> Action { - self.total_body_size += body_size; if !end_of_stream { // Wait -- we'll be called again when the complete body is buffered // at the host side. @@ -56,15 +44,11 @@ impl HttpContext for HttpBody { // Replace the message body if it contains the text "secret". // Since we returned "Pause" previuously, this will return the whole body. - // However, we have to calculate the size ourselves. - if let Some(body_bytes) = self.get_http_response_body(0, self.total_body_size) { + if let Some(body_bytes) = self.get_http_response_body(0, body_size) { let body_str = String::from_utf8(body_bytes).unwrap(); if body_str.find("secret").is_some() { - let new_body = format!( - "Original message body ({} bytes) redacted.", - self.total_body_size - ); - self.set_http_response_body(0, self.total_body_size, &new_body.into_bytes()); + let new_body = format!("Original message body ({} bytes) redacted.", body_size); + self.set_http_response_body(0, body_size, &new_body.into_bytes()); } } Action::Continue From 6f3208572db871130f86e9a15d303291e43dbacb Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Sat, 15 Aug 2020 02:38:43 -0700 Subject: [PATCH 15/42] Add support for setting network buffers. (#31) Signed-off-by: Piotr Sikora --- src/traits.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/traits.rs b/src/traits.rs index 268ef39c..10b24514 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -136,6 +136,10 @@ pub trait StreamContext: Context { hostcalls::get_buffer(BufferType::DownstreamData, start, max_size).unwrap() } + fn set_downstream_data(&self, start: usize, size: usize, value: &[u8]) { + hostcalls::set_buffer(BufferType::DownstreamData, start, size, value).unwrap() + } + fn on_downstream_close(&mut self, _peer_type: PeerType) {} fn on_upstream_data(&mut self, _data_size: usize, _end_of_stream: bool) -> Action { @@ -146,6 +150,10 @@ pub trait StreamContext: Context { hostcalls::get_buffer(BufferType::UpstreamData, start, max_size).unwrap() } + fn set_upstream_data(&self, start: usize, size: usize, value: &[u8]) { + hostcalls::set_buffer(BufferType::UpstreamData, start, size, value).unwrap() + } + fn on_upstream_close(&mut self, _peer_type: PeerType) {} fn on_log(&mut self) {} From e7a6ad0f123965b5c05fa85606da9da00cac6ab6 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Sat, 15 Aug 2020 04:25:37 -0700 Subject: [PATCH 16/42] Add metrics. (#30) Fixes #4. Signed-off-by: Piotr Sikora --- src/hostcalls.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ src/types.rs | 8 ++++++ 2 files changed, 72 insertions(+) diff --git a/src/hostcalls.rs b/src/hostcalls.rs index 1d7509d7..8f37f2ae 100644 --- a/src/hostcalls.rs +++ b/src/hostcalls.rs @@ -678,6 +678,70 @@ pub fn done() -> Result<(), Status> { } } +extern "C" { + fn proxy_define_metric( + metric_type: MetricType, + name_data: *const u8, + name_size: usize, + return_id: *mut u32, + ) -> Status; +} + +pub fn define_metric(metric_type: MetricType, name: &str) -> Result { + let mut return_id: u32 = 0; + unsafe { + match proxy_define_metric(metric_type, name.as_ptr(), name.len(), &mut return_id) { + Status::Ok => Ok(return_id), + status => panic!("unexpected status: {}", status as u32), + } + } +} + +extern "C" { + fn proxy_get_metric(metric_id: u32, return_value: *mut u64) -> Status; +} + +pub fn get_metric(metric_id: u32) -> Result { + let mut return_value: u64 = 0; + unsafe { + match proxy_get_metric(metric_id, &mut return_value) { + Status::Ok => Ok(return_value), + Status::NotFound => Err(Status::NotFound), + Status::BadArgument => Err(Status::BadArgument), + status => panic!("unexpected status: {}", status as u32), + } + } +} + +extern "C" { + fn proxy_record_metric(metric_id: u32, value: u64) -> Status; +} + +pub fn record_metric(metric_id: u32, value: u64) -> Result<(), Status> { + unsafe { + match proxy_record_metric(metric_id, value) { + Status::Ok => Ok(()), + Status::NotFound => Err(Status::NotFound), + status => panic!("unexpected status: {}", status as u32), + } + } +} + +extern "C" { + fn proxy_increment_metric(metric_id: u32, offset: i64) -> Status; +} + +pub fn increment_metric(metric_id: u32, offset: i64) -> Result<(), Status> { + unsafe { + match proxy_increment_metric(metric_id, offset) { + Status::Ok => Ok(()), + Status::NotFound => Err(Status::NotFound), + Status::BadArgument => Err(Status::BadArgument), + status => panic!("unexpected status: {}", status as u32), + } + } +} + mod utils { use crate::types::Bytes; use std::convert::TryFrom; diff --git a/src/types.rs b/src/types.rs index ba9749c3..a951f78f 100644 --- a/src/types.rs +++ b/src/types.rs @@ -76,4 +76,12 @@ pub enum PeerType { Remote = 2, } +#[repr(u32)] +#[derive(Debug)] +pub enum MetricType { + Counter = 0, + Gauge = 1, + Histogram = 2, +} + pub type Bytes = Vec; From 3aad1be93c7794ca0697254e65b58c9efda0a669 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Tue, 3 Nov 2020 19:39:53 -0800 Subject: [PATCH 17/42] Update hashbrown and transitive dependencies. (#45) Signed-off-by: Piotr Sikora --- Cargo.toml | 2 +- bazel/cargo/BUILD | 4 +- bazel/cargo/Cargo.lock | 42 +++++---- bazel/cargo/crates.bzl | 89 ++++++++++--------- .../{ahash-0.3.8.BUILD => ahash-0.4.6.BUILD} | 2 +- ...utocfg-1.0.0.BUILD => autocfg-1.0.1.BUILD} | 2 +- ...hrono-0.4.15.BUILD => chrono-0.4.19.BUILD} | 12 ++- ...rown-0.8.2.BUILD => hashbrown-0.9.1.BUILD} | 6 +- .../{libc-0.2.74.BUILD => libc-0.2.80.BUILD} | 2 +- ...-0.1.43.BUILD => num-integer-0.1.44.BUILD} | 4 +- ...s-0.2.12.BUILD => num-traits-0.2.14.BUILD} | 2 +- .../{time-0.1.43.BUILD => time-0.1.44.BUILD} | 4 +- .../wasi-0.10.0+wasi-snapshot-preview1.BUILD | 45 ++++++++++ 13 files changed, 141 insertions(+), 75 deletions(-) rename bazel/cargo/remote/{ahash-0.3.8.BUILD => ahash-0.4.6.BUILD} (97%) rename bazel/cargo/remote/{autocfg-1.0.0.BUILD => autocfg-1.0.1.BUILD} (97%) rename bazel/cargo/remote/{chrono-0.4.15.BUILD => chrono-0.4.19.BUILD} (79%) rename bazel/cargo/remote/{hashbrown-0.8.2.BUILD => hashbrown-0.9.1.BUILD} (88%) rename bazel/cargo/remote/{libc-0.2.74.BUILD => libc-0.2.80.BUILD} (97%) rename bazel/cargo/remote/{num-integer-0.1.43.BUILD => num-integer-0.1.44.BUILD} (93%) rename bazel/cargo/remote/{num-traits-0.2.12.BUILD => num-traits-0.2.14.BUILD} (97%) rename bazel/cargo/remote/{time-0.1.43.BUILD => time-0.1.44.BUILD} (92%) create mode 100644 bazel/cargo/remote/wasi-0.10.0+wasi-snapshot-preview1.BUILD diff --git a/Cargo.toml b/Cargo.toml index e47b572f..25fd5a25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/proxy-wasm/proxy-wasm-rust-sdk" edition = "2018" [dependencies] -hashbrown = { version = "0.8", default-features = false, features = ["ahash", "inline-more"] } +hashbrown = "0.9" log = "0.4" wee_alloc = "0.4" diff --git a/bazel/cargo/BUILD b/bazel/cargo/BUILD index 1683f612..4a095b98 100644 --- a/bazel/cargo/BUILD +++ b/bazel/cargo/BUILD @@ -10,12 +10,12 @@ licenses([ ]) alias( name = "chrono", - actual = "@raze__chrono__0_4_15//:chrono", + actual = "@raze__chrono__0_4_19//:chrono", tags = ["cargo-raze"], ) alias( name = "hashbrown", - actual = "@raze__hashbrown__0_8_2//:hashbrown", + actual = "@raze__hashbrown__0_9_1//:hashbrown", tags = ["cargo-raze"], ) alias( diff --git a/bazel/cargo/Cargo.lock b/bazel/cargo/Cargo.lock index a9421c7a..9d618368 100644 --- a/bazel/cargo/Cargo.lock +++ b/bazel/cargo/Cargo.lock @@ -2,15 +2,15 @@ # It is not intended for manual editing. [[package]] name = "ahash" -version = "0.3.8" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +checksum = "f6789e291be47ace86a60303502173d84af8327e3627ecf334356ee0f87a164c" [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "cfg-if" @@ -20,30 +20,31 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chrono" -version = "0.4.15" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "libc", "num-integer", "num-traits", "time", + "winapi", ] [[package]] name = "hashbrown" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" +checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" dependencies = [ "ahash", - "autocfg", ] [[package]] name = "libc" -version = "0.2.74" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10" +checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" [[package]] name = "log" @@ -62,9 +63,9 @@ checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ "autocfg", "num-traits", @@ -72,9 +73,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ "autocfg", ] @@ -91,14 +92,21 @@ dependencies = [ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi", "winapi", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wee_alloc" version = "0.4.5" diff --git a/bazel/cargo/crates.bzl b/bazel/cargo/crates.bzl index 5b60b01e..e133346e 100644 --- a/bazel/cargo/crates.bzl +++ b/bazel/cargo/crates.bzl @@ -17,21 +17,21 @@ def _new_git_repository(name, **kwargs): def raze_fetch_remote_crates(): _new_http_archive( - name = "raze__ahash__0_3_8", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/ahash/ahash-0.3.8.crate", + name = "raze__ahash__0_4_6", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/ahash/ahash-0.4.6.crate", type = "tar.gz", - sha256 = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217", - strip_prefix = "ahash-0.3.8", - build_file = Label("//bazel/cargo/remote:ahash-0.3.8.BUILD"), + sha256 = "f6789e291be47ace86a60303502173d84af8327e3627ecf334356ee0f87a164c", + strip_prefix = "ahash-0.4.6", + build_file = Label("//bazel/cargo/remote:ahash-0.4.6.BUILD"), ) _new_http_archive( - name = "raze__autocfg__1_0_0", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/autocfg/autocfg-1.0.0.crate", + name = "raze__autocfg__1_0_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/autocfg/autocfg-1.0.1.crate", type = "tar.gz", - sha256 = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d", - strip_prefix = "autocfg-1.0.0", - build_file = Label("//bazel/cargo/remote:autocfg-1.0.0.BUILD"), + sha256 = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a", + strip_prefix = "autocfg-1.0.1", + build_file = Label("//bazel/cargo/remote:autocfg-1.0.1.BUILD"), ) _new_http_archive( @@ -44,30 +44,30 @@ def raze_fetch_remote_crates(): ) _new_http_archive( - name = "raze__chrono__0_4_15", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/chrono/chrono-0.4.15.crate", + name = "raze__chrono__0_4_19", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/chrono/chrono-0.4.19.crate", type = "tar.gz", - sha256 = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b", - strip_prefix = "chrono-0.4.15", - build_file = Label("//bazel/cargo/remote:chrono-0.4.15.BUILD"), + sha256 = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73", + strip_prefix = "chrono-0.4.19", + build_file = Label("//bazel/cargo/remote:chrono-0.4.19.BUILD"), ) _new_http_archive( - name = "raze__hashbrown__0_8_2", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/hashbrown/hashbrown-0.8.2.crate", + name = "raze__hashbrown__0_9_1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/hashbrown/hashbrown-0.9.1.crate", type = "tar.gz", - sha256 = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25", - strip_prefix = "hashbrown-0.8.2", - build_file = Label("//bazel/cargo/remote:hashbrown-0.8.2.BUILD"), + sha256 = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04", + strip_prefix = "hashbrown-0.9.1", + build_file = Label("//bazel/cargo/remote:hashbrown-0.9.1.BUILD"), ) _new_http_archive( - name = "raze__libc__0_2_74", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.74.crate", + name = "raze__libc__0_2_80", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.80.crate", type = "tar.gz", - sha256 = "a2f02823cf78b754822df5f7f268fb59822e7296276d3e069d8e8cb26a14bd10", - strip_prefix = "libc-0.2.74", - build_file = Label("//bazel/cargo/remote:libc-0.2.74.BUILD"), + sha256 = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614", + strip_prefix = "libc-0.2.80", + build_file = Label("//bazel/cargo/remote:libc-0.2.80.BUILD"), ) _new_http_archive( @@ -89,30 +89,39 @@ def raze_fetch_remote_crates(): ) _new_http_archive( - name = "raze__num_integer__0_1_43", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-integer/num-integer-0.1.43.crate", + name = "raze__num_integer__0_1_44", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-integer/num-integer-0.1.44.crate", type = "tar.gz", - sha256 = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b", - strip_prefix = "num-integer-0.1.43", - build_file = Label("//bazel/cargo/remote:num-integer-0.1.43.BUILD"), + sha256 = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db", + strip_prefix = "num-integer-0.1.44", + build_file = Label("//bazel/cargo/remote:num-integer-0.1.44.BUILD"), ) _new_http_archive( - name = "raze__num_traits__0_2_12", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-traits/num-traits-0.2.12.crate", + name = "raze__num_traits__0_2_14", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-traits/num-traits-0.2.14.crate", type = "tar.gz", - sha256 = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611", - strip_prefix = "num-traits-0.2.12", - build_file = Label("//bazel/cargo/remote:num-traits-0.2.12.BUILD"), + sha256 = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290", + strip_prefix = "num-traits-0.2.14", + build_file = Label("//bazel/cargo/remote:num-traits-0.2.14.BUILD"), ) _new_http_archive( - name = "raze__time__0_1_43", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/time/time-0.1.43.crate", + name = "raze__time__0_1_44", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/time/time-0.1.44.crate", type = "tar.gz", - sha256 = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438", - strip_prefix = "time-0.1.43", - build_file = Label("//bazel/cargo/remote:time-0.1.43.BUILD"), + sha256 = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255", + strip_prefix = "time-0.1.44", + build_file = Label("//bazel/cargo/remote:time-0.1.44.BUILD"), + ) + + _new_http_archive( + name = "raze__wasi__0_10_0_wasi_snapshot_preview1", + url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/wasi/wasi-0.10.0+wasi-snapshot-preview1.crate", + type = "tar.gz", + sha256 = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f", + strip_prefix = "wasi-0.10.0+wasi-snapshot-preview1", + build_file = Label("//bazel/cargo/remote:wasi-0.10.0+wasi-snapshot-preview1.BUILD"), ) _new_http_archive( diff --git a/bazel/cargo/remote/ahash-0.3.8.BUILD b/bazel/cargo/remote/ahash-0.4.6.BUILD similarity index 97% rename from bazel/cargo/remote/ahash-0.3.8.BUILD rename to bazel/cargo/remote/ahash-0.4.6.BUILD index 56f7acd7..c79e45d7 100644 --- a/bazel/cargo/remote/ahash-0.3.8.BUILD +++ b/bazel/cargo/remote/ahash-0.4.6.BUILD @@ -36,7 +36,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.3.8", + version = "0.4.6", tags = ["cargo-raze"], crate_features = [ ], diff --git a/bazel/cargo/remote/autocfg-1.0.0.BUILD b/bazel/cargo/remote/autocfg-1.0.1.BUILD similarity index 97% rename from bazel/cargo/remote/autocfg-1.0.0.BUILD rename to bazel/cargo/remote/autocfg-1.0.1.BUILD index 34c629ae..088d5bcc 100644 --- a/bazel/cargo/remote/autocfg-1.0.0.BUILD +++ b/bazel/cargo/remote/autocfg-1.0.1.BUILD @@ -35,7 +35,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "1.0.0", + version = "1.0.1", tags = ["cargo-raze"], crate_features = [ ], diff --git a/bazel/cargo/remote/chrono-0.4.15.BUILD b/bazel/cargo/remote/chrono-0.4.19.BUILD similarity index 79% rename from bazel/cargo/remote/chrono-0.4.15.BUILD rename to bazel/cargo/remote/chrono-0.4.19.BUILD index f19c711c..b0369d4e 100644 --- a/bazel/cargo/remote/chrono-0.4.15.BUILD +++ b/bazel/cargo/remote/chrono-0.4.19.BUILD @@ -29,9 +29,10 @@ rust_library( name = "chrono", crate_type = "lib", deps = [ - "@raze__num_integer__0_1_43//:num_integer", - "@raze__num_traits__0_2_12//:num_traits", - "@raze__time__0_1_43//:time", + "@raze__libc__0_2_80//:libc", + "@raze__num_integer__0_1_44//:num_integer", + "@raze__num_traits__0_2_14//:num_traits", + "@raze__time__0_1_44//:time", ], srcs = glob(["**/*.rs"]), crate_root = "src/lib.rs", @@ -39,13 +40,16 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.4.15", + version = "0.4.19", tags = ["cargo-raze"], crate_features = [ "clock", "default", + "libc", + "oldtime", "std", "time", + "winapi", ], ) diff --git a/bazel/cargo/remote/hashbrown-0.8.2.BUILD b/bazel/cargo/remote/hashbrown-0.9.1.BUILD similarity index 88% rename from bazel/cargo/remote/hashbrown-0.8.2.BUILD rename to bazel/cargo/remote/hashbrown-0.9.1.BUILD index f3416b79..ac49a03d 100644 --- a/bazel/cargo/remote/hashbrown-0.8.2.BUILD +++ b/bazel/cargo/remote/hashbrown-0.9.1.BUILD @@ -24,13 +24,12 @@ load( # Unsupported target "bench" with type "bench" omitted -# Unsupported target "build-script-build" with type "custom-build" omitted rust_library( name = "hashbrown", crate_type = "lib", deps = [ - "@raze__ahash__0_3_8//:ahash", + "@raze__ahash__0_4_6//:ahash", ], srcs = glob(["**/*.rs"]), crate_root = "src/lib.rs", @@ -38,10 +37,11 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.8.2", + version = "0.9.1", tags = ["cargo-raze"], crate_features = [ "ahash", + "default", "inline-more", ], ) diff --git a/bazel/cargo/remote/libc-0.2.74.BUILD b/bazel/cargo/remote/libc-0.2.80.BUILD similarity index 97% rename from bazel/cargo/remote/libc-0.2.74.BUILD rename to bazel/cargo/remote/libc-0.2.80.BUILD index 3fc249c0..29ee9e12 100644 --- a/bazel/cargo/remote/libc-0.2.74.BUILD +++ b/bazel/cargo/remote/libc-0.2.80.BUILD @@ -37,7 +37,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.2.74", + version = "0.2.80", tags = ["cargo-raze"], crate_features = [ "default", diff --git a/bazel/cargo/remote/num-integer-0.1.43.BUILD b/bazel/cargo/remote/num-integer-0.1.44.BUILD similarity index 93% rename from bazel/cargo/remote/num-integer-0.1.43.BUILD rename to bazel/cargo/remote/num-integer-0.1.44.BUILD index 45c79ea3..66715db2 100644 --- a/bazel/cargo/remote/num-integer-0.1.43.BUILD +++ b/bazel/cargo/remote/num-integer-0.1.44.BUILD @@ -32,7 +32,7 @@ rust_library( name = "num_integer", crate_type = "lib", deps = [ - "@raze__num_traits__0_2_12//:num_traits", + "@raze__num_traits__0_2_14//:num_traits", ], srcs = glob(["**/*.rs"]), crate_root = "src/lib.rs", @@ -40,7 +40,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.1.43", + version = "0.1.44", tags = ["cargo-raze"], crate_features = [ ], diff --git a/bazel/cargo/remote/num-traits-0.2.12.BUILD b/bazel/cargo/remote/num-traits-0.2.14.BUILD similarity index 97% rename from bazel/cargo/remote/num-traits-0.2.12.BUILD rename to bazel/cargo/remote/num-traits-0.2.14.BUILD index d870bc23..88cd7de7 100644 --- a/bazel/cargo/remote/num-traits-0.2.12.BUILD +++ b/bazel/cargo/remote/num-traits-0.2.14.BUILD @@ -37,7 +37,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.2.12", + version = "0.2.14", tags = ["cargo-raze"], crate_features = [ ], diff --git a/bazel/cargo/remote/time-0.1.43.BUILD b/bazel/cargo/remote/time-0.1.44.BUILD similarity index 92% rename from bazel/cargo/remote/time-0.1.43.BUILD rename to bazel/cargo/remote/time-0.1.44.BUILD index e3a046b0..260cb3af 100644 --- a/bazel/cargo/remote/time-0.1.43.BUILD +++ b/bazel/cargo/remote/time-0.1.44.BUILD @@ -28,7 +28,7 @@ rust_library( name = "time", crate_type = "lib", deps = [ - "@raze__libc__0_2_74//:libc", + "@raze__libc__0_2_80//:libc", ], srcs = glob(["**/*.rs"]), crate_root = "src/lib.rs", @@ -36,7 +36,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.1.43", + version = "0.1.44", tags = ["cargo-raze"], crate_features = [ ], diff --git a/bazel/cargo/remote/wasi-0.10.0+wasi-snapshot-preview1.BUILD b/bazel/cargo/remote/wasi-0.10.0+wasi-snapshot-preview1.BUILD new file mode 100644 index 00000000..4b6c4e43 --- /dev/null +++ b/bazel/cargo/remote/wasi-0.10.0+wasi-snapshot-preview1.BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Apache-2.0 from expression "Apache-2.0 OR (Apache-2.0 OR MIT)" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "wasi", + crate_type = "lib", + deps = [ + ], + srcs = glob(["**/*.rs"]), + crate_root = "src/lib.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.10.0+wasi-snapshot-preview1", + tags = ["cargo-raze"], + crate_features = [ + "default", + "std", + ], +) + From 9f179f8b6fe5c00609929ef497e3ecc4b43c13e1 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Wed, 4 Nov 2020 11:26:02 -0800 Subject: [PATCH 18/42] Allow building for wasm32-wasi target. (#42) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 30 ++++++++++++++++++++++++++---- src/allocator.rs | 6 +++++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 79776ffe..8340af02 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -89,17 +89,28 @@ jobs: run: | rustup toolchain install stable --component clippy --component rustfmt rustup target add wasm32-unknown-unknown + rustup target add wasm32-wasi - - name: Build + - name: Build (wasm32-unknown-unknown) env: RUSTFLAGS: -D warnings -C link-args=-S run: cargo build --release --all-targets --target=wasm32-unknown-unknown - - name: Format (clippy) + - name: Clippy (wasm32-unknown-unknown) env: RUSTFLAGS: -D warnings -C link-args=-S run: cargo clippy --release --all-targets --target=wasm32-unknown-unknown + - name: Build (wasm32-wasi) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo build --release --all-targets --target=wasm32-wasi + + - name: Clippy (wasm32-wasi) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo clippy --release --all-targets --target=wasm32-wasi + - name: Format (rustfmt) run: cargo fmt -- --check @@ -122,18 +133,29 @@ jobs: run: | rustup toolchain install nightly --component clippy --component rustfmt rustup +nightly target add wasm32-unknown-unknown + rustup +nightly target add wasm32-wasi rustup default nightly - - name: Build + - name: Build (wasm32-unknown-unknown) env: RUSTFLAGS: -D warnings -C link-args=-S run: cargo build --release --all-targets --target=wasm32-unknown-unknown - - name: Format (clippy) + - name: Clippy (wasm32-unknown-unknown) env: RUSTFLAGS: -D warnings -C link-args=-S run: cargo clippy --release --all-targets --target=wasm32-unknown-unknown + - name: Build (wasm32-wasi) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo build --release --all-targets --target=wasm32-wasi + + - name: Clippy (wasm32-wasi) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo clippy --release --all-targets --target=wasm32-wasi + - name: Format (rustfmt) run: cargo fmt -- --check diff --git a/src/allocator.rs b/src/allocator.rs index 5e66543b..3c708a60 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -15,8 +15,12 @@ #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; +#[cfg_attr( + all(target_arch = "wasm32", target_os = "unknown"), + export_name = "malloc" +)] #[no_mangle] -pub extern "C" fn malloc(size: usize) -> *mut u8 { +pub extern "C" fn proxy_on_memory_allocate(size: usize) -> *mut u8 { let mut vec: Vec = Vec::with_capacity(size); unsafe { vec.set_len(size); From d159da45dd67994db6d1f879283a4a968a8f4831 Mon Sep 17 00:00:00 2001 From: Yuval Kohavi Date: Wed, 4 Nov 2020 16:33:21 -0500 Subject: [PATCH 19/42] Make wee-alloc an optional feature. (#38) Signed-off-by: Yuval Kohavi --- .github/workflows/rust.yml | 20 +++++++++ BUILD | 1 - Cargo.toml | 5 ++- README.md | 11 +++++ bazel/cargo/BUILD | 5 --- bazel/cargo/crates.bzl | 18 -------- bazel/cargo/remote/memory_units-0.4.0.BUILD | 43 ------------------ bazel/cargo/remote/wee_alloc-0.4.5.BUILD | 48 --------------------- bazel/cargo/remote/winapi-0.3.9.BUILD | 3 -- src/allocator.rs | 1 + 10 files changed, 36 insertions(+), 119 deletions(-) delete mode 100644 bazel/cargo/remote/memory_units-0.4.0.BUILD delete mode 100644 bazel/cargo/remote/wee_alloc-0.4.5.BUILD diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8340af02..30086c6c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -106,11 +106,21 @@ jobs: RUSTFLAGS: -D warnings -C link-args=-S run: cargo build --release --all-targets --target=wasm32-wasi + - name: Build (wasm32-wasi with wee-alloc) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo build --release --all-targets --target=wasm32-wasi --features=wee-alloc + - name: Clippy (wasm32-wasi) env: RUSTFLAGS: -D warnings -C link-args=-S run: cargo clippy --release --all-targets --target=wasm32-wasi + - name: Clippy (wasm32-wasi with wee-alloc) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo clippy --release --all-targets --target=wasm32-wasi --features=wee-alloc + - name: Format (rustfmt) run: cargo fmt -- --check @@ -151,11 +161,21 @@ jobs: RUSTFLAGS: -D warnings -C link-args=-S run: cargo build --release --all-targets --target=wasm32-wasi + - name: Build (wasm32-wasi with wee-alloc) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo build --release --all-targets --target=wasm32-wasi --features=wee-alloc + - name: Clippy (wasm32-wasi) env: RUSTFLAGS: -D warnings -C link-args=-S run: cargo clippy --release --all-targets --target=wasm32-wasi + - name: Clippy (wasm32-wasi with wee-alloc) + env: + RUSTFLAGS: -D warnings -C link-args=-S + run: cargo clippy --release --all-targets --target=wasm32-wasi --features=wee-alloc + - name: Format (rustfmt) run: cargo fmt -- --check diff --git a/BUILD b/BUILD index f323a4bf..53d433f6 100644 --- a/BUILD +++ b/BUILD @@ -8,6 +8,5 @@ rust_library( deps = [ "//bazel/cargo:hashbrown", "//bazel/cargo:log", - "//bazel/cargo:wee_alloc", ], ) diff --git a/Cargo.toml b/Cargo.toml index 25fd5a25..2f436eff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,13 @@ license = "Apache-2.0" repository = "https://github.com/proxy-wasm/proxy-wasm-rust-sdk" edition = "2018" +[features] +wee-alloc = ["wee_alloc"] + [dependencies] hashbrown = "0.9" log = "0.4" -wee_alloc = "0.4" +wee_alloc = { version = "0.4", optional = true } [dev-dependencies] chrono = "0.4" diff --git a/README.md b/README.md index c2823fe7..002b7764 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,14 @@ + [Extending Envoy with WASM and Rust](https://antweiss.com/blog/extending-envoy-with-wasm-and-rust/) + [Extending Istio with Rust and WebAssembly](https://blog.red-badger.com/extending-istio-with-rust-and-webassembly) + +# Updating dependencies + +When updating dependencies, you need to regenerate `BUILD` files to match updated `Cargo.toml`: +``` +cargo install cargo-raze --version 0.3.8 +rm -rf bazel/cargo/ +cargo generate-lockfile +cargo raze --output=bazel/cargo +mv Cargo.lock bazel/cargo/ +``` \ No newline at end of file diff --git a/bazel/cargo/BUILD b/bazel/cargo/BUILD index 4a095b98..b72a27f6 100644 --- a/bazel/cargo/BUILD +++ b/bazel/cargo/BUILD @@ -23,8 +23,3 @@ alias( actual = "@raze__log__0_4_11//:log", tags = ["cargo-raze"], ) -alias( - name = "wee_alloc", - actual = "@raze__wee_alloc__0_4_5//:wee_alloc", - tags = ["cargo-raze"], -) diff --git a/bazel/cargo/crates.bzl b/bazel/cargo/crates.bzl index e133346e..d7dbf9bb 100644 --- a/bazel/cargo/crates.bzl +++ b/bazel/cargo/crates.bzl @@ -79,15 +79,6 @@ def raze_fetch_remote_crates(): build_file = Label("//bazel/cargo/remote:log-0.4.11.BUILD"), ) - _new_http_archive( - name = "raze__memory_units__0_4_0", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/memory_units/memory_units-0.4.0.crate", - type = "tar.gz", - sha256 = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3", - strip_prefix = "memory_units-0.4.0", - build_file = Label("//bazel/cargo/remote:memory_units-0.4.0.BUILD"), - ) - _new_http_archive( name = "raze__num_integer__0_1_44", url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-integer/num-integer-0.1.44.crate", @@ -124,15 +115,6 @@ def raze_fetch_remote_crates(): build_file = Label("//bazel/cargo/remote:wasi-0.10.0+wasi-snapshot-preview1.BUILD"), ) - _new_http_archive( - name = "raze__wee_alloc__0_4_5", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/wee_alloc/wee_alloc-0.4.5.crate", - type = "tar.gz", - sha256 = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e", - strip_prefix = "wee_alloc-0.4.5", - build_file = Label("//bazel/cargo/remote:wee_alloc-0.4.5.BUILD"), - ) - _new_http_archive( name = "raze__winapi__0_3_9", url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi/winapi-0.3.9.crate", diff --git a/bazel/cargo/remote/memory_units-0.4.0.BUILD b/bazel/cargo/remote/memory_units-0.4.0.BUILD deleted file mode 100644 index a8964bfa..00000000 --- a/bazel/cargo/remote/memory_units-0.4.0.BUILD +++ /dev/null @@ -1,43 +0,0 @@ -""" -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "reciprocal", # MPL-2.0 from expression "MPL-2.0" -]) - -load( - "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", - "rust_binary", - "rust_test", -) - - - -rust_library( - name = "memory_units", - crate_type = "lib", - deps = [ - ], - srcs = glob(["**/*.rs"]), - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - version = "0.4.0", - tags = ["cargo-raze"], - crate_features = [ - ], -) - diff --git a/bazel/cargo/remote/wee_alloc-0.4.5.BUILD b/bazel/cargo/remote/wee_alloc-0.4.5.BUILD deleted file mode 100644 index 26e2bc58..00000000 --- a/bazel/cargo/remote/wee_alloc-0.4.5.BUILD +++ /dev/null @@ -1,48 +0,0 @@ -""" -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "reciprocal", # MPL-2.0 from expression "MPL-2.0" -]) - -load( - "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", - "rust_binary", - "rust_test", -) - - -# Unsupported target "build-script-build" with type "custom-build" omitted - -rust_library( - name = "wee_alloc", - crate_type = "lib", - deps = [ - "@raze__cfg_if__0_1_10//:cfg_if", - "@raze__memory_units__0_4_0//:memory_units", - ], - srcs = glob(["**/*.rs"]), - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - version = "0.4.5", - tags = ["cargo-raze"], - crate_features = [ - "default", - "size_classes", - ], -) - diff --git a/bazel/cargo/remote/winapi-0.3.9.BUILD b/bazel/cargo/remote/winapi-0.3.9.BUILD index 49b1e59a..ed409429 100644 --- a/bazel/cargo/remote/winapi-0.3.9.BUILD +++ b/bazel/cargo/remote/winapi-0.3.9.BUILD @@ -39,16 +39,13 @@ rust_library( version = "0.3.9", tags = ["cargo-raze"], crate_features = [ - "memoryapi", "minwinbase", "minwindef", "ntdef", "profileapi", "std", - "synchapi", "sysinfoapi", "timezoneapi", - "winbase", ], ) diff --git a/src/allocator.rs b/src/allocator.rs index 3c708a60..c7e1199c 100644 --- a/src/allocator.rs +++ b/src/allocator.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#[cfg(feature = "wee-alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; From adb8fdb113667b73141ea27ceca38e532878385e Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Thu, 5 Nov 2020 17:35:49 -0800 Subject: [PATCH 20/42] Update rules_rust to latest. (#46) Signed-off-by: Piotr Sikora --- WORKSPACE | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 5e586280..569182ad 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,35 +2,20 @@ workspace(name = "proxy_wasm_rust_sdk") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -http_archive( - name = "bazel_skylib", - sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", - ], -) - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() - http_archive( name = "io_bazel_rules_rust", - sha256 = "484a2b2b67cd2d1fa1054876de7f8d291c4b203fd256bc8cbea14d749bb864ce", - # Last commit where "out_binary = True" works. - # See: https://github.com/bazelbuild/rules_rust/issues/386 - strip_prefix = "rules_rust-fda9a1ce6482973adfda022cadbfa6b300e269c3", - url = "https://github.com/bazelbuild/rules_rust/archive/fda9a1ce6482973adfda022cadbfa6b300e269c3.tar.gz", + sha256 = "17dbf791f4dab0fd4496ce5345af35e9ce2f6d011c1c8423436da517d019a3ea", + strip_prefix = "rules_rust-2f97db595b05b1ee8cc44bde5bdf03c00bd169fb", + url = "https://github.com/bazelbuild/rules_rust/archive/2f97db595b05b1ee8cc44bde5bdf03c00bd169fb.tar.gz", ) load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") rust_repositories() -load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") +load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace") -bazel_version(name = "bazel_version") +rust_workspace() load("//bazel/cargo:crates.bzl", "raze_fetch_remote_crates") From f61a14238c98b15ef183dac999266dfac959ce67 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Thu, 5 Nov 2020 17:44:13 -0800 Subject: [PATCH 21/42] Update cargo-raze to latest and regenerate artifacts. (#47) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 2 +- Cargo.toml | 5 +- README.md | 4 +- bazel/cargo/{BUILD => BUILD.bazel} | 25 +++- bazel/cargo/crates.bzl | 116 ++++++++++-------- ...sh-0.4.6.BUILD => BUILD.ahash-0.4.6.bazel} | 50 +++++--- ...-1.0.1.BUILD => BUILD.autocfg-1.0.1.bazel} | 56 +++++---- bazel/cargo/remote/{BUILD => BUILD.bazel} | 0 ...0.1.10.BUILD => BUILD.cfg-if-0.1.10.bazel} | 44 ++++--- bazel/cargo/remote/BUILD.chrono-0.4.19.bazel | 87 +++++++++++++ ....9.1.BUILD => BUILD.hashbrown-0.9.1.bazel} | 56 +++++---- ...c-0.2.80.BUILD => BUILD.libc-0.2.80.bazel} | 51 +++++--- ...og-0.4.11.BUILD => BUILD.log-0.4.11.bazel} | 50 +++++--- ...4.BUILD => BUILD.num-integer-0.1.44.bazel} | 57 +++++---- ...14.BUILD => BUILD.num-traits-0.2.14.bazel} | 47 ++++--- bazel/cargo/remote/BUILD.time-0.1.44.bazel | 72 +++++++++++ ....wasi-0.10.0+wasi-snapshot-preview1.bazel} | 49 +++++--- ...i-0.3.9.BUILD => BUILD.winapi-0.3.9.bazel} | 56 +++++---- ...LD.winapi-i686-pc-windows-gnu-0.4.0.bazel} | 46 ++++--- ....winapi-x86_64-pc-windows-gnu-0.4.0.bazel} | 46 ++++--- bazel/cargo/remote/chrono-0.4.19.BUILD | 57 --------- bazel/cargo/remote/time-0.1.44.BUILD | 44 ------- 22 files changed, 620 insertions(+), 400 deletions(-) rename bazel/cargo/{BUILD => BUILD.bazel} (53%) rename bazel/cargo/remote/{ahash-0.4.6.BUILD => BUILD.ahash-0.4.6.bazel} (61%) rename bazel/cargo/remote/{autocfg-1.0.1.BUILD => BUILD.autocfg-1.0.1.bazel} (61%) rename bazel/cargo/remote/{BUILD => BUILD.bazel} (100%) rename bazel/cargo/remote/{cfg-if-0.1.10.BUILD => BUILD.cfg-if-0.1.10.bazel} (53%) create mode 100644 bazel/cargo/remote/BUILD.chrono-0.4.19.bazel rename bazel/cargo/remote/{hashbrown-0.9.1.BUILD => BUILD.hashbrown-0.9.1.bazel} (63%) rename bazel/cargo/remote/{libc-0.2.80.BUILD => BUILD.libc-0.2.80.bazel} (57%) rename bazel/cargo/remote/{log-0.4.11.BUILD => BUILD.log-0.4.11.bazel} (60%) rename bazel/cargo/remote/{num-integer-0.1.44.BUILD => BUILD.num-integer-0.1.44.bazel} (64%) rename bazel/cargo/remote/{num-traits-0.2.14.BUILD => BUILD.num-traits-0.2.14.bazel} (56%) create mode 100644 bazel/cargo/remote/BUILD.time-0.1.44.bazel rename bazel/cargo/remote/{wasi-0.10.0+wasi-snapshot-preview1.BUILD => BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel} (52%) rename bazel/cargo/remote/{winapi-0.3.9.BUILD => BUILD.winapi-0.3.9.bazel} (59%) rename bazel/cargo/remote/{winapi-i686-pc-windows-gnu-0.4.0.BUILD => BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel} (54%) rename bazel/cargo/remote/{winapi-x86_64-pc-windows-gnu-0.4.0.BUILD => BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel} (55%) delete mode 100644 bazel/cargo/remote/chrono-0.4.19.BUILD delete mode 100644 bazel/cargo/remote/time-0.1.44.BUILD diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 30086c6c..6f199be6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -72,7 +72,7 @@ jobs: - name: Format (cargo raze) run: | - cargo install cargo-raze --version 0.3.8 + cargo install cargo-raze --git https://github.com/google/cargo-raze --rev cb9f85d22b1c81cceb9acaf1fa4336c5fc4e6bff cp -p bazel/cargo/Cargo.lock . rm -rf bazel/cargo/ cargo raze --output=bazel/cargo diff --git a/Cargo.toml b/Cargo.toml index 2f436eff..299166e0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,12 +24,11 @@ lto = true opt-level = 3 panic = "abort" -[raze] +[package.metadata.raze] workspace_path = "//bazel/cargo" -target = "wasm32-unknown-unknown" genmode = "Remote" -[raze.crates.log.'0.4.11'] +[package.metadata.raze.crates.log.'0.4.11'] additional_flags = ["--cfg=atomic_cas"] [[example]] diff --git a/README.md b/README.md index 002b7764..059289d8 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ When updating dependencies, you need to regenerate `BUILD` files to match updated `Cargo.toml`: ``` -cargo install cargo-raze --version 0.3.8 +cargo install cargo-raze --git https://github.com/google/cargo-raze --rev cb9f85d22b1c81cceb9acaf1fa4336c5fc4e6bff rm -rf bazel/cargo/ cargo generate-lockfile cargo raze --output=bazel/cargo mv Cargo.lock bazel/cargo/ -``` \ No newline at end of file +``` diff --git a/bazel/cargo/BUILD b/bazel/cargo/BUILD.bazel similarity index 53% rename from bazel/cargo/BUILD rename to bazel/cargo/BUILD.bazel index b72a27f6..1bc21aa1 100644 --- a/bazel/cargo/BUILD +++ b/bazel/cargo/BUILD.bazel @@ -1,25 +1,40 @@ """ -cargo-raze workspace build file. +@generated +cargo-raze generated Bazel file. DO NOT EDIT! Replaced on runs of cargo-raze """ + package(default_visibility = ["//visibility:public"]) licenses([ - "notice" # See individual crates for specific licenses + "notice", # See individual crates for specific licenses ]) + +# Aliased targets alias( name = "chrono", actual = "@raze__chrono__0_4_19//:chrono", - tags = ["cargo-raze"], + tags = [ + "cargo-raze", + "manual", + ], ) + alias( name = "hashbrown", actual = "@raze__hashbrown__0_9_1//:hashbrown", - tags = ["cargo-raze"], + tags = [ + "cargo-raze", + "manual", + ], ) + alias( name = "log", actual = "@raze__log__0_4_11//:log", - tags = ["cargo-raze"], + tags = [ + "cargo-raze", + "manual", + ], ) diff --git a/bazel/cargo/crates.bzl b/bazel/cargo/crates.bzl index d7dbf9bb..15831dc0 100644 --- a/bazel/cargo/crates.bzl +++ b/bazel/cargo/crates.bzl @@ -1,144 +1,152 @@ """ -cargo-raze crate workspace functions +@generated +cargo-raze generated Bazel file. DO NOT EDIT! Replaced on runs of cargo-raze """ -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") -def _new_http_archive(name, **kwargs): - if not native.existing_rule(name): - http_archive(name=name, **kwargs) - -def _new_git_repository(name, **kwargs): - if not native.existing_rule(name): - new_git_repository(name=name, **kwargs) +load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") # buildifier: disable=load def raze_fetch_remote_crates(): - - _new_http_archive( + """This function defines a collection of repos and should be called in a WORKSPACE file""" + maybe( + http_archive, name = "raze__ahash__0_4_6", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/ahash/ahash-0.4.6.crate", + url = "https://crates.io/api/v1/crates/ahash/0.4.6/download", type = "tar.gz", sha256 = "f6789e291be47ace86a60303502173d84af8327e3627ecf334356ee0f87a164c", strip_prefix = "ahash-0.4.6", - build_file = Label("//bazel/cargo/remote:ahash-0.4.6.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.ahash-0.4.6.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__autocfg__1_0_1", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/autocfg/autocfg-1.0.1.crate", + url = "https://crates.io/api/v1/crates/autocfg/1.0.1/download", type = "tar.gz", sha256 = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a", strip_prefix = "autocfg-1.0.1", - build_file = Label("//bazel/cargo/remote:autocfg-1.0.1.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.autocfg-1.0.1.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__cfg_if__0_1_10", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/cfg-if/cfg-if-0.1.10.crate", + url = "https://crates.io/api/v1/crates/cfg-if/0.1.10/download", type = "tar.gz", sha256 = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822", strip_prefix = "cfg-if-0.1.10", - build_file = Label("//bazel/cargo/remote:cfg-if-0.1.10.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.cfg-if-0.1.10.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__chrono__0_4_19", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/chrono/chrono-0.4.19.crate", + url = "https://crates.io/api/v1/crates/chrono/0.4.19/download", type = "tar.gz", sha256 = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73", strip_prefix = "chrono-0.4.19", - build_file = Label("//bazel/cargo/remote:chrono-0.4.19.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.chrono-0.4.19.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__hashbrown__0_9_1", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/hashbrown/hashbrown-0.9.1.crate", + url = "https://crates.io/api/v1/crates/hashbrown/0.9.1/download", type = "tar.gz", sha256 = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04", strip_prefix = "hashbrown-0.9.1", - build_file = Label("//bazel/cargo/remote:hashbrown-0.9.1.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.hashbrown-0.9.1.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__libc__0_2_80", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/libc/libc-0.2.80.crate", + url = "https://crates.io/api/v1/crates/libc/0.2.80/download", type = "tar.gz", sha256 = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614", strip_prefix = "libc-0.2.80", - build_file = Label("//bazel/cargo/remote:libc-0.2.80.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.libc-0.2.80.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__log__0_4_11", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/log/log-0.4.11.crate", + url = "https://crates.io/api/v1/crates/log/0.4.11/download", type = "tar.gz", sha256 = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b", strip_prefix = "log-0.4.11", - build_file = Label("//bazel/cargo/remote:log-0.4.11.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.log-0.4.11.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__num_integer__0_1_44", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-integer/num-integer-0.1.44.crate", + url = "https://crates.io/api/v1/crates/num-integer/0.1.44/download", type = "tar.gz", sha256 = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db", strip_prefix = "num-integer-0.1.44", - build_file = Label("//bazel/cargo/remote:num-integer-0.1.44.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.num-integer-0.1.44.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__num_traits__0_2_14", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/num-traits/num-traits-0.2.14.crate", + url = "https://crates.io/api/v1/crates/num-traits/0.2.14/download", type = "tar.gz", sha256 = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290", strip_prefix = "num-traits-0.2.14", - build_file = Label("//bazel/cargo/remote:num-traits-0.2.14.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.num-traits-0.2.14.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__time__0_1_44", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/time/time-0.1.44.crate", + url = "https://crates.io/api/v1/crates/time/0.1.44/download", type = "tar.gz", sha256 = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255", strip_prefix = "time-0.1.44", - build_file = Label("//bazel/cargo/remote:time-0.1.44.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.time-0.1.44.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__wasi__0_10_0_wasi_snapshot_preview1", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/wasi/wasi-0.10.0+wasi-snapshot-preview1.crate", + url = "https://crates.io/api/v1/crates/wasi/0.10.0+wasi-snapshot-preview1/download", type = "tar.gz", sha256 = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f", strip_prefix = "wasi-0.10.0+wasi-snapshot-preview1", - build_file = Label("//bazel/cargo/remote:wasi-0.10.0+wasi-snapshot-preview1.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__winapi__0_3_9", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi/winapi-0.3.9.crate", + url = "https://crates.io/api/v1/crates/winapi/0.3.9/download", type = "tar.gz", sha256 = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419", strip_prefix = "winapi-0.3.9", - build_file = Label("//bazel/cargo/remote:winapi-0.3.9.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.winapi-0.3.9.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__winapi_i686_pc_windows_gnu__0_4_0", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-i686-pc-windows-gnu/winapi-i686-pc-windows-gnu-0.4.0.crate", + url = "https://crates.io/api/v1/crates/winapi-i686-pc-windows-gnu/0.4.0/download", type = "tar.gz", sha256 = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6", strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0", - build_file = Label("//bazel/cargo/remote:winapi-i686-pc-windows-gnu-0.4.0.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel"), ) - _new_http_archive( + maybe( + http_archive, name = "raze__winapi_x86_64_pc_windows_gnu__0_4_0", - url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/winapi-x86_64-pc-windows-gnu/winapi-x86_64-pc-windows-gnu-0.4.0.crate", + url = "https://crates.io/api/v1/crates/winapi-x86_64-pc-windows-gnu/0.4.0/download", type = "tar.gz", sha256 = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f", strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0", - build_file = Label("//bazel/cargo/remote:winapi-x86_64-pc-windows-gnu-0.4.0.BUILD"), + build_file = Label("//bazel/cargo/remote:BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel"), ) - diff --git a/bazel/cargo/remote/ahash-0.4.6.BUILD b/bazel/cargo/remote/BUILD.ahash-0.4.6.bazel similarity index 61% rename from bazel/cargo/remote/ahash-0.4.6.BUILD rename to bazel/cargo/remote/BUILD.ahash-0.4.6.bazel index c79e45d7..30fb8006 100644 --- a/bazel/cargo/remote/ahash-0.4.6.BUILD +++ b/bazel/cargo/remote/BUILD.ahash-0.4.6.bazel @@ -1,48 +1,62 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "ahash" with type "bench" omitted +# Unsupported target "map" with type "bench" omitted + rust_library( name = "ahash", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2018", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.4.6", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ ], ) # Unsupported target "bench" with type "test" omitted -# Unsupported target "map" with type "bench" omitted + # Unsupported target "map_tests" with type "test" omitted + # Unsupported target "nopanic" with type "test" omitted diff --git a/bazel/cargo/remote/autocfg-1.0.1.BUILD b/bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel similarity index 61% rename from bazel/cargo/remote/autocfg-1.0.1.BUILD rename to bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel index 088d5bcc..e7de20ab 100644 --- a/bazel/cargo/remote/autocfg-1.0.1.BUILD +++ b/bazel/cargo/remote/BUILD.autocfg-1.0.1.bazel @@ -1,48 +1,62 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" +]) + +# Generated Targets + +# Unsupported target "integers" with type "example" omitted + +# Unsupported target "paths" with type "example" omitted +# Unsupported target "traits" with type "example" omitted + +# Unsupported target "versions" with type "example" omitted rust_library( name = "autocfg", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2015", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "1.0.1", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ ], ) -# Unsupported target "integers" with type "example" omitted -# Unsupported target "paths" with type "example" omitted # Unsupported target "rustflags" with type "test" omitted -# Unsupported target "traits" with type "example" omitted -# Unsupported target "versions" with type "example" omitted diff --git a/bazel/cargo/remote/BUILD b/bazel/cargo/remote/BUILD.bazel similarity index 100% rename from bazel/cargo/remote/BUILD rename to bazel/cargo/remote/BUILD.bazel diff --git a/bazel/cargo/remote/cfg-if-0.1.10.BUILD b/bazel/cargo/remote/BUILD.cfg-if-0.1.10.bazel similarity index 53% rename from bazel/cargo/remote/cfg-if-0.1.10.BUILD rename to bazel/cargo/remote/BUILD.cfg-if-0.1.10.bazel index a3b94083..32abbfae 100644 --- a/bazel/cargo/remote/cfg-if-0.1.10.BUILD +++ b/bazel/cargo/remote/BUILD.cfg-if-0.1.10.bazel @@ -1,43 +1,53 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) +# Generated Targets rust_library( name = "cfg_if", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2018", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.1.10", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ ], ) diff --git a/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel new file mode 100644 index 00000000..88341193 --- /dev/null +++ b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel @@ -0,0 +1,87 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "chrono" with type "bench" omitted + +# Unsupported target "serde" with type "bench" omitted + +rust_library( + name = "chrono", + srcs = glob(["**/*.rs"]), + aliases = { + }, + crate_features = [ + "clock", + "default", + "libc", + "oldtime", + "std", + "time", + "winapi", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.4.19", + # buildifier: leave-alone + deps = [ + "@raze__libc__0_2_80//:libc", + "@raze__num_integer__0_1_44//:num_integer", + "@raze__num_traits__0_2_14//:num_traits", + "@raze__time__0_1_44//:time", + ] + selects.with_or({ + # cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))) + ( + "@io_bazel_rules_rust//rust/platform:wasm32-unknown-unknown", + ): [ + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(windows) + ( + "@io_bazel_rules_rust//rust/platform:i686-pc-windows-msvc", + "@io_bazel_rules_rust//rust/platform:x86_64-pc-windows-msvc", + ): [ + "@raze__winapi__0_3_9//:winapi", + ], + "//conditions:default": [], + }), +) + +# Unsupported target "wasm" with type "test" omitted diff --git a/bazel/cargo/remote/hashbrown-0.9.1.BUILD b/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel similarity index 63% rename from bazel/cargo/remote/hashbrown-0.9.1.BUILD rename to bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel index ac49a03d..d27b21de 100644 --- a/bazel/cargo/remote/hashbrown-0.9.1.BUILD +++ b/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel @@ -1,52 +1,66 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" +]) + +# Generated Targets # Unsupported target "bench" with type "bench" omitted rust_library( name = "hashbrown", - crate_type = "lib", - deps = [ - "@raze__ahash__0_4_6//:ahash", - ], srcs = glob(["**/*.rs"]), + crate_features = [ + "ahash", + "default", + "inline-more", + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2018", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.9.1", - tags = ["cargo-raze"], - crate_features = [ - "ahash", - "default", - "inline-more", + # buildifier: leave-alone + deps = [ + "@raze__ahash__0_4_6//:ahash", ], ) # Unsupported target "hasher" with type "test" omitted + # Unsupported target "rayon" with type "test" omitted + # Unsupported target "serde" with type "test" omitted + # Unsupported target "set" with type "test" omitted diff --git a/bazel/cargo/remote/libc-0.2.80.BUILD b/bazel/cargo/remote/BUILD.libc-0.2.80.bazel similarity index 57% rename from bazel/cargo/remote/libc-0.2.80.BUILD rename to bazel/cargo/remote/BUILD.libc-0.2.80.bazel index 29ee9e12..838522ff 100644 --- a/bazel/cargo/remote/libc-0.2.80.BUILD +++ b/bazel/cargo/remote/BUILD.libc-0.2.80.bazel @@ -1,47 +1,58 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "build-script-build" with type "custom-build" omitted -# Unsupported target "const_fn" with type "test" omitted rust_library( name = "libc", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "std", + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2015", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.2.80", - tags = ["cargo-raze"], - crate_features = [ - "default", - "std", + # buildifier: leave-alone + deps = [ ], ) +# Unsupported target "const_fn" with type "test" omitted diff --git a/bazel/cargo/remote/log-0.4.11.BUILD b/bazel/cargo/remote/BUILD.log-0.4.11.bazel similarity index 60% rename from bazel/cargo/remote/log-0.4.11.BUILD rename to bazel/cargo/remote/BUILD.log-0.4.11.bazel index 0d08d313..022c0e5c 100644 --- a/bazel/cargo/remote/log-0.4.11.BUILD +++ b/bazel/cargo/remote/BUILD.log-0.4.11.bazel @@ -1,48 +1,60 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "build-script-build" with type "custom-build" omitted -# Unsupported target "filters" with type "test" omitted rust_library( name = "log", - crate_type = "lib", - deps = [ - "@raze__cfg_if__0_1_10//:cfg_if", - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2015", rustc_flags = [ "--cap-lints=allow", "--cfg=atomic_cas", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.4.11", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ + "@raze__cfg_if__0_1_10//:cfg_if", ], ) +# Unsupported target "filters" with type "test" omitted + # Unsupported target "macros" with type "test" omitted diff --git a/bazel/cargo/remote/num-integer-0.1.44.BUILD b/bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel similarity index 64% rename from bazel/cargo/remote/num-integer-0.1.44.BUILD rename to bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel index 66715db2..f498d6a7 100644 --- a/bazel/cargo/remote/num-integer-0.1.44.BUILD +++ b/bazel/cargo/remote/BUILD.num-integer-0.1.44.bazel @@ -1,50 +1,65 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "average" with type "bench" omitted -# Unsupported target "average" with type "test" omitted -# Unsupported target "build-script-build" with type "custom-build" omitted + # Unsupported target "gcd" with type "bench" omitted +# Unsupported target "roots" with type "bench" omitted + +# Unsupported target "build-script-build" with type "custom-build" omitted + rust_library( name = "num_integer", - crate_type = "lib", - deps = [ - "@raze__num_traits__0_2_14//:num_traits", - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2015", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.1.44", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ + "@raze__num_traits__0_2_14//:num_traits", ], ) -# Unsupported target "roots" with type "bench" omitted +# Unsupported target "average" with type "test" omitted + # Unsupported target "roots" with type "test" omitted diff --git a/bazel/cargo/remote/num-traits-0.2.14.BUILD b/bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel similarity index 56% rename from bazel/cargo/remote/num-traits-0.2.14.BUILD rename to bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel index 88cd7de7..683f9d57 100644 --- a/bazel/cargo/remote/num-traits-0.2.14.BUILD +++ b/bazel/cargo/remote/BUILD.num-traits-0.2.14.bazel @@ -1,45 +1,56 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "build-script-build" with type "custom-build" omitted -# Unsupported target "cast" with type "test" omitted rust_library( name = "num_traits", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2015", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.2.14", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ ], ) +# Unsupported target "cast" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.time-0.1.44.bazel b/bazel/cargo/remote/BUILD.time-0.1.44.bazel new file mode 100644 index 00000000..e1ce0d27 --- /dev/null +++ b/bazel/cargo/remote/BUILD.time-0.1.44.bazel @@ -0,0 +1,72 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "time", + srcs = glob(["**/*.rs"]), + aliases = { + }, + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.1.44", + # buildifier: leave-alone + deps = [ + "@raze__libc__0_2_80//:libc", + ] + selects.with_or({ + # cfg(target_os = "wasi") + ( + "@io_bazel_rules_rust//rust/platform:wasm32-wasi", + ): [ + "@raze__wasi__0_10_0_wasi_snapshot_preview1//:wasi", + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(windows) + ( + "@io_bazel_rules_rust//rust/platform:i686-pc-windows-msvc", + "@io_bazel_rules_rust//rust/platform:x86_64-pc-windows-msvc", + ): [ + "@raze__winapi__0_3_9//:winapi", + ], + "//conditions:default": [], + }), +) diff --git a/bazel/cargo/remote/wasi-0.10.0+wasi-snapshot-preview1.BUILD b/bazel/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel similarity index 52% rename from bazel/cargo/remote/wasi-0.10.0+wasi-snapshot-preview1.BUILD rename to bazel/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel index 4b6c4e43..35fc2e3f 100644 --- a/bazel/cargo/remote/wasi-0.10.0+wasi-snapshot-preview1.BUILD +++ b/bazel/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel @@ -1,45 +1,54 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # Apache-2.0 from expression "Apache-2.0 OR (Apache-2.0 OR MIT)" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Apache-2.0 from expression "Apache-2.0 OR (Apache-2.0 OR MIT)" +]) + +# Generated Targets rust_library( name = "wasi", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "std", + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2018", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.10.0+wasi-snapshot-preview1", - tags = ["cargo-raze"], - crate_features = [ - "default", - "std", + # buildifier: leave-alone + deps = [ ], ) - diff --git a/bazel/cargo/remote/winapi-0.3.9.BUILD b/bazel/cargo/remote/BUILD.winapi-0.3.9.bazel similarity index 59% rename from bazel/cargo/remote/winapi-0.3.9.BUILD rename to bazel/cargo/remote/BUILD.winapi-0.3.9.bazel index ed409429..fa325c78 100644 --- a/bazel/cargo/remote/winapi-0.3.9.BUILD +++ b/bazel/cargo/remote/BUILD.winapi-0.3.9.bazel @@ -1,43 +1,40 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "build-script-build" with type "custom-build" omitted rust_library( name = "winapi", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - version = "0.3.9", - tags = ["cargo-raze"], crate_features = [ "minwinbase", "minwindef", @@ -47,5 +44,18 @@ rust_library( "sysinfoapi", "timezoneapi", ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.3.9", + # buildifier: leave-alone + deps = [ + ], ) - diff --git a/bazel/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD b/bazel/cargo/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel similarity index 54% rename from bazel/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD rename to bazel/cargo/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel index b6841433..7a0447a4 100644 --- a/bazel/cargo/remote/winapi-i686-pc-windows-gnu-0.4.0.BUILD +++ b/bazel/cargo/remote/BUILD.winapi-i686-pc-windows-gnu-0.4.0.bazel @@ -1,44 +1,54 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "build-script-build" with type "custom-build" omitted rust_library( name = "winapi_i686_pc_windows_gnu", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2015", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.4.0", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ ], ) - diff --git a/bazel/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD b/bazel/cargo/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel similarity index 55% rename from bazel/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD rename to bazel/cargo/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel index c8a62c4f..95d47678 100644 --- a/bazel/cargo/remote/winapi-x86_64-pc-windows-gnu-0.4.0.BUILD +++ b/bazel/cargo/remote/BUILD.winapi-x86_64-pc-windows-gnu-0.4.0.bazel @@ -1,44 +1,54 @@ """ +@generated cargo-raze crate build file. DO NOT EDIT! Replaced on runs of cargo-raze """ -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) +# buildifier: disable=load load( "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", "rust_binary", + "rust_library", "rust_test", ) +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets # Unsupported target "build-script-build" with type "custom-build" omitted rust_library( name = "winapi_x86_64_pc_windows_gnu", - crate_type = "lib", - deps = [ - ], srcs = glob(["**/*.rs"]), + crate_features = [ + ], crate_root = "src/lib.rs", + crate_type = "lib", edition = "2015", rustc_flags = [ "--cap-lints=allow", ], + tags = [ + "cargo-raze", + "manual", + ], version = "0.4.0", - tags = ["cargo-raze"], - crate_features = [ + # buildifier: leave-alone + deps = [ ], ) - diff --git a/bazel/cargo/remote/chrono-0.4.19.BUILD b/bazel/cargo/remote/chrono-0.4.19.BUILD deleted file mode 100644 index b0369d4e..00000000 --- a/bazel/cargo/remote/chrono-0.4.19.BUILD +++ /dev/null @@ -1,57 +0,0 @@ -""" -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) - -load( - "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", - "rust_binary", - "rust_test", -) - - -# Unsupported target "chrono" with type "bench" omitted - -rust_library( - name = "chrono", - crate_type = "lib", - deps = [ - "@raze__libc__0_2_80//:libc", - "@raze__num_integer__0_1_44//:num_integer", - "@raze__num_traits__0_2_14//:num_traits", - "@raze__time__0_1_44//:time", - ], - srcs = glob(["**/*.rs"]), - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - version = "0.4.19", - tags = ["cargo-raze"], - crate_features = [ - "clock", - "default", - "libc", - "oldtime", - "std", - "time", - "winapi", - ], -) - -# Unsupported target "serde" with type "bench" omitted -# Unsupported target "wasm" with type "test" omitted diff --git a/bazel/cargo/remote/time-0.1.44.BUILD b/bazel/cargo/remote/time-0.1.44.BUILD deleted file mode 100644 index 260cb3af..00000000 --- a/bazel/cargo/remote/time-0.1.44.BUILD +++ /dev/null @@ -1,44 +0,0 @@ -""" -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) - -load( - "@io_bazel_rules_rust//rust:rust.bzl", - "rust_library", - "rust_binary", - "rust_test", -) - - - -rust_library( - name = "time", - crate_type = "lib", - deps = [ - "@raze__libc__0_2_80//:libc", - ], - srcs = glob(["**/*.rs"]), - crate_root = "src/lib.rs", - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - version = "0.1.44", - tags = ["cargo-raze"], - crate_features = [ - ], -) - From b8921ba4112727330d787a89094941449b153790 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 6 Nov 2020 17:12:56 -0800 Subject: [PATCH 22/42] Allow building for wasm32-wasi target using Bazel. (#50) While there, update Bazel to 3.7.0. Signed-off-by: Piotr Sikora --- .bazelrc | 4 ++-- .bazelversion | 2 +- .github/workflows/rust.yml | 7 +++++-- Cargo.toml | 11 +++++++++++ bazel/cargo/remote/BUILD.libc-0.2.80.bazel | 7 +++++++ 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.bazelrc b/.bazelrc index 800bf8f4..38ca0fbf 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,2 +1,2 @@ -# Force Bazel to use --target=wasm32-unknown-unknown. -build --platforms=@io_bazel_rules_rust//rust/platform:wasm +# Force Bazel to use --target=wasm32-wasi +build --platforms=@io_bazel_rules_rust//rust/platform:wasi diff --git a/.bazelversion b/.bazelversion index 47b322c9..7c69a55d 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -3.4.1 +3.7.0 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6f199be6..3df51920 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -59,8 +59,11 @@ jobs: ~/.cargo/registry key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock') }} - - name: Build - run: bazelisk build //... + - name: Build (wasm32-unknown-unknown) + run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasm //... + + - name: Build (wasm32-wasi) + run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasi //... - name: Format (buildifier) run: | diff --git a/Cargo.toml b/Cargo.toml index 299166e0..2d70b5a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,17 @@ panic = "abort" workspace_path = "//bazel/cargo" genmode = "Remote" +[package.metadata.raze.crates.libc.'0.2.80'] +additional_flags = [ + "--cfg=libc_priv_mod_use", + "--cfg=libc_union", + "--cfg=libc_const_size_of", + "--cfg=libc_align", + "--cfg=libc_core_cvoid", + "--cfg=libc_packedN", + "--cfg=libc_cfg_target_vendor", +] + [package.metadata.raze.crates.log.'0.4.11'] additional_flags = ["--cfg=atomic_cas"] diff --git a/bazel/cargo/remote/BUILD.libc-0.2.80.bazel b/bazel/cargo/remote/BUILD.libc-0.2.80.bazel index 838522ff..34e15553 100644 --- a/bazel/cargo/remote/BUILD.libc-0.2.80.bazel +++ b/bazel/cargo/remote/BUILD.libc-0.2.80.bazel @@ -44,6 +44,13 @@ rust_library( edition = "2015", rustc_flags = [ "--cap-lints=allow", + "--cfg=libc_priv_mod_use", + "--cfg=libc_union", + "--cfg=libc_const_size_of", + "--cfg=libc_align", + "--cfg=libc_core_cvoid", + "--cfg=libc_packedN", + "--cfg=libc_cfg_target_vendor", ], tags = [ "cargo-raze", From 39d49d81af2f561ddca8d9410732614d5dae8a6b Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 6 Nov 2020 17:23:06 -0800 Subject: [PATCH 23/42] Show getrandom and chrono/time usage in examples. (#51) Signed-off-by: Piotr Sikora --- Cargo.toml | 4 + bazel/cargo/BUILD.bazel | 18 ++++ bazel/cargo/Cargo.lock | 31 +++++- bazel/cargo/crates.bzl | 30 ++++++ bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel | 54 +++++++++++ .../cargo/remote/BUILD.getrandom-0.2.0.bazel | 96 +++++++++++++++++++ ...LD.wasi-0.9.0+wasi-snapshot-preview1.bazel | 54 +++++++++++ examples/BUILD | 6 +- examples/hello_world.rs | 18 +++- 9 files changed, 305 insertions(+), 6 deletions(-) create mode 100644 bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel create mode 100644 bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel create mode 100644 bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel diff --git a/Cargo.toml b/Cargo.toml index 2d70b5a9..0e06abc7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,8 +17,12 @@ log = "0.4" wee_alloc = { version = "0.4", optional = true } [dev-dependencies] +cfg-if = "1.0" chrono = "0.4" +[target.'cfg(not(all(target_arch = "wasm32", target_os = "unknown")))'.dev-dependencies] +getrandom = "0.2" + [profile.release] lto = true opt-level = 3 diff --git a/bazel/cargo/BUILD.bazel b/bazel/cargo/BUILD.bazel index 1bc21aa1..bd1ed422 100644 --- a/bazel/cargo/BUILD.bazel +++ b/bazel/cargo/BUILD.bazel @@ -12,6 +12,15 @@ licenses([ ]) # Aliased targets +alias( + name = "cfg_if", + actual = "@raze__cfg_if__1_0_0//:cfg_if", + tags = [ + "cargo-raze", + "manual", + ], +) + alias( name = "chrono", actual = "@raze__chrono__0_4_19//:chrono", @@ -21,6 +30,15 @@ alias( ], ) +alias( + name = "getrandom", + actual = "@raze__getrandom__0_2_0//:getrandom", + tags = [ + "cargo-raze", + "manual", + ], +) + alias( name = "hashbrown", actual = "@raze__hashbrown__0_9_1//:hashbrown", diff --git a/bazel/cargo/Cargo.lock b/bazel/cargo/Cargo.lock index 9d618368..65fd749b 100644 --- a/bazel/cargo/Cargo.lock +++ b/bazel/cargo/Cargo.lock @@ -18,6 +18,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "chrono" version = "0.4.19" @@ -31,6 +37,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "getrandom" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "hashbrown" version = "0.9.1" @@ -52,7 +69,7 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] @@ -84,7 +101,9 @@ dependencies = [ name = "proxy-wasm" version = "0.1.2" dependencies = [ + "cfg-if 1.0.0", "chrono", + "getrandom", "hashbrown", "log", "wee_alloc", @@ -97,10 +116,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", - "wasi", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -113,7 +138,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb3b5a6b2bb17cb6ad44a2e68a43e8d2722c997da10e928665c72ec6c0a0b8e" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "libc", "memory_units", "winapi", diff --git a/bazel/cargo/crates.bzl b/bazel/cargo/crates.bzl index 15831dc0..0d580df1 100644 --- a/bazel/cargo/crates.bzl +++ b/bazel/cargo/crates.bzl @@ -41,6 +41,16 @@ def raze_fetch_remote_crates(): build_file = Label("//bazel/cargo/remote:BUILD.cfg-if-0.1.10.bazel"), ) + maybe( + http_archive, + name = "raze__cfg_if__1_0_0", + url = "https://crates.io/api/v1/crates/cfg-if/1.0.0/download", + type = "tar.gz", + sha256 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd", + strip_prefix = "cfg-if-1.0.0", + build_file = Label("//bazel/cargo/remote:BUILD.cfg-if-1.0.0.bazel"), + ) + maybe( http_archive, name = "raze__chrono__0_4_19", @@ -51,6 +61,16 @@ def raze_fetch_remote_crates(): build_file = Label("//bazel/cargo/remote:BUILD.chrono-0.4.19.bazel"), ) + maybe( + http_archive, + name = "raze__getrandom__0_2_0", + url = "https://crates.io/api/v1/crates/getrandom/0.2.0/download", + type = "tar.gz", + sha256 = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4", + strip_prefix = "getrandom-0.2.0", + build_file = Label("//bazel/cargo/remote:BUILD.getrandom-0.2.0.bazel"), + ) + maybe( http_archive, name = "raze__hashbrown__0_9_1", @@ -121,6 +141,16 @@ def raze_fetch_remote_crates(): build_file = Label("//bazel/cargo/remote:BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel"), ) + maybe( + http_archive, + name = "raze__wasi__0_9_0_wasi_snapshot_preview1", + url = "https://crates.io/api/v1/crates/wasi/0.9.0+wasi-snapshot-preview1/download", + type = "tar.gz", + sha256 = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519", + strip_prefix = "wasi-0.9.0+wasi-snapshot-preview1", + build_file = Label("//bazel/cargo/remote:BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel"), + ) + maybe( http_archive, name = "raze__winapi__0_3_9", diff --git a/bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel b/bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel new file mode 100644 index 00000000..6e3db87e --- /dev/null +++ b/bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel @@ -0,0 +1,54 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "cfg_if", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.0.0", + # buildifier: leave-alone + deps = [ + ], +) + +# Unsupported target "xcrate" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel b/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel new file mode 100644 index 00000000..d91deb02 --- /dev/null +++ b/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel @@ -0,0 +1,96 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "mod" with type "bench" omitted + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "getrandom", + srcs = glob(["**/*.rs"]), + aliases = { + }, + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.0", + # buildifier: leave-alone + deps = [ + "@raze__cfg_if__0_1_10//:cfg_if", + ] + selects.with_or({ + # cfg(all(target_arch = "wasm32", target_os = "unknown", not(cargo_web))) + ( + "@io_bazel_rules_rust//rust/platform:wasm32-unknown-unknown", + ): [ + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(target_os = "wasi") + ( + "@io_bazel_rules_rust//rust/platform:wasm32-wasi", + ): [ + "@raze__wasi__0_9_0_wasi_snapshot_preview1//:wasi", + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(unix) + ( + "@io_bazel_rules_rust//rust/platform:aarch64-apple-ios", + "@io_bazel_rules_rust//rust/platform:aarch64-linux-android", + "@io_bazel_rules_rust//rust/platform:aarch64-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:arm-unknown-linux-gnueabi", + "@io_bazel_rules_rust//rust/platform:i686-apple-darwin", + "@io_bazel_rules_rust//rust/platform:i686-linux-android", + "@io_bazel_rules_rust//rust/platform:i686-unknown-freebsd", + "@io_bazel_rules_rust//rust/platform:i686-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:powerpc-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:s390x-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:x86_64-apple-darwin", + "@io_bazel_rules_rust//rust/platform:x86_64-apple-ios", + "@io_bazel_rules_rust//rust/platform:x86_64-linux-android", + "@io_bazel_rules_rust//rust/platform:x86_64-unknown-freebsd", + "@io_bazel_rules_rust//rust/platform:x86_64-unknown-linux-gnu", + ): [ + "@raze__libc__0_2_80//:libc", + ], + "//conditions:default": [], + }), +) diff --git a/bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel b/bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel new file mode 100644 index 00000000..013a1c1c --- /dev/null +++ b/bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel @@ -0,0 +1,54 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Apache-2.0 from expression "Apache-2.0 OR (Apache-2.0 OR MIT)" +]) + +# Generated Targets + +rust_library( + name = "wasi", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.9.0+wasi-snapshot-preview1", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/examples/BUILD b/examples/BUILD index 4901dd94..047cae40 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -8,9 +8,13 @@ rust_binary( out_binary = True, deps = [ "//:proxy_wasm", + "//bazel/cargo:cfg_if", "//bazel/cargo:chrono", "//bazel/cargo:log", - ], + ] + select({ + "@io_bazel_rules_rust//rust/platform:wasm32-unknown-unknown": [], + "//conditions:default": ["//bazel/cargo:getrandom"], + }), ) rust_binary( diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 8f439540..b493aa1b 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -12,12 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. +use cfg_if::cfg_if; use chrono::{DateTime, Utc}; use log::info; use proxy_wasm::traits::*; use proxy_wasm::types::*; use std::time::Duration; +#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] +use getrandom::getrandom; + #[no_mangle] pub fn _start() { proxy_wasm::set_log_level(LogLevel::Trace); @@ -36,7 +40,17 @@ impl RootContext for HelloWorld { } fn on_tick(&mut self) { - let datetime: DateTime = self.get_current_time().into(); - info!("It's {}", datetime); + cfg_if! { + if #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] { + let now: DateTime = self.get_current_time().into(); + info!("It's {}, there is no lucky number.", now); + + } else { + let now: DateTime = Utc::now(); + let mut buf = [0u8; 1]; + getrandom(&mut buf).unwrap(); + info!("It's {}, your lucky number is {}.", now, buf[0]); + } + } } } From 4cb2db7e398fb8166f49fcc899ef5ede261005d1 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Wed, 11 Nov 2020 18:04:48 -0800 Subject: [PATCH 24/42] Use cargo-raze's gen_buildrs for trusted crates. (#53) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 2 +- Cargo.toml | 19 ++---- .../cargo/remote/BUILD.getrandom-0.2.0.bazel | 67 ++++++++++++++++++- bazel/cargo/remote/BUILD.libc-0.2.80.bazel | 39 ++++++++--- bazel/cargo/remote/BUILD.log-0.4.11.bazel | 31 ++++++++- 5 files changed, 130 insertions(+), 28 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3df51920..dcaf7963 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -75,7 +75,7 @@ jobs: - name: Format (cargo raze) run: | - cargo install cargo-raze --git https://github.com/google/cargo-raze --rev cb9f85d22b1c81cceb9acaf1fa4336c5fc4e6bff + cargo install cargo-raze --version 0.7.0 cp -p bazel/cargo/Cargo.lock . rm -rf bazel/cargo/ cargo raze --output=bazel/cargo diff --git a/Cargo.toml b/Cargo.toml index 0e06abc7..2e5b8d7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,19 +32,14 @@ panic = "abort" workspace_path = "//bazel/cargo" genmode = "Remote" -[package.metadata.raze.crates.libc.'0.2.80'] -additional_flags = [ - "--cfg=libc_priv_mod_use", - "--cfg=libc_union", - "--cfg=libc_const_size_of", - "--cfg=libc_align", - "--cfg=libc_core_cvoid", - "--cfg=libc_packedN", - "--cfg=libc_cfg_target_vendor", -] +[package.metadata.raze.crates.getrandom.'=0.2.0'] +gen_buildrs = true -[package.metadata.raze.crates.log.'0.4.11'] -additional_flags = ["--cfg=atomic_cas"] +[package.metadata.raze.crates.libc.'=0.2.80'] +gen_buildrs = true + +[package.metadata.raze.crates.log.'=0.4.11'] +gen_buildrs = true [[example]] name = "hello_world" diff --git a/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel b/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel index d91deb02..5e431e5c 100644 --- a/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel +++ b/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel @@ -28,11 +28,71 @@ licenses([ "notice", # MIT from expression "MIT OR Apache-2.0" ]) -# Generated Targets +# Generated Targets# buildifier: disable=load-on-top +load( + "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", + "cargo_build_script", +) -# Unsupported target "mod" with type "bench" omitted +cargo_build_script( + name = "getrandom_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + ], + crate_root = "build.rs", + data = glob(["**"]), + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.0", + visibility = ["//visibility:private"], + deps = [ + ] + selects.with_or({ + # cfg(all(target_arch = "wasm32", target_os = "unknown", not(cargo_web))) + ( + "@io_bazel_rules_rust//rust/platform:wasm32-unknown-unknown", + ): [ + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(target_os = "wasi") + ( + "@io_bazel_rules_rust//rust/platform:wasm32-wasi", + ): [ + ], + "//conditions:default": [], + }) + selects.with_or({ + # cfg(unix) + ( + "@io_bazel_rules_rust//rust/platform:aarch64-apple-ios", + "@io_bazel_rules_rust//rust/platform:aarch64-linux-android", + "@io_bazel_rules_rust//rust/platform:aarch64-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:arm-unknown-linux-gnueabi", + "@io_bazel_rules_rust//rust/platform:i686-apple-darwin", + "@io_bazel_rules_rust//rust/platform:i686-linux-android", + "@io_bazel_rules_rust//rust/platform:i686-unknown-freebsd", + "@io_bazel_rules_rust//rust/platform:i686-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:powerpc-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:s390x-unknown-linux-gnu", + "@io_bazel_rules_rust//rust/platform:x86_64-apple-darwin", + "@io_bazel_rules_rust//rust/platform:x86_64-apple-ios", + "@io_bazel_rules_rust//rust/platform:x86_64-linux-android", + "@io_bazel_rules_rust//rust/platform:x86_64-unknown-freebsd", + "@io_bazel_rules_rust//rust/platform:x86_64-unknown-linux-gnu", + ): [ + ], + "//conditions:default": [], + }), +) -# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "mod" with type "bench" omitted rust_library( name = "getrandom", @@ -54,6 +114,7 @@ rust_library( version = "0.2.0", # buildifier: leave-alone deps = [ + ":getrandom_build_script", "@raze__cfg_if__0_1_10//:cfg_if", ] + selects.with_or({ # cfg(all(target_arch = "wasm32", target_os = "unknown", not(cargo_web))) diff --git a/bazel/cargo/remote/BUILD.libc-0.2.80.bazel b/bazel/cargo/remote/BUILD.libc-0.2.80.bazel index 34e15553..81bb143b 100644 --- a/bazel/cargo/remote/BUILD.libc-0.2.80.bazel +++ b/bazel/cargo/remote/BUILD.libc-0.2.80.bazel @@ -28,9 +28,36 @@ licenses([ "notice", # MIT from expression "MIT OR Apache-2.0" ]) -# Generated Targets +# Generated Targets# buildifier: disable=load-on-top +load( + "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", + "cargo_build_script", +) -# Unsupported target "build-script-build" with type "custom-build" omitted +cargo_build_script( + name = "libc_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + "default", + "std", + ], + crate_root = "build.rs", + data = glob(["**"]), + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.80", + visibility = ["//visibility:private"], + deps = [ + ], +) rust_library( name = "libc", @@ -44,13 +71,6 @@ rust_library( edition = "2015", rustc_flags = [ "--cap-lints=allow", - "--cfg=libc_priv_mod_use", - "--cfg=libc_union", - "--cfg=libc_const_size_of", - "--cfg=libc_align", - "--cfg=libc_core_cvoid", - "--cfg=libc_packedN", - "--cfg=libc_cfg_target_vendor", ], tags = [ "cargo-raze", @@ -59,6 +79,7 @@ rust_library( version = "0.2.80", # buildifier: leave-alone deps = [ + ":libc_build_script", ], ) diff --git a/bazel/cargo/remote/BUILD.log-0.4.11.bazel b/bazel/cargo/remote/BUILD.log-0.4.11.bazel index 022c0e5c..3910f0b2 100644 --- a/bazel/cargo/remote/BUILD.log-0.4.11.bazel +++ b/bazel/cargo/remote/BUILD.log-0.4.11.bazel @@ -28,9 +28,34 @@ licenses([ "notice", # MIT from expression "MIT OR Apache-2.0" ]) -# Generated Targets +# Generated Targets# buildifier: disable=load-on-top +load( + "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", + "cargo_build_script", +) -# Unsupported target "build-script-build" with type "custom-build" omitted +cargo_build_script( + name = "log_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + ], + crate_root = "build.rs", + data = glob(["**"]), + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.4.11", + visibility = ["//visibility:private"], + deps = [ + ], +) rust_library( name = "log", @@ -42,7 +67,6 @@ rust_library( edition = "2015", rustc_flags = [ "--cap-lints=allow", - "--cfg=atomic_cas", ], tags = [ "cargo-raze", @@ -51,6 +75,7 @@ rust_library( version = "0.4.11", # buildifier: leave-alone deps = [ + ":log_build_script", "@raze__cfg_if__0_1_10//:cfg_if", ], ) From 9d3123663a7d939d70c1f42072e568dcee487e91 Mon Sep 17 00:00:00 2001 From: SvetlinZarev-SAP <43135961+SvetlinZarev-SAP@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:35:07 +0200 Subject: [PATCH 25/42] Add support for nested HTTP callouts. (#56) Signed-off-by: Svetlin Zarev --- src/dispatcher.rs | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/dispatcher.rs b/src/dispatcher.rs index 897f95d8..bc7d639b 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -345,22 +345,24 @@ impl Dispatcher { body_size: usize, num_trailers: usize, ) { - if let Some(context_id) = self.callouts.borrow_mut().remove(&token_id) { - if let Some(http_stream) = self.http_streams.borrow_mut().get_mut(&context_id) { - self.active_id.set(context_id); - hostcalls::set_effective_context(context_id).unwrap(); - http_stream.on_http_call_response(token_id, num_headers, body_size, num_trailers) - } else if let Some(stream) = self.streams.borrow_mut().get_mut(&context_id) { - self.active_id.set(context_id); - hostcalls::set_effective_context(context_id).unwrap(); - stream.on_http_call_response(token_id, num_headers, body_size, num_trailers) - } else if let Some(root) = self.roots.borrow_mut().get_mut(&context_id) { - self.active_id.set(context_id); - hostcalls::set_effective_context(context_id).unwrap(); - root.on_http_call_response(token_id, num_headers, body_size, num_trailers) - } - } else { - panic!("invalid token_id") + let context_id = self + .callouts + .borrow_mut() + .remove(&token_id) + .expect("invalid token_id"); + + if let Some(http_stream) = self.http_streams.borrow_mut().get_mut(&context_id) { + self.active_id.set(context_id); + hostcalls::set_effective_context(context_id).unwrap(); + http_stream.on_http_call_response(token_id, num_headers, body_size, num_trailers) + } else if let Some(stream) = self.streams.borrow_mut().get_mut(&context_id) { + self.active_id.set(context_id); + hostcalls::set_effective_context(context_id).unwrap(); + stream.on_http_call_response(token_id, num_headers, body_size, num_trailers) + } else if let Some(root) = self.roots.borrow_mut().get_mut(&context_id) { + self.active_id.set(context_id); + hostcalls::set_effective_context(context_id).unwrap(); + root.on_http_call_response(token_id, num_headers, body_size, num_trailers) } } } From 7de2acdd783e7d3072f7267517b34c95caa1d3b7 Mon Sep 17 00:00:00 2001 From: Daniel Grimm Date: Fri, 4 Dec 2020 10:57:48 +0100 Subject: [PATCH 26/42] Allow RootContext to create child contexts for streams. (#34) Fixes #6. Signed-off-by: Daniel Grimm --- Cargo.toml | 5 +++ examples/http_body.rs | 16 +++++++++- examples/http_config.rs | 64 ++++++++++++++++++++++++++++++++++++++ examples/http_headers.rs | 20 ++++++++++-- src/dispatcher.rs | 66 +++++++++++++++++++++++++--------------- src/traits.rs | 12 ++++++++ src/types.rs | 7 +++++ 7 files changed, 161 insertions(+), 29 deletions(-) create mode 100644 examples/http_config.rs diff --git a/Cargo.toml b/Cargo.toml index 2e5b8d7e..c3e4ac7d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,3 +60,8 @@ crate-type = ["cdylib"] name = "http_body" path = "examples/http_body.rs" crate-type = ["cdylib"] + +[[example]] +name = "http_config" +path = "examples/http_config.rs" +crate-type = ["cdylib"] diff --git a/examples/http_body.rs b/examples/http_body.rs index 5db8ed8f..da1bda55 100644 --- a/examples/http_body.rs +++ b/examples/http_body.rs @@ -18,7 +18,21 @@ use proxy_wasm::types::*; #[no_mangle] pub fn _start() { proxy_wasm::set_log_level(LogLevel::Trace); - proxy_wasm::set_http_context(|_, _| -> Box { Box::new(HttpBody) }); + proxy_wasm::set_root_context(|_| -> Box { Box::new(HttpBodyRoot) }); +} + +struct HttpBodyRoot; + +impl Context for HttpBodyRoot {} + +impl RootContext for HttpBodyRoot { + fn get_type(&self) -> Option { + Some(ContextType::HttpContext) + } + + fn create_http_context(&self, _context_id: u32) -> Option> { + Some(Box::new(HttpBody)) + } } struct HttpBody; diff --git a/examples/http_config.rs b/examples/http_config.rs new file mode 100644 index 00000000..fc297a08 --- /dev/null +++ b/examples/http_config.rs @@ -0,0 +1,64 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use proxy_wasm::traits::*; +use proxy_wasm::types::*; + +#[no_mangle] +pub fn _start() { + proxy_wasm::set_log_level(LogLevel::Trace); + proxy_wasm::set_root_context(|_| -> Box { + Box::new(HttpConfigHeaderRoot { + header_content: String::new(), + }) + }); +} + +struct HttpConfigHeader { + header_content: String, +} + +impl Context for HttpConfigHeader {} + +impl HttpContext for HttpConfigHeader { + fn on_http_response_headers(&mut self, _num_headers: usize) -> Action { + self.add_http_response_header("custom-header", self.header_content.as_str()); + Action::Continue + } +} + +struct HttpConfigHeaderRoot { + header_content: String, +} + +impl Context for HttpConfigHeaderRoot {} + +impl RootContext for HttpConfigHeaderRoot { + fn on_configure(&mut self, _plugin_configuration_size: usize) -> bool { + if let Some(config_bytes) = self.get_configuration() { + self.header_content = String::from_utf8(config_bytes).unwrap() + } + true + } + + fn create_http_context(&self, _context_id: u32) -> Option> { + Some(Box::new(HttpConfigHeader { + header_content: self.header_content.clone(), + })) + } + + fn get_type(&self) -> Option { + Some(ContextType::HttpContext) + } +} diff --git a/examples/http_headers.rs b/examples/http_headers.rs index 14b32861..615fdcc6 100644 --- a/examples/http_headers.rs +++ b/examples/http_headers.rs @@ -19,9 +19,23 @@ use proxy_wasm::types::*; #[no_mangle] pub fn _start() { proxy_wasm::set_log_level(LogLevel::Trace); - proxy_wasm::set_http_context(|context_id, _| -> Box { - Box::new(HttpHeaders { context_id }) - }); + proxy_wasm::set_root_context(|_| -> Box { Box::new(HttpHeadersRoot) }); +} + +struct HttpHeadersRoot; + +impl Context for HttpHeadersRoot {} + +impl RootContext for HttpHeadersRoot { + fn get_type(&self) -> Option { + Some(ContextType::HttpContext) + } + + fn create_http_context(&self, _context_id: u32) -> Option> { + Some(Box::new(HttpHeaders { + context_id: _context_id, + })) + } } struct HttpHeaders { diff --git a/src/dispatcher.rs b/src/dispatcher.rs index bc7d639b..d9c9d491 100644 --- a/src/dispatcher.rs +++ b/src/dispatcher.rs @@ -80,6 +80,17 @@ impl Dispatcher { self.new_http_stream.set(Some(callback)); } + fn register_callout(&self, token_id: u32) { + if self + .callouts + .borrow_mut() + .insert(token_id, self.active_id.get()) + .is_some() + { + panic!("duplicate token_id") + } + } + fn create_root_context(&self, context_id: u32) { let new_context = match self.new_root.get() { Some(f) => f(context_id), @@ -96,12 +107,15 @@ impl Dispatcher { } fn create_stream_context(&self, context_id: u32, root_context_id: u32) { - if !self.roots.borrow().contains_key(&root_context_id) { - panic!("invalid root_context_id") - } - let new_context = match self.new_stream.get() { - Some(f) => f(context_id, root_context_id), - None => panic!("missing constructor"), + let new_context = match self.roots.borrow().get(&root_context_id) { + Some(root_context) => match self.new_stream.get() { + Some(f) => f(context_id, root_context_id), + None => match root_context.create_stream_context(context_id) { + Some(stream_context) => stream_context, + None => panic!("create_stream_context returned None"), + }, + }, + None => panic!("invalid root_context_id"), }; if self .streams @@ -114,12 +128,15 @@ impl Dispatcher { } fn create_http_context(&self, context_id: u32, root_context_id: u32) { - if !self.roots.borrow().contains_key(&root_context_id) { - panic!("invalid root_context_id") - } - let new_context = match self.new_http_stream.get() { - Some(f) => f(context_id, root_context_id), - None => panic!("missing constructor"), + let new_context = match self.roots.borrow().get(&root_context_id) { + Some(root_context) => match self.new_http_stream.get() { + Some(f) => f(context_id, root_context_id), + None => match root_context.create_http_context(context_id) { + Some(stream_context) => stream_context, + None => panic!("create_http_context returned None"), + }, + }, + None => panic!("invalid root_context_id"), }; if self .http_streams @@ -131,26 +148,25 @@ impl Dispatcher { } } - fn register_callout(&self, token_id: u32) { - if self - .callouts - .borrow_mut() - .insert(token_id, self.active_id.get()) - .is_some() - { - panic!("duplicate token_id") - } - } - fn on_create_context(&self, context_id: u32, root_context_id: u32) { if root_context_id == 0 { - self.create_root_context(context_id) + self.create_root_context(context_id); } else if self.new_http_stream.get().is_some() { self.create_http_context(context_id, root_context_id); } else if self.new_stream.get().is_some() { self.create_stream_context(context_id, root_context_id); + } else if let Some(root_context) = self.roots.borrow().get(&root_context_id) { + match root_context.get_type() { + Some(ContextType::HttpContext) => { + self.create_http_context(context_id, root_context_id) + } + Some(ContextType::StreamContext) => { + self.create_stream_context(context_id, root_context_id) + } + None => panic!("missing ContextType on root_context"), + } } else { - panic!("missing constructors") + panic!("invalid root_context_id and missing constructors"); } } diff --git a/src/traits.rs b/src/traits.rs index 10b24514..5b7fc4be 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -121,6 +121,18 @@ pub trait RootContext: Context { fn on_queue_ready(&mut self, _queue_id: u32) {} fn on_log(&mut self) {} + + fn create_http_context(&self, _context_id: u32) -> Option> { + None + } + + fn create_stream_context(&self, _context_id: u32) -> Option> { + None + } + + fn get_type(&self) -> Option { + None + } } pub trait StreamContext: Context { diff --git a/src/types.rs b/src/types.rs index a951f78f..855a414b 100644 --- a/src/types.rs +++ b/src/types.rs @@ -47,6 +47,13 @@ pub enum Status { InternalFailure = 10, } +#[repr(u32)] +#[derive(Debug)] +pub enum ContextType { + HttpContext = 0, + StreamContext = 1, +} + #[repr(u32)] #[derive(Debug)] pub enum BufferType { From 85f92f8316c56d35a08cc4140bd683c4a6149eca Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 4 Dec 2020 11:34:26 -0800 Subject: [PATCH 27/42] Fix warnings from Clippy v1.50.0 (nightly). (#58) Signed-off-by: Piotr Sikora --- examples/http_body.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/http_body.rs b/examples/http_body.rs index da1bda55..374a8751 100644 --- a/examples/http_body.rs +++ b/examples/http_body.rs @@ -60,7 +60,7 @@ impl HttpContext for HttpBody { // Since we returned "Pause" previuously, this will return the whole body. if let Some(body_bytes) = self.get_http_response_body(0, body_size) { let body_str = String::from_utf8(body_bytes).unwrap(); - if body_str.find("secret").is_some() { + if body_str.contains("secret") { let new_body = format!("Original message body ({} bytes) redacted.", body_size); self.set_http_response_body(0, body_size, &new_body.into_bytes()); } From 56a680a70faded9f4ba2c42b23e15883f9199782 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 4 Dec 2020 11:54:29 -0800 Subject: [PATCH 28/42] Release v0.1.3. (#59) Signed-off-by: Piotr Sikora --- CHANGELOG.md | 39 ++++++++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- bazel/cargo/Cargo.lock | 2 +- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7ae8da4..3c9ca036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,52 @@ # Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). + +## [0.1.3] - 2020-12-04 + +### Fixed + +- Fixed support for nested HTTP callouts. + Thanks [@SvetlinZarev](https://github.com/SvetlinZarev)! + +### Changed + +- Changed `wee-alloc` to an optional feature. + Thanks [@yuval-k](https://github.com/yuval-k)! + +### Added + +- Added support for building for `wasm32-wasi` target. +- Added support for metrics. +- Added support for `RootContext` to create child contexts for streams. + Thanks [@dgn](https://github.com/dgn)! +- Added support for setting network buffers. + ## [0.1.2] - 2020-08-05 -- Updated MapType values to match updated Proxy-Wasm ABI v0.1.0. +### Changed + +- Updated `MapType` values to match updated Proxy-Wasm ABI v0.1.0. + Thanks [@yskopets](https://github.com/yskopets)! ## [0.1.1] - 2020-08-05 +### Added + - Added support for building with Bazel. - Added support for setting HTTP bodies. + Thanks [@gbrail](https://github.com/gbrail)! ## [0.1.0] - 2020-02-29 +### Added + - Initial release. -[0.1.2]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.2 -[0.1.1]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.1 +[0.1.3]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/compare/v0.1.2...v0.1.3 +[0.1.2]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/compare/v0.1.1...v0.1.2 +[0.1.1]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/proxy-wasm/proxy-wasm-rust-sdk/releases/tag/v0.1.0 diff --git a/Cargo.toml b/Cargo.toml index c3e4ac7d..7c3da4e7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "proxy-wasm" -version = "0.1.2" +version = "0.1.3" authors = ["Piotr Sikora "] description = "WebAssembly for Proxies" readme = "README.md" diff --git a/bazel/cargo/Cargo.lock b/bazel/cargo/Cargo.lock index 65fd749b..e234d5cd 100644 --- a/bazel/cargo/Cargo.lock +++ b/bazel/cargo/Cargo.lock @@ -99,7 +99,7 @@ dependencies = [ [[package]] name = "proxy-wasm" -version = "0.1.2" +version = "0.1.3" dependencies = [ "cfg-if 1.0.0", "chrono", From 42572fb20b88aa3af455b928e843c265e2057fc2 Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 4 Dec 2020 15:56:51 -0800 Subject: [PATCH 29/42] Cleanup instructions for updating dependencies. (#60) Signed-off-by: Piotr Sikora --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 059289d8..e708990e 100644 --- a/README.md +++ b/README.md @@ -26,11 +26,11 @@ + [Extending Envoy with WASM and Rust](https://antweiss.com/blog/extending-envoy-with-wasm-and-rust/) + [Extending Istio with Rust and WebAssembly](https://blog.red-badger.com/extending-istio-with-rust-and-webassembly) -# Updating dependencies +## Updating dependencies -When updating dependencies, you need to regenerate `BUILD` files to match updated `Cargo.toml`: +When updating dependencies, you need to regenerate Bazel `BUILD` files to match updated `Cargo.toml`: ``` -cargo install cargo-raze --git https://github.com/google/cargo-raze --rev cb9f85d22b1c81cceb9acaf1fa4336c5fc4e6bff +cargo install cargo-raze --version 0.7.0 rm -rf bazel/cargo/ cargo generate-lockfile cargo raze --output=bazel/cargo From 802cab2eabc1da106d8b8b7be2c7278b2bfadfbd Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Fri, 4 Dec 2020 16:12:31 -0800 Subject: [PATCH 30/42] Cleanup WORKSPACE. (#61) Signed-off-by: Piotr Sikora --- .github/workflows/rust.yml | 2 +- WORKSPACE | 21 ++++----------------- bazel/BUILD | 0 bazel/dependencies.bzl | 20 ++++++++++++++++++++ bazel/repositories.bzl | 23 +++++++++++++++++++++++ 5 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 bazel/BUILD create mode 100644 bazel/dependencies.bzl create mode 100644 bazel/repositories.bzl diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index dcaf7963..7219ce70 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,7 +57,7 @@ jobs: ~/.cargo/.crates2.json ~/.cargo/bin ~/.cargo/registry - key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock') }} + key: ${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/cargo/Cargo.lock', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }} - name: Build (wasm32-unknown-unknown) run: bazelisk --bazelrc=/dev/null build --platforms=@io_bazel_rules_rust//rust/platform:wasm //... diff --git a/WORKSPACE b/WORKSPACE index 569182ad..4261aeed 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,22 +1,9 @@ workspace(name = "proxy_wasm_rust_sdk") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@proxy_wasm_rust_sdk//bazel:repositories.bzl", "proxy_wasm_rust_sdk_repositories") -http_archive( - name = "io_bazel_rules_rust", - sha256 = "17dbf791f4dab0fd4496ce5345af35e9ce2f6d011c1c8423436da517d019a3ea", - strip_prefix = "rules_rust-2f97db595b05b1ee8cc44bde5bdf03c00bd169fb", - url = "https://github.com/bazelbuild/rules_rust/archive/2f97db595b05b1ee8cc44bde5bdf03c00bd169fb.tar.gz", -) +proxy_wasm_rust_sdk_repositories() -load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") +load("@proxy_wasm_rust_sdk//bazel:dependencies.bzl", "proxy_wasm_rust_sdk_dependencies") -rust_repositories() - -load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace") - -rust_workspace() - -load("//bazel/cargo:crates.bzl", "raze_fetch_remote_crates") - -raze_fetch_remote_crates() +proxy_wasm_rust_sdk_dependencies() diff --git a/bazel/BUILD b/bazel/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl new file mode 100644 index 00000000..b8f2b84d --- /dev/null +++ b/bazel/dependencies.bzl @@ -0,0 +1,20 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") +load("@proxy_wasm_rust_sdk//bazel/cargo:crates.bzl", "raze_fetch_remote_crates") + +def proxy_wasm_rust_sdk_dependencies(): + rust_repositories() + raze_fetch_remote_crates() diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl new file mode 100644 index 00000000..6ddf170f --- /dev/null +++ b/bazel/repositories.bzl @@ -0,0 +1,23 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +def proxy_wasm_rust_sdk_repositories(): + http_archive( + name = "io_bazel_rules_rust", + sha256 = "5cb2fbcc3debebc7b68f5f66c1b7ef741bdcca87c70594de688d4518538c36c8", + strip_prefix = "rules_rust-aa7c6938cf1cc2973bc065c7532f89874bf09818", + url = "https://github.com/bazelbuild/rules_rust/archive/aa7c6938cf1cc2973bc065c7532f89874bf09818.tar.gz", + ) From b9ea6d03d3de66d23d39a3097cb1a1b24078caee Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 7 Dec 2020 14:20:27 -0800 Subject: [PATCH 31/42] Cleanup examples. (#62) Signed-off-by: Piotr Sikora --- examples/BUILD | 12 ++++++++++++ examples/http_body.rs | 2 +- examples/http_config.rs | 6 +++--- examples/http_headers.rs | 6 ++---- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/examples/BUILD b/examples/BUILD index 047cae40..ba5935dd 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -52,3 +52,15 @@ rust_binary( "//bazel/cargo:log", ], ) + +rust_binary( + name = "http_config", + srcs = ["http_config.rs"], + crate_type = "cdylib", + edition = "2018", + out_binary = True, + deps = [ + "//:proxy_wasm", + "//bazel/cargo:log", + ], +) diff --git a/examples/http_body.rs b/examples/http_body.rs index 374a8751..ff884648 100644 --- a/examples/http_body.rs +++ b/examples/http_body.rs @@ -30,7 +30,7 @@ impl RootContext for HttpBodyRoot { Some(ContextType::HttpContext) } - fn create_http_context(&self, _context_id: u32) -> Option> { + fn create_http_context(&self, _: u32) -> Option> { Some(Box::new(HttpBody)) } } diff --git a/examples/http_config.rs b/examples/http_config.rs index fc297a08..d912ae03 100644 --- a/examples/http_config.rs +++ b/examples/http_config.rs @@ -32,7 +32,7 @@ struct HttpConfigHeader { impl Context for HttpConfigHeader {} impl HttpContext for HttpConfigHeader { - fn on_http_response_headers(&mut self, _num_headers: usize) -> Action { + fn on_http_response_headers(&mut self, _: usize) -> Action { self.add_http_response_header("custom-header", self.header_content.as_str()); Action::Continue } @@ -45,14 +45,14 @@ struct HttpConfigHeaderRoot { impl Context for HttpConfigHeaderRoot {} impl RootContext for HttpConfigHeaderRoot { - fn on_configure(&mut self, _plugin_configuration_size: usize) -> bool { + fn on_configure(&mut self, _: usize) -> bool { if let Some(config_bytes) = self.get_configuration() { self.header_content = String::from_utf8(config_bytes).unwrap() } true } - fn create_http_context(&self, _context_id: u32) -> Option> { + fn create_http_context(&self, _: u32) -> Option> { Some(Box::new(HttpConfigHeader { header_content: self.header_content.clone(), })) diff --git a/examples/http_headers.rs b/examples/http_headers.rs index 615fdcc6..b0f1a745 100644 --- a/examples/http_headers.rs +++ b/examples/http_headers.rs @@ -31,10 +31,8 @@ impl RootContext for HttpHeadersRoot { Some(ContextType::HttpContext) } - fn create_http_context(&self, _context_id: u32) -> Option> { - Some(Box::new(HttpHeaders { - context_id: _context_id, - })) + fn create_http_context(&self, context_id: u32) -> Option> { + Some(Box::new(HttpHeaders { context_id })) } } From f1a0ec203c43241587a330a47bd4705a947112de Mon Sep 17 00:00:00 2001 From: Piotr Sikora Date: Mon, 7 Dec 2020 14:23:01 -0800 Subject: [PATCH 32/42] Update libc (transitive dependency) to v0.2.81. (#63) Signed-off-by: Piotr Sikora --- Cargo.toml | 2 +- bazel/cargo/Cargo.lock | 4 ++-- bazel/cargo/crates.bzl | 10 +++++----- bazel/cargo/remote/BUILD.chrono-0.4.19.bazel | 2 +- bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel | 2 +- ...BUILD.libc-0.2.80.bazel => BUILD.libc-0.2.81.bazel} | 4 ++-- bazel/cargo/remote/BUILD.time-0.1.44.bazel | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) rename bazel/cargo/remote/{BUILD.libc-0.2.80.bazel => BUILD.libc-0.2.81.bazel} (97%) diff --git a/Cargo.toml b/Cargo.toml index 7c3da4e7..24edd3ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ genmode = "Remote" [package.metadata.raze.crates.getrandom.'=0.2.0'] gen_buildrs = true -[package.metadata.raze.crates.libc.'=0.2.80'] +[package.metadata.raze.crates.libc.'=0.2.81'] gen_buildrs = true [package.metadata.raze.crates.log.'=0.4.11'] diff --git a/bazel/cargo/Cargo.lock b/bazel/cargo/Cargo.lock index e234d5cd..3ee0bc88 100644 --- a/bazel/cargo/Cargo.lock +++ b/bazel/cargo/Cargo.lock @@ -59,9 +59,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" +checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" [[package]] name = "log" diff --git a/bazel/cargo/crates.bzl b/bazel/cargo/crates.bzl index 0d580df1..17c44dd9 100644 --- a/bazel/cargo/crates.bzl +++ b/bazel/cargo/crates.bzl @@ -83,12 +83,12 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__libc__0_2_80", - url = "https://crates.io/api/v1/crates/libc/0.2.80/download", + name = "raze__libc__0_2_81", + url = "https://crates.io/api/v1/crates/libc/0.2.81/download", type = "tar.gz", - sha256 = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614", - strip_prefix = "libc-0.2.80", - build_file = Label("//bazel/cargo/remote:BUILD.libc-0.2.80.bazel"), + sha256 = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb", + strip_prefix = "libc-0.2.81", + build_file = Label("//bazel/cargo/remote:BUILD.libc-0.2.81.bazel"), ) maybe( diff --git a/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel index 88341193..6154bbd0 100644 --- a/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel +++ b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel @@ -61,7 +61,7 @@ rust_library( version = "0.4.19", # buildifier: leave-alone deps = [ - "@raze__libc__0_2_80//:libc", + "@raze__libc__0_2_81//:libc", "@raze__num_integer__0_1_44//:num_integer", "@raze__num_traits__0_2_14//:num_traits", "@raze__time__0_1_44//:time", diff --git a/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel b/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel index 5e431e5c..45977782 100644 --- a/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel +++ b/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel @@ -150,7 +150,7 @@ rust_library( "@io_bazel_rules_rust//rust/platform:x86_64-unknown-freebsd", "@io_bazel_rules_rust//rust/platform:x86_64-unknown-linux-gnu", ): [ - "@raze__libc__0_2_80//:libc", + "@raze__libc__0_2_81//:libc", ], "//conditions:default": [], }), diff --git a/bazel/cargo/remote/BUILD.libc-0.2.80.bazel b/bazel/cargo/remote/BUILD.libc-0.2.81.bazel similarity index 97% rename from bazel/cargo/remote/BUILD.libc-0.2.80.bazel rename to bazel/cargo/remote/BUILD.libc-0.2.81.bazel index 81bb143b..83617479 100644 --- a/bazel/cargo/remote/BUILD.libc-0.2.80.bazel +++ b/bazel/cargo/remote/BUILD.libc-0.2.81.bazel @@ -53,7 +53,7 @@ cargo_build_script( "cargo-raze", "manual", ], - version = "0.2.80", + version = "0.2.81", visibility = ["//visibility:private"], deps = [ ], @@ -76,7 +76,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.2.80", + version = "0.2.81", # buildifier: leave-alone deps = [ ":libc_build_script", diff --git a/bazel/cargo/remote/BUILD.time-0.1.44.bazel b/bazel/cargo/remote/BUILD.time-0.1.44.bazel index e1ce0d27..ca43c192 100644 --- a/bazel/cargo/remote/BUILD.time-0.1.44.bazel +++ b/bazel/cargo/remote/BUILD.time-0.1.44.bazel @@ -50,7 +50,7 @@ rust_library( version = "0.1.44", # buildifier: leave-alone deps = [ - "@raze__libc__0_2_80//:libc", + "@raze__libc__0_2_81//:libc", ] + selects.with_or({ # cfg(target_os = "wasi") ( From 89750dcd5297c6f591e85bd409b633d394b12f5c Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Wed, 27 Jan 2021 12:51:59 +0900 Subject: [PATCH 33/42] Update the declared ABI version to 0.2.0 Signed-off-by: Takaya Saeki --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 03bb3d48..ea12546d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![doc(html_root_url = "https://docs.rs/proxy-wasm-experimental/0.0.7")] +#![doc(html_root_url = "https://docs.rs/proxy-wasm-experimental/0.0.8")] pub mod error; pub mod hostcalls; @@ -50,4 +50,4 @@ where } #[no_mangle] -pub extern "C" fn proxy_abi_version_0_1_0() {} +pub extern "C" fn proxy_abi_version_0_2_0() {} From 711835da87075f734b50eb563cd3da2df998b334 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Wed, 27 Jan 2021 12:53:05 +0900 Subject: [PATCH 34/42] Update the examples so that they use the latest API Signed-off-by: Takaya Saeki --- examples/http_body.rs | 6 ++++-- examples/http_config.rs | 14 ++++++++++---- src/lib.rs | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/examples/http_body.rs b/examples/http_body.rs index ff884648..3926e1c5 100644 --- a/examples/http_body.rs +++ b/examples/http_body.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use proxy_wasm_experimental as proxy_wasm; + use proxy_wasm::traits::*; use proxy_wasm::types::*; @@ -40,7 +42,7 @@ struct HttpBody; impl Context for HttpBody {} impl HttpContext for HttpBody { - fn on_http_response_headers(&mut self, _: usize) -> Action { + fn on_http_response_headers(&mut self, _: usize, _: bool) -> Action { // If there is a Content-Length header and we change the length of // the body later, then clients will break. So remove it. // We must do this here, because once we exit this function we @@ -59,7 +61,7 @@ impl HttpContext for HttpBody { // Replace the message body if it contains the text "secret". // Since we returned "Pause" previuously, this will return the whole body. if let Some(body_bytes) = self.get_http_response_body(0, body_size) { - let body_str = String::from_utf8(body_bytes).unwrap(); + let body_str = body_bytes.into_string().unwrap(); if body_str.contains("secret") { let new_body = format!("Original message body ({} bytes) redacted.", body_size); self.set_http_response_body(0, body_size, &new_body.into_bytes()); diff --git a/examples/http_config.rs b/examples/http_config.rs index d912ae03..3063fe5b 100644 --- a/examples/http_config.rs +++ b/examples/http_config.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +use proxy_wasm_experimental as proxy_wasm; + use proxy_wasm::traits::*; use proxy_wasm::types::*; @@ -32,7 +34,7 @@ struct HttpConfigHeader { impl Context for HttpConfigHeader {} impl HttpContext for HttpConfigHeader { - fn on_http_response_headers(&mut self, _: usize) -> Action { + fn on_http_response_headers(&mut self, _: usize, _: bool) -> Action { self.add_http_response_header("custom-header", self.header_content.as_str()); Action::Continue } @@ -45,9 +47,13 @@ struct HttpConfigHeaderRoot { impl Context for HttpConfigHeaderRoot {} impl RootContext for HttpConfigHeaderRoot { - fn on_configure(&mut self, _: usize) -> bool { - if let Some(config_bytes) = self.get_configuration() { - self.header_content = String::from_utf8(config_bytes).unwrap() + fn on_configure(&mut self, configuration_size: usize) -> bool { + if let Ok(Some(config_bytes)) = proxy_wasm::hostcalls::get_buffer( + BufferType::PluginConfiguration, + 0, + configuration_size, + ) { + self.header_content = config_bytes.into_string().unwrap(); } true } diff --git a/src/lib.rs b/src/lib.rs index ea12546d..ce5e503a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![doc(html_root_url = "https://docs.rs/proxy-wasm-experimental/0.0.8")] +#![doc(html_root_url = "https://docs.rs/proxy-wasm-experimental/0.0.7")] pub mod error; pub mod hostcalls; From e653d6c0296001742ee2996e5fbc24c06065a75b Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Thu, 28 Jan 2021 18:35:12 +0900 Subject: [PATCH 35/42] Remove ChildContext for now, which is not used anymore Signed-off-by: Takaya Saeki --- src/traits.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/traits.rs b/src/traits.rs index 898ac38a..b68e266e 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -96,12 +96,6 @@ pub trait Context { } } -/// Represents a child context of the root context. -pub enum ChildContext { - StreamContext(Box), - HttpContext(Box), -} - pub trait RootContext: Context { fn on_vm_start(&mut self, _vm_configuration_size: usize) -> bool { true From 41dd8d0b548bb1e816549955bef9e4f795bcc463 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Tue, 2 Feb 2021 19:44:05 +0900 Subject: [PATCH 36/42] Bump the version to 0.0.8 Signed-off-by: Takaya Saeki --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e37c5bf0..ac642ce0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "proxy-wasm-experimental" -version = "0.0.7" +version = "0.0.8" authors = ["Piotr Sikora ", "Yaroslav Skopets "] description = "WebAssembly for Proxies" readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index ce5e503a..ea12546d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![doc(html_root_url = "https://docs.rs/proxy-wasm-experimental/0.0.7")] +#![doc(html_root_url = "https://docs.rs/proxy-wasm-experimental/0.0.8")] pub mod error; pub mod hostcalls; From bb0c5970cc25f5a4dab0ae12c914c03791c14e23 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Wed, 3 Feb 2021 16:43:52 +0900 Subject: [PATCH 37/42] Fix bazel build for the fork's crate Signed-off-by: Takaya Saeki --- BUILD | 2 +- examples/BUILD | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BUILD b/BUILD index 53d433f6..f6296901 100644 --- a/BUILD +++ b/BUILD @@ -1,7 +1,7 @@ load("@io_bazel_rules_rust//rust:rust.bzl", "rust_library") rust_library( - name = "proxy_wasm", + name = "proxy_wasm_experimental", srcs = glob(["src/*.rs"]), edition = "2018", visibility = ["//visibility:public"], diff --git a/examples/BUILD b/examples/BUILD index ba5935dd..258e55fc 100644 --- a/examples/BUILD +++ b/examples/BUILD @@ -7,7 +7,7 @@ rust_binary( edition = "2018", out_binary = True, deps = [ - "//:proxy_wasm", + "//:proxy_wasm_experimental", "//bazel/cargo:cfg_if", "//bazel/cargo:chrono", "//bazel/cargo:log", @@ -24,7 +24,7 @@ rust_binary( edition = "2018", out_binary = True, deps = [ - "//:proxy_wasm", + "//:proxy_wasm_experimental", "//bazel/cargo:log", ], ) @@ -36,7 +36,7 @@ rust_binary( edition = "2018", out_binary = True, deps = [ - "//:proxy_wasm", + "//:proxy_wasm_experimental", "//bazel/cargo:log", ], ) @@ -48,7 +48,7 @@ rust_binary( edition = "2018", out_binary = True, deps = [ - "//:proxy_wasm", + "//:proxy_wasm_experimental", "//bazel/cargo:log", ], ) @@ -60,7 +60,7 @@ rust_binary( edition = "2018", out_binary = True, deps = [ - "//:proxy_wasm", + "//:proxy_wasm_experimental", "//bazel/cargo:log", ], ) From 95934d3e3999eb3b8f7666a3e958007cb3edea11 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Wed, 3 Feb 2021 16:44:26 +0900 Subject: [PATCH 38/42] Fix clippy erros in bytestring.rs Signed-off-by: Takaya Saeki --- src/bytestring.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bytestring.rs b/src/bytestring.rs index 22d6fb70..2359cfad 100644 --- a/src/bytestring.rs +++ b/src/bytestring.rs @@ -87,7 +87,7 @@ impl fmt::Debug for ByteStr { } else if b == b'\0' { write!(f, "\\0")?; // ASCII printable - } else if b >= 0x20 && b < 0x7f { + } else if (0x20..0x7f).contains(&b) { write!(f, "{}", b as char)?; } else { write!(f, "\\x{:02x}", b)?; @@ -621,6 +621,7 @@ mod tests { } #[test] + #[allow(clippy::eq_op)] fn test_bytestring_eq_string() { let string: ByteString = "utf-8 encoded string".into(); @@ -634,6 +635,7 @@ mod tests { } #[test] + #[allow(clippy::eq_op)] fn test_bytestring_eq_bytes() { let bytes: ByteString = vec![144u8, 145u8, 146u8].into(); From d1ac8573b49e0214d91f1f8fd394bb43115c5051 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Wed, 3 Feb 2021 17:19:04 +0900 Subject: [PATCH 39/42] Update dependencies Signed-off-by: Takaya Saeki --- bazel/cargo/BUILD.bazel | 22 +- bazel/cargo/Cargo.lock | 271 ++++++++++++-- bazel/cargo/crates.bzl | 340 +++++++++++++++--- ...sh-0.4.6.bazel => BUILD.ahash-0.4.7.bazel} | 2 +- bazel/cargo/remote/BUILD.bitflags-1.2.1.bazel | 55 +++ ...c-0.2.81.bazel => BUILD.bstr-0.2.14.bazel} | 58 ++- ...iew1.bazel => BUILD.byteorder-1.4.2.bazel} | 10 +- bazel/cargo/remote/BUILD.chrono-0.4.19.bazel | 4 +- .../remote/BUILD.form_urlencoded-1.0.0.bazel | 54 +++ ....2.0.bazel => BUILD.getrandom-0.2.2.bazel} | 83 +---- .../cargo/remote/BUILD.hashbrown-0.9.1.bazel | 2 +- bazel/cargo/remote/BUILD.idna-0.2.0.bazel | 59 +++ .../remote/BUILD.lazy_static-1.4.0.bazel | 56 +++ bazel/cargo/remote/BUILD.libc-0.2.85.bazel | 58 +++ bazel/cargo/remote/BUILD.log-0.4.11.bazel | 85 ----- bazel/cargo/remote/BUILD.log-0.4.14.bazel | 61 ++++ bazel/cargo/remote/BUILD.matches-0.1.8.bazel | 54 +++ bazel/cargo/remote/BUILD.memchr-2.3.4.bazel | 57 +++ .../remote/BUILD.percent-encoding-2.1.0.bazel | 52 +++ .../remote/BUILD.proc-macro2-1.0.24.bazel | 68 ++++ .../remote/BUILD.pulldown-cmark-0.7.2.bazel | 98 +++++ bazel/cargo/remote/BUILD.quote-1.0.8.bazel | 58 +++ bazel/cargo/remote/BUILD.regex-1.4.3.bazel | 92 +++++ .../remote/BUILD.regex-automata-0.1.9.bazel | 55 +++ .../remote/BUILD.regex-syntax-0.6.22.bazel | 62 ++++ ....bazel => BUILD.semver-parser-0.9.0.bazel} | 8 +- bazel/cargo/remote/BUILD.serde-1.0.123.bazel | 56 +++ bazel/cargo/remote/BUILD.syn-1.0.60.bazel | 121 +++++++ ...e-0.1.44.bazel => BUILD.time-0.1.43.bazel} | 12 +- bazel/cargo/remote/BUILD.tinyvec-1.1.1.bazel | 62 ++++ .../remote/BUILD.tinyvec_macros-0.1.0.bazel | 52 +++ bazel/cargo/remote/BUILD.toml-0.5.8.bazel | 62 ++++ bazel/cargo/remote/BUILD.unicase-2.6.0.bazel | 54 +++ .../remote/BUILD.unicode-bidi-0.3.4.bazel | 54 +++ .../BUILD.unicode-normalization-0.1.16.bazel | 57 +++ .../remote/BUILD.unicode-xid-0.2.1.bazel | 55 +++ bazel/cargo/remote/BUILD.url-2.2.0.bazel | 58 +++ .../remote/BUILD.version-sync-0.9.1.bazel | 61 ++++ .../remote/BUILD.version_check-0.9.2.bazel | 52 +++ ....wasi-0.10.2+wasi-snapshot-preview1.bazel} | 2 +- 40 files changed, 2306 insertions(+), 276 deletions(-) rename bazel/cargo/remote/{BUILD.ahash-0.4.6.bazel => BUILD.ahash-0.4.7.bazel} (98%) create mode 100644 bazel/cargo/remote/BUILD.bitflags-1.2.1.bazel rename bazel/cargo/remote/{BUILD.libc-0.2.81.bazel => BUILD.bstr-0.2.14.bazel} (56%) rename bazel/cargo/remote/{BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel => BUILD.byteorder-1.4.2.bazel} (83%) create mode 100644 bazel/cargo/remote/BUILD.form_urlencoded-1.0.0.bazel rename bazel/cargo/remote/{BUILD.getrandom-0.2.0.bazel => BUILD.getrandom-0.2.2.bazel} (51%) create mode 100644 bazel/cargo/remote/BUILD.idna-0.2.0.bazel create mode 100644 bazel/cargo/remote/BUILD.lazy_static-1.4.0.bazel create mode 100644 bazel/cargo/remote/BUILD.libc-0.2.85.bazel delete mode 100644 bazel/cargo/remote/BUILD.log-0.4.11.bazel create mode 100644 bazel/cargo/remote/BUILD.log-0.4.14.bazel create mode 100644 bazel/cargo/remote/BUILD.matches-0.1.8.bazel create mode 100644 bazel/cargo/remote/BUILD.memchr-2.3.4.bazel create mode 100644 bazel/cargo/remote/BUILD.percent-encoding-2.1.0.bazel create mode 100644 bazel/cargo/remote/BUILD.proc-macro2-1.0.24.bazel create mode 100644 bazel/cargo/remote/BUILD.pulldown-cmark-0.7.2.bazel create mode 100644 bazel/cargo/remote/BUILD.quote-1.0.8.bazel create mode 100644 bazel/cargo/remote/BUILD.regex-1.4.3.bazel create mode 100644 bazel/cargo/remote/BUILD.regex-automata-0.1.9.bazel create mode 100644 bazel/cargo/remote/BUILD.regex-syntax-0.6.22.bazel rename bazel/cargo/remote/{BUILD.cfg-if-0.1.10.bazel => BUILD.semver-parser-0.9.0.bazel} (88%) create mode 100644 bazel/cargo/remote/BUILD.serde-1.0.123.bazel create mode 100644 bazel/cargo/remote/BUILD.syn-1.0.60.bazel rename bazel/cargo/remote/{BUILD.time-0.1.44.bazel => BUILD.time-0.1.43.bazel} (80%) create mode 100644 bazel/cargo/remote/BUILD.tinyvec-1.1.1.bazel create mode 100644 bazel/cargo/remote/BUILD.tinyvec_macros-0.1.0.bazel create mode 100644 bazel/cargo/remote/BUILD.toml-0.5.8.bazel create mode 100644 bazel/cargo/remote/BUILD.unicase-2.6.0.bazel create mode 100644 bazel/cargo/remote/BUILD.unicode-bidi-0.3.4.bazel create mode 100644 bazel/cargo/remote/BUILD.unicode-normalization-0.1.16.bazel create mode 100644 bazel/cargo/remote/BUILD.unicode-xid-0.2.1.bazel create mode 100644 bazel/cargo/remote/BUILD.url-2.2.0.bazel create mode 100644 bazel/cargo/remote/BUILD.version-sync-0.9.1.bazel create mode 100644 bazel/cargo/remote/BUILD.version_check-0.9.2.bazel rename bazel/cargo/remote/{BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel => BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel} (95%) diff --git a/bazel/cargo/BUILD.bazel b/bazel/cargo/BUILD.bazel index bd1ed422..161ba0f4 100644 --- a/bazel/cargo/BUILD.bazel +++ b/bazel/cargo/BUILD.bazel @@ -12,6 +12,15 @@ licenses([ ]) # Aliased targets +alias( + name = "bstr", + actual = "@raze__bstr__0_2_14//:bstr", + tags = [ + "cargo-raze", + "manual", + ], +) + alias( name = "cfg_if", actual = "@raze__cfg_if__1_0_0//:cfg_if", @@ -32,7 +41,7 @@ alias( alias( name = "getrandom", - actual = "@raze__getrandom__0_2_0//:getrandom", + actual = "@raze__getrandom__0_2_2//:getrandom", tags = [ "cargo-raze", "manual", @@ -50,7 +59,16 @@ alias( alias( name = "log", - actual = "@raze__log__0_4_11//:log", + actual = "@raze__log__0_4_14//:log", + tags = [ + "cargo-raze", + "manual", + ], +) + +alias( + name = "version_sync", + actual = "@raze__version_sync__0_9_1//:version_sync", tags = [ "cargo-raze", "manual", diff --git a/bazel/cargo/Cargo.lock b/bazel/cargo/Cargo.lock index 3ee0bc88..3ce9e842 100644 --- a/bazel/cargo/Cargo.lock +++ b/bazel/cargo/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "ahash" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6789e291be47ace86a60303502173d84af8327e3627ecf334356ee0f87a164c" +checksum = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e" [[package]] name = "autocfg" @@ -12,6 +12,29 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bstr" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf" +dependencies = [ + "lazy_static", + "memchr", + "regex-automata", +] + +[[package]] +name = "byteorder" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" + [[package]] name = "cfg-if" version = "0.1.10" @@ -37,15 +60,25 @@ dependencies = [ "winapi", ] +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding", +] + [[package]] name = "getrandom" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "wasi 0.9.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -57,21 +90,50 @@ dependencies = [ "ahash", ] +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[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.81" +version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "memchr" +version = "2.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" + [[package]] name = "memory_units" version = "0.4.0" @@ -98,39 +160,206 @@ dependencies = [ ] [[package]] -name = "proxy-wasm" -version = "0.1.3" +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "proxy-wasm-experimental" +version = "0.0.8" dependencies = [ + "bstr", "cfg-if 1.0.0", "chrono", "getrandom", "hashbrown", "log", + "version-sync", "wee_alloc", ] +[[package]] +name = "pulldown-cmark" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca36dea94d187597e104a5c8e4b07576a8a45aa5db48a65e12940d3eb7461f55" +dependencies = [ + "bitflags", + "memchr", + "unicase", +] + +[[package]] +name = "quote" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +dependencies = [ + "byteorder", +] + +[[package]] +name = "regex-syntax" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" + +[[package]] +name = "semver-parser" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b46e1121e8180c12ff69a742aabc4f310542b6ccb69f1691689ac17fdf8618aa" + +[[package]] +name = "serde" +version = "1.0.123" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" + +[[package]] +name = "syn" +version = "1.0.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "time" -version = "0.1.44" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ "libc", - "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] [[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" +name = "tinyvec" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "url" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "version-sync" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7b77d2a6f56988f7bb54102fe73ab963df4e7374b58298a7efa1361f681e0e2" +dependencies = [ + "proc-macro2", + "pulldown-cmark", + "regex", + "semver-parser", + "syn", + "toml", + "url", +] + +[[package]] +name = "version_check" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wee_alloc" diff --git a/bazel/cargo/crates.bzl b/bazel/cargo/crates.bzl index 17c44dd9..895acd87 100644 --- a/bazel/cargo/crates.bzl +++ b/bazel/cargo/crates.bzl @@ -13,12 +13,12 @@ def raze_fetch_remote_crates(): """This function defines a collection of repos and should be called in a WORKSPACE file""" maybe( http_archive, - name = "raze__ahash__0_4_6", - url = "https://crates.io/api/v1/crates/ahash/0.4.6/download", + name = "raze__ahash__0_4_7", + url = "https://crates.io/api/v1/crates/ahash/0.4.7/download", type = "tar.gz", - sha256 = "f6789e291be47ace86a60303502173d84af8327e3627ecf334356ee0f87a164c", - strip_prefix = "ahash-0.4.6", - build_file = Label("//bazel/cargo/remote:BUILD.ahash-0.4.6.bazel"), + sha256 = "739f4a8db6605981345c5654f3a85b056ce52f37a39d34da03f25bf2151ea16e", + strip_prefix = "ahash-0.4.7", + build_file = Label("//bazel/cargo/remote:BUILD.ahash-0.4.7.bazel"), ) maybe( @@ -33,12 +33,32 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__cfg_if__0_1_10", - url = "https://crates.io/api/v1/crates/cfg-if/0.1.10/download", + name = "raze__bitflags__1_2_1", + url = "https://crates.io/api/v1/crates/bitflags/1.2.1/download", type = "tar.gz", - sha256 = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822", - strip_prefix = "cfg-if-0.1.10", - build_file = Label("//bazel/cargo/remote:BUILD.cfg-if-0.1.10.bazel"), + sha256 = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693", + strip_prefix = "bitflags-1.2.1", + build_file = Label("//bazel/cargo/remote:BUILD.bitflags-1.2.1.bazel"), + ) + + maybe( + http_archive, + name = "raze__bstr__0_2_14", + url = "https://crates.io/api/v1/crates/bstr/0.2.14/download", + type = "tar.gz", + sha256 = "473fc6b38233f9af7baa94fb5852dca389e3d95b8e21c8e3719301462c5d9faf", + strip_prefix = "bstr-0.2.14", + build_file = Label("//bazel/cargo/remote:BUILD.bstr-0.2.14.bazel"), + ) + + maybe( + http_archive, + name = "raze__byteorder__1_4_2", + url = "https://crates.io/api/v1/crates/byteorder/1.4.2/download", + type = "tar.gz", + sha256 = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b", + strip_prefix = "byteorder-1.4.2", + build_file = Label("//bazel/cargo/remote:BUILD.byteorder-1.4.2.bazel"), ) maybe( @@ -63,12 +83,22 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__getrandom__0_2_0", - url = "https://crates.io/api/v1/crates/getrandom/0.2.0/download", + name = "raze__form_urlencoded__1_0_0", + url = "https://crates.io/api/v1/crates/form_urlencoded/1.0.0/download", + type = "tar.gz", + sha256 = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00", + strip_prefix = "form_urlencoded-1.0.0", + build_file = Label("//bazel/cargo/remote:BUILD.form_urlencoded-1.0.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__getrandom__0_2_2", + url = "https://crates.io/api/v1/crates/getrandom/0.2.2/download", type = "tar.gz", - sha256 = "ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4", - strip_prefix = "getrandom-0.2.0", - build_file = Label("//bazel/cargo/remote:BUILD.getrandom-0.2.0.bazel"), + sha256 = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8", + strip_prefix = "getrandom-0.2.2", + build_file = Label("//bazel/cargo/remote:BUILD.getrandom-0.2.2.bazel"), ) maybe( @@ -83,22 +113,62 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__libc__0_2_81", - url = "https://crates.io/api/v1/crates/libc/0.2.81/download", + name = "raze__idna__0_2_0", + url = "https://crates.io/api/v1/crates/idna/0.2.0/download", type = "tar.gz", - sha256 = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb", - strip_prefix = "libc-0.2.81", - build_file = Label("//bazel/cargo/remote:BUILD.libc-0.2.81.bazel"), + sha256 = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9", + strip_prefix = "idna-0.2.0", + build_file = Label("//bazel/cargo/remote:BUILD.idna-0.2.0.bazel"), ) maybe( http_archive, - name = "raze__log__0_4_11", - url = "https://crates.io/api/v1/crates/log/0.4.11/download", + name = "raze__lazy_static__1_4_0", + url = "https://crates.io/api/v1/crates/lazy_static/1.4.0/download", type = "tar.gz", - sha256 = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b", - strip_prefix = "log-0.4.11", - build_file = Label("//bazel/cargo/remote:BUILD.log-0.4.11.bazel"), + sha256 = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646", + strip_prefix = "lazy_static-1.4.0", + build_file = Label("//bazel/cargo/remote:BUILD.lazy_static-1.4.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__libc__0_2_85", + url = "https://crates.io/api/v1/crates/libc/0.2.85/download", + type = "tar.gz", + sha256 = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3", + strip_prefix = "libc-0.2.85", + build_file = Label("//bazel/cargo/remote:BUILD.libc-0.2.85.bazel"), + ) + + maybe( + http_archive, + name = "raze__log__0_4_14", + url = "https://crates.io/api/v1/crates/log/0.4.14/download", + type = "tar.gz", + sha256 = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710", + strip_prefix = "log-0.4.14", + build_file = Label("//bazel/cargo/remote:BUILD.log-0.4.14.bazel"), + ) + + maybe( + http_archive, + name = "raze__matches__0_1_8", + url = "https://crates.io/api/v1/crates/matches/0.1.8/download", + type = "tar.gz", + sha256 = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08", + strip_prefix = "matches-0.1.8", + build_file = Label("//bazel/cargo/remote:BUILD.matches-0.1.8.bazel"), + ) + + maybe( + http_archive, + name = "raze__memchr__2_3_4", + url = "https://crates.io/api/v1/crates/memchr/2.3.4/download", + type = "tar.gz", + sha256 = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525", + strip_prefix = "memchr-2.3.4", + build_file = Label("//bazel/cargo/remote:BUILD.memchr-2.3.4.bazel"), ) maybe( @@ -123,32 +193,222 @@ def raze_fetch_remote_crates(): maybe( http_archive, - name = "raze__time__0_1_44", - url = "https://crates.io/api/v1/crates/time/0.1.44/download", + name = "raze__percent_encoding__2_1_0", + url = "https://crates.io/api/v1/crates/percent-encoding/2.1.0/download", + type = "tar.gz", + sha256 = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e", + strip_prefix = "percent-encoding-2.1.0", + build_file = Label("//bazel/cargo/remote:BUILD.percent-encoding-2.1.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__proc_macro2__1_0_24", + url = "https://crates.io/api/v1/crates/proc-macro2/1.0.24/download", + type = "tar.gz", + sha256 = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71", + strip_prefix = "proc-macro2-1.0.24", + build_file = Label("//bazel/cargo/remote:BUILD.proc-macro2-1.0.24.bazel"), + ) + + maybe( + http_archive, + name = "raze__pulldown_cmark__0_7_2", + url = "https://crates.io/api/v1/crates/pulldown-cmark/0.7.2/download", + type = "tar.gz", + sha256 = "ca36dea94d187597e104a5c8e4b07576a8a45aa5db48a65e12940d3eb7461f55", + strip_prefix = "pulldown-cmark-0.7.2", + build_file = Label("//bazel/cargo/remote:BUILD.pulldown-cmark-0.7.2.bazel"), + ) + + maybe( + http_archive, + name = "raze__quote__1_0_8", + url = "https://crates.io/api/v1/crates/quote/1.0.8/download", + type = "tar.gz", + sha256 = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df", + strip_prefix = "quote-1.0.8", + build_file = Label("//bazel/cargo/remote:BUILD.quote-1.0.8.bazel"), + ) + + maybe( + http_archive, + name = "raze__regex__1_4_3", + url = "https://crates.io/api/v1/crates/regex/1.4.3/download", + type = "tar.gz", + sha256 = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a", + strip_prefix = "regex-1.4.3", + build_file = Label("//bazel/cargo/remote:BUILD.regex-1.4.3.bazel"), + ) + + maybe( + http_archive, + name = "raze__regex_automata__0_1_9", + url = "https://crates.io/api/v1/crates/regex-automata/0.1.9/download", + type = "tar.gz", + sha256 = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4", + strip_prefix = "regex-automata-0.1.9", + build_file = Label("//bazel/cargo/remote:BUILD.regex-automata-0.1.9.bazel"), + ) + + maybe( + http_archive, + name = "raze__regex_syntax__0_6_22", + url = "https://crates.io/api/v1/crates/regex-syntax/0.6.22/download", + type = "tar.gz", + sha256 = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581", + strip_prefix = "regex-syntax-0.6.22", + build_file = Label("//bazel/cargo/remote:BUILD.regex-syntax-0.6.22.bazel"), + ) + + maybe( + http_archive, + name = "raze__semver_parser__0_9_0", + url = "https://crates.io/api/v1/crates/semver-parser/0.9.0/download", + type = "tar.gz", + sha256 = "b46e1121e8180c12ff69a742aabc4f310542b6ccb69f1691689ac17fdf8618aa", + strip_prefix = "semver-parser-0.9.0", + build_file = Label("//bazel/cargo/remote:BUILD.semver-parser-0.9.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__serde__1_0_123", + url = "https://crates.io/api/v1/crates/serde/1.0.123/download", + type = "tar.gz", + sha256 = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae", + strip_prefix = "serde-1.0.123", + build_file = Label("//bazel/cargo/remote:BUILD.serde-1.0.123.bazel"), + ) + + maybe( + http_archive, + name = "raze__syn__1_0_60", + url = "https://crates.io/api/v1/crates/syn/1.0.60/download", + type = "tar.gz", + sha256 = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081", + strip_prefix = "syn-1.0.60", + build_file = Label("//bazel/cargo/remote:BUILD.syn-1.0.60.bazel"), + ) + + maybe( + http_archive, + name = "raze__time__0_1_43", + url = "https://crates.io/api/v1/crates/time/0.1.43/download", + type = "tar.gz", + sha256 = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438", + strip_prefix = "time-0.1.43", + build_file = Label("//bazel/cargo/remote:BUILD.time-0.1.43.bazel"), + ) + + maybe( + http_archive, + name = "raze__tinyvec__1_1_1", + url = "https://crates.io/api/v1/crates/tinyvec/1.1.1/download", + type = "tar.gz", + sha256 = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023", + strip_prefix = "tinyvec-1.1.1", + build_file = Label("//bazel/cargo/remote:BUILD.tinyvec-1.1.1.bazel"), + ) + + maybe( + http_archive, + name = "raze__tinyvec_macros__0_1_0", + url = "https://crates.io/api/v1/crates/tinyvec_macros/0.1.0/download", + type = "tar.gz", + sha256 = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c", + strip_prefix = "tinyvec_macros-0.1.0", + build_file = Label("//bazel/cargo/remote:BUILD.tinyvec_macros-0.1.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__toml__0_5_8", + url = "https://crates.io/api/v1/crates/toml/0.5.8/download", + type = "tar.gz", + sha256 = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa", + strip_prefix = "toml-0.5.8", + build_file = Label("//bazel/cargo/remote:BUILD.toml-0.5.8.bazel"), + ) + + maybe( + http_archive, + name = "raze__unicase__2_6_0", + url = "https://crates.io/api/v1/crates/unicase/2.6.0/download", + type = "tar.gz", + sha256 = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6", + strip_prefix = "unicase-2.6.0", + build_file = Label("//bazel/cargo/remote:BUILD.unicase-2.6.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__unicode_bidi__0_3_4", + url = "https://crates.io/api/v1/crates/unicode-bidi/0.3.4/download", + type = "tar.gz", + sha256 = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5", + strip_prefix = "unicode-bidi-0.3.4", + build_file = Label("//bazel/cargo/remote:BUILD.unicode-bidi-0.3.4.bazel"), + ) + + maybe( + http_archive, + name = "raze__unicode_normalization__0_1_16", + url = "https://crates.io/api/v1/crates/unicode-normalization/0.1.16/download", + type = "tar.gz", + sha256 = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606", + strip_prefix = "unicode-normalization-0.1.16", + build_file = Label("//bazel/cargo/remote:BUILD.unicode-normalization-0.1.16.bazel"), + ) + + maybe( + http_archive, + name = "raze__unicode_xid__0_2_1", + url = "https://crates.io/api/v1/crates/unicode-xid/0.2.1/download", + type = "tar.gz", + sha256 = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564", + strip_prefix = "unicode-xid-0.2.1", + build_file = Label("//bazel/cargo/remote:BUILD.unicode-xid-0.2.1.bazel"), + ) + + maybe( + http_archive, + name = "raze__url__2_2_0", + url = "https://crates.io/api/v1/crates/url/2.2.0/download", + type = "tar.gz", + sha256 = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e", + strip_prefix = "url-2.2.0", + build_file = Label("//bazel/cargo/remote:BUILD.url-2.2.0.bazel"), + ) + + maybe( + http_archive, + name = "raze__version_sync__0_9_1", + url = "https://crates.io/api/v1/crates/version-sync/0.9.1/download", type = "tar.gz", - sha256 = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255", - strip_prefix = "time-0.1.44", - build_file = Label("//bazel/cargo/remote:BUILD.time-0.1.44.bazel"), + sha256 = "c7b77d2a6f56988f7bb54102fe73ab963df4e7374b58298a7efa1361f681e0e2", + strip_prefix = "version-sync-0.9.1", + build_file = Label("//bazel/cargo/remote:BUILD.version-sync-0.9.1.bazel"), ) maybe( http_archive, - name = "raze__wasi__0_10_0_wasi_snapshot_preview1", - url = "https://crates.io/api/v1/crates/wasi/0.10.0+wasi-snapshot-preview1/download", + name = "raze__version_check__0_9_2", + url = "https://crates.io/api/v1/crates/version_check/0.9.2/download", type = "tar.gz", - sha256 = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f", - strip_prefix = "wasi-0.10.0+wasi-snapshot-preview1", - build_file = Label("//bazel/cargo/remote:BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel"), + sha256 = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed", + strip_prefix = "version_check-0.9.2", + build_file = Label("//bazel/cargo/remote:BUILD.version_check-0.9.2.bazel"), ) maybe( http_archive, - name = "raze__wasi__0_9_0_wasi_snapshot_preview1", - url = "https://crates.io/api/v1/crates/wasi/0.9.0+wasi-snapshot-preview1/download", + name = "raze__wasi__0_10_2_wasi_snapshot_preview1", + url = "https://crates.io/api/v1/crates/wasi/0.10.2+wasi-snapshot-preview1/download", type = "tar.gz", - sha256 = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519", - strip_prefix = "wasi-0.9.0+wasi-snapshot-preview1", - build_file = Label("//bazel/cargo/remote:BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel"), + sha256 = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6", + strip_prefix = "wasi-0.10.2+wasi-snapshot-preview1", + build_file = Label("//bazel/cargo/remote:BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel"), ) maybe( diff --git a/bazel/cargo/remote/BUILD.ahash-0.4.6.bazel b/bazel/cargo/remote/BUILD.ahash-0.4.7.bazel similarity index 98% rename from bazel/cargo/remote/BUILD.ahash-0.4.6.bazel rename to bazel/cargo/remote/BUILD.ahash-0.4.7.bazel index 30fb8006..99ca0a90 100644 --- a/bazel/cargo/remote/BUILD.ahash-0.4.6.bazel +++ b/bazel/cargo/remote/BUILD.ahash-0.4.7.bazel @@ -49,7 +49,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.4.6", + version = "0.4.7", # buildifier: leave-alone deps = [ ], diff --git a/bazel/cargo/remote/BUILD.bitflags-1.2.1.bazel b/bazel/cargo/remote/BUILD.bitflags-1.2.1.bazel new file mode 100644 index 00000000..f83a025b --- /dev/null +++ b/bazel/cargo/remote/BUILD.bitflags-1.2.1.bazel @@ -0,0 +1,55 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "bitflags", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.2.1", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.libc-0.2.81.bazel b/bazel/cargo/remote/BUILD.bstr-0.2.14.bazel similarity index 56% rename from bazel/cargo/remote/BUILD.libc-0.2.81.bazel rename to bazel/cargo/remote/BUILD.bstr-0.2.14.bazel index 83617479..74365876 100644 --- a/bazel/cargo/remote/BUILD.libc-0.2.81.bazel +++ b/bazel/cargo/remote/BUILD.bstr-0.2.14.bazel @@ -28,43 +28,33 @@ licenses([ "notice", # MIT from expression "MIT OR Apache-2.0" ]) -# Generated Targets# buildifier: disable=load-on-top -load( - "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", - "cargo_build_script", -) +# Generated Targets -cargo_build_script( - name = "libc_build_script", - srcs = glob(["**/*.rs"]), - build_script_env = { - }, - crate_features = [ - "default", - "std", - ], - crate_root = "build.rs", - data = glob(["**"]), - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.2.81", - visibility = ["//visibility:private"], - deps = [ - ], -) +# Unsupported target "graphemes" with type "example" omitted + +# Unsupported target "graphemes-std" with type "example" omitted + +# Unsupported target "lines" with type "example" omitted + +# Unsupported target "lines-std" with type "example" omitted + +# Unsupported target "uppercase" with type "example" omitted + +# Unsupported target "uppercase-std" with type "example" omitted + +# Unsupported target "words" with type "example" omitted + +# Unsupported target "words-std" with type "example" omitted rust_library( - name = "libc", + name = "bstr", srcs = glob(["**/*.rs"]), crate_features = [ "default", + "lazy_static", + "regex-automata", "std", + "unicode", ], crate_root = "src/lib.rs", crate_type = "lib", @@ -76,11 +66,11 @@ rust_library( "cargo-raze", "manual", ], - version = "0.2.81", + version = "0.2.14", # buildifier: leave-alone deps = [ - ":libc_build_script", + "@raze__lazy_static__1_4_0//:lazy_static", + "@raze__memchr__2_3_4//:memchr", + "@raze__regex_automata__0_1_9//:regex_automata", ], ) - -# Unsupported target "const_fn" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel b/bazel/cargo/remote/BUILD.byteorder-1.4.2.bazel similarity index 83% rename from bazel/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel rename to bazel/cargo/remote/BUILD.byteorder-1.4.2.bazel index 35fc2e3f..7913c3eb 100644 --- a/bazel/cargo/remote/BUILD.wasi-0.10.0+wasi-snapshot-preview1.bazel +++ b/bazel/cargo/remote/BUILD.byteorder-1.4.2.bazel @@ -25,17 +25,17 @@ package(default_visibility = [ ]) licenses([ - "notice", # Apache-2.0 from expression "Apache-2.0 OR (Apache-2.0 OR MIT)" + "unencumbered", # Unlicense from expression "Unlicense OR MIT" ]) # Generated Targets +# Unsupported target "bench" with type "bench" omitted + rust_library( - name = "wasi", + name = "byteorder", srcs = glob(["**/*.rs"]), crate_features = [ - "default", - "std", ], crate_root = "src/lib.rs", crate_type = "lib", @@ -47,7 +47,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.10.0+wasi-snapshot-preview1", + version = "1.4.2", # buildifier: leave-alone deps = [ ], diff --git a/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel index 6154bbd0..7420c4cc 100644 --- a/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel +++ b/bazel/cargo/remote/BUILD.chrono-0.4.19.bazel @@ -61,10 +61,10 @@ rust_library( version = "0.4.19", # buildifier: leave-alone deps = [ - "@raze__libc__0_2_81//:libc", + "@raze__libc__0_2_85//:libc", "@raze__num_integer__0_1_44//:num_integer", "@raze__num_traits__0_2_14//:num_traits", - "@raze__time__0_1_44//:time", + "@raze__time__0_1_43//:time", ] + selects.with_or({ # cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi")))) ( diff --git a/bazel/cargo/remote/BUILD.form_urlencoded-1.0.0.bazel b/bazel/cargo/remote/BUILD.form_urlencoded-1.0.0.bazel new file mode 100644 index 00000000..e4127f8a --- /dev/null +++ b/bazel/cargo/remote/BUILD.form_urlencoded-1.0.0.bazel @@ -0,0 +1,54 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "form_urlencoded", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.0.0", + # buildifier: leave-alone + deps = [ + "@raze__matches__0_1_8//:matches", + "@raze__percent_encoding__2_1_0//:percent_encoding", + ], +) diff --git a/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel b/bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel similarity index 51% rename from bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel rename to bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel index 45977782..0bdc50a2 100644 --- a/bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel +++ b/bazel/cargo/remote/BUILD.getrandom-0.2.2.bazel @@ -28,72 +28,12 @@ licenses([ "notice", # MIT from expression "MIT OR Apache-2.0" ]) -# Generated Targets# buildifier: disable=load-on-top -load( - "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", - "cargo_build_script", -) - -cargo_build_script( - name = "getrandom_build_script", - srcs = glob(["**/*.rs"]), - build_script_env = { - }, - crate_features = [ - ], - crate_root = "build.rs", - data = glob(["**"]), - edition = "2018", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.2.0", - visibility = ["//visibility:private"], - deps = [ - ] + selects.with_or({ - # cfg(all(target_arch = "wasm32", target_os = "unknown", not(cargo_web))) - ( - "@io_bazel_rules_rust//rust/platform:wasm32-unknown-unknown", - ): [ - ], - "//conditions:default": [], - }) + selects.with_or({ - # cfg(target_os = "wasi") - ( - "@io_bazel_rules_rust//rust/platform:wasm32-wasi", - ): [ - ], - "//conditions:default": [], - }) + selects.with_or({ - # cfg(unix) - ( - "@io_bazel_rules_rust//rust/platform:aarch64-apple-ios", - "@io_bazel_rules_rust//rust/platform:aarch64-linux-android", - "@io_bazel_rules_rust//rust/platform:aarch64-unknown-linux-gnu", - "@io_bazel_rules_rust//rust/platform:arm-unknown-linux-gnueabi", - "@io_bazel_rules_rust//rust/platform:i686-apple-darwin", - "@io_bazel_rules_rust//rust/platform:i686-linux-android", - "@io_bazel_rules_rust//rust/platform:i686-unknown-freebsd", - "@io_bazel_rules_rust//rust/platform:i686-unknown-linux-gnu", - "@io_bazel_rules_rust//rust/platform:powerpc-unknown-linux-gnu", - "@io_bazel_rules_rust//rust/platform:s390x-unknown-linux-gnu", - "@io_bazel_rules_rust//rust/platform:x86_64-apple-darwin", - "@io_bazel_rules_rust//rust/platform:x86_64-apple-ios", - "@io_bazel_rules_rust//rust/platform:x86_64-linux-android", - "@io_bazel_rules_rust//rust/platform:x86_64-unknown-freebsd", - "@io_bazel_rules_rust//rust/platform:x86_64-unknown-linux-gnu", - ): [ - ], - "//conditions:default": [], - }), -) +# Generated Targets # Unsupported target "mod" with type "bench" omitted +# Unsupported target "build-script-build" with type "custom-build" omitted + rust_library( name = "getrandom", srcs = glob(["**/*.rs"]), @@ -111,13 +51,12 @@ rust_library( "cargo-raze", "manual", ], - version = "0.2.0", + version = "0.2.2", # buildifier: leave-alone deps = [ - ":getrandom_build_script", - "@raze__cfg_if__0_1_10//:cfg_if", + "@raze__cfg_if__1_0_0//:cfg_if", ] + selects.with_or({ - # cfg(all(target_arch = "wasm32", target_os = "unknown", not(cargo_web))) + # cfg(all(target_arch = "wasm32", target_os = "unknown")) ( "@io_bazel_rules_rust//rust/platform:wasm32-unknown-unknown", ): [ @@ -128,7 +67,7 @@ rust_library( ( "@io_bazel_rules_rust//rust/platform:wasm32-wasi", ): [ - "@raze__wasi__0_9_0_wasi_snapshot_preview1//:wasi", + "@raze__wasi__0_10_2_wasi_snapshot_preview1//:wasi", ], "//conditions:default": [], }) + selects.with_or({ @@ -150,8 +89,14 @@ rust_library( "@io_bazel_rules_rust//rust/platform:x86_64-unknown-freebsd", "@io_bazel_rules_rust//rust/platform:x86_64-unknown-linux-gnu", ): [ - "@raze__libc__0_2_81//:libc", + "@raze__libc__0_2_85//:libc", ], "//conditions:default": [], }), ) + +# Unsupported target "custom" with type "test" omitted + +# Unsupported target "normal" with type "test" omitted + +# Unsupported target "rdrand" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel b/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel index d27b21de..9cc788fd 100644 --- a/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel +++ b/bazel/cargo/remote/BUILD.hashbrown-0.9.1.bazel @@ -53,7 +53,7 @@ rust_library( version = "0.9.1", # buildifier: leave-alone deps = [ - "@raze__ahash__0_4_6//:ahash", + "@raze__ahash__0_4_7//:ahash", ], ) diff --git a/bazel/cargo/remote/BUILD.idna-0.2.0.bazel b/bazel/cargo/remote/BUILD.idna-0.2.0.bazel new file mode 100644 index 00000000..16600dbf --- /dev/null +++ b/bazel/cargo/remote/BUILD.idna-0.2.0.bazel @@ -0,0 +1,59 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "idna", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.0", + # buildifier: leave-alone + deps = [ + "@raze__matches__0_1_8//:matches", + "@raze__unicode_bidi__0_3_4//:unicode_bidi", + "@raze__unicode_normalization__0_1_16//:unicode_normalization", + ], +) + +# Unsupported target "tests" with type "test" omitted + +# Unsupported target "unit" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.lazy_static-1.4.0.bazel b/bazel/cargo/remote/BUILD.lazy_static-1.4.0.bazel new file mode 100644 index 00000000..7587e7fd --- /dev/null +++ b/bazel/cargo/remote/BUILD.lazy_static-1.4.0.bazel @@ -0,0 +1,56 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "lazy_static", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.4.0", + # buildifier: leave-alone + deps = [ + ], +) + +# Unsupported target "no_std" with type "test" omitted + +# Unsupported target "test" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.libc-0.2.85.bazel b/bazel/cargo/remote/BUILD.libc-0.2.85.bazel new file mode 100644 index 00000000..a52a0759 --- /dev/null +++ b/bazel/cargo/remote/BUILD.libc-0.2.85.bazel @@ -0,0 +1,58 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "libc", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.85", + # buildifier: leave-alone + deps = [ + ], +) + +# Unsupported target "const_fn" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.log-0.4.11.bazel b/bazel/cargo/remote/BUILD.log-0.4.11.bazel deleted file mode 100644 index 3910f0b2..00000000 --- a/bazel/cargo/remote/BUILD.log-0.4.11.bazel +++ /dev/null @@ -1,85 +0,0 @@ -""" -@generated -cargo-raze crate build file. - -DO NOT EDIT! Replaced on runs of cargo-raze -""" - -# buildifier: disable=load -load( - "@io_bazel_rules_rust//rust:rust.bzl", - "rust_binary", - "rust_library", - "rust_test", -) - -# buildifier: disable=load -load("@bazel_skylib//lib:selects.bzl", "selects") - -package(default_visibility = [ - # Public for visibility by "@raze__crate__version//" targets. - # - # Prefer access through "//bazel/cargo", which limits external - # visibility to explicit Cargo.toml dependencies. - "//visibility:public", -]) - -licenses([ - "notice", # MIT from expression "MIT OR Apache-2.0" -]) - -# Generated Targets# buildifier: disable=load-on-top -load( - "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", - "cargo_build_script", -) - -cargo_build_script( - name = "log_build_script", - srcs = glob(["**/*.rs"]), - build_script_env = { - }, - crate_features = [ - ], - crate_root = "build.rs", - data = glob(["**"]), - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.4.11", - visibility = ["//visibility:private"], - deps = [ - ], -) - -rust_library( - name = "log", - srcs = glob(["**/*.rs"]), - crate_features = [ - ], - crate_root = "src/lib.rs", - crate_type = "lib", - edition = "2015", - rustc_flags = [ - "--cap-lints=allow", - ], - tags = [ - "cargo-raze", - "manual", - ], - version = "0.4.11", - # buildifier: leave-alone - deps = [ - ":log_build_script", - "@raze__cfg_if__0_1_10//:cfg_if", - ], -) - -# Unsupported target "filters" with type "test" omitted - -# Unsupported target "macros" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.log-0.4.14.bazel b/bazel/cargo/remote/BUILD.log-0.4.14.bazel new file mode 100644 index 00000000..905b65cb --- /dev/null +++ b/bazel/cargo/remote/BUILD.log-0.4.14.bazel @@ -0,0 +1,61 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "value" with type "bench" omitted + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "log", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.4.14", + # buildifier: leave-alone + deps = [ + "@raze__cfg_if__1_0_0//:cfg_if", + ], +) + +# Unsupported target "filters" with type "test" omitted + +# Unsupported target "macros" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.matches-0.1.8.bazel b/bazel/cargo/remote/BUILD.matches-0.1.8.bazel new file mode 100644 index 00000000..6a25d8b3 --- /dev/null +++ b/bazel/cargo/remote/BUILD.matches-0.1.8.bazel @@ -0,0 +1,54 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT" +]) + +# Generated Targets + +rust_library( + name = "matches", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.1.8", + # buildifier: leave-alone + deps = [ + ], +) + +# Unsupported target "macro_use_one" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.memchr-2.3.4.bazel b/bazel/cargo/remote/BUILD.memchr-2.3.4.bazel new file mode 100644 index 00000000..609a04f7 --- /dev/null +++ b/bazel/cargo/remote/BUILD.memchr-2.3.4.bazel @@ -0,0 +1,57 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "unencumbered", # Unlicense from expression "Unlicense OR MIT" +]) + +# Generated Targets + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "memchr", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "std", + "use_std", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "2.3.4", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.percent-encoding-2.1.0.bazel b/bazel/cargo/remote/BUILD.percent-encoding-2.1.0.bazel new file mode 100644 index 00000000..132e764c --- /dev/null +++ b/bazel/cargo/remote/BUILD.percent-encoding-2.1.0.bazel @@ -0,0 +1,52 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "percent_encoding", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "2.1.0", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.proc-macro2-1.0.24.bazel b/bazel/cargo/remote/BUILD.proc-macro2-1.0.24.bazel new file mode 100644 index 00000000..82e62f74 --- /dev/null +++ b/bazel/cargo/remote/BUILD.proc-macro2-1.0.24.bazel @@ -0,0 +1,68 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "proc_macro2", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "proc-macro", + "span-locations", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.0.24", + # buildifier: leave-alone + deps = [ + "@raze__unicode_xid__0_2_1//:unicode_xid", + ], +) + +# Unsupported target "comments" with type "test" omitted + +# Unsupported target "features" with type "test" omitted + +# Unsupported target "marker" with type "test" omitted + +# Unsupported target "test" with type "test" omitted + +# Unsupported target "test_fmt" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.pulldown-cmark-0.7.2.bazel b/bazel/cargo/remote/BUILD.pulldown-cmark-0.7.2.bazel new file mode 100644 index 00000000..e529713d --- /dev/null +++ b/bazel/cargo/remote/BUILD.pulldown-cmark-0.7.2.bazel @@ -0,0 +1,98 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT" +]) + +# Generated Targets + +# Unsupported target "html_rendering" with type "bench" omitted + +# Unsupported target "lib" with type "bench" omitted + +rust_binary( + # Prefix bin name to disambiguate from (probable) collision with lib name + # N.B.: The exact form of this is subject to change. + name = "cargo_bin_pulldown_cmark", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/main.rs", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.7.2", + # buildifier: leave-alone + deps = [ + # Binaries get an implicit dependency on their crate's lib + ":pulldown_cmark", + "@raze__bitflags__1_2_1//:bitflags", + "@raze__memchr__2_3_4//:memchr", + "@raze__unicase__2_6_0//:unicase", + ], +) + +# Unsupported target "build-script-build" with type "custom-build" omitted + +# Unsupported target "event-filter" with type "example" omitted + +# Unsupported target "string-to-string" with type "example" omitted + +rust_library( + name = "pulldown_cmark", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.7.2", + # buildifier: leave-alone + deps = [ + "@raze__bitflags__1_2_1//:bitflags", + "@raze__memchr__2_3_4//:memchr", + "@raze__unicase__2_6_0//:unicase", + ], +) + +# Unsupported target "errors" with type "test" omitted + +# Unsupported target "html" with type "test" omitted + +# Unsupported target "lib" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.quote-1.0.8.bazel b/bazel/cargo/remote/BUILD.quote-1.0.8.bazel new file mode 100644 index 00000000..c3831893 --- /dev/null +++ b/bazel/cargo/remote/BUILD.quote-1.0.8.bazel @@ -0,0 +1,58 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "quote", + srcs = glob(["**/*.rs"]), + crate_features = [ + "proc-macro", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.0.8", + # buildifier: leave-alone + deps = [ + "@raze__proc_macro2__1_0_24//:proc_macro2", + ], +) + +# Unsupported target "compiletest" with type "test" omitted + +# Unsupported target "test" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.regex-1.4.3.bazel b/bazel/cargo/remote/BUILD.regex-1.4.3.bazel new file mode 100644 index 00000000..6a7b723f --- /dev/null +++ b/bazel/cargo/remote/BUILD.regex-1.4.3.bazel @@ -0,0 +1,92 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "shootout-regex-dna" with type "example" omitted + +# Unsupported target "shootout-regex-dna-bytes" with type "example" omitted + +# Unsupported target "shootout-regex-dna-cheat" with type "example" omitted + +# Unsupported target "shootout-regex-dna-replace" with type "example" omitted + +# Unsupported target "shootout-regex-dna-single" with type "example" omitted + +# Unsupported target "shootout-regex-dna-single-cheat" with type "example" omitted + +rust_library( + name = "regex", + srcs = glob(["**/*.rs"]), + crate_features = [ + "std", + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.4.3", + # buildifier: leave-alone + deps = [ + "@raze__regex_syntax__0_6_22//:regex_syntax", + ], +) + +# Unsupported target "backtrack" with type "test" omitted + +# Unsupported target "backtrack-bytes" with type "test" omitted + +# Unsupported target "backtrack-utf8bytes" with type "test" omitted + +# Unsupported target "crates-regex" with type "test" omitted + +# Unsupported target "default" with type "test" omitted + +# Unsupported target "default-bytes" with type "test" omitted + +# Unsupported target "nfa" with type "test" omitted + +# Unsupported target "nfa-bytes" with type "test" omitted + +# Unsupported target "nfa-utf8bytes" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.regex-automata-0.1.9.bazel b/bazel/cargo/remote/BUILD.regex-automata-0.1.9.bazel new file mode 100644 index 00000000..11cee719 --- /dev/null +++ b/bazel/cargo/remote/BUILD.regex-automata-0.1.9.bazel @@ -0,0 +1,55 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "unencumbered", # Unlicense from expression "Unlicense OR MIT" +]) + +# Generated Targets + +rust_library( + name = "regex_automata", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.1.9", + # buildifier: leave-alone + deps = [ + "@raze__byteorder__1_4_2//:byteorder", + ], +) + +# Unsupported target "default" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.regex-syntax-0.6.22.bazel b/bazel/cargo/remote/BUILD.regex-syntax-0.6.22.bazel new file mode 100644 index 00000000..134c2287 --- /dev/null +++ b/bazel/cargo/remote/BUILD.regex-syntax-0.6.22.bazel @@ -0,0 +1,62 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "bench" with type "bench" omitted + +rust_library( + name = "regex_syntax", + srcs = glob(["**/*.rs"]), + crate_features = [ + "unicode", + "unicode-age", + "unicode-bool", + "unicode-case", + "unicode-gencat", + "unicode-perl", + "unicode-script", + "unicode-segment", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.6.22", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.cfg-if-0.1.10.bazel b/bazel/cargo/remote/BUILD.semver-parser-0.9.0.bazel similarity index 88% rename from bazel/cargo/remote/BUILD.cfg-if-0.1.10.bazel rename to bazel/cargo/remote/BUILD.semver-parser-0.9.0.bazel index 32abbfae..25a6549a 100644 --- a/bazel/cargo/remote/BUILD.cfg-if-0.1.10.bazel +++ b/bazel/cargo/remote/BUILD.semver-parser-0.9.0.bazel @@ -31,13 +31,13 @@ licenses([ # Generated Targets rust_library( - name = "cfg_if", + name = "semver_parser", srcs = glob(["**/*.rs"]), crate_features = [ ], crate_root = "src/lib.rs", crate_type = "lib", - edition = "2018", + edition = "2015", rustc_flags = [ "--cap-lints=allow", ], @@ -45,10 +45,8 @@ rust_library( "cargo-raze", "manual", ], - version = "0.1.10", + version = "0.9.0", # buildifier: leave-alone deps = [ ], ) - -# Unsupported target "xcrate" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.serde-1.0.123.bazel b/bazel/cargo/remote/BUILD.serde-1.0.123.bazel new file mode 100644 index 00000000..ffdaa409 --- /dev/null +++ b/bazel/cargo/remote/BUILD.serde-1.0.123.bazel @@ -0,0 +1,56 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "serde", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.0.123", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.syn-1.0.60.bazel b/bazel/cargo/remote/BUILD.syn-1.0.60.bazel new file mode 100644 index 00000000..99ced3b5 --- /dev/null +++ b/bazel/cargo/remote/BUILD.syn-1.0.60.bazel @@ -0,0 +1,121 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "file" with type "bench" omitted + +# Unsupported target "rust" with type "bench" omitted + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "syn", + srcs = glob(["**/*.rs"]), + crate_features = [ + "clone-impls", + "default", + "derive", + "full", + "parsing", + "printing", + "proc-macro", + "quote", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.0.60", + # buildifier: leave-alone + deps = [ + "@raze__proc_macro2__1_0_24//:proc_macro2", + "@raze__quote__1_0_8//:quote", + "@raze__unicode_xid__0_2_1//:unicode_xid", + ], +) + +# Unsupported target "test_asyncness" with type "test" omitted + +# Unsupported target "test_attribute" with type "test" omitted + +# Unsupported target "test_derive_input" with type "test" omitted + +# Unsupported target "test_expr" with type "test" omitted + +# Unsupported target "test_generics" with type "test" omitted + +# Unsupported target "test_grouping" with type "test" omitted + +# Unsupported target "test_ident" with type "test" omitted + +# Unsupported target "test_item" with type "test" omitted + +# Unsupported target "test_iterators" with type "test" omitted + +# Unsupported target "test_lit" with type "test" omitted + +# Unsupported target "test_meta" with type "test" omitted + +# Unsupported target "test_parse_buffer" with type "test" omitted + +# Unsupported target "test_parse_stream" with type "test" omitted + +# Unsupported target "test_pat" with type "test" omitted + +# Unsupported target "test_path" with type "test" omitted + +# Unsupported target "test_precedence" with type "test" omitted + +# Unsupported target "test_receiver" with type "test" omitted + +# Unsupported target "test_round_trip" with type "test" omitted + +# Unsupported target "test_shebang" with type "test" omitted + +# Unsupported target "test_should_parse" with type "test" omitted + +# Unsupported target "test_size" with type "test" omitted + +# Unsupported target "test_stmt" with type "test" omitted + +# Unsupported target "test_token_trees" with type "test" omitted + +# Unsupported target "test_ty" with type "test" omitted + +# Unsupported target "test_visibility" with type "test" omitted + +# Unsupported target "zzz_stable" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.time-0.1.44.bazel b/bazel/cargo/remote/BUILD.time-0.1.43.bazel similarity index 80% rename from bazel/cargo/remote/BUILD.time-0.1.44.bazel rename to bazel/cargo/remote/BUILD.time-0.1.43.bazel index ca43c192..37c141c6 100644 --- a/bazel/cargo/remote/BUILD.time-0.1.44.bazel +++ b/bazel/cargo/remote/BUILD.time-0.1.43.bazel @@ -47,19 +47,11 @@ rust_library( "cargo-raze", "manual", ], - version = "0.1.44", + version = "0.1.43", # buildifier: leave-alone deps = [ - "@raze__libc__0_2_81//:libc", + "@raze__libc__0_2_85//:libc", ] + selects.with_or({ - # cfg(target_os = "wasi") - ( - "@io_bazel_rules_rust//rust/platform:wasm32-wasi", - ): [ - "@raze__wasi__0_10_0_wasi_snapshot_preview1//:wasi", - ], - "//conditions:default": [], - }) + selects.with_or({ # cfg(windows) ( "@io_bazel_rules_rust//rust/platform:i686-pc-windows-msvc", diff --git a/bazel/cargo/remote/BUILD.tinyvec-1.1.1.bazel b/bazel/cargo/remote/BUILD.tinyvec-1.1.1.bazel new file mode 100644 index 00000000..265ab1de --- /dev/null +++ b/bazel/cargo/remote/BUILD.tinyvec-1.1.1.bazel @@ -0,0 +1,62 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # Zlib from expression "Zlib OR (Apache-2.0 OR MIT)" +]) + +# Generated Targets + +# Unsupported target "macros" with type "bench" omitted + +rust_library( + name = "tinyvec", + srcs = glob(["**/*.rs"]), + crate_features = [ + "alloc", + "default", + "tinyvec_macros", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "1.1.1", + # buildifier: leave-alone + deps = [ + "@raze__tinyvec_macros__0_1_0//:tinyvec_macros", + ], +) + +# Unsupported target "arrayvec" with type "test" omitted + +# Unsupported target "tinyvec" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.tinyvec_macros-0.1.0.bazel b/bazel/cargo/remote/BUILD.tinyvec_macros-0.1.0.bazel new file mode 100644 index 00000000..2ab6e2f4 --- /dev/null +++ b/bazel/cargo/remote/BUILD.tinyvec_macros-0.1.0.bazel @@ -0,0 +1,52 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR (Apache-2.0 OR Zlib)" +]) + +# Generated Targets + +rust_library( + name = "tinyvec_macros", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.1.0", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.toml-0.5.8.bazel b/bazel/cargo/remote/BUILD.toml-0.5.8.bazel new file mode 100644 index 00000000..a2ce171b --- /dev/null +++ b/bazel/cargo/remote/BUILD.toml-0.5.8.bazel @@ -0,0 +1,62 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "decode" with type "example" omitted + +# Unsupported target "enum_external" with type "example" omitted + +# Unsupported target "toml2json" with type "example" omitted + +rust_library( + name = "toml", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.5.8", + # buildifier: leave-alone + deps = [ + "@raze__serde__1_0_123//:serde", + ], +) + +# Unsupported target "enum_external_deserialize" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.unicase-2.6.0.bazel b/bazel/cargo/remote/BUILD.unicase-2.6.0.bazel new file mode 100644 index 00000000..9d0a39cb --- /dev/null +++ b/bazel/cargo/remote/BUILD.unicase-2.6.0.bazel @@ -0,0 +1,54 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "unicase", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "2.6.0", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.unicode-bidi-0.3.4.bazel b/bazel/cargo/remote/BUILD.unicode-bidi-0.3.4.bazel new file mode 100644 index 00000000..90e8fcfd --- /dev/null +++ b/bazel/cargo/remote/BUILD.unicode-bidi-0.3.4.bazel @@ -0,0 +1,54 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "unicode_bidi", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.3.4", + # buildifier: leave-alone + deps = [ + "@raze__matches__0_1_8//:matches", + ], +) diff --git a/bazel/cargo/remote/BUILD.unicode-normalization-0.1.16.bazel b/bazel/cargo/remote/BUILD.unicode-normalization-0.1.16.bazel new file mode 100644 index 00000000..b3e35bea --- /dev/null +++ b/bazel/cargo/remote/BUILD.unicode-normalization-0.1.16.bazel @@ -0,0 +1,57 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "bench" with type "bench" omitted + +rust_library( + name = "unicode_normalization", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + "std", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.1.16", + # buildifier: leave-alone + deps = [ + "@raze__tinyvec__1_1_1//:tinyvec", + ], +) diff --git a/bazel/cargo/remote/BUILD.unicode-xid-0.2.1.bazel b/bazel/cargo/remote/BUILD.unicode-xid-0.2.1.bazel new file mode 100644 index 00000000..0cd42cb6 --- /dev/null +++ b/bazel/cargo/remote/BUILD.unicode-xid-0.2.1.bazel @@ -0,0 +1,55 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "unicode_xid", + srcs = glob(["**/*.rs"]), + crate_features = [ + "default", + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.1", + # buildifier: leave-alone + deps = [ + ], +) + +# Unsupported target "exhaustive_tests" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.url-2.2.0.bazel b/bazel/cargo/remote/BUILD.url-2.2.0.bazel new file mode 100644 index 00000000..e4fdbd6d --- /dev/null +++ b/bazel/cargo/remote/BUILD.url-2.2.0.bazel @@ -0,0 +1,58 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +# Unsupported target "parse_url" with type "bench" omitted + +rust_library( + name = "url", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "2.2.0", + # buildifier: leave-alone + deps = [ + "@raze__form_urlencoded__1_0_0//:form_urlencoded", + "@raze__idna__0_2_0//:idna", + "@raze__matches__0_1_8//:matches", + "@raze__percent_encoding__2_1_0//:percent_encoding", + ], +) diff --git a/bazel/cargo/remote/BUILD.version-sync-0.9.1.bazel b/bazel/cargo/remote/BUILD.version-sync-0.9.1.bazel new file mode 100644 index 00000000..0e6a96fb --- /dev/null +++ b/bazel/cargo/remote/BUILD.version-sync-0.9.1.bazel @@ -0,0 +1,61 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT" +]) + +# Generated Targets + +rust_library( + name = "version_sync", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.9.1", + # buildifier: leave-alone + deps = [ + "@raze__proc_macro2__1_0_24//:proc_macro2", + "@raze__pulldown_cmark__0_7_2//:pulldown_cmark", + "@raze__regex__1_4_3//:regex", + "@raze__semver_parser__0_9_0//:semver_parser", + "@raze__syn__1_0_60//:syn", + "@raze__toml__0_5_8//:toml", + "@raze__url__2_2_0//:url", + ], +) + +# Unsupported target "version-numbers" with type "test" omitted diff --git a/bazel/cargo/remote/BUILD.version_check-0.9.2.bazel b/bazel/cargo/remote/BUILD.version_check-0.9.2.bazel new file mode 100644 index 00000000..86f83058 --- /dev/null +++ b/bazel/cargo/remote/BUILD.version_check-0.9.2.bazel @@ -0,0 +1,52 @@ +""" +@generated +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" + +# buildifier: disable=load +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_binary", + "rust_library", + "rust_test", +) + +# buildifier: disable=load +load("@bazel_skylib//lib:selects.bzl", "selects") + +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//bazel/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # MIT from expression "MIT OR Apache-2.0" +]) + +# Generated Targets + +rust_library( + name = "version_check", + srcs = glob(["**/*.rs"]), + crate_features = [ + ], + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.9.2", + # buildifier: leave-alone + deps = [ + ], +) diff --git a/bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel b/bazel/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel similarity index 95% rename from bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel rename to bazel/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel index 013a1c1c..6375caa4 100644 --- a/bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel +++ b/bazel/cargo/remote/BUILD.wasi-0.10.2+wasi-snapshot-preview1.bazel @@ -47,7 +47,7 @@ rust_library( "cargo-raze", "manual", ], - version = "0.9.0+wasi-snapshot-preview1", + version = "0.10.2+wasi-snapshot-preview1", # buildifier: leave-alone deps = [ ], From 8a6dba3ef0137e5b504afb835681d8907bf67618 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Wed, 3 Feb 2021 21:28:05 +0900 Subject: [PATCH 40/42] Fix Cargo.toml Signed-off-by: Takaya Saeki --- Cargo.toml | 4 +-- bazel/cargo/remote/BUILD.libc-0.2.85.bazel | 32 ++++++++++++++++++++-- bazel/cargo/remote/BUILD.log-0.4.14.bazel | 32 ++++++++++++++++++++-- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ac642ce0..df318dd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,10 +37,10 @@ genmode = "Remote" [package.metadata.raze.crates.getrandom.'=0.2.0'] gen_buildrs = true -[package.metadata.raze.crates.libc.'=0.2.81'] +[package.metadata.raze.crates.libc.'=0.2.85'] gen_buildrs = true -[package.metadata.raze.crates.log.'=0.4.11'] +[package.metadata.raze.crates.log.'=0.4.14'] gen_buildrs = true [[example]] diff --git a/bazel/cargo/remote/BUILD.libc-0.2.85.bazel b/bazel/cargo/remote/BUILD.libc-0.2.85.bazel index a52a0759..9927ba4a 100644 --- a/bazel/cargo/remote/BUILD.libc-0.2.85.bazel +++ b/bazel/cargo/remote/BUILD.libc-0.2.85.bazel @@ -28,9 +28,36 @@ licenses([ "notice", # MIT from expression "MIT OR Apache-2.0" ]) -# Generated Targets +# Generated Targets# buildifier: disable=load-on-top +load( + "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", + "cargo_build_script", +) -# Unsupported target "build-script-build" with type "custom-build" omitted +cargo_build_script( + name = "libc_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + "default", + "std", + ], + crate_root = "build.rs", + data = glob(["**"]), + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.2.85", + visibility = ["//visibility:private"], + deps = [ + ], +) rust_library( name = "libc", @@ -52,6 +79,7 @@ rust_library( version = "0.2.85", # buildifier: leave-alone deps = [ + ":libc_build_script", ], ) diff --git a/bazel/cargo/remote/BUILD.log-0.4.14.bazel b/bazel/cargo/remote/BUILD.log-0.4.14.bazel index 905b65cb..61bc6926 100644 --- a/bazel/cargo/remote/BUILD.log-0.4.14.bazel +++ b/bazel/cargo/remote/BUILD.log-0.4.14.bazel @@ -28,11 +28,36 @@ licenses([ "notice", # MIT from expression "MIT OR Apache-2.0" ]) -# Generated Targets +# Generated Targets# buildifier: disable=load-on-top +load( + "@io_bazel_rules_rust//cargo:cargo_build_script.bzl", + "cargo_build_script", +) -# Unsupported target "value" with type "bench" omitted +cargo_build_script( + name = "log_build_script", + srcs = glob(["**/*.rs"]), + build_script_env = { + }, + crate_features = [ + ], + crate_root = "build.rs", + data = glob(["**"]), + edition = "2015", + rustc_flags = [ + "--cap-lints=allow", + ], + tags = [ + "cargo-raze", + "manual", + ], + version = "0.4.14", + visibility = ["//visibility:private"], + deps = [ + ], +) -# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "value" with type "bench" omitted rust_library( name = "log", @@ -52,6 +77,7 @@ rust_library( version = "0.4.14", # buildifier: leave-alone deps = [ + ":log_build_script", "@raze__cfg_if__1_0_0//:cfg_if", ], ) From bd83275c5d4519337038dd6e81f086850554e532 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Thu, 4 Feb 2021 01:26:25 +0900 Subject: [PATCH 41/42] outdated should check only root deps Signed-off-by: Takaya Saeki --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e627ffd7..d36fd619 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -198,7 +198,7 @@ jobs: - uses: actions/checkout@v2 - name: Run cargo outdated - run: cargo outdated --exit-code 1 + run: cargo outdated --root-deps-only --exit-code 1 - name: Check freshness of bazel/cargo/Cargo.lock run: | From 20664903b614c1ffb346c3dd5d52d59c93be3b54 Mon Sep 17 00:00:00 2001 From: Takaya Saeki Date: Tue, 2 Mar 2021 16:37:20 +0900 Subject: [PATCH 42/42] Fix inconsistent derived traits Signed-off-by: Takaya Saeki --- src/types.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/types.rs b/src/types.rs index 29cb22c2..3490efe5 100644 --- a/src/types.rs +++ b/src/types.rs @@ -50,7 +50,7 @@ pub enum Status { } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub enum ContextType { HttpContext = 0, StreamContext = 1, @@ -99,7 +99,7 @@ pub enum StreamType { } #[repr(u32)] -#[derive(Debug)] +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub enum MetricType { Counter = 0, Gauge = 1,