Skip to content

Commit

Permalink
Change import style used by gazelle, which fixes tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
reddaly authored and gonzojive committed Oct 4, 2021
1 parent 777a2fd commit 4eb7d7d
Show file tree
Hide file tree
Showing 35 changed files with 183 additions and 159 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ load("@bazel_gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/google/xtoproto
# gazelle:proto_import_prefix github.com/google/xtoproto
# gazelle:go_naming_convention import
gazelle(name = "gazelle")
8 changes: 4 additions & 4 deletions bazel/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ def go_xtoproto_converter_library(name, request, importpath, deps=None, visibili
deps = []

final_deps = deps + [
"@xtoproto//csvtoprotoparse:go_default_library",
"@xtoproto//protocp:go_default_library",
"@xtoproto//csvcoder:go_default_library",
"@xtoproto//textcoder:go_default_library",
"@xtoproto//csvtoprotoparse",
"@xtoproto//protocp",
"@xtoproto//csvcoder",
"@xtoproto//textcoder",
"@org_golang_google_protobuf//proto:go_default_library",
]
go_library(
Expand Down
10 changes: 5 additions & 5 deletions cmd/xtoproto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "go_default_library",
name = "xtoproto_lib",
srcs = ["xtoproto.go"],
importpath = "github.com/google/xtoproto/cmd/xtoproto",
visibility = ["//visibility:private"],
deps = [
"//proto/service:go_default_library",
"//service:go_default_library",
"@org_golang_google_protobuf//encoding/prototext:go_default_library",
"//proto/service",
"//service",
"@org_golang_google_protobuf//encoding/prototext",
],
)

go_binary(
name = "xtoproto",
embed = [":go_default_library"],
embed = [":xtoproto_lib"],
visibility = ["//visibility:public"],
)
6 changes: 3 additions & 3 deletions cmd/xtoproto_web/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "go_default_library",
name = "xtoproto_web_lib",
srcs = ["xtoproto_web.go"],
data = [
"//playground:playground_files",
],
importpath = "github.com/google/xtoproto/cmd/xtoproto_web",
visibility = ["//visibility:private"],
deps = [
"@com_github_golang_glog//:go_default_library",
"@com_github_golang_glog//:glog",
"@io_bazel_rules_go//go/tools/bazel:go_default_library",
],
)

go_binary(
name = "xtoproto_web",
embed = [":go_default_library"],
embed = [":xtoproto_web_lib"],
visibility = ["//visibility:public"],
)
12 changes: 6 additions & 6 deletions csvcoder/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
name = "csvcoder",
srcs = [
"csvcoder_cell.go",
"csvcoder_file.go",
Expand All @@ -10,18 +10,18 @@ go_library(
],
importpath = "github.com/google/xtoproto/csvcoder",
visibility = ["//visibility:public"],
deps = ["//textcoder:go_default_library"],
deps = ["//textcoder"],
)

go_test(
name = "go_default_test",
name = "csvcoder_test",
srcs = [
"csvcoder_examples_test.go",
"csvcoder_test.go",
],
embed = [":go_default_library"],
embed = [":csvcoder"],
deps = [
"//textcoder:go_default_library",
"@com_github_google_go_cmp//cmp:go_default_library",
"//textcoder",
"@com_github_google_go_cmp//cmp",
],
)
15 changes: 8 additions & 7 deletions csvinfer/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
name = "csvinfer",
srcs = ["csvinfer.go"],
importpath = "github.com/google/xtoproto/csvinfer",
visibility = ["//visibility:public"],
deps = ["//recordinfer:go_default_library"],
deps = ["//recordinfer"],
)

