Skip to content

Commit

Permalink
Remove dependency on rust-nightly
Browse files Browse the repository at this point in the history
Also upgrades cargo dependencies.
  • Loading branch information
allada committed Jul 21, 2022
1 parent c7dff9f commit 41028a9
Show file tree
Hide file tree
Showing 124 changed files with 551 additions and 3,972 deletions.
563 changes: 97 additions & 466 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ stdext = "0.2.1"
prost-build = "0.10.1"
tonic-build = { version = "0.7.0", features = ["compression"] }
pretty_assertions = "0.7.2"
# Crates.io does not have `rustfmt` that is sufficient version, so load from github directly.
rustfmt-nightly = { git = "https://github.com/rust-lang/rustfmt", tag = "v1.4.38" }
maplit = "1.0.2"
mock_instant = "0.2.1"
rusoto_mock = "=0.46.0"
Expand All @@ -69,7 +67,7 @@ data_attr = "['src/json5.pest']"
[package.metadata.raze.crates.clap_derive.'*']
compile_data_attr = "['README.md']"
[package.metadata.raze.crates.clap.'*']
compile_data_attr = "['README.md']"
compile_data_attr = "['README.md', 'examples/demo.md']"

[package.metadata.raze.crates.prost-build.'*']
gen_buildrs = true
Expand All @@ -80,12 +78,6 @@ buildrs_additional_environment_variables = { PROTOC = "bazel-out/host/bin/extern
[package.metadata.raze.crates.axum.'*']
compile_data_attr = "glob(['**/*.md'])"

[package.metadata.raze.crates.rustfmt-nightly.'*']
gen_buildrs = true
extra_aliased_targets = [
"cargo_bin_rustfmt"
]

[package.metadata.raze]
# The path relative path to the Bazel workspace root (location of
# WORKSPACE.bazel/WORKSPACE file). If no workspace file is found,
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ The terraform deployment is very easy to setup and configure, all you need is a

This project is still under active development, but has passed into the "Alpha" stage of development. All major components do work as expected and no major API changes are expected.

As of November 18th, 2021 the following things are in need of fixing or should be noted by any users:
* Uses nightly build of the Rust compiler version: `2021-11-01`. This is because this project is sufficiently tested and any bugs found in the rust compiler could be reported back to the community. As this project reaches maturity this will likely be phased out and we'll start using a stable version of the rust compiler.
* Although all the configurations do work from unit test and local testing perspective, they have not been tested heavily in production environments yet. Please report any bugs that are discovered.

As of July 21st, 2022 the following things are in need of fixing or should be noted by any users:
* More testing is needed in a production system.

## History

Expand All @@ -40,6 +38,7 @@ This project was first created due to frustration with similar projects not work
## Build Requirements
* Linux (most recent versions) (untested on Windows, but might work)
* Bazel 3.0.0+
* `libssl-dev` package installed (ie: `apt install libssl-dev` or `yum install libssl-dev`)

### Building
```
Expand Down
12 changes: 6 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_rust",
sha256 = "afaa4bc46bfe085252fb86f1c0a500ac811bb81831231783263558a18ba74b27",
strip_prefix = "rules_rust-3cc41db3bea0e5b153cb49b35ec8612657e796da",
sha256 = "7fb9b4fe1a6fb4341bdf7c623e619460ecc0f52d5061cc56abc750111fba8a87",
urls = [
# Main branch as of 2021-11-03.
"https://github.com/bazelbuild/rules_rust/archive/3cc41db3bea0e5b153cb49b35ec8612657e796da.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_rust/releases/download/0.7.0/rules_rust-v0.7.0.tar.gz",
"https://github.com/bazelbuild/rules_rust/releases/download/0.7.0/rules_rust-v0.7.0.tar.gz",
],
)

Expand All @@ -21,8 +20,9 @@ http_archive(
sha256 = "cd6730ed53a002c56ce4e2f396ba3b3be262fd7cb68339f0377a45e8227fe332",
)

load("@rules_rust//rust:repositories.bzl", "rust_repositories")
rust_repositories(version = "nightly", iso_date = "2021-11-01", edition="2021", dev_components = True)
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
rules_rust_dependencies()
rust_register_toolchains(version = "1.62.1", edition="2021")

load("//third_party:crates.bzl", "raze_fetch_remote_crates")
raze_fetch_remote_crates()
Expand Down
8 changes: 7 additions & 1 deletion cas/grpc_service/cas_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ impl CasServer {
);
Some(digest.clone())
},
|maybe_sz| if maybe_sz.is_some() { None } else { Some(digest.clone()) },
|maybe_sz| {
if maybe_sz.is_some() {
None
} else {
Some(digest.clone())
}
},
)
}));
}
Expand Down
12 changes: 1 addition & 11 deletions proto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ rust_binary(
deps = [
"//third_party:clap",
"//third_party:prost_build",
"//third_party:rustfmt_nightly",
"//third_party:tonic_build",
"@rules_rust//:rustfmt",
]
)

Expand All @@ -34,15 +34,6 @@ genrule(
outs = _genproto_files,
cmd = "\n".join([
"set -e",
# By default `rustfmt` will be named `cargo_bin_rustfmt`, but in
# `tonic_build` it is hard codded to look for `rustfmt` program, so we
# make a temp directory symlink a new file with the right name in that
# directory then change our path to look there first before running
# `tonic_build`. Also cleanup the tmp directory after it runs.
"TMPPATH=$$(mktemp -d -t gen_proto.XXXX)",
"trap \"rm -rf $$TMPPATH\" EXIT",
"ln -s $$PWD/$(location //third_party:cargo_bin_rustfmt) $$TMPPATH/rustfmt",
"export PATH=$$TMPPATH:$$PATH",
"export PROTOC=bazel-out/host/bin/external/com_google_protobuf/protoc",
"$(execpath :gen_protos_tool) --output_dir $(RULEDIR) " + " ".join([
("--input $(location :%s)" % file) for file in _proto_files
Expand All @@ -51,7 +42,6 @@ genrule(
tools = [
":gen_protos_tool",
"@com_google_protobuf//:protoc",
"//third_party:cargo_bin_rustfmt",
],
)

Expand Down
7 changes: 4 additions & 3 deletions rust_fmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ set -eu -o pipefail

cd "$(dirname $(realpath $0))"

RUST_FMT="./bazel-bin/external/raze__rustfmt_nightly__1_4_38/cargo_bin_rustfmt"
RUST_FMT="$(find ./bazel-bin/external/rules_rust/tools/rustfmt/rustfmt.runfiles -ipath */bin/rustfmt | head -n1)"
if [ ! -e "$RUST_FMT" ] ; then
bazel build @raze__rustfmt_nightly__1_4_38//:cargo_bin_rustfmt
bazel build @rules_rust//:rustfmt
fi
if [ "${1:-}" != "" ]; then
FILES="$@"
Expand All @@ -21,4 +21,5 @@ else
! -ipath '*/target/*' \
2> >(grep -v 'Permission denied' >&2) || true)"
fi
echo "$FILES" | parallel -I% --max-args 1 $RUST_FMT --emit files --edition 2018 %
export BUILD_WORKSPACE_DIRECTORY=$PWD
echo "$FILES" | parallel -I% --max-args 1 $RUST_FMT --emit files --edition 2021 %
34 changes: 8 additions & 26 deletions third_party/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ alias(

alias(
name = "bytes",
actual = "@raze__bytes__1_1_0//:bytes",
actual = "@raze__bytes__1_2_0//:bytes",
tags = [
"cargo-raze",
"manual",
Expand All @@ -50,7 +50,7 @@ alias(

alias(
name = "clap",
actual = "@raze__clap__3_2_6//:clap",
actual = "@raze__clap__3_2_14//:clap",
tags = [
"cargo-raze",
"manual",
Expand Down Expand Up @@ -86,7 +86,7 @@ alias(

alias(
name = "filetime",
actual = "@raze__filetime__0_2_16//:filetime",
actual = "@raze__filetime__0_2_17//:filetime",
tags = [
"cargo-raze",
"manual",
Expand Down Expand Up @@ -131,7 +131,7 @@ alias(

alias(
name = "hyper",
actual = "@raze__hyper__0_14_19//:hyper",
actual = "@raze__hyper__0_14_20//:hyper",
tags = [
"cargo-raze",
"manual",
Expand Down Expand Up @@ -176,7 +176,7 @@ alias(

alias(
name = "lru",
actual = "@raze__lru__0_7_7//:lru",
actual = "@raze__lru__0_7_8//:lru",
tags = [
"cargo-raze",
"manual",
Expand Down Expand Up @@ -275,7 +275,7 @@ alias(

alias(
name = "relative_path",
actual = "@raze__relative_path__1_7_0//:relative_path",
actual = "@raze__relative_path__1_7_2//:relative_path",
tags = [
"cargo-raze",
"manual",
Expand Down Expand Up @@ -318,27 +318,9 @@ alias(
],
)

alias(
name = "cargo_bin_rustfmt",
actual = "@raze__rustfmt_nightly__1_4_38//:cargo_bin_rustfmt",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "rustfmt_nightly",
actual = "@raze__rustfmt_nightly__1_4_38//:rustfmt_nightly",
tags = [
"cargo-raze",
"manual",
],
)

alias(
name = "serde",
actual = "@raze__serde__1_0_137//:serde",
actual = "@raze__serde__1_0_140//:serde",
tags = [
"cargo-raze",
"manual",
Expand Down Expand Up @@ -383,7 +365,7 @@ alias(

alias(
name = "tokio",
actual = "@raze__tokio__1_19_2//:tokio",
actual = "@raze__tokio__1_20_0//:tokio",
tags = [
"cargo-raze",
"manual",
Expand Down
Loading

0 comments on commit 41028a9

Please sign in to comment.