Skip to content

Commit

Permalink
Bazel query should specify --output (#2712)
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov authored and dgageot committed Aug 28, 2019
1 parent fb2107f commit 9cbc539
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/skaffold/build/bazel/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func GetDependencies(ctx context.Context, dir string, a *latest.BazelArtifact) (
return nil, errors.Wrapf(err, "unable to find absolute path for %s", dir)
}

cmd := exec.CommandContext(ctx, "bazel", "query", query(a.BuildTarget), "--noimplicit_deps", "--order_output=no")
cmd := exec.CommandContext(ctx, "bazel", "query", query(a.BuildTarget), "--noimplicit_deps", "--order_output=no", "--output=label")
cmd.Dir = dir
stdout, err := util.RunCmdOut(cmd)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/build/bazel/dependencies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestGetDependencies(t *testing.T) {
"dep1": "",
"dep2": "",
},
expectedQuery: "bazel query kind('source file', deps('target')) union buildfiles('target') --noimplicit_deps --order_output=no",
expectedQuery: "bazel query kind('source file', deps('target')) union buildfiles('target') --noimplicit_deps --order_output=no --output=label",
output: "@ignored\n//:BUILD\n//external/ignored\n\n//:dep1\n//:dep2\n",
expected: []string{"BUILD", "dep1", "dep2", "WORKSPACE"},
},
Expand All @@ -63,7 +63,7 @@ func TestGetDependencies(t *testing.T) {
"sub/folder/dep2": "",
"sub/folder/baz/dep3": "",
},
expectedQuery: "bazel query kind('source file', deps('target2')) union buildfiles('target2') --noimplicit_deps --order_output=no",
expectedQuery: "bazel query kind('source file', deps('target2')) union buildfiles('target2') --noimplicit_deps --order_output=no --output=label",
output: "@ignored\n//:BUILD\n//sub/folder:BUILD\n//external/ignored\n\n//sub/folder:dep1\n//sub/folder:dep2\n//sub/folder/baz:dep3\n",
expected: []string{filepath.Join("..", "..", "BUILD"), "BUILD", "dep1", "dep2", filepath.Join("baz", "dep3"), filepath.Join("..", "..", "WORKSPACE")},
},
Expand Down

0 comments on commit 9cbc539

Please sign in to comment.