github bazelbuild/bazel-gazelle 0.18.0

latest releases: v0.36.0, v0.35.0, v0.34.0...
pre-release4 years ago

Compatibility

  • rules_go 0.19.0 or later is now required. Older versions are not supported but may still work, depending on what features are needed.

General changes

  • gazelle update-repos now supports the flag -to_macro=file.bzl%macro. Instead of writing new repository rules to WORKSPACE, rules will be written to a function in a separate .bzl file. This helps keep related rules together. Thanks to @blico!
  • The directive # gazelle:repository_macro file.bzl%macro may be used in WORKSPACE to declare a macro generated with the above flag. gazelle update-repos will automatically update rules declared in the named macros instead of adding them to WORKSPACE. The directive may be repeated for multiple macros. gazelle fix and gazelle update will also read workspaces declared in these macros to find known repository roots and names. Thanks again to @blico!
  • The directive # gazelle:exclude . may now be written to skip updating the current directory and subdirectories. Previously, exclude only applied to files and subdirectories.

Go changes

  • go_repository can now download modules. To download a module, set the version and sum attributes instead of urls (for HTTP) or commit or tag (for VCS downloads). go_repository will download and verify the specified module with go mod download. The environment variables GOPROXY, GOPRIVATE, GONOPROXY, GOSUMDB, and GONOSUMDB are observed, so be sure to set these for private modules when using go1.13 or later.
  • gazelle update-repos <path> will add or update go_repository rules in module mode.
  • gazelle update-repos -from_file=go.mod will also add or update rules in module mode.
  • Refactored infrastructure behind go_repository. There are now separate tools and cache workspaces. Modules are downloaded into the cache. When Gazelle is updated, it should not be necessary to re-download modules unless the implementation of the cache changes. The environment variable GO_REPOSITORY_USE_HOST_CACHE may be set to 1 to use $GOPATH/pkg/mod as a module cache instead of the cache workspace.
  • go_repository now provides a replace attribute in module mode, analogous to replace in a go.mod file. The version and sum attributes are used on the replacement, but build files will be generated with the importpath of the original module. gazelle update-repos -from-file=go.mod will add replace attributes automatically (thanks to @bigkraig!).
  • gazelle update-repos now supports the flag -prune, which may be used with -from_file. When enabled, Gazelle will remove go_repository rules that no longer have equivalent repos in go.mod or Gopkg.lock. Thanks to @blico!
  • When run by go_repository, Gazelle now supports minimal module compatibility. For v2+ modules, Gazelle will generate importpath_aliases attributes so go_libraries may be imported without the semantic import version suffix by non-modularized packages.

Proto changes

  • Updated table of known proto import paths for consistency with rules_go 0.19.0.

Don't miss a new bazel-gazelle release

NewReleases is sending notifications on new releases.