Skip to content

Show getrandom and chrono/time usage in examples. #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions bazel/cargo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
31 changes: 28 additions & 3 deletions bazel/cargo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions bazel/cargo/crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
54 changes: 54 additions & 0 deletions bazel/cargo/remote/BUILD.cfg-if-1.0.0.bazel
Original file line number Diff line number Diff line change
@@ -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
96 changes: 96 additions & 0 deletions bazel/cargo/remote/BUILD.getrandom-0.2.0.bazel
Original file line number Diff line number Diff line change
@@ -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": [],
}),
)
54 changes: 54 additions & 0 deletions bazel/cargo/remote/BUILD.wasi-0.9.0+wasi-snapshot-preview1.bazel
Original file line number Diff line number Diff line change
@@ -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 = [
],
)
6 changes: 5 additions & 1 deletion examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading