Bot releases are visible (Hide)
Published by jayconrod about 4 years ago
foo
if its import path ends with foo
instead of go_default_library
. Similarly, a test will be named foo_test
instead of go_default_test
.# gazelle:go_naming_convention
directive or the -go_naming_convention
flag. Valid values are import
, go_default_library
, and import_alias
. Gazelle will rename existing targets the next time it runs after a change.go_repository
uses the import_alias
naming convention by default, so either the old or new names may be used.# gazelle:go_generate_proto
directive, which instructs the Go extension whether to generate go_proto_library
rules for proto_library
generated by the proto extension (thanks @linzhp).resolve.CrossResolver
interface. This is now used for resolve proto imports in Go (thanks @blico).update-repos
command, the -build_directives
flag may be used to set the build_directives
attribute on generated repositories (thanks @Helcaraxan).update-repos
command, new rules and macros will be inserted higher in WORKSPACE
, above go_rules_dependencies
and gazelle_dependencies
if possible, to make it easier to override indirect dependencies.gazelle_binary
no longer supports mode attributes such as goos
, race
, and gotags
. These depended on internal implementation details in rules_go. If you need to build a gazelle_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.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()
Published by jayconrod over 4 years ago
internal
directories. Previously,internal
,internal
directories themselves. Thanks to @robfig.go_repository
no longer runs cat
, and genrules
are replaced with nativeselect
expressions are no longer emitted for platforms that aren'tPublished by jayconrod over 4 years ago
# gazelle:exclude
directives now accept patterns with *
and **
wildcards. (thanks @kalbasit)-lang
flag may now be used to select which language extensions should be run. By default, all extensions Gazelle was built with will run. (thanks @robfig)proto_library
rules with one or more sources in common with the generated rule, even if the rule has been renamed. (thanks @linzhp)Published by jayconrod over 4 years ago
update-repos
is invoked with -to_macro
, Gazelle will add a call to the macro and a # gazelle:repository_macro
directive to WORKSPACE if neither is present.go_repository
rules when two module paths differ only in case. Thanks to @linzhp.load
statements for proto_library
to comply with --incompatible_load_proto_rules_from_bzl
. Thanks to @Yannic.Published by jayconrod almost 5 years ago
go_repository
stderr output.SSL_CERT_FILE
and SSL_CERT_DIR
are passed through to tools used by go_repository
.Published by jayconrod about 5 years ago
# gazelle:repository
directive is now supported in WORKSPACE files. Gazelle will behave as if a repository rule were declared with the given kind and attributes. This may override other declared rules. This is useful for declaring rules that appear in other files and can't be managed with #gazelle:repository_macro
. Thanks to @blico.update-repos
command now accepts versions for each argument, for example, update-repos github.com/sirupsen/[email protected]
. For Go, the version suffixes follow the same format that go get
accepts in module mode. Thanks to @weixiao-huang.go_repository
has better support for visibility across submodules. For example, cloud.google.com/logging
may now depend on internal packages in cloud.google.com
, when both modules are unmodified go_repository
rules. Previously, this required visibility
attributes to be patched into the parent module.go_repository
now handles WORKSPACE-based configuration more efficiently. A configuration file is derived from the relevant parts of WORKSPACE and any functions declared with # gazelle:repository_macro
. go_repository
rules are re-evaluated when the configuration file changes, not when WORKSPACE changes. Previously, non-Go-related changes to WORKSPACE would cause go_repository
to be re-evaluated. Thanks to @blico.go_repository
now accepts a build_directives
attribute, a list of directives to write into the root build file before running Gazelle. Thanks to @linzhp.# gazelle:go_visibility
directive may be used to add labels to visibility attributes of Go rules. Thanks to @linzhp.go_library
srcs
if they are consumed by another rule through the src
or srcs
attributes. Thanks to @linzhp.Published by jayconrod about 5 years ago
gazelle_binary
rules in Go 1.13.Published by jayconrod over 5 years ago
This release is a quick fix to address an issue with go_repository
on Windows.
Published by jayconrod over 5 years ago
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.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!# 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!# gazelle:exclude .
may now be written to skip updating the current directory and subdirectories. Previously, exclude
only applied to files and subdirectories.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.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!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.Published by jayconrod over 5 years ago
# gazelle:map_kind
directive can now be used to generate rules ofgo_binary
rules,go_image
, go_deployable
). Thanks to @robfig!-mode=diff
when there arego_repository
now works with Go 1.12.update-repos
command now lets you set attributes such as build filego_proto_library
rules with the-go_proto_compiler
and -go_grpc_compiler
flags. Thanks to @bartle-stripe!proto_library
attributes import_prefix
and strip_import_prefix
# gazelle:proto_import_prefix
and# gazelle:proto_strip_import_prefix
directives or the -proto_import_prefix
Published by jayconrod almost 6 years ago
gazelle_binary
is a new rule that allows developers to support new languages. To support a new language, you may:
go_library
that defines a function named NewLanguage
that returns a value assignable to language.Language
.gazelle_binary
target that depends on your go_library
and other language extensions through the languages
attribute.gazelle_binary
target through the gazelle
attribute of the gazelle
rule.rule
and other libraries to write your own tools that manipulate build files.git_repository
and http_archive
rules are deprecated. You should migrate to Bazel's git_repository
and http_archive
instead._
. Previously these were considered hidden, but go build
allows directories with these names to be imported (even if they don't match wildcards). In the next release, directories whose names start with .
will also be visited.Published by jayconrod about 6 years ago
gazelle update-repos -from_file=go.mod
. This includes transitive dependencies not explicitly mentioned in go.mod.# gazelle:follow symlink
- follow a specific symlink to a directory. Gazelle normally ignores symbolic links to directories within a repository to avoid visiting a directory on more than one path. When using this, take care to # gazelle:exclude
the directory from its actual parent to prevent this from happening.# gazelle:resolve source-lang import-lang import-string label
- specifies an explicit mapping from an import string to a label for dependency resolution.-r=true
- controls whether Gazelle updates build files recursively in directories mentioned on the command line. True by default.-index=true
- controls whether Gazelle indexes library rules in the repository and uses the index to resolve imports to Bazel labels. True by default.go_repository
rule now accepts patches and commands in the same format as git_repository
and http_archive
from @bazel_tools
. Patches are applied after Gazelle is run (if it is run).fix
and update
commands can write patch files with -mode=patch
.gazelle
rule can now append to the command line argument list (instead of replacing it) if the arguments are prefixed with -args
. For example, bazel run //:gazelle -- -args -index=false -r=false internal/label
.gazelle
rule now works on Windows.Published by jayconrod about 6 years ago
-experimental_read_build_files_dir
and -experimental_write_build_files_dir
may be used to read and write build files from alternate directories, which may be outside the repository root. If a file is read from a different directory, build files in the source tree are ignored. If a file is written to an alternate directory, build files in the source tree are not modified. These flags may change in the future.Published by jayconrod over 6 years ago
@go_googleapis
repository.
-proto=mode
flag on the command line or the # gazelle:proto mode
directive in build files or with build_file_proto_mode = "mode"
in go_repository
.
disable_global
- Like disable
mode, Gazelle won't generate, update, or delete existing proto_library
or go_proto_library
rules. In addition, special cases for proto dependency resolution (for Well Known Types and Google APIs) are disabled. This is useful if you build libraries using pre-generated .pb.go files and don't want any build-time dependency on protoc.package
- Gazelle may generate proto_library
and go_proto_library
rules for multiple packages in the same directory. .proto files are grouped into packages using either the declared proto package or an option specified by # gazelle:proto_group opt
, e.g., go_package
.git_repository
and http_archive
no longer rely on a cp
executable to copy files. This improves Windows compatibility (thanks @pmuetschard).race
and msan
tags are now ignored. Sources files will be included in rules whether these flags are true or false.Published by jayconrod over 6 years ago
importmap
is now a mergeable attribute. This means Gazelle may now replaceimportmap
attributes if they are not marked with a # keep
gazelle fix
no longer removes importpath
attributes on go_binary
go_test
rules. These attributes are no longer deprecated. The rulesgo_path
and@io_bazel_rules_go//proto/wkt
. This partially worked before, but several@bazel_gazelle
repository, probably@bazel_gazelle
in your WORKSPACE, following the template atPublished by jayconrod over 6 years ago
go_test
target when both internal andgazelle fix
will squash or rename"go_default_xtest"
.srcs
attributes are now flat: they will no longer contain platform-specificselect
expressions. rules_go will filter sources with build constraintsgoos
and goarch
attributesgo_binary
, but there are still problems with select
in deps
. See theimportmap
attributes are added for go_library
and go_proto_library
rulesimportpath
are linked into the same binary.@io_bazel_rules_go//proto/wkt
.go_repository
now supports a build_extra_args
attribute, allowinggazelle update-repos
will now load go_repository
from @bazel_gazelle
.@io_bazel_rules_go
is deprecated. gazelle fix
will alsoimportmap
on go_proto_library
. Older versions mayPublished by jayconrod over 6 years ago
github.com/bazelbuild/buildtools
is now vendored within Gazelle, due to breaking API changes upstream.-repo_root
). This fixes a bug where Gazelle incorrectly decided other symlinks pointed outside the repository.Published by jayconrod over 6 years ago
gazelle update-repos example.com/repo
adds a new go_repository
rule or updates an existing go_repository
rule in WORKSPACE.importpath
attributes from go_binary
and go_test
rules, since these are deprecated.go_binary
rules can be renamed and still be updated by Gazelle. Only one go_binary
per package though. go_library
, go_proto_library
, and go_repository
rules can be renamed as long as the importpath
still matches.cmd/move_labels
updates labels in build files after a directory is moved. This is useful for vendoring repositories that already have build files.git_repository
and http_archive
overlay repository rules. These rules fetch a repository and copy a set of pre-generated build files. All dependencies in @io_bazel_rules_go
and @bazel_gazelle
now use these rules.Published by jayconrod over 6 years ago
update-repos
command.
go_repository
rules in WORKSPACE.help
command.go_grpc_library
rules are now migrated to go_proto_library
rules with a compilers
attribute.prefix
attribute is now optional in the gazelle
rule.srcs
, deps
, and other attributes. This fixes an error that Bazel reports when the same dependency appeared to be OS-specific and architecture-specific.srcs
, deps
, embed
). Previously, rules couldn't be deleted if they had attributes other than name
and visibility
. This caused rules to be preserved that only had attributes like proto
and importpath
.Published by jayconrod almost 7 years ago
This is the first release of Gazelle in its new repository. This matches the Gazelle from rules_go at version 0.8.1, hence the similar version number.