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: 6.1.0
Choose a base ref
...
head repository: bazelbuild/buildtools
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6.1.1
Choose a head ref
  • 10 commits
  • 25 files changed
  • 5 contributors

Commits on Mar 30, 2023

  1. Add external repo support to unused_deps. (#1151)

    External repo targets can be passed as arguments to unused_deps and unused
    external repo dependencies are detected.
    
    When an external repo BUILD file needs to be edited to remove an unused
    dependency, the generated buildozer command will need some postprocessing.  The
    unused_deps utility does not know the file system location of the BUILD file,
    just its external repo label.
    brown authored Mar 30, 2023
    Copy the full SHA
    7ca77e1 View commit details

Commits on Apr 12, 2023

  1. Add use_repo_add and use_repo_remove commands (#1152)

    * Preserve compactness of `use_repo` and `use_extension` calls
    
    * Add `use_repo_add` and `use_repo_remove` commands
    
    These commands can be used to programmatically update `use_repo` calls
    in MODULE.bazel files. In the future, Bazel will emit buildozer fixups
    relying on this command when it detects that such calls are out-of-date.
    
    * Adapt label normalization to be closer to upstream
    
    * Fix CI
    fmeum authored Apr 12, 2023
    Copy the full SHA
    a3f457d View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    686e1a3 View commit details
  3. Copy the full SHA
    b5478f9 View commit details

Commits on Apr 13, 2023

  1. Copy the full SHA
    7044e4b View commit details

Commits on Apr 24, 2023

  1. Fix empty package() calls appearing in non-BUILD files (#1150)

    * Fix empty `package()` calls appearing in non-BUILD files
    
    Caused by 9c3c1fc,
    but only relevant if users use the target `__pkg__` to skip target-level
    processing for non-BUILD files.
    fmeum authored Apr 24, 2023
    Copy the full SHA
    aa477c7 View commit details
  2. Upgrade Go SDK, rules_go, bazel_gazelle versions (#1158)

    * WORKSPACE: Upgrade Go SDK 1.20.3, rules_go v0.39.1, bazel_gazelle v0.30.0
    
    * buildifier: Update README instructions with new archive versions
    
    * *: Refresh checked-in generated source files
    LINKIWI authored Apr 24, 2023
    Copy the full SHA
    cae7039 View commit details
  3. Add set_select to set attr value to a select (#1153)

    This code change adds a new command `set_select` which allows
    setting the value of an attribute to a call to `select` and builds
    the dict using the KVs passed to it.
    
    Example call:
    ```
    set_select <attr> <key_1> <value_1> <key_n> <value_n>
    ```
    healthy-pod authored Apr 24, 2023
    Copy the full SHA
    43e3add View commit details

Commits on Apr 25, 2023

  1. Copy the full SHA
    a4c276b View commit details
  2. 1
    Copy the full SHA
    3dcc8d6 View commit details
14 changes: 7 additions & 7 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -4,25 +4,25 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(version = "1.17.2")
go_register_toolchains(version = "1.20.3")

http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
],
)

3 changes: 2 additions & 1 deletion api_proto/api.gen.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 38 additions & 38 deletions build/parse.y.go
Original file line number Diff line number Diff line change
@@ -395,7 +395,7 @@ func getLastBody(stmt Expr) *[]Expr {
}

//line yacctab:1
var yyExca = [...]int{
var yyExca = [...]int16{
-1, 1,
1, -1,
-2, 0,
@@ -411,7 +411,7 @@ const yyPrivate = 57344

const yyLast = 1052

var yyAct = [...]int{
var yyAct = [...]int16{
20, 31, 234, 250, 146, 2, 29, 108, 186, 106,
7, 147, 195, 95, 160, 43, 152, 9, 23, 187,
159, 105, 240, 220, 174, 40, 87, 88, 89, 90,
@@ -520,7 +520,7 @@ var yyAct = [...]int{
72, 73,
}

var yyPact = [...]int{
var yyPact = [...]int16{
-1000, -1000, 313, -1000, -1000, -1000, -34, -1000, -1000, -1000,
192, 72, -1000, 173, 971, -1000, -1000, -1000, -10, 49,
590, 68, 971, 151, 88, 971, 971, 971, 971, -1000,
@@ -550,15 +550,15 @@ var yyPact = [...]int{
1, -18, 590, -1000, -1000, -1000, -1000,
}

var yyPgo = [...]int{
var yyPgo = [...]int16{
0, 16, 11, 4, 12, 269, 266, 19, 261, 260,
8, 259, 258, 0, 2, 88, 18, 98, 257, 101,
15, 255, 14, 20, 6, 253, 5, 252, 248, 244,
242, 241, 7, 17, 240, 13, 237, 236, 1, 9,
234, 3, 230, 229, 227, 226, 225, 224,
}

var yyR1 = [...]int{
var yyR1 = [...]int8{
0, 45, 39, 39, 46, 46, 40, 40, 40, 26,
26, 26, 26, 27, 27, 43, 44, 44, 28, 28,
28, 30, 30, 29, 29, 31, 31, 32, 34, 34,
@@ -576,7 +576,7 @@ var yyR1 = [...]int{
25, 25, 25, 25, 21, 22, 22, 23, 23,
}

var yyR2 = [...]int{
var yyR2 = [...]int8{
0, 2, 5, 2, 0, 2, 0, 3, 2, 0,
2, 2, 3, 1, 1, 5, 1, 3, 3, 6,
1, 4, 5, 1, 4, 2, 1, 4, 0, 3,
@@ -594,7 +594,7 @@ var yyR2 = [...]int{
3, 2, 2, 1, 4, 1, 3, 1, 2,
}

var yyChk = [...]int{
var yyChk = [...]int16{
-1000, -45, -26, 28, -27, 59, 27, -32, -28, -33,
-44, 30, -29, -17, 52, 53, 54, 55, -43, -30,
-13, 51, 34, -16, 39, 48, 10, 8, 24, -24,
@@ -624,7 +624,7 @@ var yyChk = [...]int{
9, 15, -13, 18, 6, -41, -38,
}

var yyDef = [...]int{
var yyDef = [...]int16{
9, -2, 0, 1, 10, 11, 0, 13, 14, 28,
0, 0, 20, 30, 32, 35, 36, 37, 16, 23,
85, 0, 0, 89, 67, 0, 0, 0, 0, 40,
@@ -654,7 +654,7 @@ var yyDef = [...]int{
126, 0, 82, 48, 44, 64, 66,
}

var yyTok1 = [...]int{
var yyTok1 = [...]int8{
1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
59, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@@ -670,14 +670,14 @@ var yyTok1 = [...]int{
3, 3, 3, 19, 21, 20, 24,
}

var yyTok2 = [...]int{
var yyTok2 = [...]int8{
2, 3, 25, 26, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 60, 61,
}

var yyTok3 = [...]int{
var yyTok3 = [...]int8{
0,
}

@@ -759,9 +759,9 @@ func yyErrorMessage(state, lookAhead int) string {
expected := make([]int, 0, 4)

// Look for shiftable tokens.
base := yyPact[state]
base := int(yyPact[state])
for tok := TOKSTART; tok-1 < len(yyToknames); tok++ {
if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok {
if n := base + tok; n >= 0 && n < yyLast && int(yyChk[int(yyAct[n])]) == tok {
if len(expected) == cap(expected) {
return res
}
@@ -771,13 +771,13 @@ func yyErrorMessage(state, lookAhead int) string {

if yyDef[state] == -2 {
i := 0
for yyExca[i] != -1 || yyExca[i+1] != state {
for yyExca[i] != -1 || int(yyExca[i+1]) != state {
i += 2
}

// Look for tokens that we accept or reduce.
for i += 2; yyExca[i] >= 0; i += 2 {
tok := yyExca[i]
tok := int(yyExca[i])
if tok < TOKSTART || yyExca[i+1] == 0 {
continue
}
@@ -808,30 +808,30 @@ func yylex1(lex yyLexer, lval *yySymType) (char, token int) {
token = 0
char = lex.Lex(lval)
if char <= 0 {
token = yyTok1[0]
token = int(yyTok1[0])
goto out
}
if char < len(yyTok1) {
token = yyTok1[char]
token = int(yyTok1[char])
goto out
}
if char >= yyPrivate {
if char < yyPrivate+len(yyTok2) {
token = yyTok2[char-yyPrivate]
token = int(yyTok2[char-yyPrivate])
goto out
}
}
for i := 0; i < len(yyTok3); i += 2 {
token = yyTok3[i+0]
token = int(yyTok3[i+0])
if token == char {
token = yyTok3[i+1]
token = int(yyTok3[i+1])
goto out
}
}

out:
if token == 0 {
token = yyTok2[1] /* unknown char */
token = int(yyTok2[1]) /* unknown char */
}
if yyDebug >= 3 {
__yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char))
@@ -886,7 +886,7 @@ yystack:
yyS[yyp].yys = yystate

yynewstate:
yyn = yyPact[yystate]
yyn = int(yyPact[yystate])
if yyn <= yyFlag {
goto yydefault /* simple state */
}
@@ -897,8 +897,8 @@ yynewstate:
if yyn < 0 || yyn >= yyLast {
goto yydefault
}
yyn = yyAct[yyn]
if yyChk[yyn] == yytoken { /* valid shift */
yyn = int(yyAct[yyn])
if int(yyChk[yyn]) == yytoken { /* valid shift */
yyrcvr.char = -1
yytoken = -1
yyVAL = yyrcvr.lval
@@ -911,7 +911,7 @@ yynewstate:

yydefault:
/* default state action */
yyn = yyDef[yystate]
yyn = int(yyDef[yystate])
if yyn == -2 {
if yyrcvr.char < 0 {
yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)
@@ -920,18 +920,18 @@ yydefault:
/* look through exception table */
xi := 0
for {
if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {
if yyExca[xi+0] == -1 && int(yyExca[xi+1]) == yystate {
break
}
xi += 2
}
for xi += 2; ; xi += 2 {
yyn = yyExca[xi+0]
yyn = int(yyExca[xi+0])
if yyn < 0 || yyn == yytoken {
break
}
}
yyn = yyExca[xi+1]
yyn = int(yyExca[xi+1])
if yyn < 0 {
goto ret0
}
@@ -953,10 +953,10 @@ yydefault:

/* find a state where "error" is a legal shift action */
for yyp >= 0 {
yyn = yyPact[yyS[yyp].yys] + yyErrCode
yyn = int(yyPact[yyS[yyp].yys]) + yyErrCode
if yyn >= 0 && yyn < yyLast {
yystate = yyAct[yyn] /* simulate a shift of "error" */
if yyChk[yystate] == yyErrCode {
yystate = int(yyAct[yyn]) /* simulate a shift of "error" */
if int(yyChk[yystate]) == yyErrCode {
goto yystack
}
}
@@ -992,7 +992,7 @@ yydefault:
yypt := yyp
_ = yypt // guard against "declared and not used"

yyp -= yyR2[yyn]
yyp -= int(yyR2[yyn])
// yyp is now the index of $0. Perform the default action. Iff the
// reduced production is ε, $1 is possibly out of range.
if yyp+1 >= len(yyS) {
@@ -1003,16 +1003,16 @@ yydefault:
yyVAL = yyS[yyp+1]

/* consult goto table to find next state */
yyn = yyR1[yyn]
yyg := yyPgo[yyn]
yyn = int(yyR1[yyn])
yyg := int(yyPgo[yyn])
yyj := yyg + yyS[yyp].yys + 1

if yyj >= yyLast {
yystate = yyAct[yyg]
yystate = int(yyAct[yyg])
} else {
yystate = yyAct[yyj]
if yyChk[yystate] != -yyn {
yystate = yyAct[yyg]
yystate = int(yyAct[yyj])
if int(yyChk[yystate]) != -yyn {
yystate = int(yyAct[yyg])
}
}
// dummy call; replaced with literal code
13 changes: 12 additions & 1 deletion build/print.go
Original file line number Diff line number Diff line change
@@ -318,6 +318,17 @@ func isBazelDep(x Expr) bool {
return false
}

func isUseRepoOrUseExtension(x Expr) bool {
call, ok := x.(*CallExpr)
if !ok {
return false
}
if ident, ok := call.X.(*Ident); ok && (ident.Name == "use_repo" || ident.Name == "use_extension") {
return true
}
return false
}

func isModuleOverride(x Expr) bool {
call, ok := x.(*CallExpr)
if !ok {
@@ -751,7 +762,7 @@ func (p *printer) expr(v Expr, outerPrec int) {

case *CallExpr:
forceCompact := v.ForceCompact
if p.fileType == TypeModule && isBazelDep(v) {
if p.fileType == TypeModule && (isBazelDep(v) || isUseRepoOrUseExtension(v)) {
start, end := v.Span()
forceCompact = start.Line == end.Line
}
2 changes: 1 addition & 1 deletion build_proto/build.gen.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions buildifier/README.md
Original file line number Diff line number Diff line change
@@ -89,10 +89,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# See https://github.com/bazelbuild/rules_go for the up to date setup instructions.
http_archive(
name = "io_bazel_rules_go",
sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)

@@ -102,14 +102,14 @@ go_rules_dependencies()

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains")

go_register_toolchains(version = "1.17.2")
go_register_toolchains(version = "1.20.3")

http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
],
)

1 change: 1 addition & 0 deletions buildifier/config/config_test.go
Original file line number Diff line number Diff line change
@@ -479,6 +479,7 @@ func TestFindConfigPath(t *testing.T) {
t.Run(name, func(t *testing.T) {
for k, v := range tc.env {
os.Setenv(k, v)
defer os.Unsetenv(k)
}

tmp, err := ioutil.TempDir("", name+"*")
Loading