Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/bazelbuild/bazel.git. Pull mirroring updated .
  1. Jun 25, 2023
  2. May 10, 2023
    • Bazel Release System's avatar
      Release 6.2.0 (2023-05-09) · 758b44da
      Bazel Release System authored
      Baseline: d60ce2c7
      
      Cherry picks:
      
         + 490f8bad:
           kshyanashree is the release manager of 6.0.0
         + 4e66d934:
           Automated rollback of commit
           2a289091.
         + 48a8d01b:
           Allow C/C++ coverage collection for external targets
         + ec7be346:
           Temporarily set parent directory of the input to writable if it
           is not.
         + b0984342:
           Infer CPUs for tvOS and watchOS when on Apple Silicon
         + 5cea7dda:
           Improve the documentation for ctx.actions.symlink.
         + a82d26f1:
           Add quotes to "Tip"
         + 75b0f3aa:
           Write a repo mapping manifest in the runfiles directory (#16555)
         + 07c5c1aa:
           Ensure repository names don't start with `~`
         + 30f6c823:
           Escape tilde more gracefully
         + cf3f48ca:
           Relax `Label` repo visibility validation
         + 4477823e:
           Use "apparent name" instead of "local name" in Bzlmod docs
         + 55f4f483:
           Bazel DevSite: Add required css file.
         + a706994a:
           Remove logic that increases delay between progress updates over
           time
         + 1d514ab0:
           Remove references to io_bazel repository
         + b0357bd3:
           Relnotes python script
         + 8f956511:
           Allow Java coverage collection for external targets
         + bddb191d:
           Fix race condition in package-bazel.sh
         + a7578527:
           Decanonicalize labels emitted by {a,c,}query if possible
         + 9d250edb:
           Add uniquify parameter to TemplateDict.add_joined
         + f02bcf8d:
           Fix identical gcov json file name problem
         + a1593309:
           Add `$(rlocationpath(s) ...)` expansion
         + 56f54daf:
           Rollup of SBOM correctness fixes (#16655)
         + 72e6e948:
           [cc] Add cc toolchain to starlark cc_proto_library (#16661)
         + 8f285138:
           Make C++ runfiles library repo mapping aware
         + 95f9adc5:
           Always collect FileProvider's filesToBuild as data runfiles
         + 4959d34e:
           fix: export constraints.bzl file from @local_config_platform so
           it can be used in downstream bzl_library targets
         + 4919d4a6:
           Add --host_per_file_copt (#16695)
         + 0a23d469:
           Moving some tests for `RemoteActionFileSystem` of BwoB to a base
           class.
         + 9296068b:
           [remote/downloader] Don't include headers in `FetchBlobRequest`
         + 128d833f:
           [remote] Respect whether the server supports action cache updates
         + 38c50191:
           [remote/downloader] Migrate `Downloader` to take `Credentials`
           (#16732)
         + 5929cb72:
           Stage repository mapping manifest as a root symlink (#16733)
         + 455454a5:
           Expose current repository name to Java with @AutoBazelRepository
         + 97dea593:
           Implement getDirectoryEntries and readdir for
           RemoteActionFileSystem.
         + aa45f5f3:
           Move integration tests for BwoB to a base class and add more
           tests there.
         + 1b073ac0:
           Make Java runfiles library repo mapping aware
         + 148bbb1c:
           Use `_repo_mapping` in C++ runfiles library (#16752)
         + 25558ada:
           Add --experimental_action_cache_store_output_metadata to the
           expansio…
         + 6e945e8a:
           Treat `DEBUG` events as progress-like.
         + 1940c5d6:
           redact 'token' strings from logging
         + 0b645254:
           Make Bash runfiles library repo mapping aware (#16753)
         + 4caae75b:
           Automated rollback of commit
           8f956511.
         + 13ff6d9e:
           Fix Bash rlocation failure with stricter Bash options
         + bd88c7e4:
           Make bazel Android remote deps compatible with bzlmod (#16772)
         + 6f6d4cca:
           Flip `--incompatible_always_include_files_in_data`
         + 94355b1b:
           Add required `--add-opens` server JVM args also with
           non-embedded JDK
         + 8349c95f:
           Also collect clang resource directory with
           `-no-canonical-prefixes`
         + dce6ed77:
           Make `bazel run` works with minimal mode
         + ca8674cc:
           Include source files with `cquery --output=files` (#16826)
         + 9cb5e0a3:
           Fsync before rename after copy in DiskCacheClient
         + 23ffce53:
           Update GetActionResult for disk cache to check referenced files
           when …
         + 0bc0ff52:
           Make Java runfiles library compilable with JDK 8
         + fe169654:
           [6.0.0] Default --incompatible_strict_conflict_checks to true.
           (#16864)
         + 99ca86f7:
           Revert "[6.0.0] Default --incompatible_strict_conflict_checks to
           true. (#16864)" (#16872)
         + 312238f2:
           Make C++ runfiles library build with `-Werror=shadow`
         + 2baa5a42:
           Keep credentials cached across build commands.
         + 8818a57f:
           [6.0.0] Only inject metadata for outputs that cannot be
           reconstructed by skyf… (#16879)
         + 31e4bf40:
           Update java_tools v11.9
         + cd406660:
           replace _get_canonical_form(label) with str(label)
         + e2bc2374:
           Avoid exceptions from hermetic sandbox for unsupported artifact
           subclasses
         + b564d145:
           Remove warnings about ignored starlark options
         + 7ccc6610:
           [6.0.0] Emit Tree objects in topological order (#16904)
         + 86dee6d2:
           Correctly match regex with tree artifact
         + 14925b57:
           Always use target's attributes to set Python version (#16959)
         + a247502d:
           Add 'toolchain' parameter to actions.{run,run_shell}
         + 497b7e40:
           Fix Bash `runfiles_current_repository` with RBE
         + 0a2c4edb:
           Fix corner cases in Bash runfiles library
         + 33b514b2:
           Fix runfiles creation with MANIFEST when building without the
           bytes
         + 3a13af41:
           Remove LCOV merger dependency of `cc_test` without coverage
           (#17004)
         + 25ba76c1:
           Include full tree artifact in inputs when prefetcher doesn't
           support partial tree artifacts.
         + 06deebfb:
           Release 6.0.0 (2022-12-19)
         + c2bfb2e9:
           Enable git_submodules tests and merge git_repository and
           starlark_git_repository (#17247)
         + e8182ce3:
           have 'bazel test' non-test targets depend on
           --remote_download_output
         + c3245cd0:
           Add `SpellChecker` suggestions for common Bzlmod errors
         + 8ec87434:
           Use xcrun to invoke install_name_tool
         + 2b2bea4e:
           Extra resources
         + 5b4de12b:
           Do not clear `--platforms` on no-op change to `--cpu`
         + db3c0130:
           Report `AspectCreationException` to the user
         + 53e9fea3:
           Use long executable path instead of `argv[0]` in all launchers
         + abae5ca3:
           Add sanitizer features to unix_cc_toolchain_config
         + db684196:
           Allow `map_each` to return `None` in `TemplateDict#add_joined`
         + 66b58ee9:
           Always emit trailing zero in human-readable download progress
         + 17b8e448:
           Upload all logs in BEP even with minimal upload
         + 28d2daae:
           Set `--experimental_action_listeners` to default in `exec` config
         + 16427c90:
           Do not count tests as failed that have not started
         + 094a0aab:
           Accept tildes in --override_module
         + 5f2866f8:
           Do the AC integrity check for disk part of the combined cache.
         + cd10d508:
           Fix `--nozip_undeclared_test_outputs` on Windows
         + 073f54b9:
           Allow pyd in extensions of dynamic libraries
         + ac504cbb:
           Register JavaCompileActionContext in Bazel.
         + f090433f:
           Rollback #14510 because it causes remote test execution to fail
         + 942dddaa:
           Prepare backwards compatible usage of optional C++ toolchain
         + 88b51f57:
           Emit LLVM coverage for source file paths with a `tmp` segment
         + bb0b8862:
           Enable archive_param_file feature by default for Windows
         + baf97c00:
           Allow `TemplateDict#map_each` callback to return a list of
           strings (#17306)
         + fcb00774:
           Only try to create groups of test actions in the ui.
         + 3c47b471:
           Find `libtool` when using `BAZEL_USE_CPP_ONLY_TOOLCHAIN`.
         + 1da8a825:
           Add -dead_strip in default opt link flags for darwin
         + b0c5eb30:
           Dont query remote cache but always use bytestream protocol
         + 00e9af19:
           Allow Java coverage collection for external targets.
         + dd24a002:
           Test and fix root symlink edge case in runfiles library
         + af97d983:
           [6.1.0] Fix broken CI (#17422)
         + b8595718:
           Add `native.package_relative_label` function
         + 82168d44:
           Make Bazel more responsive and use less memory when --jobs is
           high (#17398)
         + 84c1ed43:
           Multiplex worker fixes and tests for Android busybox tools
           (#17371)
         + 07590818:
           Improve error message for concurrent modifications (#17396)
         + 27bc896f:
           [6.1.0] Make bazel coverage work with minimal mode (#17397)
         + 544b8164:
           [6.1.0] Fix cc_binary bug related to cc_shared_library on
           Windows and prepare for future removal of
           --experimental_cc_shared_library flag (#17445)
         + 9a7aa21c:
           Fix Bash `runfiles_current_repository` for tools
         + 911eedc0:
           Fix label unambiguous canonical form to correctly report
           non-visible repo names
         + e132653e:
           Remove O1 from sanitizer feature flag defaults
         + ba9e2f8f:
           Remove usage of gRPC Context cancellation in the remote
           execution client.
         + de03a236:
           Allow -v to libtool
         + 4e35c02c:
           Prettify labels in action progress messages with Bzlmod (#17278)
         + 1be0ac3e:
           Expand tree outputs before eagerly prefetching them for local
           actions. (#17494)
         + c2666510:
           Fix Java coverage collection with Java 8 runtime
         + 1a6ffe6d:
           Add a flag to disable execution log sorting.
         + fbec8e2a:
           Reduce flakiness on Windows for BwoB tests
         + 420659a9:
           Make AutoBazelRepositoryProcessor compatible with Java 8
         + dde6d20b:
           Do not recommend `shallow_since` for `git_repository`
         + f76fc616:
           Allow the timeout value for execute calls on a mac to be set via
           an environment variable
         + 773d232f:
           Fix RPATHs for cc toolchain solib when sibling layout is used
         + 5932b3b8:
           [6.1.0] Add --host_features (#17528)
         + a0fa77cc:
           Exit with code 39 if remote cache evicted blobs that Bazel need
           during an invocation (#17496)
         + 1a438b41:
           Only fetch @remote_coverage_tools when collecting coverage
           (#17512)
         + ee1daaf9:
           [6.1.0]Only fetch @remote_coverage_tools when collecting
           coverage (#17287)
         + 350e3295:
           [6.1.0]Fix symlink file creation overhead (#17488)
         + 5406c953:
           [6.1.0] Cleanup stale state when remote cache evicted (#17538)
         + 2d1b570e:
           Bump version number in runfiles.bash init code
         + 3ab8a0a5:
           [6.1.0]Let `aquery` print effective environment for all
           `CommandAction`s (#17274)
         + 51e6c38a:
           Properly report repo fetch progress during main repo mapping
           computation
         + 744108e8:
           [docs] Update migrating to Xcode tutorial (#17563)
         + 9dc7a7e6:
           Update //third_party:jsr305 (#17557)
         + 43dadb27:
           Bump minimum supported macOS versions to 10.13
         + 7d9d23c1:
           Correctly set default subprocess factory when loading class
           `SubprocessBuilder`.
         + 77f82f4f:
           Add an --incompatible_strict_conflict_checks alias for
           --experimental_strict_conflict_checks.
         + e05345de:
           Add support for wrapping system streams in WorkRequestHandler
         + 68e1924c:
           Also handle remote cache eviction for tree artifacts. (#17601)
         + 4a6d056a:
           Add host transition to lcov_merger in Java version of py_test
         + 546e9e29:
           Fix Bazel 6.0 crash regression (#17613)
         + 7e328bb7:
           Include Bazel version information in profile metadata. (#17616)
         + aafe1235:
           [6.1.0] Handle remote cache eviction when uploading inputs for
           remote actions. (#17605)
         + 938e3482:
           [6.1.0] Rerun the artifact conflict check when
           --incompatible_strict_conflict_checks changes. (#17592)
         + 034a2815:
           Report background download for BwoB (#17619)
         + 5afbce52:
           [6.1.0] Flag for writable outputs (experimental) (#17617)
         + d4105e65:
           [6.1.0] Allow .wasm cc executable and dynamic library extension
           (#17440)
         + a306f4f7:
           make desugar dependencies deterministic
         + 37953c56:
           Apply exec transition to lcov_merger in sh_test and cc_test
         + 1d73d72a:
           [6.1.0]Fix --host_features with multiple transitions (#17641)
         + 755cd4bc:
           Release 6.1.0 (2023-03-06)
         + 885ae7ef:
           Revert "Add -dead_strip in default opt link flags for darwin
           (#17312)" (#17696)
         + 94c519bc:
           Skip empty directories instead of throwing in prefetcher.
           (#17718)
         + 60749d53:
           [6.2.0] Remove actionId from RemoteFileArtifactValue. (#17724)
         + 52deefe5:
           Correctly handle templated tree artifacts in the prefetcher.
         + 10587b1b:
           Silence setlocale warnings in Java stub
         + 3ad39277:
           Force the Bazel server Java runtime to use the root locale
         + 7c235ff1:
           [credentialhelper] Ignore failing to provide request
         + daa3dbe2:
           [remote] upload: treat `ALREADY_EXISTS` as success
         + e0cdaced:
           Fix data race in prefetcher.
         + c9e3eeb2:
           [6.2.0] Update java_tools v11.12 (#17761)
         + 6c893034:
           python: Remove temporary module space created for zip-based
           binaries (#17764)
         + b874e5fd:
           [6.2.0]Add test coverage support to android_local_test (#17467)
         + 6fc9bedb:
           Fix wasm dynamic library extension crash (#17765)
         + 38ece3c0:
           Handle `SIGWINCH` under `bazel run //some:test` (i.e. test
           rules) correctly.
         + 49a95023:
           Clear all remote metadata if any of them are evicted from remote
           cache
         + 8fab22e6:
           Include build-tools/X.Y.Z/{lib,lib64}/** in the minimal set of
           SDK files used by the Android integration tests.
         + 3a7236be:
           Allow WORKSPACE and WORKSPACE-loaded .bzl files to see Bzlmod
           root module's mappings (#17818)
         + a87b8e0b:
           [6.2.0]Add support for alias targets to cquery's `providers`
           (#17786)
         + ee32efff:
           [6.2.0] Allows --query_file to be used for cquery and aquery
           too. (#17823)
         + cfef67da:
           Fix seeking of empty chunkers.
         + 50ec6bbf:
           Rework ByteStreamUploader early return logic.
         + 745ca288:
           Suggest alternatives for typoed rule attribute names
         + 8548e202:
           Relax JSON parser, ensure duplicate keys are overridden
         + c04f0d41:
           Use less subshells and `tee`s in running tests with `bazel run`.
         + 8c6d02e0:
           Upgrade Azul JDK 17 archives. (#17852)
         + 3c1c0c09:
           Add suggestions to invalid tag class errors
         + 99b3f386:
           [6.2.0] Add native.module_{name,version} (#17893)
         + f7627e00:
           Support (workspace) relative paths in --override_module closes
           https://github.com/bazelbuild/bazel/issues/17551
         + 109b2901:
           Fail early if `use_extension` has a bad label
         + f63ce797:
           Avoid unnecessary copying when building Merkle trees.
         + 3ea18cc0:
           [6.2.0]Add `module_ctx.is_dev_dependency` (#17934)
         + 2d04c913:
           [6.2.0] Add version to JavaRuntimeInfo (#17913)
         + 2c1a63bc:
           Fix CI breakages for release-6.2.0 (#17969)
         + 788801a8:
           Enable C++ deps pruning on Windows when PARSE_SHOWINCLUDES is
           available.
         + fb4a0c28:
           [6.2.0] TargetPattern parsing fixes (#17945)
         + 70ce8378:
           Add attribute 'provides = [CcInfo]' to '_cc_proto_aspect'
         + 6e188293:
           [6.2.0]Expose cc_proto_aspect as a toplevel symbol. (#17980)
         + 0f55d124:
           Cache Merkle trees for tree artifacts.
         + 6d6fa81e:
           Deduplicate concurrent computations of the same Merkle tree.
         + 1f2b3ed4:
           Patch zlib to fix compatibility with latest Xcode
         + 27e4c624:
           Add exception message to 'failed to create output directory'
         + 40501206:
           Prevent failures creating output directories
         + 1474b5b5:
           Allow multiple matching select branches if they resolve to the
           same value (#18066)
         + 5ddef471:
           Turn applicable_licenses on platform() into a no-op. (#18089)
         + e00509bd:
           Use ctime in file digest cache key (#18105)
         + ca30372e:
           Gracefully handle output symlinks with BwoB
         + a0cb57fd:
           [6.2.0] profile: add profile_finish_ts (#18129)
         + 1a60fad7:
           fix(python): Set envvar for runfiles manifest, not runfiles dir,
           when using a manifest (#18133)
         + 5e9fa396:
           Add attribute validation to IncompatibleTargetChecker. (#18135)
         + 97312f32:
           [6.2.0] Update CODEOWNERS (#18149)
         + 76ad4a9b:
           [6.2.0]Fix worker and multiplex workers for DexBuilder and
           Desugar actions (#17965)
         + 5afb8b61:
           Lockfile cherry picks (#18143)
         + 1940dfb0:
           Automatically retry the build if encountered remote cache
           eviction error (#18171)
         + 755cf95b:
           [6.2.0]Allow remote retry max delay to be user configurable
           (#18061)
         + 6c611108:
           Add `module_ctx.extension_metadata` (#18174)
         + c1fea137:
           Introduce max_compatibility_level for bazel_dep (#18178)
         + f95b80d1:
           Include cause when reporting `ActionExecutionException`
         + 8a41be90:
           Check for the nullness of AspectValue.
         + 27151203:
           Rename `--experimental_remote_grpc_log` to `--remote_grpc_log`
         + e4682f6c:
           [6.2.0] Update java_tools v12.1 (#18197)
         + d94dee2b:
           Construct TreeArtifactValues on multiple threads. (#18194)
         + 519eef48:
           Fix crash on multiple output symlinks with BwoB
         + 2442a2e9:
           [6.2.0] default_java_toolchain.bzl cherry-picks to fix
           regression (#18225)
         + e4f3d4dd:
           Fix message generation of `ActionExecutionException`
         + f39454f0:
           Add `dev_dependency` to
           `register_{execution_platforms,toolchains}`
         + bf188c12:
           Fine tune the number of test jobs running in parallel to avoid
           timeout on Intel macOS platform
         + e0242479:
           Update java_tools v12.2
         + 2dca9823:
           Update java_tools v12.3
      
      Incompatible changes:
      
        - Bazel no longer increases the delay between progress updates when
          there is no cursor control.
        - `--incompatible_always_include_files_in_data` is flipped
          to true. See https://github.com/bazelbuild/bazel/issues/16654 for
          details.
        - `cquery --output=files` also outputs source files.
      
          Closes #16602.
        - `--incompatible_strict_conflict_checks` is flipped to true. See
          https://github.com/bazelbuild/bazel/issues/16729 for details.
        - This changes the behavior of Python version in exec/host
          configuration. Mitigation is to set Python version on the targets.
        - `--features` only applies to targets built in the target
          configuration, and `--host_features` is used for the host / exec
          configuration (gated behind `--incompatible_use_host_features`)
      
          Fixes https://github.com/bazelbuild/bazel/issues/13839
      
      
      
          Closes #16626.
      
      New features:
      
        - The aquery and cquery commands now respect the --query_file flag
          just like the query command.
      
      Important changes:
      
        - The new path variable `$(rlocationpath ...)` and its plural form
          `$(rlocationpaths ...)` can be used to expand labels to the paths
          accepted by the `Rlocation` function of runfiles libraries. This
          is the preferred way to access data dependencies at runtime and
          works on all platforms, even when runfiles are not enabled (e.g.,
          on Windows by default).
      
          Work towards #16124
          Fixes #10923
      
          Closes #16428.
        - Starlark `print()` statements are now emitted iff the line of
          code is executed. They are no longer replayed on subsequent
          invocations unless the Starlark code is re-executed.
          Additionally, multiple identical `print()` statements (same
          string from the same line of code, e.g. from a loop) are all
          emitted and no longer deduplicated.
        - Fixes a bug where some compilation flags would not be applied to
          a cc_test
        - Added a `native.package_relative_label()` function, which
          converts a label string to a Label object in the context of the
          calling package, in contrast to `Label()`, which does so in the
          context of the current .bzl file. Both functions now also accept
          relative labels such as `:foo`, and are idempotent.
        - Adds coverage metric support to android_local_test
        - Fixed an issue where WORKSPACE and WORKSPACE-loaded .bzl files
          couldn't see the Bzlmod root module's mappings when Bzlmod is
          enabled.
        - Added `native.module_name()` and `native.module_version()` to
          allow BUILD macro authors to acquire information about which
          Bazel module the current repo is associated with.
        - `@foo` labels can now be used on the command line as the
          top-level target (that is, `bazel build @foo` now works).
          Double-dot syntax is now forbidden (`bazel build ../foo` will no
          longer work).
        - Added preliminary support for a lockfile for Bzlmod. It's
          disabled by default; use `--lockfile_mode=update` to enable it.
          This lockfile contains only Bazel module information; it does not
          involve module extensions.
        - Added a new `max_compatibility_level` attribute to the
          `bazel_dep` directive, which allows version selection to upgrade
          a dependency up to the specified compatibility level.
      
      Co-authored-by: default avatarBrentley Jones <github@brentleyjones.com>
        - `--experimental_remote_grpc_log` has been renamed to
          `--remote_grpc_log`
      
          Closes #18180.
      
      This release contains contributions from many people at Google, as well as Ben Lee, Brentley Jones, Ezekiel Warren, Fabian Meumertzheim, keertk, Keith Smiley, Krzysztof Naglik, kshyanashree, lunch-glide-pepper, oquenchil, Patrick Balestra, Son Luong Ngoc, Ted Kaplan, Ted Kaplan, UebelAndre, Xùdōng Yáng, Yannic, yuzhy8701.
      6.2.0
      758b44da
  3. May 05, 2023
  4. May 03, 2023
  5. Apr 28, 2023
  6. Apr 27, 2023
  7. Apr 26, 2023
  8. Apr 25, 2023
  9. Apr 24, 2023
  10. Apr 22, 2023
  11. Apr 21, 2023
    • kshyanashree's avatar
      [6.2.0]Allow remote retry max delay to be user configurable (#18061) · 755cf95b
      kshyanashree authored
      
      * Allow remote retry max delay to be user configurable
      
      This introduces a new option `--remote_retry_max_delay` can be used to change the existing maximum exponential backoff interval used when retrying remote requests. Before this change, there was a hardcoded value controlling this maximum exponential backoff interval, set to `5s`.
      
      Rational
      `remote_retries` is useful in masking over temporary disruptions to a remote cluster. If a cluster experiences temporary downtime, it is useful to allow bazel clients to wait for a period of time for the cluster to recover before bailing and giving up. If users cannot configure the maximum exponential backoff delay, one must set a large number for `remote_retries`, each retry eventually waiting for up to 5s. This allows the bazel client to wait for a reasonable amount of time for the cluster to recover.
      
      The problem here is that under certain cluster failure modes, requests may not be handled and failed quickly, rather they may wait until `remote_timeout` before failing. A large `remote_timeout` combined with a large `remote_retries` could lead to waiting for a very long time before finally bailing on a given action.
      
      If a user can bump the `remote_retry_max_delay`, they can control the retry waiting semantics to their own needs.
      
      Closes #16058.
      
      PiperOrigin-RevId: 523680725
      Change-Id: I21daba78b91d3157362ca85bb7b1cbbef8a94bb3
      
      * Replace RemoteDurationConverter with RemoteTimeoutConverter
      
      ---------
      
      Co-authored-by: default avatarJoel Jeske <joel.jeske@robinhood.com>
      755cf95b
    • Chi Wang's avatar
      Automatically retry the build if encountered remote cache eviction error (#18171) · 1940dfb0
      Chi Wang authored
      With https://github.com/bazelbuild/bazel/pull/17358, Bazel will exit with code 39 if remote cache evicts blobs during the build. With https://github.com/bazelbuild/bazel/pull/17462 and #17747, Bazel is able to continue the build without bazel clean or bazel shutdown.
      
      However, even with https://github.com/bazelbuild/bazel/pull/17639 and following changes to extend the lease, remote cache can still evict blobs in some rare cases.
      
      Based on above changes, this PR makes bazel retry the invocation if it encountered the remote cache eviction error during previous invocation if `--experimental_remote_cache_eviction_retries` is set, or **build rewinding**.
      
      ```
      $ bazel build --experimental_remote_cache_eviction_retries=5 ...
      INFO: Invocation ID: b7348bfa-9446-4c72-a888-0a0ad012f225
      Loading:
      Loading:
      Loading: 0 packages loaded
      Analyzing: target //a:bar (0 packages loaded, 0 targets configured)
      INFO: Analyzed target //a:bar (0 packages loaded, 0 targets configured).
      INFO: Found 1 target...
      [0 / 2] [Prepa] BazelWorkspaceStatusAction stable-status.txt
      ERROR: .../workspace/a/BUILD:8:8: Executing genrule //a:bar failed: Failed to fetch blobs because they do not exist remotely: Missing digest: b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c/4
      Target //a:bar failed to build
      Use --verbose_failures to see the command lines of failed build steps.
      INFO: Elapsed time: 0.447s, Critical Path: 0.05s
      INFO: 2 processes: 2 internal.
      ERROR: Build did NOT complete successfully
      Found remote cache eviction error, retrying the build...
      INFO: Invocation ID: 983f60dc-8bb9-4b82-aa33-a378469ce140
      Loading:
      Loading:
      Loading: 0 packages loaded
      Analyzing: target //a:bar (0 packages loaded, 0 targets configured)
      INFO: Analyzed target //a:bar (0 packages loaded, 0 targets configured).
      INFO: Found 1 target...
      [0 / 2] [Prepa] BazelWorkspaceStatusAction stable-status.txt
      Target //a:bar up-to-date:
        bazel-bin/a/bar.out
      INFO: Elapsed time: 0.866s, Critical Path: 0.35s
      INFO: 3 processes: 1 internal, 1 processwrapper-sandbox, 1 remote.
      INFO: Build completed successfully, 3 total actions
      $
      ```
      
      Part of https://github.com/bazelbuild/bazel/pull/16660.
      
      Closes #17711.
      
      PiperOrigin-RevId: 520610524
      Change-Id: I20d43d1968767a03250b9c8f8a6dda4e056d4f52
      1940dfb0
  12. Apr 20, 2023
    • Salma Samy's avatar
      Lockfile cherry picks (#18143) · 5afb8b61
      Salma Samy authored
      * Module Lockfile
      
      - Created lockfile K/F/V holding module information and its related flags
      - Updated BazelDepGraph function to use the lockfile
      - Created type adapters for module, related classes & immutable collections
      - Updated tests with Module.bazel to work after enabling the lockfile
      - Added new java test class for the lockfile
      - Added a flag to enable/disable lockfile (while it's still in progress)
      - Added integration tests
      
      PiperOrigin-RevId: 520925174
      Change-Id: Ib8da99aa86a1797da44dc9a899d932f58c4a84c9
      
      # Conflicts:
      #	src/test/py/bazel/bzlmod/bazel_module_test.py
      
      * Make lockfile human readable
      
      PiperOrigin-RevId: 521009432
      Change-Id: I2b2e5e0c845f05c428ff8772aba2abce72a3830f
      
      * Split bazel_module_tests into smaller ones
      
      PiperOrigin-RevId: 521766028
      Change-Id: I44f5f68e4357bcc1219985e983814c5e4afec65d
      
      # Conflicts:
      #	src/test/py/bazel/BUILD
      #	src/test/py/bazel/bzlmod/bazel_module_test.py
      
      * Update lockfile name
      
      PiperOrigin-RevId: 521871482
      Change-Id: Ib4357c4d35fa8ebd2e636c7f15740247ee8dfab2
      
      * Add repospec to the module
      
      - With this we can get the repospec directly from the module not the registry (no need for internet access)
      - Since Repospec & Tag classes have an "attributes" field that can hold starlark values, an adapter was needed to serialize/deserialize starlark values
      
      PiperOrigin-RevId: 523364539
      Change-Id: Ifcdf0c6b4b6fbbcdae9c14a4b0cd7f53ae91c161
      
      * Update lockfile flag from experimental to different modes flag:
      - Update: run resolution and update the lock file when it mismatches the module
      - Error: throw an error if the module doesn't match the lockfile
      - Off: don't read/update the lockfile
      
      PiperOrigin-RevId: 524813416
      Change-Id: I5cc3577fdbed8339ada50001081b75b4932c017c
      
      * Hash local overrides Module files into the lockfile
      
      PiperOrigin-RevId: 525405790
      Change-Id: I7c9b26469c889435ed4adc4a49197c10e0284af0
      
      # Conflicts:
      #	src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BzlmodFlagsAndEnvVars.java
      #	src/test/java/com/google/devtools/build/lib/bazel/bzlmod/BazelLockFileFunctionTest.java
      
      * update functions names
      
      * Add auto_value_gson and fixes
      
      * update auto value import
      
      * increase install base size
      
      RELNOTES: Added preliminary support for a lockfile for Bzlmod. It's disabled by default; use `--lockfile_mode=update` to enable it. This lockfile contains only Bazel module information; it does not involve module extensions.
      5afb8b61
    • Ben Lee's avatar
    • keertk's avatar
      [6.2.0] Update CODEOWNERS (#18149) · 97312f32
      keertk authored
      97312f32
  13. Apr 19, 2023
  14. Apr 18, 2023
    • Son Luong Ngoc's avatar
      [6.2.0] profile: add profile_finish_ts (#18129) · a0cb57fd
      Son Luong Ngoc authored
      "date" field in Bazel json profile is a confusing field.
      
      It uses Java Date.toString() output which includes local timezone
      that could be hard to parse.
      
      The name is misleading since users could mistook it for profile
      start time, while it actually means the finish/end time, when
      Bazel calls the writer to serialize profiling data to disk.
      
      Add "profile_finish_ts" which has a clearer name and more consistent
      value with the time unit being used in the rest of the JSON
      profile(microseconds).
      
      We shall deprecate the "date" field in a separate patch in a major
      release.
      a0cb57fd
  15. Apr 17, 2023
  16. Apr 15, 2023
    • keertk's avatar
      Use ctime in file digest cache key (#18105) · e00509bd
      keertk authored
      File digests are now additionally keyed by ctime for supported file system implementations. Since Bazel has a non-zero default for `--cache_computed_file_digests`, this may be required for correctness in cases where different files have identical mtime and inode number. For example, this can happen on Linux when files are extracted from a tar file with fixed mtime and are then replaced with `mv`, which preserves inodes.
      
      Since Java (N)IO doesn't have support for reading file ctimes on Windows, a new method backed by a native implementation is added to `WindowsFileOperation`. Adding a call to this function to `stat` uncovered previously silent bugs where Unix-style `PathFragment`s were created on Windows:
      
      1. Bzlmod's `createLocalRepoSpec` did not correctly extract the path from a registry's `file://`
      
       URI on Windows.
      2. `--package_path` isn't usable with absolute paths on Windows as it splits on `:`. Since the flag is deprecated, this commit fixes the tests rather than the implementation.
      
      Fixes #14723
      
      Closes #18003.
      
      PiperOrigin-RevId: 524297459
      Change-Id: I96bfc0210e2f71bf8603c7b7cc5eb06a04048c85
      
      Co-authored-by: default avatarFabian Meumertzheim <fabian@meumertzhe.im>
      e00509bd
  17. Apr 14, 2023
  18. Apr 13, 2023
    • kshyanashree's avatar
      Prevent failures creating output directories (#18062) · b9e6f7de
      kshyanashree authored
      I would receive reports of build failures along these lines:
      
      > ERROR: some/path/BUILD:156:32: Executing genrule //some/path:some_target failed: failed to create output directory '.../some/path/foo'
      
      In order to root cause this, I made a minor change to Bazel to extend its logging. See https://github.com/bazelbuild/bazel/pull/17951
      
      . With that change applied, the error became:
      
      > ERROR: some/path/BUILD:156:32: Executing genrule //some/path:some_target failed: failed to create output directory '.../some/path/foo': .../some/path/foo (Not a directory)
      
      I was eventually able to reproduce this by manually creating an output file at bazel-bin/some/path, followed by attempting to build the target. It looks like Bazel simply attempts to create output directories without taking into consideration whether a file already exists at the target location. This is problematic when someone alters an existing build target to emit a directory instead of a regular file.
      
      Note that this only an issue when the remote action file system is used.    Plain builds (ones that don't use Builds without the Bytes or    bb_clientd) are unaffected. This change addresses this issue by reusing    the same fallback path creation strategy that plain builds already use.
      
      Closes #17968.
      
      PiperOrigin-RevId: 523408378
      Change-Id: I0d7559352687c317de72e0bf5bc6b5ba7452f97e
      
      Co-authored-by: default avatarEd Schouten <eschouten@apple.com>
      b9e6f7de
    • kshyanashree's avatar
      Add exception message to 'failed to create output directory' (#18067) · 37752963
      kshyanashree authored
      
      It looks like all of the similar code paths in this file properly attach the exception message to the error message, while this one does not. Omitting the message makes it hard to figure out the root cause.
      
      While there, make a minor error message string formatting improvement.
      
      Closes #17951.
      
      PiperOrigin-RevId: 523461253
      Change-Id: I96e434d0934c26ecc696cf386362ee17a6588cc5
      
      Co-authored-by: default avatarEd Schouten <eschouten@apple.com>
      37752963
  19. Apr 12, 2023
  20. Apr 11, 2023
  21. Apr 07, 2023
    • kshyanashree's avatar
      Cache Merkle trees for tree artifacts. (#17998) · 062b14dc
      kshyanashree authored
      Currently, a large tree artifact cannot benefit from the Merkle tree cache if
      it always appears on a nested set together with other (unique per-action)
      files.
      
      To improve this, modify SpawnInputExpander to treat the tree as a distinct
      node in the input hierarchy that can be cached separately.
      
      Also simplify the cache keys for filesets and runfiles, since the
      SpawnInputExpander is a per-build singleton, and this cache is only shared by
      actions within a single build.
      
      Progress on https://github.com/bazelbuild/bazel/issues/17923
      
      .
      
      Closes #17929.
      
      PiperOrigin-RevId: 522039585
      Change-Id: Ia4f2603325acfd4400239894214f2884a71d69cf
      
      Co-authored-by: default avatarTiago Quelhas <tjgq@google.com>
      062b14dc
  22. Apr 06, 2023
  23. Apr 05, 2023
    • kshyanashree's avatar
      Add attribute 'provides = [CcInfo]' to '_cc_proto_aspect' (#17979) · 41cfc6c7
      kshyanashree authored
      
      PiperOrigin-RevId: 518797574
      Change-Id: I76d765743d59c580ee98731c694a5d0ead4ec730
      
      Co-authored-by: default avatarGoogler <buchgr@google.com>
      41cfc6c7
    • Xùdōng Yáng's avatar
      [6.2.0] TargetPattern parsing fixes (#17945) · fb4a0c28
      Xùdōng Yáng authored
      * Tests for TargetPattern parsing, and some sanity fixes
      
      - TargetPatternTest isn't testing much right now. This CL changes it to actually assert the result of parsing is as expected, and also test a few different parser setups (in main repo, with a relative directory, in a non-main repo).
        - This necessitated adding #toString methods to all TargetPattern subclasses.
        - Also rearranged the parameters in the constructors of all subclasses so that `originalPattern` is always the first parameter.
      - Removed the always-true `checkWildcardConflict` parameter in `TargetsInPackage`.
      - Removed the weak check before `interpretPathAsTarget` as it was not only weak, but wrong. It made parsing `Bar\\java` a failure at the repo root but a success in a subdirectory.
      
      Work towards https://github.com/bazelbuild/bazel/issues/4385
      
      PiperOrigin-RevId: 520630430
      Change-Id: Icee98f38134fe274ba800d2e949c83f0ae18c247
      
      * Switch TargetPattern.Parser to use LabelParser
      
      - Target patterns and labels have very similar syntax, yet are parsed completely separately. Furthermore, the code for target pattern parsing wasn't written with repos in mind, causing some corner cases such as https://github.com/bazelbuild/bazel/issues/4385.
      - This CL augments LabelParser to deal with some syntax specific to target patterns (mostly the '...' thing), and switches TargetPattern.Parser to use LabelParser instead.
      - This fixes some inconsistencies between the two and eliminates the bug linked above.
      - Added LabelParserTest to make sure that the table in the javadoc of LabelParser.Parts#parse is actually accurate.
        - Switched LabelParser.Parts to use AutoValue instead to enable testing.
      - Some more cleanup in TargetPattern.Parser; removing outdated fields/methods/etc.
      
      Fixes https://github.com/bazelbuild/bazel/issues/4385.
      
      RELNOTES: `@foo` labels can now be used on the command line as the top-level target (that is, `bazel build @foo` now works). Double-dot syntax is now forbidden (`bazel build ../foo` will no longer work).
      PiperOrigin-RevId: 520902549
      Change-Id: I38d6400381a3c4ac4c370360578702d5dd870909
      fb4a0c28
    • kshyanashree's avatar
      Enable C++ deps pruning on Windows when PARSE_SHOWINCLUDES is available. (#17957) · d3b59ad6
      kshyanashree authored
      
      This fixes #14947.
      
      Closes #17928.
      
      PiperOrigin-RevId: 521446074
      Change-Id: I4bc155f0245bc1933e86cd0b37762263437ed1fe
      
      Co-authored-by: default avatarKonstantin Erman <kerman@tableau.com>
      d3b59ad6
  24. Apr 04, 2023
    • Yun Peng's avatar
      Fix CI breakages for release-6.2.0 (#17969) · 2c1a63bc
      Yun Peng authored
      * Fix CI breakages for release-6.2.0
      
      - Pin Xcode version to 14.2, due to recent CI infrastructure change, Xcode 13.0 is no longer available.
      - Disable GitRepositoryBlackBoxTest
      
      * Disable more tests
      2c1a63bc
  25. Apr 03, 2023
    • hvadehra's avatar
      [6.2.0] Add version to JavaRuntimeInfo (#17913) · 2d04c913
      hvadehra authored
      * Add version to JavaRuntimeInfo.
      
      1. As suggested in https://github.com/bazelbuild/bazel/issues/6354#issuecomment-1310489402, add a JDK version attribute to the java_runtime rule. This will allow changing behavior based on the Java runtime's version.
      
      2. As an application of the above, pass -Djava.security.manager=allow to Java tests on JDK 17+. This makes the Bazel Java test runner to work on JDK 19. Fixes https://github.com/bazelbuild/bazel/issues/14502.
      
      3. To make the above generally useful, the remote_java_repository and local_java_repository must set the new version attribute in the java_runtime rules that they create. This means the old static jdk.BUILD file no longer suffices. Move the contents of jdk.BUILD into a Starlark file, so the version can be interpolated in by JDK repository rules and macros. (This isn't the nicest, but local_java_repository is not a repository rule, so the template cannot be in a non-Starlark file.)
      
      Closes #17775.
      
      PiperOrigin-RevId: 518860040
      Change-Id: I8223b6407dd09528a4e5a6bf12354e5fc68278c6
      
      (cherry picked from commit 7556e110
      
      )
      
      * Use string.replace() instead of string.format() to avoid issues with select{} in the template string
      
      * Remove test and fix formatting
      
      * Fix starlark_repository_test
      
      Change the grep pattern to exactly match what the test is looking for. The old pattern would match BUILD file content from the jdk_build_file.bzl template
      
      ---------
      
      Co-authored-by: default avatarBenjamin Peterson <benjamin@engflow.com>
      2d04c913