Skip to content

Commit

Permalink
refactor: Move aquery and cquery to be there own verbs under pkg/aspect
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseTatasciore committed Jan 24, 2022
1 parent f67d7b8 commit fe60e7f
Show file tree
Hide file tree
Showing 21 changed files with 355 additions and 356 deletions.
2 changes: 1 addition & 1 deletion cmd/aspect/aquery/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ go_library(
importpath = "aspect.build/cli/cmd/aspect/aquery",
visibility = ["//visibility:public"],
deps = [
"//pkg/aspect/query/aquery",
"//pkg/aspect/aquery",
"//pkg/bazel",
"//pkg/ioutils",
"@com_github_spf13_cobra//:cobra",
Expand Down
2 changes: 1 addition & 1 deletion cmd/aspect/aquery/aquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package aquery
import (
"github.com/spf13/cobra"

"aspect.build/cli/pkg/aspect/query/aquery"
"aspect.build/cli/pkg/aspect/aquery"
"aspect.build/cli/pkg/bazel"
"aspect.build/cli/pkg/ioutils"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/aspect/cquery/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ go_library(
importpath = "aspect.build/cli/cmd/aspect/cquery",
visibility = ["//visibility:public"],
deps = [
"//pkg/aspect/query/cquery",
"//pkg/aspect/cquery",
"//pkg/bazel",
"//pkg/ioutils",
"@com_github_spf13_cobra//:cobra",
Expand Down
2 changes: 1 addition & 1 deletion cmd/aspect/cquery/cquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package cquery
import (
"github.com/spf13/cobra"

"aspect.build/cli/pkg/aspect/query/cquery"
"aspect.build/cli/pkg/aspect/cquery"
"aspect.build/cli/pkg/bazel"
"aspect.build/cli/pkg/ioutils"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/aspect/query/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ go_library(
importpath = "aspect.build/cli/cmd/aspect/query",
visibility = ["//visibility:public"],
deps = [
"//pkg/aspect/query/query",
"//pkg/aspect/query",
"//pkg/bazel",
"//pkg/ioutils",
"@com_github_spf13_cobra//:cobra",
Expand Down
2 changes: 1 addition & 1 deletion cmd/aspect/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package query
import (
"github.com/spf13/cobra"

"aspect.build/cli/pkg/aspect/query/query"
"aspect.build/cli/pkg/aspect/query"
"aspect.build/cli/pkg/bazel"
"aspect.build/cli/pkg/ioutils"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "aquery",
srcs = ["aquery.go"],
importpath = "aspect.build/cli/pkg/aspect/query/aquery",
importpath = "aspect.build/cli/pkg/aspect/aquery",
visibility = ["//visibility:public"],
deps = [
"//pkg/aspect/query",
"//pkg/aspect/query/shared",
"//pkg/bazel",
"//pkg/ioutils",
"@com_github_spf13_cobra//:cobra",
Expand All @@ -18,8 +18,8 @@ go_test(
srcs = ["aquery_test.go"],
deps = [
":aquery",
"//pkg/aspect/query",
"//pkg/aspect/query/mock",
"//pkg/aspect/query/shared",
"//pkg/aspect/query/shared/mock",
"//pkg/bazel/mock",
"//pkg/ioutils",
"@com_github_golang_mock//gomock",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package aquery
import (
"github.com/spf13/cobra"

shared "aspect.build/cli/pkg/aspect/query"
"aspect.build/cli/pkg/aspect/query/shared"
"aspect.build/cli/pkg/bazel"
"aspect.build/cli/pkg/ioutils"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import (
. "github.com/onsi/gomega"
"github.com/spf13/cobra"

"aspect.build/cli/pkg/aspect/query"
shared "aspect.build/cli/pkg/aspect/query"
"aspect.build/cli/pkg/aspect/query/aquery"
query_mock "aspect.build/cli/pkg/aspect/query/mock"
"aspect.build/cli/pkg/aspect/aquery"
"aspect.build/cli/pkg/aspect/query/shared"
query_mock "aspect.build/cli/pkg/aspect/query/shared/mock"
bazel_mock "aspect.build/cli/pkg/bazel/mock"
"aspect.build/cli/pkg/ioutils"
)
Expand Down Expand Up @@ -185,15 +184,15 @@ func TestQuery(t *testing.T) {
Streams: streams,
Bzl: spawner,
IsInteractive: true,
Prompt: func(label string) query.PromptRunner {
Prompt: func(label string) shared.PromptRunner {
g.Expect(strings.Contains(label, "targettwo") || strings.Contains(label, "dependencytwo")).To(Equal(true))
return promptRunner
},
Select: func(presetNames []string) query.SelectRunner {
Select: func(presetNames []string) shared.SelectRunner {
return selectRunner
},
}
q.Presets = []*query.PresetQuery{
q.Presets = []*shared.PresetQuery{
{
Name: "why1",
Description: "Determine why a target depends on another",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "cquery",
srcs = ["cquery.go"],
importpath = "aspect.build/cli/pkg/aspect/query/cquery",
importpath = "aspect.build/cli/pkg/aspect/cquery",
visibility = ["//visibility:public"],
deps = [
"//pkg/aspect/query",
"//pkg/aspect/query/shared",
"//pkg/bazel",
"//pkg/ioutils",
"@com_github_spf13_cobra//:cobra",
Expand All @@ -18,8 +18,8 @@ go_test(
srcs = ["cquery_test.go"],
deps = [
":cquery",
"//pkg/aspect/query",
"//pkg/aspect/query/mock",
"//pkg/aspect/query/shared",
"//pkg/aspect/query/shared/mock",
"//pkg/bazel/mock",
"//pkg/ioutils",
"@com_github_golang_mock//gomock",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package cquery
import (
"github.com/spf13/cobra"

shared "aspect.build/cli/pkg/aspect/query"
"aspect.build/cli/pkg/aspect/query/shared"
"aspect.build/cli/pkg/bazel"
"aspect.build/cli/pkg/ioutils"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
. "github.com/onsi/gomega"
"github.com/spf13/cobra"

shared "aspect.build/cli/pkg/aspect/query"
"aspect.build/cli/pkg/aspect/query/cquery"
query_mock "aspect.build/cli/pkg/aspect/query/mock"
"aspect.build/cli/pkg/aspect/cquery"
"aspect.build/cli/pkg/aspect/query/shared"
query_mock "aspect.build/cli/pkg/aspect/query/shared/mock"
bazel_mock "aspect.build/cli/pkg/bazel/mock"
"aspect.build/cli/pkg/ioutils"
)
Expand Down
22 changes: 19 additions & 3 deletions pkg/aspect/query/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "query",
srcs = ["query.go"],
importpath = "aspect.build/cli/pkg/aspect/query",
visibility = ["//visibility:public"],
deps = [
"//pkg/aspecterrors",
"//pkg/aspect/query/shared",
"//pkg/bazel",
"//pkg/ioutils",
"@com_github_manifoldco_promptui//:promptui",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
],
)

go_test(
name = "query_test",
srcs = ["query_test.go"],
deps = [
":query",
"//pkg/aspect/query/shared",
"//pkg/aspect/query/shared/mock",
"//pkg/bazel/mock",
"//pkg/ioutils",
"@com_github_golang_mock//gomock",
"@com_github_onsi_gomega//:gomega",
"@com_github_spf13_cobra//:cobra",
"@com_github_spf13_viper//:viper",
],
)
Loading

0 comments on commit fe60e7f

Please sign in to comment.