Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions repositories/deps.bzl
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
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