minor dead code: unused format string
Using URL base64 encoding (without padding, i.e. with trailing '=' or '==') hash string width is 256/6 = 43 characters. file size virtually unchanged, out/soong/build.ninja: 7,188,669,041 => 7,186,999,370 ie 1.6M Bug: N/A Test: manually verified (e.g. ran `m nothing` successfully) Change-Id: I166d613e1fd857555da9611d420d6691806571c7
This commit is contained in:
@@ -878,7 +878,7 @@ func (c *bazelSingleton) GenerateBuildActions(ctx SingletonContext) {
|
||||
}
|
||||
|
||||
// The actual Bazel action.
|
||||
cmd.Text(" " + buildStatement.Command)
|
||||
cmd.Text(buildStatement.Command)
|
||||
|
||||
for _, outputPath := range buildStatement.OutputPaths {
|
||||
cmd.ImplicitOutput(PathForBazelOut(ctx, outputPath))
|
||||
|
@@ -16,6 +16,7 @@ package bazel
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
@@ -295,7 +296,7 @@ func (a *aqueryArtifactHandler) artifactPathsFromDepsetHash(depsetHash string) (
|
||||
a.depsetHashToArtifactPathsCache[depsetHash] = result
|
||||
return result, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("undefined input depset hash %d", depsetHash)
|
||||
return nil, fmt.Errorf("undefined input depset hash %s", depsetHash)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,8 +391,8 @@ func depsetContentHash(directPaths []string, transitiveDepsetHashes []string) st
|
||||
h := sha256.New()
|
||||
// Use newline as delimiter, as paths cannot contain newline.
|
||||
h.Write([]byte(strings.Join(directPaths, "\n")))
|
||||
h.Write([]byte(strings.Join(transitiveDepsetHashes, "\n")))
|
||||
fullHash := fmt.Sprintf("%016x", h.Sum(nil))
|
||||
h.Write([]byte(strings.Join(transitiveDepsetHashes, "")))
|
||||
fullHash := base64.RawURLEncoding.EncodeToString(h.Sum(nil))
|
||||
return fullHash
|
||||
}
|
||||
|
||||
|
@@ -847,8 +847,8 @@ func TestMiddlemenAction(t *testing.T) {
|
||||
}
|
||||
|
||||
expectedDepsetFiles := [][]string{
|
||||
[]string{"middleinput_one", "middleinput_two"},
|
||||
[]string{"middleinput_one", "middleinput_two", "maininput_one", "maininput_two"},
|
||||
{"middleinput_one", "middleinput_two", "maininput_one", "maininput_two"},
|
||||
{"middleinput_one", "middleinput_two"},
|
||||
}
|
||||
assertFlattenedDepsets(t, actualDepsets, expectedDepsetFiles)
|
||||
|
||||
@@ -897,7 +897,7 @@ func flattenDepset(depsetHashToFlatten string, allDepsets map[string]AqueryDepse
|
||||
func assertFlattenedDepsets(t *testing.T, actualDepsets []AqueryDepset, expectedDepsetFiles [][]string) {
|
||||
t.Helper()
|
||||
if len(actualDepsets) != len(expectedDepsetFiles) {
|
||||
t.Errorf("Expected %d depsets, but got %d depsets", expectedDepsetFiles, actualDepsets)
|
||||
t.Errorf("Expected %s depsets, but got %s depsets", expectedDepsetFiles, actualDepsets)
|
||||
}
|
||||
for i, actualDepset := range actualDepsets {
|
||||
actualFlattenedInputs := flattenDepsets([]string{actualDepset.ContentHash}, actualDepsets)
|
||||
|
Reference in New Issue
Block a user