diff --git a/.bazelrc b/.bazelrc index 5c9525c20..2e841bfbf 100644 --- a/.bazelrc +++ b/.bazelrc @@ -26,9 +26,17 @@ test --test_output=errors # don't add empty __init__.py files build --incompatible_default_to_explicit_init_py -# faster for .ui file generation, but may sacrifice correctness -#--genrule_strategy=standalone - build:ci --show_timestamps --isatty=0 --color=yes --show_progress_rate_limit=5 +# incrementally compile Anki crates in fastbuild mode, but not release mode. +# The worker must be separately enabled; see docs/development.md +build -c fastbuild --@rules_rust//worker:include_regex=anki.*|rsbridge +build:opt -c opt --@rules_rust//worker:include_regex=no-crates-please +build --worker_max_instances=Rustc=HOST_CPUS*0.5 + +# the TypeScript workers on Windows choke when deps are changed while they're +# still running, so shut them down at the end of the build. Also fixes issues +# with the optional Rust worker. +build:windows --worker_quit_after_build + try-import %workspace%/user.bazelrc diff --git a/docs/development.md b/docs/development.md index 6735bd475..c9a53ef38 100644 --- a/docs/development.md +++ b/docs/development.md @@ -149,11 +149,11 @@ build --disk_cache=~/bazel/ankidisk --repository_cache=~/bazel/ankirepo ``` If you're frequently modifying the Rust parts of Anki, you can place the -following in your user.bazelrc file to enable incremental compilation: +following in your user.bazelrc file to enable incremental compilation +when using ./run. ``` -build --@rules_rust//worker:use_worker=True -build:windows --worker_quit_after_build +build --@rules_rust//worker:cache_root=/path/to/folder/to/store/temp/files ``` The worker support is experimental, so you may need to remove it in future diff --git a/repos.bzl b/repos.bzl index e60055496..836ac670b 100644 --- a/repos.bzl +++ b/repos.bzl @@ -33,11 +33,11 @@ def register_repos(): maybe( http_archive, name = "rules_rust", - strip_prefix = "rules_rust-anki-2021-03-27-2", + strip_prefix = "rules_rust-anki-2021-03-30", urls = [ - "https://github.com/ankitects/rules_rust/archive/anki-2021-03-27-2.tar.gz", + "https://github.com/ankitects/rules_rust/archive/anki-2021-03-30.tar.gz", ], - sha256 = "435cbefb4154a51f2f019c831a9ec3248724a90415f13858030562b14d6416bf", + sha256 = "ad6286615fd21f71db4490207aa8d5ecdf5f526643cd65d682458d92aa84ff85", ) # python diff --git a/scripts/build b/scripts/build index 19acc7aa7..ae2b2f45b 100755 --- a/scripts/build +++ b/scripts/build @@ -8,5 +8,5 @@ test -e WORKSPACE || ( ) rm -rf bazel-dist -bazel build -c opt --@rules_rust//worker:use_worker=False dist +bazel build --config opt dist tar xvf bazel-bin/dist.tar diff --git a/scripts/runopt b/scripts/runopt index a8156e1bc..5663c58cd 100755 --- a/scripts/runopt +++ b/scripts/runopt @@ -2,4 +2,4 @@ set -e -BUILDARGS="-c opt --@rules_rust//worker:use_worker=False" $(dirname $0)/../run $* +BUILDARGS="--config opt" $(dirname $0)/../run $*