Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow support for WORKSPACE.bazel files #1992

Merged
merged 1 commit into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions repositories/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ repository.

load(":go_repositories.bzl", "go_deps")

def deps():
# TODO: `go_repository_default_config` is only useful for working around
# https://github.com/bazelbuild/rules_docker/issues/1902 and could likely be
# removed after https://github.com/bazelbuild/rules_docker/issues/1787
def deps(go_repository_default_config = "@//:WORKSPACE"):
"""Pull in external dependencies needed by rules in this repo.

Pull in all dependencies needed to run rules in this
repository. This function assumes the repositories imported by the macro
'repositories' in //repositories:repositories.bzl have been imported
already.

Args:
go_repository_default_config (str, optional): A file used to determine the root of the workspace.
"""
go_deps()
go_deps(go_repository_default_config = go_repository_default_config)
10 changes: 8 additions & 2 deletions repositories/go_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,23 @@ repository.
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

def go_deps():
# TODO: `go_repository_default_config` is only useful for working around
# https://github.com/bazelbuild/rules_docker/issues/1902 and could likely be
# removed after https://github.com/bazelbuild/rules_docker/issues/1787
def go_deps(go_repository_default_config = "@//:WORKSPACE"):
"""Pull in external Go packages needed by Go binaries in this repo.

Pull in all dependencies needed to build the Go binaries in this
repository. This function assumes the repositories imported by the macro
'repositories' in //repositories:repositories.bzl have been imported
already.

Args:
go_repository_default_config (str, optional): A file used to determine the root of the workspace.
"""
go_rules_dependencies()
go_register_toolchains()
gazelle_dependencies()
gazelle_dependencies(go_repository_default_config = go_repository_default_config)
excludes = native.existing_rules().keys()
if "com_github_google_go_containerregistry" not in excludes:
go_repository(
Expand Down