diff options
author | ccalvarin <ccalvarin@google.com> | 2018-08-13 10:31:15 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-08-13 10:33:11 -0700 |
commit | 37c70a125a0282d331a1ec92397b750d50367551 (patch) | |
tree | 6a93a272bbed696544410a13405255d66aa5cddd /src/main/java/com/google/devtools/build/lib/exec | |
parent | 6ab4e16b89aca166fdee85628e264eb6ca5288af (diff) |
Add easy access to MessageDigests in DigestHashFunction
Move the message-digest cloning to DigestHashFunction and out of Fingerprint, to make it possible to configure Fingerprint to use different hash functions. We keep the default MD5 for now, we'd like it to use the global default but want to isolate the configuration change from any change adding potential contention.
RELNOTES: None.
PiperOrigin-RevId: 208502993
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/BinTools.java | 2 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/SpawnLogContext.java | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/BinTools.java b/src/main/java/com/google/devtools/build/lib/exec/BinTools.java index 46991b3f85..a24ba60812 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/BinTools.java +++ b/src/main/java/com/google/devtools/build/lib/exec/BinTools.java @@ -262,7 +262,7 @@ public final class BinTools { private static FileArtifactValue hash(Path path) throws IOException { DigestHashFunction hashFn = path.getFileSystem().getDigestFunction(); - Hasher hasher = hashFn.getHash().newHasher(); + Hasher hasher = hashFn.getHashFunction().newHasher(); int bytesCopied = 0; try (InputStream in = path.getInputStream()) { byte[] buffer = new byte[1024]; diff --git a/src/main/java/com/google/devtools/build/lib/exec/SpawnLogContext.java b/src/main/java/com/google/devtools/build/lib/exec/SpawnLogContext.java index 1b5e82096e..4fe3c31711 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/SpawnLogContext.java +++ b/src/main/java/com/google/devtools/build/lib/exec/SpawnLogContext.java @@ -221,7 +221,7 @@ public class SpawnLogContext implements ActionContext { ((VirtualActionInput) input).writeTo(buffer); byte[] blob = buffer.toByteArray(); return digest - .setHash(hashFunction.getHash().hashBytes(blob).toString()) + .setHash(hashFunction.getHashFunction().hashBytes(blob).toString()) .setSizeBytes(blob.length) .build(); } |