go_test(
name = "go_default_test",
name = "csvinfer_test",
srcs = ["csvinfer_test.go"],
embed = [":go_default_library"],
embed = [":csvinfer"],
deps = [
"//recordinfer:go_default_library",
"@com_github_google_go_cmp//cmp:go_default_library",
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
"//proto/recordtoproto",
"//recordinfer",
"@com_github_google_go_cmp//cmp",
"@org_golang_google_protobuf//testing/protocmp",
],
)
9 changes: 5 additions & 4 deletions csvtoproto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
name = "csvtoproto",
srcs = [
"csvtoproto.go",
"csvtoproto_go_codegen.go",
],
importpath = "github.com/google/xtoproto/csvtoproto",
visibility = ["//visibility:public"],
deps = [
"@com_github_golang_glog//:go_default_library",
"@com_github_mitchellh_go_wordwrap//:go_default_library",
"@com_github_stoewer_go_strcase//:go_default_library",
"//proto/recordtoproto",
"@com_github_golang_glog//:glog",
"@com_github_mitchellh_go_wordwrap//:go-wordwrap",
"@com_github_stoewer_go_strcase//:go-strcase",
],
)
6 changes: 3 additions & 3 deletions csvtoprotoparse/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
name = "csvtoprotoparse",
srcs = ["csvtoprotoparse.go"],
importpath = "github.com/google/xtoproto/csvtoprotoparse",
visibility = ["//visibility:public"],
deps = [
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@org_golang_google_protobuf//types/known/durationpb:go_default_library",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
"@org_golang_google_protobuf//types/known/durationpb",
"@org_golang_google_protobuf//types/known/timestamppb",
],
)
2 changes: 1 addition & 1 deletion examples/example01/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ load("@xtoproto//bazel:defs.bzl", "go_xtoproto_converter_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
name = "example01",
embed = [":mypackage_go_proto"],
importpath = "github.com/google/xtoproto/examples/example01",
visibility = ["//visibility:public"],
Expand Down
21 changes: 16 additions & 5 deletions examples/example01/converter/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
load("@xtoproto//bazel:defs.bzl", "go_xtoproto_converter_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

# gazelle:resolve go github.com/google/xtoproto/examples/example01/converter :go_default_library
# gazelle:resolve go github.com/google/xtoproto/examples/example01/converter :converter
go_xtoproto_converter_library(
name = "go_default_library",
name = "converter",
importpath = "github.com/google/xtoproto/examples/example01/converter",
request = "codegen_request.pbtxt",
deps = [
"//examples/example01:go_default_library",
"//examples/example01",
],
)

go_test(
name = "go_default_test",
srcs = ["converter_test.go"],
deps = [
"//examples/example01:go_default_library",
"//examples/example01/converter:go_default_library",
"//examples/example01",
"//examples/example01/converter",
"@com_github_google_go_cmp//cmp:go_default_library",
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
],
)

go_test(
name = "converter_test",
srcs = ["converter_test.go"],
deps = [
"//examples/example01",
"//examples/example01/converter",
"@com_github_google_go_cmp//cmp",
"@org_golang_google_protobuf//testing/protocmp",
],
)
2 changes: 1 addition & 1 deletion examples/example02/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ go_proto_library(
)

go_library(
name = "go_default_library",
name = "example02",
embed = [":mycompany_mypackage_go_proto"],
importpath = "github.com/google/xtoproto/examples/example02",
visibility = ["//visibility:public"],
Expand Down
26 changes: 20 additions & 6 deletions examples/example02/converter02/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
load("@xtoproto//bazel:defs.bzl", "go_xtoproto_converter_library")
load("@io_bazel_rules_go//go:def.bzl", "go_test")

# gazelle:resolve go github.com/google/xtoproto/examples/example02/converter02 :go_default_library
# gazelle:resolve go github.com/google/xtoproto/examples/example02/converter02 :converter02
go_xtoproto_converter_library(
name = "go_default_library",
name = "converter02",
importpath = "github.com/google/xtoproto/examples/example02/converter02",
request = "codegen_request.pbtxt",
deps = [
"//examples/example02:go_default_library",
"//examples/example02",
],
)

go_test(
name = "go_default_test",
srcs = ["converter02_test.go"],
deps = [
"//csvtoprotoparse:go_default_library",
"//examples/example02:go_default_library",
"//examples/example02/converter02:go_default_library",
"//csvtoprotoparse",
"//examples/example02",
"//examples/example02/converter02",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_google_go_cmp//cmp:go_default_library",
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
],
)

go_test(
name = "converter02_test",
srcs = ["converter02_test.go"],
deps = [
"//csvtoprotoparse",
"//examples/example02",
"//examples/example02/converter02",
"@com_github_golang_protobuf//ptypes:go_default_library_gen",
"@com_github_google_go_cmp//cmp",
"@org_golang_google_protobuf//testing/protocmp",
"@org_golang_google_protobuf//types/known/timestamppb",
],
)
24 changes: 12 additions & 12 deletions internal/protoreflectcmp/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
name = "protoreflectcmp",
srcs = [
"protoreflectcmp.go",
"protoreflectcmp_list_impl.go",
],
importpath = "github.com/google/xtoproto/internal/protoreflectcmp",
visibility = ["//:__subpackages__"],
deps = [
"@com_github_google_go_cmp//cmp:go_default_library",
"@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@com_github_google_go_cmp//cmp",
"@com_github_google_go_cmp//cmp/cmpopts",
"@org_golang_google_protobuf//proto",
"@org_golang_google_protobuf//reflect/protoreflect",
],
)

go_test(
name = "go_default_test",
name = "protoreflectcmp_test",
srcs = ["protoreflectcmp_test.go"],
embed = [":go_default_library"],
embed = [":protoreflectcmp"],
deps = [
"//proto/wirepath/testproto:go_default_library",
"@com_github_google_go_cmp//cmp:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//testing/protocmp:go_default_library",
"//proto/wirepath/testproto",
"@com_github_google_go_cmp//cmp",
"@org_golang_google_protobuf//proto",
"@org_golang_google_protobuf//reflect/protoreflect",
"@org_golang_google_protobuf//testing/protocmp",
],
)
2 changes: 1 addition & 1 deletion internal/protoutil/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "go_default_library",
name = "protoutil",
srcs = ["protoutil.go"],
importpath = "github.com/google/xtoproto/internal/protoutil",
visibility = ["//:__subpackages__"],
Expand Down
12 changes: 6 additions & 6 deletions playground/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
#load("defs.bzl", "")

go_library(
name = "go_default_library",
name = "playground_lib",
srcs = ["playground.go"],
importpath = "github.com/google/xtoproto/playground",
visibility = ["//visibility:private"],
deps = select({
"@io_bazel_rules_go//go/platform:js_wasm": [
"//proto/service:go_default_library",
"//service:go_default_library",
"@org_golang_google_protobuf//encoding/prototext:go_default_library",
"@org_golang_google_protobuf//proto:go_default_library",
"//proto/service",
"//service",
"@org_golang_google_protobuf//encoding/prototext",
"@org_golang_google_protobuf//proto",
],
"//conditions:default": [],
}),
Expand All @@ -20,7 +20,7 @@ go_library(
go_binary(
name = "playground",
out = "playground.wasm",
embed = [":go_default_library"],
embed = [":playground_lib"],
goarch = "wasm",
goos = "js",
pure = "on",
Expand Down
2 changes: 1 addition & 1 deletion proto/recordtoproto/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ go_proto_library(
)

go_library(
name = "go_default_library",
name = "recordtoproto",
embed = [":recordtoproto_go_proto"],
importpath = "github.com/google/xtoproto/proto/recordtoproto",
visibility = ["//visibility:public"],
Expand Down
4 changes: 2 additions & 2 deletions proto/service/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ go_proto_library(
importpath = "github.com/google/xtoproto/proto/service",
proto = ":service_proto",
visibility = ["//visibility:public"],
deps = ["//proto/recordtoproto:go_default_library"],
deps = ["//proto/recordtoproto"],
)

go_library(
name = "go_default_library",
name = "service",
embed = [":service_go_proto"],
importpath = "github.com/google/xtoproto/proto/service",
visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion proto/wirepath/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ go_proto_library(
)

go_library(
name = "go_default_library",
name = "wirepath",
embed = [":wirepath_go_proto"],
importpath = "github.com/google/xtoproto/proto/wirepath",
visibility = ["//visibility:public"],
Expand Down
Loading

0 comments on commit 4eb7d7d

Please sign in to comment.