Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/bazelbuild/bazel.git. Pull mirroring updated .
  1. May 31, 2024
    • Googler's avatar
      Integrate the skymeld cases into the rewinding inconsistency receiver. · 3e7dfb72
      Googler authored
      https://github.com/bazelbuild/bazel/commit/2a61fe711e297773d0df24b2dfe5ad83d1a24071 attempted this, but the logic was incomplete. The case of skymeld inconsistencies and rewinding ones is more complex because they involve the same SkyKeys (not the case for the heuristic node dropping inconsistencies, which don't touch execution nodes).
      
      Observation: the rewinding inconsistency receiver carries out additional actions compared to the Skymeld one, which simply returns if the inconsistency is expected. We should therefore prefer the former when applicable.
      
      This CL handles the inconsistencies case-by-base:
      
      - RESET_REQUESTED: Can be both. Handle as a Rewinding inconsistency, since it's more comprehensive than Skymeld.
      - PARENT_FORCE_REBUILD_OF_CHILD: Rewinding only.
      - BUILDING_PARENT_FOUND_UNDONE_CHILD: Can be both. Try to handle as a Rewinding inconsistency first, then attempt the skymeld route if needed.
      - ALREADY_DECLARED_CHILD_MISSING: Skymeld only.
      
      PiperOrigin-RevId: 636844413
      Change-Id: I84adefa519ccb9fa09c079a6c8cec15b14d91e33
      3e7dfb72
    • Googler's avatar
      Do not record events announced after the build-completing event. · d378f4a0
      Googler authored
      Doing so results in a race condition: last_message is set when there are no events that are announced but not posted. Progress events always announce the subsequent progress event so if there is a progress event after the build-completing event, last_message is never set.
      
      The UI is updated on a separate thread and writing to the console results in a progress event so the above scenario is entirely possible.
      
      RELNOTES: None.
      PiperOrigin-RevId: 636810448
      Change-Id: I86e1b9d37b338b3d574a6e27a7d72e81a6ecdffa
      d378f4a0
  2. May 23, 2024
    • Googler's avatar
      Split ConfigurationTransitionApi to a new target. · 739f7b83
      Googler authored
      This helps to reduce dependency cycles.
      
      Work towards composable starlark transitions: #22248.
      
      PiperOrigin-RevId: 636260650
      Change-Id: I17c0137e9d442fb02cf51e360ede876b4d92f6c4
      739f7b83
    • Fabian Meumertzheim's avatar
      Provide "did you mean ...?" suggestions for unknown command-line options · 0e9287f4
      Fabian Meumertzheim authored
      Examples:
      
      ```
      $ bazel build //src:bazel-dev --experimental_remote_cache_evection_retries=5
      ERROR: --experimental_remote_cache_evection_retries=5 :: Unrecognized option: --experimental_remote_cache_evection_retries=5 (did you mean '--experimental_remote_cache_eviction_retries'?)
      $ bazel build //src:bazel-dev --notest_kep_going
      ERROR: --notest_kep_going :: Unrecognized option: --notest_kep_going (did you mean '--notest_keep_going'?)
      
      Closes #22193.
      
      PiperOrigin-RevId: 636258381
      Change-Id: Ie81344caa14054e1d328d5a6e9b94da506d6a577
      0e9287f4
    • Fabian Meumertzheim's avatar
      Fail early on certain invalid labels in module files · cdace8f4
      Fabian Meumertzheim authored
      The following validation checks were not enforced due to backwards compatibility concerns, but ended up crashing Bazel when invalid labels made it into the lockfile, which is enabled by default. We might as well enable them now:
      
      * Fail if a label passed to `use_extension` is not valid
      * Fail if a label passed to the `patches` attribute of an override is not valid or points to a repo other than the main repo
      
      Work towards #21845
      
      Closes #22487.
      
      PiperOrigin-RevId: 636255834
      Change-Id: I55dda374cd1716e514c4d78642479b136fd3ad43
      cdace8f4
    • Googler's avatar
      Modify `LateBoundAlias` rules to declare a new provider that they always return · 72c8ae56
      Googler authored
      In preparation for forcing native rules to always return the providers they declare. Since `LateBoundAlias` do not always return `AliasProvider` they can no longer advertise it. Instead a new dummy provider `LateBoundAliasProvider` is created to identify these rules as `maybe` alias rules. Now `LateBoundAlias` should always return `LateBoundAliasProvider`.
      
      PiperOrigin-RevId: 636249343
      Change-Id: I5c0590d09f8759cf079d9a67628f7d0753bf5519
      72c8ae56
    • Googler's avatar
      Remove stack slot calculation from RClassGenerator. · e0913746
      Googler authored
      The stack slot calculation is not needed because the COMPUTE_MAXS flag is set on the ClassWriter (passed values are ignored).
      
      PiperOrigin-RevId: 636244899
      Change-Id: If51599c3cbec0ac95bdedbdac6b87a6472d81128
      e0913746
    • Googler's avatar
      Rollback of... · bcbd9563
      Googler authored
      Rollback of https://github.com/bazelbuild/bazel/commit/4d6513b54fa07321115cac350553b29914d43a65 due to user breakage reports.
      
      PiperOrigin-RevId: 636212550
      Change-Id: Ie880ff94a05a7eb5d4fbb8f8b410ba26e6aa88d1
      bcbd9563
    • Googler's avatar
      Remove unused NullTransition. · 56739f43
      Googler authored
      Work towards composable starlark transitions: #22248.
      
      PiperOrigin-RevId: 636209749
      Change-Id: I9ecdec8b376a9c95b06dea36bacbf9268d0c5195
      56739f43
    • Googler's avatar
      Fix error message when casting to boolean. · 89432dfb
      Googler authored
      PiperOrigin-RevId: 636196253
      Change-Id: I416a1eab42901a2a0d3578e1bc56c1e61158817e
      89432dfb
    • Fabian Meumertzheim's avatar
      Verify in a test that all rules have the `package_metadata` attribute · 373ea03f
      Fabian Meumertzheim authored
      Work towards #22403
      
      Closes #22497.
      
      PiperOrigin-RevId: 636193924
      Change-Id: Ia91d249397cd26aed90c6cb5be709a9f29803279
      373ea03f
  3. May 22, 2024
  4. May 21, 2024
    • Googler's avatar
      Switch CredentialHelper to WindowsSubprocessFactory on Windows and increase... · 241badf3
      Googler authored
      Switch CredentialHelper to WindowsSubprocessFactory on Windows and increase the stdout/stderr pipe size to 64KB.
      
      Fixes #21287 by preventing a deadlock/timeout when a credential helper response is too big, while avoiding more complex solutions for now. 64KB ought to be enough for anybody (TM).
      
      PiperOrigin-RevId: 635808494
      Change-Id: I29c8d79ae1c92740e7400ba4074c835dcea7de14
      241badf3
    • Googler's avatar
      Remove declared providers from `AndroidResourceSupportRule` as its child... · 9824d2ce
      Googler authored
      Remove declared providers from `AndroidResourceSupportRule` as its child `android_binary` does not return them
      
      This is in preparation to make native rules always return their declared providers
      
      PiperOrigin-RevId: 635795266
      Change-Id: I0b526e476da29987cb60ee4a9bf7840cfab825b4
      9824d2ce
    • Googler's avatar
      Close the stdin pipe handle when the respective OutputStream is closed. · b3f5c62d
      Googler authored
      Otherwise, a subprocess that consumes the stdin in its entirety can never terminate.
      
      PiperOrigin-RevId: 635774207
      Change-Id: I134ddd1fee50faccb8ddb8400dbb11ce6a354c05
      b3f5c62d
    • Googler's avatar
      Fix a typo in extend_rule_api_allowlist · daa61a72
      Googler authored
      PiperOrigin-RevId: 635750884
      Change-Id: Ie5a02fdee7d56adfab9b745e5ff8acff05ad2eea
      daa61a72
    • Googler's avatar
      Wait for background tasks finished before releasing remoteCache. · a804fb17
      Googler authored
      So that the last task won't try to shutdown the remoteCache, otherwise, might cause deadlocks.
      
      Fixes https://github.com/bazelbuild/bazel/issues/21568.
      
      PiperOrigin-RevId: 635746896
      Change-Id: Ic321216dd0bda05ef1ad18367c8ebbcd1a1d272c
      a804fb17
    • Keith Smiley's avatar
      Make env on test rules override --test_env · 01a90d64
      Keith Smiley authored
      Fixes https://github.com/bazelbuild/bazel/issues/14418
      
      Closes #22420.
      
      PiperOrigin-RevId: 635740423
      Change-Id: Iffd4d172c4175be2e1b6cfad04ddad2759adb987
      01a90d64
    • Keith Smiley's avatar
      Add layering_check support for macOS · 0a658930
      Keith Smiley authored
      There were 2 things with the previous implementation that needed to be improved here:
      
      1. Apple Clang has a bug where it doesn't pass module compiler flags to the underlying -cc1 invocation, so we have to manually pass them directly to that invocation with -Xclang
      2. The previous search script was too aggressive and slow for macOS. The macOS SDK has tons of files that aren't headers, and tons of symlinks pointing to other files within the SDK. This adds a fork in the script to run a version that works with Apple SDKs. The time difference on my machine is 41s->6s. 6s is still pretty long so if desired we can put this behavior behind an env var for users to opt in with.
      
      I've added a hermetic version of this to the apple_support toolchain, but similar to the Linux setup here the modulemap file includes absolute paths.
      
      Closes #22259.
      
      PiperOrigin-RevId: 635735410
      Change-Id: Icb3f30dd7319f147b0db54b3b42d4dc9032dc1a0
      0a658930
    • Googler's avatar
      Basic strategy-policy implementation · fdaaa6a7
      Googler authored
      Basic foundation for limiting strategies used in bazel a la invocation policy.
      Implemented as an explicit policy for fine-grained control, though for now we
      just implement an allowlist (in the future it should be extensible enough for
      more creativity).
      
      Naming of the fields in the proto definition is biased towards more ergonomic
      textproto configuration.
      
      Alternatives considered include extending invocation policy to support
      key/value flags, but this seemed like too much power being added to the flag
      system for too narrow of a use case.
      
      Note that this policy applies universally, regardless of whether or not
      strategies come by flag or are hard-coded in bazel. This is intentional - it
      allows *full* control over where/how bazel is executing actions.
      
      --strategy_regexp is presently ignored, it requires larger changes to implement, will be done in the next CLs.
      
      PiperOrigin-RevId: 635733824
      Change-Id: Ic43cf76c2b58b0fcce089119b8ce43a0116c8490
      fdaaa6a7
    • Keith Smiley's avatar
      Remove objc_library transition · d5532733
      Keith Smiley authored
      Closes #20084.
      
      PiperOrigin-RevId: 635730538
      Change-Id: I83a22b0c884d6dc699891f8d71121be80c92c0f1
      d5532733
    • Googler's avatar
      Remove the ability to dump the action graph after running a build. · bc9e71d8
      Googler authored
      RELNOTES[INC]: The --experimental_aquery_dump_after_build_format and --experimental_aquery_dump_after_build_output_file command line options are not available anymore.
      
      PiperOrigin-RevId: 635721237
      Change-Id: Ie6c13337bc42e104493637ae8dc6e383165bec2b
      bc9e71d8
    • Googler's avatar
      In 'test'/'run' commands, BEP will extract "non-crash" OOM error details to set `AbortReason`. · 83bded5d
      Googler authored
      When the main command thread is interrupted during a build, it may be due to a
      catastrophic error that happened on another thread. In this scenario we already
      correctly capture the `DetailedExitCode` in the `BuildResult`, in the
      `BuildCompleteEvent`. We do not include a `Throwable crash` in this scenario.
      
      For the 'test'/'run' commands, the `BuildEventStreamer` was incorrectly
      ignoring the error details specifically when the OOM error happened on
      another thread and did not have a `Throwable crash` in its `BuildResult`.
      
      A similar bug may exist for non-OOM catastrophic errors. Resolving this is left for a targeted followup.
      
      PiperOrigin-RevId: 635654254
      Change-Id: Ifdeb0f17463ca6d05d90077fbe6a2045c2a21ab2
      83bded5d
    • Fabian Meumertzheim's avatar
      Let `Label#debugPrint` emit label strings in display form · 0fe30635
      Fabian Meumertzheim authored
      This is a reland of 30b95e33 with a different approach to emitting display form labels that avoids adding a new `to_display_form()` method to `Label`:
      * In action command lines, which are the most frequent use of labels in rule implementation functions, labels are automatically emitted in display form since 9d3a8b02.
      * In module extensions and repository rules, if labels can be turned into display form, the inverse of the repository mapping would need to be tracked in lockfiles and marker files for correct incrementality. Furthermore, allowing implementation functions to access apparent names would allow them to "discriminate" against them, thus possibly breaking the user's capability to map repos at will via `use_repo` and `repo_name`. Similar to how providers on a target can't be enumerated, it is thus safer to not provide this information to the implementation functions directly.
      
      This change thus implements `StarlarkValue#debugPrint` for `Label` to allow ruleset authors to emit labels in display form in warnings and error messages while ensuring that Starlark logic doesn't have access to this information. `print("My message", label)` degrades gracefully with older Bazel versions (it just prints a canonical label literal) and can thus be adopted immediately without a need for feature detection.
      
      This requires changing the signature of `StarlarkValue#debugPrint` to receive the `StarlarkThread` instead of just the `StarlarkSemantics`. Since `debugPrint` is meant for emitting potentially non-deterministic information, it is safe to give it access to `StarlarkThread`.
      
      Also improves the Bzlmod cycle reporter so that it prints helpful information on a cycle encountered in a previous iteration of this PR.
      
      Fixes #20486
      
      RELNOTES: `Label` instances passed to `print` or `fail` as positional arguments are now formatted with apparent repository names (optimized for human readability).
      
      Closes #21963.
      
      PiperOrigin-RevId: 635589078
      Change-Id: If60fdc632a59f19dad0cb02312690c15a0540c8e
      0fe30635
    • Googler's avatar
      Add test to reproduce error when a rule transition reads a configured... · 1b99372c
      Googler authored
      Add test to reproduce error when a rule transition reads a configured attribute and the rule was referenced by an output file.
      
      PiperOrigin-RevId: 635511847
      Change-Id: Iacba4d4065dbb1d089c2d4df3c1c64ae5204fe35
      1b99372c
    • Googler's avatar
      Test overriding the platform module by first copying the existing version. · 077bb404
      Googler authored
      Otherwise, anything that depends on `@platform//cpu` will fail.
      
      Work towards platform-based flags: #19409.
      
      PiperOrigin-RevId: 635502289
      Change-Id: I2431a7bc849d2d0b0c6b4573de6a4838ffe9478e
      077bb404
    • Googler's avatar
      Update producers used for ConfiguredTargetFunction to handle output files. · c5efdb55
      Googler authored
      PiperOrigin-RevId: 635500424
      Change-Id: I841f96c4ef3c23fa97fa3e8bb4d1220b31888652
      c5efdb55
    • Googler's avatar
      Disable absl debug logging when `--client_debug=false` (the default). · aa480481
      Googler authored
      The Bazel client codebase doesn't use absl, but one of the library we use (e.g. gRPC) might. We wouldn't want that to spam the Bazel's user's stderr. Thus, this CL attempts to insulate the client program from that risk.
      
      We do this by disabling absl debug logging at the point in the life of the client program where we consider `--client_debug`. This is therefore a non-foolproof approach; consider a library we use that makes debug statements before that point in the life of our program. But we also add an integration test that would catch regressions like this!
      
      I noted future improvements in code comments.
      
      PiperOrigin-RevId: 635488965
      Change-Id: I26d01f9aeda3a237aa68438586f958ae01d5448d
      aa480481