-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Fingerprint to prefix-based framing/tagging. Clarify Fingerpri…
…nt docs. This essentially reverts unknown commit. The primary file of interest for this CL is Fingerprint.java: * addStrings and addPaths were be changed to take a Collection and prefix the length. See new docstring for why prefix is preferable. * Add and use addIterableStrings (using a unary encoding for the length) for the one place where only Iterable<String> is available. See b/150312032. * Add and use Artifacts.addToFingerprint static methods. * Remove addSInt as was redundant to addInt. * Fingerprint no longer implements Consumer<String>. In other files: * Added some TODOs/comments in ActionKeyCacher as subtypes are NOT consistent about the GUID part of the contract for computeKey. See b/150305897. * BigIntegerFingerprint now uses a UUID as a marker, rather than -1. Various concerns raised about the need for the class. See b/150308424. * ActionEnvironment.inheritedEnv is now Collection<> instead of Iterable<> RELNOTES: None PiperOrigin-RevId: 297927885
- Loading branch information
1 parent
39a6fd4
commit a9b118b
Showing
11 changed files
with
173 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/google/devtools/build/lib/actions/Artifacts.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2020 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
package com.google.devtools.build.lib.actions; | ||
|
||
import com.google.devtools.build.lib.util.Fingerprint; | ||
import java.util.Collection; | ||
|
||
/** Helper functions for dealing with {@link Artifacts} */ | ||
public final class Artifacts { | ||
|
||
private Artifacts() {} | ||
|
||
public static void addToFingerprint(Fingerprint fp, Artifact artifact) { | ||
fp.addString(artifact.getExecPathString()); | ||
} | ||
|
||
// TODO(bazel-team): Add option to sort collection of artifacts before adding to fingerprint? | ||
/** Appends a description of a complete collection of {@link Artifact} to the fingerprint. */ | ||
public static void addToFingerprint(Fingerprint fp, Collection<Artifact> artifacts) { | ||
fp.addInt(artifacts.size()); | ||
for (Artifact artifact : artifacts) { | ||
addToFingerprint(fp, artifact); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.