-
Notifications
You must be signed in to change notification settings - Fork 88
Porting to build Rust wasm test datas with Bazel #613
Changes from 13 commits
e2b9313
88cbcce
ab0917d
3b7147a
e177d1a
7cd18e2
e4be6ad
bd3c13c
3920e7f
9d5b435
b1da231
57723bd
c78bd2e
f8d0dc7
dae4a91
ee04c91
545cb49
dab96a6
2b92a8d
cff866a
513262e
43f8f7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
""" | ||
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", | ||
strip_prefix = "ahash-0.3.8", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "autocfg-1.0.0", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "cfg-if-0.1.10", | ||
build_file = Label("//bazel/external/cargo/remote:cfg-if-0.1.10.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", | ||
strip_prefix = "hashbrown-0.7.2", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "libc-0.2.74", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "log-0.4.11", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "memory_units-0.4.0", | ||
build_file = Label("//bazel/external/cargo/remote:memory_units-0.4.0.BUILD"), | ||
) | ||
|
||
_new_http_archive( | ||
name = "raze__proxy_wasm__0_1_2", | ||
url = "https://crates-io.s3-us-west-1.amazonaws.com/crates/proxy-wasm/proxy-wasm-0.1.2.crate", | ||
type = "tar.gz", | ||
strip_prefix = "proxy-wasm-0.1.2", | ||
build_file = Label("//bazel/external/cargo/remote:proxy-wasm-0.1.2.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", | ||
strip_prefix = "wee_alloc-0.4.5", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "winapi-0.3.9", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "winapi-i686-pc-windows-gnu-0.4.0", | ||
build_file = Label("//bazel/external/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", | ||
strip_prefix = "winapi-x86_64-pc-windows-gnu-0.4.0", | ||
build_file = Label("//bazel/external/cargo/remote:winapi-x86_64-pc-windows-gnu-0.4.0.BUILD"), | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
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 = "log", | ||
actual = "@raze__log__0_4_11//:log", | ||
tags = ["cargo-raze"], | ||
) | ||
|
||
alias( | ||
name = "proxy_wasm", | ||
actual = "@raze__proxy_wasm__0_1_2//:proxy_wasm", | ||
tags = ["cargo-raze"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the plan to check all of this into the main Envoy repo? Seems kind of terrifying from a maintenance perspective, even if automatically generated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. But maintaining these automatically generated is not inevitable. I think that we should force to use this. And warn to use this script by DO NOT EDIT comment by inserting that "We must use tools/cargo-raze.sh". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or, automatically generate with cargo-raze.sh from pre-push script by checking the Cargo.toml had staged or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meanwhile, yes, eventually I think it can made into rules_rust to generate WORKSPACE rule, just like rules_python's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely want a tracking issue for this one, since this is a lot of boilerplate that we should be able to minimize. But I'd be willing to take it as MVP. |
||
cargo-raze crate build file. | ||
|
||
DO NOT EDIT! Replaced on runs of cargo-raze | ||
""" | ||
|
||
load( | ||
"@io_bazel_rules_rust//rust:rust.bzl", | ||
"rust_library", | ||
) | ||
|
||
package(default_visibility = [ | ||
# Public for visibility by "@raze__crate__version//" targets. | ||
# | ||
# Prefer access through "//bazel/external/cargo", which limits external | ||
# visibility to explicit Cargo.toml dependencies. | ||
"//visibility:public", | ||
]) | ||
|
||
licenses([ | ||
"notice", # MIT from expression "MIT OR Apache-2.0" | ||
]) | ||
|
||
# Unsupported target "ahash" with type "bench" omitted | ||
|
||
rust_library( | ||
name = "ahash", | ||
srcs = glob(["**/*.rs"]), | ||
crate_features = [ | ||
], | ||
crate_root = "src/lib.rs", | ||
crate_type = "lib", | ||
edition = "2018", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = ["cargo-raze"], | ||
version = "0.3.8", | ||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
cargo-raze crate build file. | ||
|
||
DO NOT EDIT! Replaced on runs of cargo-raze | ||
""" | ||
|
||
load( | ||
"@io_bazel_rules_rust//rust:rust.bzl", | ||
"rust_library", | ||
) | ||
|
||
package(default_visibility = [ | ||
# Public for visibility by "@raze__crate__version//" targets. | ||
# | ||
# Prefer access through "//bazel/external/cargo", which limits external | ||
# visibility to explicit Cargo.toml dependencies. | ||
"//visibility:public", | ||
]) | ||
|
||
licenses([ | ||
"notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" | ||
]) | ||
|
||
rust_library( | ||
name = "autocfg", | ||
srcs = glob(["**/*.rs"]), | ||
crate_features = [ | ||
], | ||
crate_root = "src/lib.rs", | ||
crate_type = "lib", | ||
edition = "2015", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = ["cargo-raze"], | ||
version = "1.0.0", | ||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
cargo-raze crate build file. | ||
|
||
DO NOT EDIT! Replaced on runs of cargo-raze | ||
""" | ||
|
||
load( | ||
"@io_bazel_rules_rust//rust:rust.bzl", | ||
"rust_library", | ||
) | ||
|
||
package(default_visibility = [ | ||
# Public for visibility by "@raze__crate__version//" targets. | ||
# | ||
# Prefer access through "//bazel/external/cargo", which limits external | ||
# visibility to explicit Cargo.toml dependencies. | ||
"//visibility:public", | ||
]) | ||
|
||
licenses([ | ||
"notice", # MIT from expression "MIT OR Apache-2.0" | ||
]) | ||
|
||
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"], | ||
version = "0.1.10", | ||
deps = [ | ||
], | ||
) | ||
|
||
# Unsupported target "xcrate" with type "test" omitted |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
cargo-raze crate build file. | ||
|
||
DO NOT EDIT! Replaced on runs of cargo-raze | ||
""" | ||
|
||
load( | ||
"@io_bazel_rules_rust//rust:rust.bzl", | ||
"rust_library", | ||
) | ||
|
||
package(default_visibility = [ | ||
# Public for visibility by "@raze__crate__version//" targets. | ||
# | ||
# Prefer access through "//bazel/external/cargo", which limits external | ||
# visibility to explicit Cargo.toml dependencies. | ||
"//visibility:public", | ||
]) | ||
|
||
licenses([ | ||
"notice", # Apache-2.0 from expression "Apache-2.0 OR MIT" | ||
]) | ||
|
||
# Unsupported target "bench" with type "bench" omitted | ||
# Unsupported target "build-script-build" with type "custom-build" omitted | ||
|
||
rust_library( | ||
name = "hashbrown", | ||
srcs = glob(["**/*.rs"]), | ||
crate_features = [ | ||
"ahash", | ||
"inline-more", | ||
], | ||
crate_root = "src/lib.rs", | ||
crate_type = "lib", | ||
edition = "2018", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = ["cargo-raze"], | ||
version = "0.7.2", | ||
deps = [ | ||
"@raze__ahash__0_3_8//: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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
cargo-raze crate build file. | ||
|
||
DO NOT EDIT! Replaced on runs of cargo-raze | ||
""" | ||
|
||
load( | ||
"@io_bazel_rules_rust//rust:rust.bzl", | ||
"rust_library", | ||
) | ||
|
||
package(default_visibility = [ | ||
# Public for visibility by "@raze__crate__version//" targets. | ||
# | ||
# Prefer access through "//bazel/external/cargo", which limits external | ||
# visibility to explicit Cargo.toml dependencies. | ||
"//visibility:public", | ||
]) | ||
|
||
licenses([ | ||
"notice", # MIT from expression "MIT OR Apache-2.0" | ||
]) | ||
|
||
# Unsupported target "build-script-build" with type "custom-build" omitted | ||
# Unsupported target "const_fn" with type "test" omitted | ||
|
||
rust_library( | ||
name = "libc", | ||
srcs = glob(["**/*.rs"]), | ||
crate_features = [ | ||
], | ||
crate_root = "src/lib.rs", | ||
crate_type = "lib", | ||
edition = "2015", | ||
rustc_flags = [ | ||
"--cap-lints=allow", | ||
], | ||
tags = ["cargo-raze"], | ||
version = "0.2.74", | ||
deps = [ | ||
], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are all very similar, can you create a
_rust_crate(..)
macro that factors out all the boilerplate? it should be possible to have just_rust_crate(name="hashbrown", version="0.7.2")
and it can fill the rest I think.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are all automatically generated by
cargo raze
tool, using macros here would turn this into manual work.