Loading android/bazel_handler.go +4 −4 Original line number Diff line number Diff line Loading @@ -938,12 +938,12 @@ func getConfigString(key cqueryKey) string { // Use host platform, which is currently hardcoded to be x86_64. arch = "x86_64" } os := key.configKey.osType.Name if len(os) == 0 || os == "common_os" || os == "linux_glibc" { osName := key.configKey.osType.Name if len(osName) == 0 || osName == "common_os" || osName == "linux_glibc" { // Use host OS, which is currently hardcoded to be linux. os = "linux" osName = "linux" } return arch + "|" + os return arch + "|" + osName } func GetConfigKey(ctx BaseModuleContext) configKey { Loading bazel/aquery.go +2 −2 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ func newAqueryHandler(aqueryResult actionGraphContainer) (*aqueryArtifactHandler // Map middleman artifact ContentHash to input artifact depset ID. // Middleman artifacts are treated as "substitute" artifacts for mixed builds. For example, // if we find a middleman action which has outputs [foo, bar], and output [baz_middleman], then, // if we find a middleman action which has inputs [foo, bar], and output [baz_middleman], then, // for each other action which has input [baz_middleman], we add [foo, bar] to the inputs for // that action instead. middlemanIdToDepsetIds := map[artifactId][]depsetId{} Loading Loading @@ -348,7 +348,7 @@ func AqueryBuildStatements(aqueryJsonProto []byte) ([]BuildStatement, []AqueryDe if prevEntry, hasKey := depsetsByHash[aqueryDepset.ContentHash]; hasKey { // Two depsets collide on hash. Ensure that their contents are identical. if !reflect.DeepEqual(aqueryDepset, prevEntry) { return nil, nil, fmt.Errorf("Two different depsets have the same hash: %v, %v", prevEntry, aqueryDepset) return nil, nil, fmt.Errorf("two different depsets have the same hash: %v, %v", prevEntry, aqueryDepset) } } else { depsetsByHash[aqueryDepset.ContentHash] = aqueryDepset Loading bazel/aquery_test.go +11 −11 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ func TestAqueryMultiArchGenrule(t *testing.T) { }] }` actualbuildStatements, actualDepsets, _ := AqueryBuildStatements([]byte(inputString)) expectedBuildStatements := []BuildStatement{} var expectedBuildStatements []BuildStatement for _, arch := range []string{"arm", "arm64", "x86", "x86_64"} { expectedBuildStatements = append(expectedBuildStatements, BuildStatement{ Loading @@ -235,7 +235,7 @@ func TestAqueryMultiArchGenrule(t *testing.T) { fmt.Sprintf("bazel-out/sourceroot/k8-fastbuild/bin/bionic/libc/syscalls-%s.S", arch), }, Env: []KeyValuePair{ KeyValuePair{Key: "PATH", Value: "/bin:/usr/bin:/usr/local/bin"}, {Key: "PATH", Value: "/bin:/usr/bin:/usr/local/bin"}, }, Mnemonic: "Genrule", }) Loading Loading @@ -747,7 +747,7 @@ func TestTransitiveInputDepsets(t *testing.T) { actualbuildStatements, actualDepsets, _ := AqueryBuildStatements([]byte(inputString)) expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "/bin/bash -c 'touch bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_out'", OutputPaths: []string{"bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_out"}, Mnemonic: "Action", Loading @@ -758,7 +758,7 @@ func TestTransitiveInputDepsets(t *testing.T) { // Inputs for the action are test_{i} from 1 to 20, and test_root. These inputs // are given via a deep depset, but the depset is flattened when returned as a // BuildStatement slice. expectedFlattenedInputs := []string{} var expectedFlattenedInputs []string for i := 1; i < 20; i++ { expectedFlattenedInputs = append(expectedFlattenedInputs, fmt.Sprintf("bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_%d", i)) } Loading Loading @@ -876,7 +876,7 @@ func flattenDepsets(depsetHashesToFlatten []string, allDepsets []AqueryDepset) [ for _, depset := range allDepsets { depsetsByHash[depset.ContentHash] = depset } result := []string{} var result []string for _, depsetId := range depsetHashesToFlatten { result = append(result, flattenDepset(depsetId, depsetsByHash)...) } Loading @@ -886,7 +886,7 @@ func flattenDepsets(depsetHashesToFlatten []string, allDepsets []AqueryDepset) [ // Returns the contents of a given depset in post order. func flattenDepset(depsetHashToFlatten string, allDepsets map[string]AqueryDepset) []string { depset := allDepsets[depsetHashToFlatten] result := []string{} var result []string for _, depsetId := range depset.TransitiveDepSetHashes { result = append(result, flattenDepset(depsetId, allDepsets)...) } Loading Loading @@ -958,7 +958,7 @@ func TestSimpleSymlink(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "mkdir -p one/symlink_subdir && " + "rm -f one/symlink_subdir/symlink && " + "ln -sf $PWD/one/file_subdir/file one/symlink_subdir/symlink", Loading Loading @@ -1022,7 +1022,7 @@ func TestSymlinkQuotesPaths(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "mkdir -p 'one/symlink subdir' && " + "rm -f 'one/symlink subdir/symlink' && " + "ln -sf $PWD/'one/file subdir/file' 'one/symlink subdir/symlink'", Loading Loading @@ -1154,7 +1154,7 @@ func TestTemplateExpandActionSubstitutions(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "/bin/bash -c 'echo \"Test template substitutions: abcd, python3\" | sed \"s/\\\\\\\\n/\\\\n/g\" > template_file && " + "chmod a+x template_file'", OutputPaths: []string{"template_file"}, Loading Loading @@ -1320,14 +1320,14 @@ func TestPythonZipperActionSuccess(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "/bin/bash -c 'echo \"Test template substitutions: abcd, python3\" | sed \"s/\\\\\\\\n/\\\\n/g\" > python_binary && " + "chmod a+x python_binary'", InputPaths: []string{"python_binary.zip"}, OutputPaths: []string{"python_binary"}, Mnemonic: "TemplateExpand", }, BuildStatement{ { Command: "../bazel_tools/tools/zip/zipper/zipper cC python_binary.zip __main__.py=bazel-out/k8-fastbuild/bin/python_binary.temp " + "__init__.py= runfiles/__main__/__init__.py= runfiles/__main__/python_binary.py=python_binary.py && " + "../bazel_tools/tools/zip/zipper/zipper x python_binary.zip -d python_binary.runfiles && ln -sf runfiles/__main__ python_binary.runfiles", Loading Loading
android/bazel_handler.go +4 −4 Original line number Diff line number Diff line Loading @@ -938,12 +938,12 @@ func getConfigString(key cqueryKey) string { // Use host platform, which is currently hardcoded to be x86_64. arch = "x86_64" } os := key.configKey.osType.Name if len(os) == 0 || os == "common_os" || os == "linux_glibc" { osName := key.configKey.osType.Name if len(osName) == 0 || osName == "common_os" || osName == "linux_glibc" { // Use host OS, which is currently hardcoded to be linux. os = "linux" osName = "linux" } return arch + "|" + os return arch + "|" + osName } func GetConfigKey(ctx BaseModuleContext) configKey { Loading
bazel/aquery.go +2 −2 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ func newAqueryHandler(aqueryResult actionGraphContainer) (*aqueryArtifactHandler // Map middleman artifact ContentHash to input artifact depset ID. // Middleman artifacts are treated as "substitute" artifacts for mixed builds. For example, // if we find a middleman action which has outputs [foo, bar], and output [baz_middleman], then, // if we find a middleman action which has inputs [foo, bar], and output [baz_middleman], then, // for each other action which has input [baz_middleman], we add [foo, bar] to the inputs for // that action instead. middlemanIdToDepsetIds := map[artifactId][]depsetId{} Loading Loading @@ -348,7 +348,7 @@ func AqueryBuildStatements(aqueryJsonProto []byte) ([]BuildStatement, []AqueryDe if prevEntry, hasKey := depsetsByHash[aqueryDepset.ContentHash]; hasKey { // Two depsets collide on hash. Ensure that their contents are identical. if !reflect.DeepEqual(aqueryDepset, prevEntry) { return nil, nil, fmt.Errorf("Two different depsets have the same hash: %v, %v", prevEntry, aqueryDepset) return nil, nil, fmt.Errorf("two different depsets have the same hash: %v, %v", prevEntry, aqueryDepset) } } else { depsetsByHash[aqueryDepset.ContentHash] = aqueryDepset Loading
bazel/aquery_test.go +11 −11 Original line number Diff line number Diff line Loading @@ -224,7 +224,7 @@ func TestAqueryMultiArchGenrule(t *testing.T) { }] }` actualbuildStatements, actualDepsets, _ := AqueryBuildStatements([]byte(inputString)) expectedBuildStatements := []BuildStatement{} var expectedBuildStatements []BuildStatement for _, arch := range []string{"arm", "arm64", "x86", "x86_64"} { expectedBuildStatements = append(expectedBuildStatements, BuildStatement{ Loading @@ -235,7 +235,7 @@ func TestAqueryMultiArchGenrule(t *testing.T) { fmt.Sprintf("bazel-out/sourceroot/k8-fastbuild/bin/bionic/libc/syscalls-%s.S", arch), }, Env: []KeyValuePair{ KeyValuePair{Key: "PATH", Value: "/bin:/usr/bin:/usr/local/bin"}, {Key: "PATH", Value: "/bin:/usr/bin:/usr/local/bin"}, }, Mnemonic: "Genrule", }) Loading Loading @@ -747,7 +747,7 @@ func TestTransitiveInputDepsets(t *testing.T) { actualbuildStatements, actualDepsets, _ := AqueryBuildStatements([]byte(inputString)) expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "/bin/bash -c 'touch bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_out'", OutputPaths: []string{"bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_out"}, Mnemonic: "Action", Loading @@ -758,7 +758,7 @@ func TestTransitiveInputDepsets(t *testing.T) { // Inputs for the action are test_{i} from 1 to 20, and test_root. These inputs // are given via a deep depset, but the depset is flattened when returned as a // BuildStatement slice. expectedFlattenedInputs := []string{} var expectedFlattenedInputs []string for i := 1; i < 20; i++ { expectedFlattenedInputs = append(expectedFlattenedInputs, fmt.Sprintf("bazel-out/sourceroot/k8-fastbuild/bin/testpkg/test_%d", i)) } Loading Loading @@ -876,7 +876,7 @@ func flattenDepsets(depsetHashesToFlatten []string, allDepsets []AqueryDepset) [ for _, depset := range allDepsets { depsetsByHash[depset.ContentHash] = depset } result := []string{} var result []string for _, depsetId := range depsetHashesToFlatten { result = append(result, flattenDepset(depsetId, depsetsByHash)...) } Loading @@ -886,7 +886,7 @@ func flattenDepsets(depsetHashesToFlatten []string, allDepsets []AqueryDepset) [ // Returns the contents of a given depset in post order. func flattenDepset(depsetHashToFlatten string, allDepsets map[string]AqueryDepset) []string { depset := allDepsets[depsetHashToFlatten] result := []string{} var result []string for _, depsetId := range depset.TransitiveDepSetHashes { result = append(result, flattenDepset(depsetId, allDepsets)...) } Loading Loading @@ -958,7 +958,7 @@ func TestSimpleSymlink(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "mkdir -p one/symlink_subdir && " + "rm -f one/symlink_subdir/symlink && " + "ln -sf $PWD/one/file_subdir/file one/symlink_subdir/symlink", Loading Loading @@ -1022,7 +1022,7 @@ func TestSymlinkQuotesPaths(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "mkdir -p 'one/symlink subdir' && " + "rm -f 'one/symlink subdir/symlink' && " + "ln -sf $PWD/'one/file subdir/file' 'one/symlink subdir/symlink'", Loading Loading @@ -1154,7 +1154,7 @@ func TestTemplateExpandActionSubstitutions(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "/bin/bash -c 'echo \"Test template substitutions: abcd, python3\" | sed \"s/\\\\\\\\n/\\\\n/g\" > template_file && " + "chmod a+x template_file'", OutputPaths: []string{"template_file"}, Loading Loading @@ -1320,14 +1320,14 @@ func TestPythonZipperActionSuccess(t *testing.T) { } expectedBuildStatements := []BuildStatement{ BuildStatement{ { Command: "/bin/bash -c 'echo \"Test template substitutions: abcd, python3\" | sed \"s/\\\\\\\\n/\\\\n/g\" > python_binary && " + "chmod a+x python_binary'", InputPaths: []string{"python_binary.zip"}, OutputPaths: []string{"python_binary"}, Mnemonic: "TemplateExpand", }, BuildStatement{ { Command: "../bazel_tools/tools/zip/zipper/zipper cC python_binary.zip __main__.py=bazel-out/k8-fastbuild/bin/python_binary.temp " + "__init__.py= runfiles/__main__/__init__.py= runfiles/__main__/python_binary.py=python_binary.py && " + "../bazel_tools/tools/zip/zipper/zipper x python_binary.zip -d python_binary.runfiles && ln -sf runfiles/__main__ python_binary.runfiles", Loading