Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gazelle/buf/buf_lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package buf

// bufLock is subset of the `buf.lock` representation copied from bufbuild/buf
//
//
// Must be kept in sync with: bufbuild/buf/private/bufpkg/buflock.ExternalConfigV1
type bufLock struct {
Version string `yaml:"version,omitempty" json:"version,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions gazelle/buf/buf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func TestPush(t *testing.T) {
testRunGazelle(t, "push")
}

func TestMerge(t *testing.T) {
t.Parallel()
testRunGazelle(t, "merge")
}

func TestImportResolve(t *testing.T) {
t.Parallel()
testRunGazelle(t, "imports", "update-repos", "--from_file=buf.work.yaml", "-to_macro=buf_deps.bzl%buf_deps", "-prune")
Expand Down
2 changes: 1 addition & 1 deletion gazelle/buf/buf_work.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package buf

// bufWork is a subset of the `buf.work.yaml` representation copied from bufbuild/buf
//
//
// Must be kept in sync with: bufbuild/buf/private/buf/bufwork.ExternalConfigV1
type bufWork struct {
Version string `yaml:"version,omitempty" json:"version,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion gazelle/buf/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func shouldRemoveSingleTargetBufRule(
// Not generated by us
return false
}
if len(targets) == 1 && protoRuleMap[targets[0]] != nil {
if len(targets) == 1 && protoRuleMap[strings.TrimPrefix(targets[0], ":")] != nil {
Comment thread
emcfarlane marked this conversation as resolved.
// Target is accurate so skip
return false
}
Expand Down
2 changes: 2 additions & 0 deletions gazelle/buf/testdata/merge/BUILD.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# gazelle:buf_breaking_against //:against_file
# gazelle:buf_breaking_mode package
2 changes: 2 additions & 0 deletions gazelle/buf/testdata/merge/BUILD.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# gazelle:buf_breaking_against //:against_file
# gazelle:buf_breaking_mode package
7 changes: 7 additions & 0 deletions gazelle/buf/testdata/merge/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
24 changes: 24 additions & 0 deletions gazelle/buf/testdata/merge/foo/v1/BUILD.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_buf//buf:defs.bzl", "buf_breaking_test", "buf_lint_test")

proto_library(
name = "foo_proto",
srcs = ["foo.proto"],
visibility = ["//visibility:public"],
)

buf_lint_test(
name = "foo_proto_lint",
size = "small",
config = "//:buf.yaml",
targets = [":foo_proto"],
)

buf_breaking_test(
name = "foo_proto_breaking",
size = "small",
against = "//:against_file",
config = "//:buf.yaml",
limit_to_input_files = True,
targets = [":foo_proto"],
)
24 changes: 24 additions & 0 deletions gazelle/buf/testdata/merge/foo/v1/BUILD.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_buf//buf:defs.bzl", "buf_breaking_test", "buf_lint_test")

proto_library(
name = "foo_proto",
srcs = ["foo.proto"],
visibility = ["//visibility:public"],
)

buf_lint_test(
name = "foo_proto_lint",
size = "small",
config = "//:buf.yaml",
targets = [":foo_proto"],
)

buf_breaking_test(
name = "foo_proto_breaking",
size = "small",
against = "//:against_file",
config = "//:buf.yaml",
limit_to_input_files = True,
targets = [":foo_proto"],
)
Empty file.