Skip to content
Snippets Groups Projects
This project is mirrored from https://github.com/bazelbuild/bazel.git. Pull mirroring updated .
  1. Feb 06, 2024
  2. Feb 05, 2024
  3. Jan 06, 2024
    • Googler's avatar
      Makes ImmutableMap codecs DeferredObjectCodec. · 8e8ddaba
      Googler authored
      * Fixes a soundness error with ImmutableMapCodec which would cause a crash if
        the declared type is ImmutableSortedMap by splitting into 2 codecs.
      * This necessarily includes ImmutableBiMapCodec and
        ImmutableClassToInstanceMapCodec because those two previously had
        dependencies on ImmutableMapCodec.
      
      PiperOrigin-RevId: 596078698
      Change-Id: I23b928307a3f1b1722d31b2907366fe46352ee6f
      8e8ddaba
    • Googler's avatar
      Cosmetic DeferredObjectCodec touchups. · 6a527959
      Googler authored
      PiperOrigin-RevId: 596062007
      Change-Id: I97d95c3944e381caaa01ac995eee607ebfdb9f2e
      6a527959
    • Googler's avatar
      Flip --incompatible_objc_provider_remove_linking_info to true · 67c5c0fb
      Googler authored
      #19000
      
      PiperOrigin-RevId: 596060323
      Change-Id: Ifbef6ea29918e4af7856a675b18f1ebfd1a14f37
      67c5c0fb
    • Googler's avatar
      Simplify input file creation logic · dd11578f
      Googler authored
      This alters an error message that used some obsolete verbiage (it said "generated label" when really it could be any non-input-file target).
      
      - Eliminate GeneratedLabelConflict subclass. It's unnecessary to distinguish the case of input file conflicts from other types of name conflicts.
      
      - Clarify comment about nameConflictCheckingPolicy.
      
      - Remove addInputFile() overload that did its own creation of the InputFile. This makes custody of the input file object more explicit and allows it to be passed to helper functions like nameConflict().
      
      - In createInputFile(), reorder clauses for readability and reuse of InputFile object across two cases.
      
      Work toward #19922.
      
      PiperOrigin-RevId: 596059017
      Change-Id: Ie7acc7ba7592875c8726271b01c81f4a56c42a2d
      dd11578f
    • Googler's avatar
      Make ImmutableTableCodec a DeferredObjectCodec. · ca3239a4
      Googler authored
      PiperOrigin-RevId: 596051669
      Change-Id: Ibfa7b49e4a7dc3e2282a554a00d37586ab6ebb67
      ca3239a4
    • Googler's avatar
      Update `PrecomputedValue.Key` and `PrecomputedValue.UnshareableKey` to use... · 14e9ef9c
      Googler authored
      Update `PrecomputedValue.Key` and `PrecomputedValue.UnshareableKey` to use `@AutoCodec.Interner` instead of `@AutoCodec.Instantiator`.
      
      PiperOrigin-RevId: 596048876
      Change-Id: I7f23da6170e787d20e45a2cded0c279ca74da9b4
      14e9ef9c
    • Googler's avatar
      Update `PackageIdentifier` to use `@AutoCodec.Interner` instead of `@AutoCodec.Instantiator`. · 18632fb4
      Googler authored
      PiperOrigin-RevId: 596045519
      Change-Id: I4523b762770f601e91ffd4ae0d3f4c122ae3b537
      18632fb4
    • Googler's avatar
      Remove package name from error message · 4ad18091
      Googler authored
      This makes the affected error message more symmetric with other related errors that do not include the package name. The package name should be added somewhere higher up in the handling logic anyway.
      
      Work toward #19922. (Drive-by fix)
      
      PiperOrigin-RevId: 596041531
      Change-Id: Ibfc3731f941de3a5020d751d46ac33f77e7d2019
      4ad18091
    • Googler's avatar
      No public description · 9ae2cdaf
      Googler authored
      PiperOrigin-RevId: 596041334
      Change-Id: I6e29b07a3c21452642169c52494383c5fac0b09c
      9ae2cdaf
    • Googler's avatar
      Refactor name conflict detection and error messaging · 1013c528
      Googler authored
      This change is a no-op.
      
      - The idiom of checking the `targets` map for a newly added target and failing if it finds one, is factored into a new helper checkNameConflict().
      
      - Updated javadoc to checkForConflicts(). Ensured that all existing checks are mentioned, and deleted reference to two conditions that don't appear to actually be checked: "no rule with errors is inserted into the package" -- we seem to do the opposite and propagate error bits from rules to the package; and "the generating rule of every output must itself be in the package" -- perhaps this is enforced elsewhere, but it's not part of this method.
      
      - Add TODO of me pondering whether we care if an output file prefix clashes with a non-output-file target.
      
      - Merge duplicateOutputFile() into nameConflict(). (This doesn't change the error message because nameConflict() was never called with an OutputFile as its first arg.)
      
      - Add TODO identifying that we don't actually verify that an output doesn't clash with its own generating rule, even though we check it against other previously introduced rules.
      
      - Rename conflictingOutputFile() -> overlappingOutputFilePrefixes() to distinguish from the other kinds of conflicts we're talking about.
      
      - Inline checkForInputOutputConflicts() and inputOutputNameConflict(), which each only had one call site and are more readable as part of checkForConflicts().
      
      - Use String.format() more.
      
      Work toward #19922.
      
      PiperOrigin-RevId: 596031120
      Change-Id: I02ed6bb4d0f4c1f5aa2bfa16c91835d92e4cef39
      1013c528
    • Googler's avatar
      Add FlatDeserializationContext. · 23d6d70c
      Googler authored
      FlatDeserializationContext only accepts deserializeFully. It's clear that
      interned types actually only work with deserializeFully because partially
      deserialized values would not be correctly interned.
      
      * Make InterningObjectCodec use FlatDeserializationContext instead of
        AsyncDeserializationContext.
      * Splits out FLAT_OBJECT_ARRAY_PROCESSOR from OBJECT_ARRAY_PROCESSOR that uses
        the FlatDeserializationContext.
      
      PiperOrigin-RevId: 596016993
      Change-Id: Ic799000d8caa446e2291858737669c16ab7bafa7
      23d6d70c
    • Googler's avatar
      Automated rollback of commit 13bd8288. · c6ba1c33
      Googler authored
      *** Reason for rollback ***
      
      Broke tests
      
      *** Original change description ***
      
      Update CompatDexBuilder to compile using the DexFilePerClassFileConsumer.
      
      The builder is already compiling a single classfile to a single dex file (in DexIndexed mode). The use of the DexFilePerClassFileConsumer mode will not change that, but it informs D8 that the compilation is an "intermediate" compilation and more closely matches the usage.
      
      PiperOrigin-RevId: 596000561
      Change-Id: If44a3c63264cdbb482e0de5809ee2e6479b5c614
      c6ba1c33
    • Googler's avatar
      Automated rollback of commit d9dc4fde. · fecb4126
      Googler authored
      *** Reason for rollback ***
      
      Rollforward after fixing the underlying problem in https://github.com/bazelbuild/bazel/commit/9b027c88051797ada7350098ef190191b953014a
      
      *** Original change description ***
      
      Disable PyTest.testSmoke on macOS
      
      Due to https://github.com/bazelbuild/bazel/issues/20660
      
      RELNOTES: None
      PiperOrigin-RevId: 595998556
      Change-Id: Idddf6149a918de4408a3fda016d605380a4ab6af
      fecb4126
  4. Jan 05, 2024
    • Googler's avatar
      Print file names without root base in progress messages · 1e9ca85d
      Googler authored
      This change is primarily done to support CppLinkAction which already prints names like this.
      
      Alternatively we could add new placeholders for short names, however I believe it's better we only keep one form consistently thoughout the rules.
      
      RELNOTES[INC]: progress messages print short primary input and output without root base
      
      PiperOrigin-RevId: 595968580
      Change-Id: I0e612763102e207511f38bdb014862d6084cd500
      1e9ca85d
    • Googler's avatar
      Update CompatDexBuilder to compile using the DexFilePerClassFileConsumer. · 13bd8288
      Googler authored
      The builder is already compiling a single classfile to a single dex file (in DexIndexed mode). The use of the DexFilePerClassFileConsumer mode will not change that, but it informs D8 that the compilation is an "intermediate" compilation and more closely matches the usage.
      
      PiperOrigin-RevId: 595956205
      Change-Id: I063e8e2e71fe1057c7d651f88e77ecd95a89c1d6
      13bd8288
    • Googler's avatar
      Fix a comment. · fb4f63fb
      Googler authored
      This method is in fact not available from Starlark.
      
      RELNOTES: None.
      PiperOrigin-RevId: 595949407
      Change-Id: I1cc9d8583c2edca42e2a2eadf27bbd74b8f9604f
      fb4f63fb
    • Googler's avatar
      Retry binding to ipv6 localhost · 1a0b3a0d
      Googler authored
      Fixes https://github.com/bazelbuild/bazel/issues/20743
      
      PiperOrigin-RevId: 595935153
      Change-Id: I0409552aa92f3886c5abf3bd3ce50d67594dab7e
      1a0b3a0d
    • Googler's avatar
      Refactor splitting of LinkerCommandLine · b5cfea5f
      Googler authored
      Before `getRawLinkArgv` generated a joint/mixed command line, which was composed of 'linker executable' (first argument) and regular arguments. Reference to 'param file' was mixed into the regular arguments.
      
      Linker command line is long, too long. To fix this, most of linkers are called like `linker @param.file`. The long list of arguments is hidden in `param.file`.
      
      `splitCommandline` used `isLikelyParamFile` to filter out what that `param file` reference was. The result were 2 command lines. First one with 'linker executable' and reference to 'param file' and second command line contained regular arguments, that are written to param file.
      
      Generate those 2 command lines directly. First one is returned by `getCommandLine` and second one (the regular arguments) by `getParamCommandLine`
      
      Param file reference is formatted using `linker_param_file` feature, using `%{linker_param_file}` substitution. In most cases this is just `@%{linker_param_file}`, but there are some linkers that need different formatting.
      
      This change is also needed for Starlarkification of CppLinkAction, because the Starlark interface requires to set how param file is formatted, directly. See https://bazel.build/rules/lib/builtins/Args#use_param_file
      
      Fixes: https://github.com/bazelbuild/bazel/issues/18074
      PiperOrigin-RevId: 595912823
      Change-Id: I54b36113d87f975af63341b2dec17b2f861c0ffa
      b5cfea5f
    • Googler's avatar
      Make ImmutableSortedSetCodec a DeferredObjectCodec. · debec5cd
      Googler authored
      PiperOrigin-RevId: 595844312
      Change-Id: I3f7af05ad57bb3b233a693665bac079388638184
      debec5cd
    • Googler's avatar
      Makes ImmutableSetRuntimeCodec a DeferredObjectCodec. · af682fd4
      Googler authored
      * Renames ImmutableSetRuntimeCodec to ImmutableSetCodec for consistency.
      * Changes Collections.emptySet to serialize using a reference constant.
      * Adds a unit test.
      
      PiperOrigin-RevId: 595820617
      Change-Id: Ic2592216a1463e8e17168f4d308e4c49f83644c9
      af682fd4
    • Xdng Yng's avatar
      Let module extensions track calls to `Label()` · 5cba0579
      Xdng Yng authored
      ... that use repo mapping. This is a rather obscure case of the lockfile being stale; if the `Label()` constructor is called in an extension impl function, and that call uses repo mapping of any form (i.e. the argument looks like `@foo//bar`), then we need to be ready to rerun the extension if `@foo` were to suddenly map to something else.
      
      I also did a minor refactoring in `SingleExtensionEvalFunction` around the logic to decide whether the locked extension is up-to-date. Right now we perform a "diff" between the locked extension and what we expect to be up-to-date, and if a "diff" is found *and* `--lockfile_mode=error`, we basically perform a diff again. We also don't short circuit; that is, if the transitive bzl digest has changed, there's no point in seeing whether any files have changed, but we do right now.
      
      A follow-up will be sent to fix the analogous bug for repo rules.
      
      Fixes #20721.
      
      Closes #20742.
      
      PiperOrigin-RevId: 595818144
      Change-Id: Id660b7a659a7f2e4dde19c16784c2ab18a9ceb69
      5cba0579
    • Fabian Meumertzheim's avatar
      Add support for bind mounts under `/tmp` with hermetic tmp · 5e68afda
      Fabian Meumertzheim authored
      This is achieved by rewriting the user-specified mounts to mounts onto subdirectories of the hermetic sandbox tmp directory.
      
      Fixes #20527
      
      Closes #20583.
      
      PiperOrigin-RevId: 595815029
      Change-Id: Ibfe5f67fb8fb59131b6c82a826ed5200f2b10a94
      5e68afda
    • Googler's avatar
      Replace calls to getRawLinkArgv with calls to arguments · c92ecbf6
      Googler authored
      The implementation of both methods is the same. Because the second one is already public, this reduces the number of public methods of LinkCommandLine.
      
      The change is a no-op.
      
      PiperOrigin-RevId: 595771439
      Change-Id: Ia5a494746c1f15be7a16149ee28ae349c57c955d
      c92ecbf6
    • Marc Redemske's avatar
      Fix `constraint_value` link · cb98d329
      Marc Redemske authored
      platform.html does not exist (anymore)
      
      it now points to: https://bazel.build/reference/be/platforms-and-toolchains#constraint_value
      
      Closes #20694.
      
      PiperOrigin-RevId: 595743748
      Change-Id: I5ea30e4ce2b89af86d42456a724986e648c9140c
      cb98d329
  5. Jan 04, 2024
    • Googler's avatar
      Internal change. · d4e2d50d
      Googler authored
      PiperOrigin-RevId: 595703930
      Change-Id: Ic4e836b8384ba788ae6f7ecd968e4e90ca889771
      d4e2d50d
    • Googler's avatar
      Clarify name conflict checking invariants · d0498fb0
      Googler authored
      Previously, it was possible in theory, but not in practice, to call both addRule() and addRuleUnchecked() on the same Package.Builder. This CL removes that possibility, and in doing so makes it easier to reason about whether the ruleLabels map will be null. It also makes the outputFilePrefixes map nullable along the same lines as ruleLabels. Both maps are only used for validation, and so are irrelevant to Builders that use addRuleUnchecked.
      
      For completeness/correctness, replaceTarget is also updated to mention its interaction with this invariant.
      
      Work toward #19922.
      
      PiperOrigin-RevId: 595696336
      Change-Id: I3965033784025e3dd6cfc85ec0b591a21c24de8c
      d0498fb0
    • Googler's avatar
      Delete redundant output file conflict logic · 5ec0761c
      Googler authored
      outputFilePrefixes is a map used to help check whether one OutputFile's name clashes with a directory prefix of another. Since it's updated with info from every OutputFile of a rule passed to checkForConflicts(), there's no need to also update it in addRuleUnchecked().
      
      This is a no-op assuming that no user of Package.Builder calls both addRule() and addRuleUnchecked() -- which is currently the case, and ought to be enforced, perhaps in a follow-up CL.
      
      (Note that the alternative approach, of deleting the map update in checkForConflicts() while leaving it intact in addRuleUnchecked(), is not only less readable, but also incorrect since it doesn't catch conflicts between OutputFiles of the same generating rule.)
      
      Work toward #19922.
      
      PiperOrigin-RevId: 595683434
      Change-Id: I8b660807edfa1eef5101fe362ddaed4352e3f684
      5ec0761c
    • Googler's avatar
      Merge extractArgumentsForStaticLinkParamFile and extractArgumentsForDynamicLinkParamFile · 3490df22
      Googler authored
      The implementation was exactly the same. (Probably historically that wasn't the case).
      
      PiperOrigin-RevId: 595674237
      Change-Id: I608b6d5f06db0d81a8abf631505e2552ce45a7b3
      3490df22
    • Googler's avatar
      Fix missing triple-backtick introduced in... · 0218b1ab
      Googler authored
      Fix missing triple-backtick introduced in https://github.com/bazelbuild/bazel/commit/13ecdf583301a94484a1ae0eb27c56fcf3248dc5
      
      PiperOrigin-RevId: 595654761
      Change-Id: Ib02ad8c5f5a3e29bd022ffd006a71cb182ab7466
      0218b1ab
    • Googler's avatar
      Set --sandbox_default_allow_network to true for macOS · 33d4e3b4
      Googler authored
      To mitigate https://github.com/bazelbuild/bazel/issues/20743
      
      PiperOrigin-RevId: 595652084
      Change-Id: I349024873d86f9b57dffca3c53429bf8ec3ed453
      33d4e3b4
    • Googler's avatar
      Remove linkingMode from LinkCommandLine · 24ed0ea8
      Googler authored
      It's used only in tests, where it can be more accurtely determined if there is an .so artifact present.
      
      PiperOrigin-RevId: 595644582
      Change-Id: Iffc2b89fdbef322cc63d92f5acf4aa1261f1fca3
      24ed0ea8
    • Googler's avatar
      Make MultimapCodec async-compatible. · 1f2d5763
      Googler authored
      The previous implementation contained unsound casts. LinkedHashMultimap is
      a declarable type that cannot be assigned from ImmutableSetMultimap which
      would have led to a runtime crash. So the codecs are broken out and registered
      individually.
      
      Minor ArrayProcessor changes.
      * Use a static import for array offset constants.
      * Add a deserializeObjectArrayFully method.
      
      PiperOrigin-RevId: 595569849
      Change-Id: I8add48dacd13d4e08159c48e4145632055af2e15
      1f2d5763
    • Googler's avatar
      Make `RegularFileArtifactValue#toString` not crash if the digest is null. · dc3a3596
      Googler authored
      Observed NPE in a debugger that was trying to show a string representation.
      
      Also make the string representation of the digest consistent with `RemoteFileArtifactValue`.
      
      PiperOrigin-RevId: 595554648
      Change-Id: I705ed0ffabf4bde81bb3b1f653f30b7565e65b82
      dc3a3596
    • Googler's avatar
      explcitly traverse aspects in cquery · 81e1333c
      Googler authored
      This CL adds aspect nodes as explicit targets in cquery deps by making
      ConfiguredTargetQueryEnvironment generic over a new interface,
      CqueryNode, rather than ConfiguredTarget.
      
      CqueryNode is implemented by AspectKey as well as ConfiguredTarget so
      that both can be traversed in a deps query.
      
      PiperOrigin-RevId: 595509373
      Change-Id: I8a637cd3ed640907d2b1501bcd2b4a4507d183e7
      81e1333c
    • Fabian Meumertzheim's avatar
      Add support for tmpfs mounts under `/tmp` with hermetic tmp · 620d617b
      Fabian Meumertzheim authored
      This is achieved by mounting tmpfs after regular mounts in the sandbox binary as well as creating the directories at which tmpfs are mounted under the sandbox tmp directory.
      
      Closes #20658.
      
      PiperOrigin-RevId: 595500822
      Change-Id: Icf3d51bffdd004f668ba4fbbdbd5f833c20db3d9
      620d617b
    • Richard Levasseur's avatar
      python: fix bazel py_test testSmoke for Python 3.11+ · 9b027c88
      Richard Levasseur authored
      The test was failing because the `b.py` file couldn't be imported because, starting with Python 3.11, the `PYTHONSAFEPATH` environment variable (set by the bootstrap startup) is respected. This setting inhibits the default Python behavior of adding the main script's directory to sys.path.
      
      To fix, use `py_library.imports` to explicitly add the necessary directory to `sys.path`.
      
      Fixes https://github.com/bazelbuild/bazel/issues/20660
      
      Closes #20738.
      
      PiperOrigin-RevId: 595498775
      Change-Id: I0c9521b210fe9e2c40692727fc87d41995e0968a
      9b027c88