Releases: bazelbuild/bazel-gazelle
Releases · bazelbuild/bazel-gazelle
v0.28.0
What's Changed
- language/proto: gen_known_imports creates structs instead of function calls by @eric-skydio in #1333
- Add DoneGeneratingRules language hook by @illicitonion in #1325
- Allow configuring timeout of generation tests by @illicitonion in #1324
- bug: Allow user-specified tags on gazelle rule by @Helcaraxan in #1308
- Replace _get_auth with Bazel's read_user_netrc by @linzhp in #1338
- language/go should consider default_visibility set by OtherGen (#783) by @dnathe4th in #1341
- fix: pass
visibility
attribute forgazelle
macro to resultingsh_binary
by @cgrindel in #1340 - Add additional bzlmod requirements to allow grpc protobufs to work by @shs96c in #1345
- bzlmod: Simplify go_grpc_library support by @fmeum in #1346
- bzlmod: Add support for custom
go_proto_library
compilers by @fmeum in #1348 - Add visibility extension to support recursive default_visibility (#783) by @dnathe4th in #1343
- Make
gazelle_generation_test
respect out suffix when generating golden files by @blorente in #1352 - Add size argument to
gazelle_generation_test
by @charlesoconor in #1351
New Contributors
- @eric-skydio made their first contribution in #1333
- @dnathe4th made their first contribution in #1341
- @cgrindel made their first contribution in #1340
- @shs96c made their first contribution in #1345
- @blorente made their first contribution in #1352
- @charlesoconor made their first contribution in #1351
Full Changelog: v0.27.0...v0.28.0
v0.27.0
What's Changed
- Use repo-relative labels everywhere by @fmeum in #1294
- Fix RST URL errors for rules_jvm by @qaisjp in #1296
- bzlmod prototype by @fmeum in #1266
- bzlmod: Do not create a repository with an invalid name by @fmeum in #1304
- language/go: Add support for //go:build tags by @thempatel in #1243
- Unwrap
go list -m -json
errors correctly by @fmeum in #1301 - Make one more label repo-relative by @fmeum in #1297
- bzlmod: Add go_deps.from_file by @fmeum in #1300
- language: add BaseLang by @sluongng in #1303
- Allow adding arguments to Rules by @illicitonion in #1310
- Register and parse flags before calling Kinds/Loads by @illicitonion in #1318
- SortMacro() should also sort the Loads by @tyler-french in #1321
- bzlmod: Fix canonical label literal after Bazel change by @fmeum in #1322
- update-repos: don't add repositories declared with gazelle:repository… by @tyler-french in #1326
- Look in call args for loadable symbols by @illicitonion in #1317
- SortMacro() should also sort rules by Kind() by @tyler-french in #1327
- bzlmod: Fix missing .format in go_deps by @fmeum in #1330
- bzlmod: Depend on rules_proto by @fmeum in #1331
New Contributors
Full Changelog: v0.26.0...v0.27.0
v0.26.0
What's Changed
- fix(tests): fix gazelle_generation_test expected stderr update by @jbedard in #1220
- Add an e2e test confirming no output on success by @achew22 in #1216
- Update extend.md with a practical languages example by @Anthony-Bible in #1222
- fix: Remove gazelle_binary import collision by @illicitonion in #1226
- Broaden label name regex by @illicitonion in #1229
- gazelle_generation_test: redact workspace path from output by @dr-dime in #1231
- Add -print0 to print names of rewritten files by @dr-dime in #1213
- Code Quality Improvements by @sluongng in #1197
- Add -strict to exit on build file and directive errors by @dr-dime in #1214
- fix(lang/proto): include imports from different targets by @nickgooding in #1237
- Update rules example in README to v0.25.0 by @yujunz in #1240
- Allow static dependency resolution for Gazelle rule by @uhthomas in #1242
- Handle wrapped errors by @illicitonion in #1234
- Go: Update tests to use cmp.Diff instead of reflect.DeepEqual by @thempatel in #1244
- Fix startup script manifest resolution with --nolegacy_external_runfiles by @jvolkman in #1247
- Label's package may contain @s by @illicitonion in #1249
- Trim runfiles prefix consistently by @uhthomas in #1257
- Respect .bazelignore by @Whoaa512 in #1245
- Implement very minimalistic support for go workspaces by @HakanSunay in #1250
- Fix typo in comment by @yujunz in #1270
- Use
patch
from@bazel_tools//tools/build_defs/repo:utils.bzl
by @bozaro in #1269 - Update rules_go to 0.33.0 by @fmeum in #1263
- Add support for auth_patterns in go_repository by @dmivankov in #1254
- Sluongng/revert patch by @sluongng in #1277
- Stop inferring import path for empty packages by @linzhp in #1280
- Don't exclude spaces from the label name regex by @illicitonion in #1271
New Contributors
- @Anthony-Bible made their first contribution in #1222
- @dr-dime made their first contribution in #1231
- @sluongng made their first contribution in #1197
- @nickgooding made their first contribution in #1237
- @yujunz made their first contribution in #1240
- @uhthomas made their first contribution in #1242
- @thempatel made their first contribution in #1244
- @Whoaa512 made their first contribution in #1245
- @HakanSunay made their first contribution in #1250
- @bozaro made their first contribution in #1269
- @fmeum made their first contribution in #1263
- @dmivankov made their first contribution in #1254
Full Changelog: v0.25.0...v0.26.0
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_gazelle",
sha256 = "501deb3d5695ab658e82f6f6f549ba681ea3ca2a5fb7911154b5aa45596183fa",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################
gazelle_dependencies()
v0.25.0
Go changes
- Introduce static dependency resolution mode which prevents Gazelle from calling out the network.
go_repository
rules now default to this mode, showing significant performance improvements for some repo rules by @blico in #1201 go_repository
rules no longer log Gazelle warnings, unlessdebug
mode is explictly set by @blico in #1205- Support
canonical_id
attribute forgo_repository
by @kmicklas in #1121
Proto changes
General changes
- gazelle_generation_test utility for running the gazelle binary on a set of test workspaces by @aptenodytes-forsteri in #1183
- Introduced
rule.AddAlias
func to support loading aliased symbols by @dorfire in #1127 FixLoad
now generatesload
statements for helper functions by @illicitonion in #1164- Many more bug fixes and documentation updates, thanks to everyone who helped out!
Full Changelog: v0.24.0...v0.25.0
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_gazelle",
sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################
gazelle_dependencies()
v0.24.0
This release requires rules_go 0.29 to support the retirement of go_tool_library
.
IMPORTANT
This release includes many new dependencies. Please be sure that your own workspace's dependencies are declared PRIOR to gazelle_dependencies()
, or else they may be overridden. See the prompt block comment in the boilerplate below.
Changes
- .netrc files are now supported for authenticated access for
go_repository
rules (#1090) - There is now a Gazelle extension for authoring BUILD files for the R language, using rules_r.
Fixes
- language/go: don't let 'go mod download' edit go.sum by @jayconrod in #1015
- Label fix: properly parse external references to the main repository by @tfrench-uber in #1006
- gazelle: add -e flag for go list 1.16 by @axelberardino in #1019
- Correctly propagate runfiles from gazelle_bin to gazelle by @HALtheWise in #1008
- Support Label @repo -> @repo//:repo shorthand by @wolfd in #1023
- language/go: rewrite embedResolver to use a tree structure by @jayconrod in #1024
- Respect .bazelignore by @Michaelhobo in #1022
- Change merge behavior to remove attrs instead of panicking by @wolfd in #1031
- Allow ListRepositories to load macros not in Workspace by @tfrench-uber in #1053
- Honor host GOMODCACHE when GO_REPOSITORY_USE_HOST_CACHE by @linzhp in #1069
- language/go: add golang.org/x/tools/internal/typeparams to nogo deps list by @jayconrod in #1074
- Fix "exclude" token parsing by @gibfahn in #1073
- Have label properly resolve directives starting with "@//" by @tfrench-uber in #1086
- Correctly propagate runfiles from data dependencies to gazelle by @alexeagle in #1094
- Add bzl_library targets to Gazelle by @achew22 in #760
- Escape vars in cgo flags with an extra $ by @dierksen in #1107
- autogazelle can build on windows by @asuffield in #1083
- and many documentation updates by @tanyabouman
Full Changelog: v0.23.0...v0.24.0
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_gazelle",
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
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",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################
gazelle_dependencies()
v0.23.0
Changes
- Go
CXXFLAGS
andCPPFLAGS
#cgo
directives are separated intocxxopts
andcppopts
attributes, respectively. Thanks @otan.- Dependencies on mapped kinds are now supported. Thanks @robfig.
- The
gazelle
rule now supports theupdate-repos
command. - The
gazelle
rule now has adata
attribute and expands$(location)
within arguments. go_repository
'sbuild_naming_convention
is now considered when resolving external dependencies. If a repository already has build files, this attribute may be set to indicate which naming convention it follows.embedsrcs
attributes are generated for packages that contain//go:embed
directives.
- Protobuf
proto_strip_import_prefix
may be set in the root build file. Thanks @linzhp.
WORKSPACE
code
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_gazelle",
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
v0.22.3
Bug fixes
-mode=diff
treats empty build files correctly. (thanks @vpanta)- Gazelle should walk subdirectories more quickly when indexing is disabled. (thanks @blico)
- Fixed dependency resolution with mapped kinds. (thanks @robfig)
- Compatibility fixes for Go 1.16.
WORKSPACE code
http_archive(
name = "bazel_gazelle",
sha256 = "222e49f034ca7a1d1231422cdb67066b885819885c356673cb1f72f748a3c9d4",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.3/bazel-gazelle-v0.22.3.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.3/bazel-gazelle-v0.22.3.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
v0.22.2
Compatibility
- Gazelle no longer depends on the deprecated
go_rule
function from rules_go, which will be removed in 0.25. This should improve compatibility with future versions.
WORKSPACE code
http_archive(
name = "bazel_gazelle",
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
v0.22.1
Bug fixes
Go
- The version of rules_go may now be inferred from
WORKSPACE
if the repositoryio_bazel_rules_go
hasn't been fetched yet. - The
gazelle_binary
rule should now work correctly with previous versions of rules_go. - In the
import
andimport_alias
naming conventions, dots will be replaced with underscores in generated test names. This avoids generating targets that have the same names as source files. update-repos -from_file=go.mod
should no longer fail mysteriously whengo.mod
has areplace
directive that uses a relative path. Local replacements are still not supported though. (thanks @dragonsinth)
WORKSPACE code
http_archive(
name = "bazel_gazelle",
sha256 = "72d339ff874a382f819aaea80669be049069f502d6c726a07759fdca99653c48",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.1/bazel-gazelle-v0.22.1.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.1/bazel-gazelle-v0.22.1.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()
v0.22.0
Changes
- The Go extension can now generate targets with a new naming convention.
- In new projects, by default, a library will be named
foo
if its import path ends withfoo
instead ofgo_default_library
. Similarly, a test will be namedfoo_test
instead ofgo_default_test
. - Gazelle will attempt to detect the naming convention used in existing projects, so it shouldn't unexpectedly change the naming convention.
- To specify the naming convention explicitly, use the
# gazelle:go_naming_convention
directive or the-go_naming_convention
flag. Valid values areimport
,go_default_library
, andimport_alias
. Gazelle will rename existing targets the next time it runs after a change. go_repository
uses theimport_alias
naming convention by default, so either the old or new names may be used.- Thanks to @tomlu for implementing this.
- In new projects, by default, a library will be named
- Added
# gazelle:go_generate_proto
directive, which instructs the Go extension whether to generatego_proto_library
rules forproto_library
generated by the proto extension (thanks @linzhp). - Improved Windows compatibility (thanks @tomlu).
- Language extensions can now provide dependency resolution for other extensions by implementing the
resolve.CrossResolver
interface. This is now used for resolve proto imports in Go (thanks @blico). - In the
update-repos
command, the-build_directives
flag may be used to set thebuild_directives
attribute on generated repositories (thanks @Helcaraxan). - In the
update-repos
command, new rules and macros will be inserted higher inWORKSPACE
, abovego_rules_dependencies
andgazelle_dependencies
if possible, to make it easier to override indirect dependencies.
Compatibility
gazelle_binary
no longer supports mode attributes such asgoos
,race
, andgotags
. These depended on internal implementation details in rules_go. If you need to build agazelle_binary
for a platform other than the host, use command-line flags such as--platforms
and--@io_bazel_rules_go//go/config:race
or use a transition.
WORKSPACE code
http_archive(
name = "bazel_gazelle",
sha256 = "d4113967ab451dd4d2d767c3ca5f927fec4b30f3b2c6f8135a2033b9c05a5687",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.0/bazel-gazelle-v0.22.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.0/bazel-gazelle-v0.22.0.tar.gz",
],
)
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
gazelle_dependencies()