Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/bazelbuild/bazel.git. Pull mirroring updated .
  1. Oct 19, 2024
    • Rostislav Rumenov's avatar
      Add ICP open source project · fc0bbd73
      Rostislav Rumenov authored
      ICP is one of the biggest Rust open source repositories using bazel.
      
      Closes #24025.
      
      PiperOrigin-RevId: 687427480
      Change-Id: Ie340064b714987f4d9aace58dbd5a1f6876d492b
      fc0bbd73
    • Googler's avatar
      Use base target's toolchain context to resolve its dependencies during aspect propagation · 4a26e8f5
      Googler authored
      The toolchain context of the aspect is currently used to configure the dependencies of the base target, which is incorrect and results into a number of issues due to missing execution groups or different ones being picked up.
      
      This CL modifies `AspectFunction` to always prepare the `baseTargetUnloadedToolchainContexts` and pass it to `PrerequisiteParameters`. `PrerequisiteParameters#baseTargetUnloadedToolchainContexts` is then used for the target's dependencies while `PrerequisiteParameters#toolchainContexts` continues to be used for the aspect owned dependencies.
      
      The base target toolchains and execution groups will not be available in the aspect implementation function via `ctx.rule.toolchains` and `ctx.rule.exec_groups` unless the aspects path propagates to toolchains.
      
      PiperOrigin-RevId: 687376763
      Change-Id: I78167bab7f8648e5855178d5dbcc3fcb02357a38
      4a26e8f5
  2. Oct 18, 2024
    • Googler's avatar
      Update error handling for absolute symlink violations when evaluating a fileset. · 225d0a8b
      Googler authored
      PiperOrigin-RevId: 687311869
      Change-Id: I2f481f7a702494691093bf91905fbb28f309a482
      225d0a8b
    • Googler's avatar
      Fix shell tests not to assume MODULE.bazel is empty · 948323fd
      Googler authored
      Removing this assumption makes it possible to put something into the default MODULE.bazel, generated by setup_module_dot_bazel.
      
      In my case, I'll use this to temporarily patch rules_java and protobuf so that they don't cause additional unnecessary downloads.
      
      Some tests assumed that MODULE.bazel was empty and deleted its content. Other tests needed empty MODULE.bazel, and assumed it already was.
      
      I believe this change is generally useful, when we need to do some patching.
      
      PiperOrigin-RevId: 687256923
      Change-Id: Id0a5f25676c0ad8992737a37dfe9acaf573f1d35
      948323fd
    • Alexandre Rostovtsev's avatar
      Rename `stripPrefix=` to `strip_prefix=` · 49d7bb66
      Alexandre Rostovtsev authored
      Fixes https://github.com/bazelbuild/bazel/issues/16496
      
      Closes #24019.
      
      RELNOTES: The stripPrefix parameter of repository_ctx.download_and_extract()
      and repository_ctx.extract() has been renamed to strip_prefix; the deprecated
      stripPrefix name remains usable for compatibility.
      PiperOrigin-RevId: 687224164
      Change-Id: Iffaba2e65c049a2ff8bb98d1fba52e0bba9e5a02
      49d7bb66
    • Googler's avatar
      Stop using `--fat_apk_cpu` in tests. · 2ce9e357
      Googler authored
      PiperOrigin-RevId: 687111838
      Change-Id: Ifb804d115aa0adec833287e67f44c519080c299b
      2ce9e357
    • Dimi Shahbaz's avatar
      Fix small grammar mistake in bzlmod migration doc · 408ab2d3
      Dimi Shahbaz authored
      Remove word to fix grammar issue.
      
      Closes #24018.
      
      PiperOrigin-RevId: 687041869
      Change-Id: I2802ea9f6ddb1503f48e9c1f5f78d2446954ca3f
      408ab2d3
    • Googler's avatar
      Deduplcate rpaths in linkopts · 6938c496
      Googler authored
      When switching to cpp linking variables, we need to modify the Apple rules to
      ensure that -Wl,-rpath,/usr/lib/swift appear before other rpaths.
      
      But we still need to leave behind that rpath in swift rules for linking rules
      that don't use apple rules (e.g. cc_binary).
      
      The side effect is that the are now more Appler linker warning about duplicate
      rpaths for simple targets.  I don't know of a way to turn that off, and since we
      already have logic to deduplicate frameworks, let's deduplicate rpaths while
      we're at it.
      
      PiperOrigin-RevId: 687016661
      Change-Id: Iba80b5690121ba90453e461057167d0920eafa5f
      6938c496
    • Tony Aiuto's avatar
      Remove dependency on python six from bazel_external_repository_test · 505596a4
      Tony Aiuto authored
      The external repository test depends on a .tgz file which would be downloaded from another repo. I think that when whomever made the original test, they just copied six-1.0.0.tar.gz to the test data. But the test does not actually care about what the repo does. It only cares that it can unload it and inject a BUILD file.  This PR replaces that tarball with a trivial equivalent.
      
      This does not impact the bazel distribution size, it just means we have one less false dependency.
      
      Fixes: #18272
      
      Closes #23875.
      
      PiperOrigin-RevId: 686978582
      Change-Id: Id59be40caa6625e6bd39d36cef108ee15b3a8d9e
      505596a4
  3. Oct 17, 2024
    • Googler's avatar
      Fix implicit input file creation for symbolic macros · 2b9a2e79
      Googler authored
      Previously we weren't creating input files for labels used in the attribute of a top-level symbolic macro. This meant that if you wrote
      
      ```
      my_macro(
          name = "foo",
          srcs = ["input.txt"],
      )
      ```
      
      you'd get an error message claiming that input.txt is not declared and requires an `exports_files()`. (The usages of input.txt by targets declared inside of foo don't count, because implicit input file creation only works for usages of labels outside of symbolic macro bodies.)
      
      This CL fixes this behavior, refactors the relevant logic in Package.java, and adds more test coverage.
      
      Package.java:
      - Factor the big for loop from `beforeBuild()` to `createAssumedInputFiles()`. Leave the original for loop in place for test suite accumulation, and pull the `if (discover...)` out of the new call.
      - Factor the meat of the logic into a helper, `maybeCreateAssumedInputFile()`, so we can reuse it for both rules and macros (previously there was no loop over references in macros).
      - Add tedious javadoc to this tedious logic.
      
      SymbolicMacroTest.java
      - Add explanatory comment to `macroCanReferToInputFile()`.
      - Expand `macroCannotForceCreationOfImplicitInputFileOnItsOwn()` to check that the target is still not created when the inner usage is in an attr of a MacroInstance rather than a Rule.
      
      PackageFactoryTest.java
      - Expand comment in `testSymbolicMacro_macroPreventsImplicitCreationOfInputFilesUnderItsNamespace()`, include coverage for when the reference comes from within a target or submacro inside the symbolic macro itself.
      - New test case for the behavior of this CL, `..._macroInstantiationCanForceImplicitCreationOfInputFile()`.
      - Drive-by: Add a test case for when a badly named target in a symbolic macro clashes with an implicitly created input file. This behavior may be affected by lazy macro evaluation in the future.
      
      Confirmed that this CL works for the case I originally discovered it on while writing examples documentation.
      
      Fixes #24007.
      
      PiperOrigin-RevId: 686919555
      Change-Id: I6313070f76456c0b0b5d5458ca35c89d1d6da33b
      2b9a2e79
    • Googler's avatar
      Fix a rare NPE with Skymeld cleanup. · 85edcfe2
      Googler authored
      The watchdog is setup at the beginning of the analysis/execution phase, by listening to an event. It's then cleaned up at the end of the build, via a `finally` clause.
      
      If the build fails early enough in the analysis/execution phase, the cleanup code would win the race and be triggered before the watchdog was setup.
      
      PiperOrigin-RevId: 686852796
      Change-Id: I736a17312c601c3720e2ac751d87357c3faec08f
      85edcfe2
    • Googler's avatar
      Add documentation for the --quiet startup option. · c3677ba0
      Googler authored
      Finishing touches for #4867.
      
      RELNOTES: None.
      PiperOrigin-RevId: 686819148
      Change-Id: I9ff2424683b8579ad5a953f7974c9579c5e715db
      c3677ba0
    • Googler's avatar
      Implement "quiet mode" · 6fa9e13f
      Googler authored
      This change adds a "--quiet" startup option, which causes Blaze not to print any status messages, progress messages, info messages or warnings of any kind. Error messages are still emitted as usual.
      
      Fixes #4867.
      
      RELNOTES[NEW]: The "blaze --quiet" command line option can now be used to make Blaze emit much less output.
      
      PiperOrigin-RevId: 686784300
      Change-Id: Ibaa0b6a1788b43863337dce6fc16da09defb6724
      6fa9e13f
    • Googler's avatar
      Migrate writing `--explain` output to use `InstrumentationOutput` interface · 1d022f40
      Googler authored
      PiperOrigin-RevId: 686659518
      Change-Id: I4a9de1ac4880ef1c5dd01e4b5bcb1538e69029af
      1d022f40
  4. Oct 16, 2024
  5. Oct 15, 2024
    • Googler's avatar
      Expose internal functions needed by multi_arch_binary_support.bzl and... · 41dcb2b3
      Googler authored
      Expose internal functions needed by multi_arch_binary_support.bzl and linking_support.bzl (both from builtins_bzl/common/objc/) via apple_common.
      
      This is inpreparation for moving the content of both bzl files to the repo in unknown commit.
      
      PiperOrigin-RevId: 686100272
      Change-Id: Iadbe8da6a4335e30daca889cd19afcb627df2b5c
      41dcb2b3
    • Googler's avatar
      Remove the last production use of IgnoredSubdirectories.prefixes(). · 3cfd64b4
      Googler authored
      Progress towards #7093.
      
      RELNOTES: None.
      PiperOrigin-RevId: 686088272
      Change-Id: I17ea2481ed58b76352ff1939b78ba93b8bdc9eac
      3cfd64b4
    • Googler's avatar
      Upgrade rules_cc to 0.0.13 · cb171a14
      Googler authored
      Those are needed to remove proto rules from Bazel. Older version uses native.cc_proto_library in defs.bzl. Newer uses the rules from protobuf.
      
      Additional dep on cc_proto_library_bzl is needed because rules_python use @rules_cc//cc:defs.bzl, which depends on cc_proto_library_bzl.
      
      PiperOrigin-RevId: 686077918
      Change-Id: Ie8ddfffd106a3e2be1a73a03dd27110064b6d917
      cb171a14
    • Googler's avatar
      Refactor DiffAwareness to use IgnoredSubdirectories. · e81e8d9d
      Googler authored
      Progress towards #9037.
      
      RELNOTES: None.
      PiperOrigin-RevId: 686074081
      Change-Id: I919a452eb27d149b8e52c9c8188df294521fe347
      e81e8d9d
    • Googler's avatar
      Add protobuf loads to unit tests · e63c6158
      Googler authored
      This is needed to remove proto rules from Bazel. The automatic loading is disabled in unit tests.
      
      PiperOrigin-RevId: 686069253
      Change-Id: I8a2e5751ab98f24be1dc5e7854a57f68a06a6323
      e63c6158
    • Googler's avatar
      Replace header files check using prettyArtifactNames · f1e796e7
      Googler authored
      It's simpler.
      Remove starlarkCcProtoAspect. It became unused.
      
      PiperOrigin-RevId: 686068336
      Change-Id: Id796a274c937ec1d433a7e9d8952783e4ec8f67e
      f1e796e7
    • Googler's avatar
      Document the valid options for `--experimental_build_event_upload_strategy`... · fab37d98
      Googler authored
      Document the valid options for `--experimental_build_event_upload_strategy` for Bazel users in the option's help string.
      
      In Bazel, this option may be either 'local' or 'remote'.
      
      Fixes #23789.
      
      RELNOTES: None.
      PiperOrigin-RevId: 686067559
      Change-Id: Ib7fde8c1210dea25cce30eaf1613cf0130ba037c
      fab37d98
    • Googler's avatar
      Push the IgnoredSubdirectories abstraction a little further, everywhere other than diff awareness. · 298da7bc
      Googler authored
      Progress towards #9037.
      
      RELNOTES: None.
      PiperOrigin-RevId: 686063047
      Change-Id: If27b64213ed51f0b5f8c361c657b9bba2d7511f6
      298da7bc
    • Googler's avatar
      Copy Proto rules from @protobuf instead of mocking · 73f7d23a
      Googler authored
      Setup copying. This will make it possible to use rules implementation from @protobuf repository in the tests.
      Remove mocking of proto_lang_toolchain. It's not needed anymore
      Rename protobuf_workspace to third_party/protobuf. This make loads nicer.
      Keep mocking the rules. Tests are still using built-in rules and mixing them with @protobuf rules doesn't work well.
      Remove some other unnecessary mocks.
      
      Fix bazel_skylib to be imported in one go, instead of from the lib and rules directory.
      
      PiperOrigin-RevId: 686052269
      Change-Id: I9e7bcbcd1ce42fd27e88e4e446e74e9aec1605f8
      73f7d23a
    • Googler's avatar
      Encapsulate the list of ignored subdirectories in an object. · 216ea785
      Googler authored
      This is the mechanical part of the change. It's not, strictly speaking, necessary, but given that the that set of path fragments will not be interpreted as a set of path fragments soon, I think it's better to be explicit.
      
      An ancillary benefit is that now one can search for the new object to figure out which parts of the code handle the concept of "ignored subdirectories".
      
      Progress towards #7093 .
      
      RELNOTES: None.
      PiperOrigin-RevId: 686046437
      Change-Id: I4191297c9b1e5a6599d4c5f8eb2c80fae14ac220
      216ea785
    • Googler's avatar
      Validate element types for list-typed computed default attributes · 20e37c35
      Googler authored
      Before this change, returning non-Label's from a computed default for `label_list` attributes would crash Bazel (at a later point while visiting the labels).
      
      PiperOrigin-RevId: 685990009
      Change-Id: I6b9c220a92f355d61c7340a6c383edc007f77be2
      20e37c35
    • Googler's avatar
      Make FileSystemDependencies implementations classes instead of record. · 18e3dc07
      Googler authored
      Record's implementation of hashCode and equals is inappropriate here due
      to the recursive nature of these types. Instead, use reference equality.
      These types are effectively interned via FileDependencyDeserializer
      anyway.
      
      PiperOrigin-RevId: 685830037
      Change-Id: I00a28e80fa61805edd841f15391ea123c70af71e
      18e3dc07
    • Googler's avatar
      Add missing newline in code example in string module documentation · aa33d7f8
      Googler authored
      PiperOrigin-RevId: 685784112
      Change-Id: I7472b8789b5d14e8f0b898ab716eb4a22103d15f
      aa33d7f8