Skip to content

Commit

Permalink
chore: migrate to bazel 7 and rust 1.84 (#1219)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaMilosa authored Jan 17, 2025
1 parent 6068e52 commit 391c864
Show file tree
Hide file tree
Showing 22 changed files with 15,683 additions and 4,525 deletions.
98 changes: 2 additions & 96 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,97 +1,3 @@
# Mypy support.
# Targets with tag "typecheck" will get type-checked when built, run or tested.
# common --enable_bzlmod --aspects //tools:aspects.bzl%mypy_aspect --output_groups=+mypy

build --workspace_status_command=$(pwd)/bazel/workspace_status.sh --stamp

# Use local disk cache by default
build --disk_cache=~/.cache/bazel/local_cache

# Repository cache
build --repository_cache=~/.cache/bazel/repository_cache

# Use hard links in the repository cache, to save disk space
build --experimental_repository_cache_hardlinks=true

# Retry downloads
build --experimental_repository_downloader_retries=3

# Use hermetic JDK
# See https://bazel.build/docs/bazel-and-java#hermetic-testing
build --java_runtime_version=remotejdk_17

# --config=ci implies --config=lint
build:ci --config=lint
# --config=ci implies --config=dfinity
build:ci --config=dfinity
# --config=lint implies both --config=fmt and --config=clippy.
build:lint --config=fmt
build:lint --config=clippy

build:ci --progress_report_interval=30

build --sandbox_default_allow_network
build --incompatible_strict_action_env # use an environment with a static value for PATH and do not inherit LD_LIBRARY_PATH

# default to optimized and unstripped binaries.
build --compilation_mode=opt
build --@rules_rust//:extra_rustc_flags=-Cdebug-assertions=on
build --@rules_rust//:extra_rustc_flag=-Dbindings_with_variant_name
build --strip=never

# build --remote_cache=grpc://localhost:9092
build --remote_instance_name=default
build --google_default_credentials=false
build --remote_upload_local_results=false
# build --experimental_remote_cache_async
build --experimental_remote_cache_compression # compress/decompress cache blobs with zstd
build --remote_timeout=30s # Default is 60s.
build:ci --remote_timeout=5m # Default is 60s.
build:ci --remote_upload_local_results=true

build:local --experimental_remote_downloader=

# Does not produce valid JSON. See https://github.com/bazelbuild/bazel/issues/14209
build --execution_log_json_file=bazel-build-log.json

build:dfinity --bes_results_url=https://dash.idx.dfinity.network/invocation/
build:dfinity --bes_backend=bes.idx.dfinity.network
build --bes_timeout=30s # Default is no timeout.
build:ci --bes_timeout=180s # Default is no timeout.
build:ci --bes_upload_mode=fully_async
build:ci --bes_results_url=
build:ci --bes_backend=

build --remote_local_fallback
build --experimental_repository_downloader_retries=3 # https://bazel.build/reference/command-line-reference#flag--experimental_repository_downloader_retries

build --cxxopt='-std=c++17'
build:clippy --aspects=@rules_rust//rust:defs.bzl%rust_clippy_aspect
build:clippy --output_groups=+clippy_checks
build --@rules_rust//:clippy.toml=//:clippy.toml --@rules_rust//:clippy_flags=-D,warnings,-D,clippy::all,-D,clippy::mem_forget,-A,clippy::manual_clamp,-A,clippy::redundant_closure,-A,clippy::too_many_arguments,-C,debug-assertions=off

build:fmt --aspects=@rules_rust//rust:defs.bzl%rustfmt_aspect
build:fmt --output_groups=+rustfmt_checks
build --@rules_rust//:rustfmt.toml=//:rustfmt.toml

test --test_output=streamed
test --test_env=RUST_BACKTRACE=full

test:precommit --build_tests_only
# Run all tests once by default, run flaky tests up to 3 times in CI.
test --flaky_test_attempts=1
test:ci --flaky_test_attempts=default
build:ci --remote_local_fallback
# So that developers can build in debug mode.
build:dev --compilation_mode=fastbuild
build:macos_ci --compilation_mode=fastbuild

# Run `bazel build ... --config=local` if you don't have access to the buildfarm infrastructure.
build:local --remote_cache=
build:local --bes_backend=

# Suppress all additional output to make it more convenient in scripts
query --ui_event_filters=-info,-debug --noshow_progress
cquery --ui_event_filters=-info,-debug --noshow_progress

# import default bazelrc fragments, see bazel/conf/README.md
import %workspace%/bazel/conf/.bazelrc.build
try-import %workspace%/user.bazelrc
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
buildbuddy-io/5.0.138
6.5.0
7.4.1
6 changes: 3 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ genrule(
cmd = "cp $< $@",
)

py_binary(
load("@rules_python//python/entry_points:py_console_script_binary.bzl", "py_console_script_binary")
py_console_script_binary(
name = "mkdocs",
srcs = ["@python_deps_mkdocs//:rules_python_wheel_entry_point_mkdocs"],
pkg = "@python_deps//mkdocs",
data = [
"mkdocs.yml",
":release-docs",
] + glob(["docs/**/*"]),
main = "rules_python_wheel_entry_point_mkdocs.py",
deps = [
requirement("mkdocs-material"),
requirement("mkdocs-git-revision-date-localized-plugin"),
Expand Down
Loading

0 comments on commit 391c864

Please sign in to comment.