Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bazelbuild/buildtools
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.3.2
Choose a base ref
...
head repository: bazelbuild/buildtools
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.3.3
Choose a head ref
  • 5 commits
  • 36 files changed
  • 4 contributors

Commits on Aug 21, 2023

  1. Also generate import-style targets with Gazelle (#1173)

    Since the repo uses checked-in build files, it should support both the
    `import` and `go_default_library` naming conventions supported by
    Gazelle to ensure that it works with all possible values of the
    `gazelle:go_naming_convention_external` directive.
    
    This is achieved by using `gazelle:go_naming_convention import_alias`.
    fmeum authored Aug 21, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    4f43986 View commit details

Commits on Aug 23, 2023

  1. 1
    Copy the full SHA
    691e01a View commit details
  2. Update code owners (#1182)

    vladmos authored Aug 23, 2023
    1
    Copy the full SHA
    ae8e320 View commit details
  3. 1
    Copy the full SHA
    5662808 View commit details

Commits on Aug 25, 2023

  1. Add format command to force unconditional formatting (#1186)

    This allows users of buildozer to format files without also having
    buildifier installed. This was possible previously by making a trivial
    edit and reverting it, but a dedicated command is cleaner.
    
    Will be used as part of the upcoming `bazel mod tidy` command.
    fmeum authored Aug 25, 2023
    1
    Copy the full SHA
    b163fcf View commit details
15 changes: 8 additions & 7 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -21,21 +21,22 @@ test_suite(
name = "tests",
tests = [
"//api_proto:api.gen.pb.go_checkshtest",
"//build:go_default_test",
"//build:build_test",
"//build_proto:build.gen.pb.go_checkshtest",
"//buildifier:buildifier_integration_test",
"//deps_proto:deps.gen.pb.go_checkshtest",
"//edit:go_default_test",
"//edit:edit_test",
"//extra_actions_base_proto:extra_actions_base.gen.pb.go_checkshtest",
"//labels:go_default_test",
"//labels:labels_test",
"//lang:tables.gen.go_checkshtest",
"//tables:go_default_test",
"//warn:go_default_test",
"//warn/docs:go_default_test",
"//wspace:go_default_test",
"//tables:tables_test",
"//warn:warn_test",
"//warn/docs:docs_test",
"//wspace:wspace_test",
],
)

#gazelle:go_naming_convention import_alias
gazelle(
name = "gazelle",
prefix = "github.com/bazelbuild/buildtools",
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Admins
* @vladmos @pmbethe09 @meisterT
* @vladmos @pmbethe09 @larsrc-google
1 change: 0 additions & 1 deletion WARNINGS.md
Original file line number Diff line number Diff line change
@@ -765,7 +765,6 @@ The statement has no effect. Consider removing it or storing its result in a var

* Category name: `out-of-order-load`
* Automatic fix: yes
* [Disabled by default](buildifier/README.md#linter)
* [Suppress the warning](#suppress): `# buildifier: disable=out-of-order-load`

Load statements should be ordered by their first argument - extension file label.
8 changes: 7 additions & 1 deletion api_proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -23,8 +23,14 @@ go_proto_library(
)

go_library(
name = "go_default_library",
name = "api_proto",
embed = [":api_proto_go_proto"],
importpath = "github.com/bazelbuild/buildtools/api_proto",
visibility = ["//visibility:public"],
)

alias(
name = "go_default_library",
actual = ":api_proto",
visibility = ["//visibility:public"],
)
16 changes: 11 additions & 5 deletions build/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ go_yacc(
)

go_library(
name = "go_default_library",
name = "build",
srcs = [
"lex.go",
"parse.y.baz.go", # keep
@@ -23,12 +23,12 @@ go_library(
importpath = "github.com/bazelbuild/buildtools/build",
visibility = ["//visibility:public"],
deps = [
"//tables:go_default_library",
"//tables",
],
)

go_test(
name = "go_default_test",
name = "build_test",
size = "small",
srcs = [
"checkfile_test.go",
@@ -49,9 +49,15 @@ go_test(
"rewrite_test_files/original_formatted.star",
"rewrite_test_files/original.star",
],
embed = [":go_default_library"],
embed = [":build"],
deps = [
"//tables:go_default_library",
"//tables",
"//testutils",
],
)

alias(
name = "go_default_library",
actual = ":build",
visibility = ["//visibility:public"],
)
16 changes: 15 additions & 1 deletion build_proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//build:build_defs.bzl", "go_proto_checkedin_test")
@@ -18,8 +19,21 @@ proto_library(
)

go_proto_library(
name = "go_default_library",
name = "build_proto_go_proto",
importpath = "github.com/bazelbuild/buildtools/build_proto",
proto = ":blaze_query_proto",
visibility = ["//visibility:public"],
)

go_library(
name = "build_proto",
embed = [":build_proto_go_proto"],
importpath = "github.com/bazelbuild/buildtools/build_proto",
visibility = ["//visibility:public"],
)

alias(
name = "go_default_library",
actual = ":build_proto",
visibility = ["//visibility:public"],
)
26 changes: 12 additions & 14 deletions buildifier/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -2,14 +2,14 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_binary(
name = "buildifier",
embed = [":go_default_library"],
embed = [":buildifier_lib"],
visibility = ["//visibility:public"],
)

go_binary(
name = "buildifier-darwin",
out = "buildifier-darwin_amd64",
embed = [":go_default_library"],
embed = [":buildifier_lib"],
goarch = "amd64",
goos = "darwin",
pure = "on",
@@ -19,7 +19,7 @@ go_binary(
go_binary(
name = "buildifier-linux",
out = "buildifier-linux_amd64",
embed = [":go_default_library"],
embed = [":buildifier_lib"],
goarch = "amd64",
goos = "linux",
pure = "on",
@@ -29,7 +29,7 @@ go_binary(
go_binary(
name = "buildifier-windows",
out = "buildifier-windows_amd64.exe",
embed = [":go_default_library"],
embed = [":buildifier_lib"],
goarch = "amd64",
goos = "windows",
pure = "on",
@@ -39,7 +39,7 @@ go_binary(
go_binary(
name = "buildifier-darwin-arm64",
out = "buildifier-darwin_arm64",
embed = [":go_default_library"],
embed = [":buildifier_lib"],
goarch = "arm64",
goos = "darwin",
pure = "on",
@@ -49,7 +49,7 @@ go_binary(
go_binary(
name = "buildifier-linux-arm64",
out = "buildifier-linux_arm64",
embed = [":go_default_library"],
embed = [":buildifier_lib"],
goarch = "arm64",
goos = "linux",
pure = "on",
@@ -73,7 +73,7 @@ sh_test(
)

go_library(
name = "go_default_library",
name = "buildifier_lib",
srcs = ["buildifier.go"],
importpath = "github.com/bazelbuild/buildtools/buildifier",
visibility = ["//visibility:private"],
@@ -82,13 +82,11 @@ go_library(
"main.buildScmRevision": "{STABLE_buildScmRevision}",
},
deps = [
"//build:go_default_library",
"//buildifier/config:go_default_library",
"//buildifier/utils:go_default_library",
"//differ:go_default_library",
"//tables:go_default_library",
"//warn:go_default_library",
"//wspace:go_default_library",
"//build",
"//buildifier/config",
"//buildifier/utils",
"//differ",
"//wspace",
],
)

18 changes: 12 additions & 6 deletions buildifier/config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "go_default_library",
name = "config",
srcs = [
"config.go",
"validation.go",
],
importpath = "github.com/bazelbuild/buildtools/buildifier/config",
visibility = ["//buildifier:__pkg__"],
deps = [
"//tables:go_default_library",
"//warn:go_default_library",
"//wspace:go_default_library",
"//tables",
"//warn",
"//wspace",
],
)

go_test(
name = "go_default_test",
name = "config_test",
srcs = ["config_test.go"],
embed = [":go_default_library"],
embed = [":config"],
)

alias(
name = "go_default_library",
actual = ":config",
visibility = ["//visibility:public"],
)
10 changes: 5 additions & 5 deletions buildifier/config/config_test.go
Original file line number Diff line number Diff line change
@@ -335,7 +335,7 @@ func TestValidate(t *testing.T) {
// "native-proto",
// "native-py",
"no-effect",
// "out-of-order-load",
"out-of-order-load",
"output-group",
"overly-nested-depset",
"package-name",
@@ -357,7 +357,7 @@ func TestValidate(t *testing.T) {
// "unsorted-dict-items",
"unused-variable",
}},
"warnings plus/minus": {options: "--warnings=+out-of-order-load,-print,-deprecated-function", wantWarnings: []string{
"warnings plus/minus": {options: "--warnings=+native-cc,-print,-deprecated-function", wantWarnings: []string{
"attr-applicable_licenses",
"attr-cfg",
"attr-license",
@@ -394,12 +394,12 @@ func TestValidate(t *testing.T) {
"name-conventions",
// "native-android",
"native-build",
// "native-cc",
// "native-java",
"native-package",
// "native-proto",
// "native-py",
"no-effect",
"out-of-order-load",
"output-group",
"overly-nested-depset",
"package-name",
@@ -420,9 +420,9 @@ func TestValidate(t *testing.T) {
"unreachable",
// "unsorted-dict-items",
"unused-variable",
"out-of-order-load",
"native-cc",
}},
"warnings error": {options: "--warnings=out-of-order-load,-print,-deprecated-function", wantErr: fmt.Errorf(`warning categories with modifiers ("+" or "-") can't be mixed with raw warning categories`)},
"warnings error": {options: "--warnings=native-cc,-print,-deprecated-function", wantErr: fmt.Errorf(`warning categories with modifiers ("+" or "-") can't be mixed with raw warning categories`)},
} {
t.Run(name, func(t *testing.T) {
c := New()
16 changes: 11 additions & 5 deletions buildifier/utils/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 = "utils",
srcs = [
"diagnostics.go",
"tempfile.go",
@@ -10,13 +10,19 @@ go_library(
importpath = "github.com/bazelbuild/buildtools/buildifier/utils",
visibility = ["//buildifier:__subpackages__"],
deps = [
"//build:go_default_library",
"//warn:go_default_library",
"//build",
"//warn",
],
)

go_test(
name = "go_default_test",
name = "utils_test",
srcs = ["utils_test.go"],
embed = [":go_default_library"],
embed = [":utils"],
)

alias(
name = "go_default_library",
actual = ":utils",
visibility = ["//visibility:public"],
)
10 changes: 5 additions & 5 deletions buildifier2/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 = "buildifier2_lib",
srcs = ["buildifier2.go"],
importpath = "github.com/bazelbuild/buildtools/buildifier2",
visibility = ["//visibility:private"],
deps = [
"//build:go_default_library",
"//convertast:go_default_library",
"@skylark_syntax//syntax:go_default_library",
"//build",
"//convertast",
"@skylark_syntax//syntax",
],
)

go_binary(
name = "buildifier2",
embed = [":go_default_library"],
embed = [":buildifier2_lib"],
visibility = ["//visibility:public"],
)
Loading