blob: 87a9bed4b79930ceaf6d1b0ab620a0f2e63aef21 [file] [log] [blame] [edit]
module(
name = "gazelle_bcr_tests",
)
bazel_dep(name = "gazelle", version = "")
local_path_override(
module_name = "gazelle",
path = "../..",
)
bazel_dep(name = "test_dep", version = "1.0.0")
local_path_override(
module_name = "test_dep",
path = "test_dep",
)
bazel_dep(name = "rules_go", version = "0.42.0", repo_name = "my_rules_go")
# This bazel_dep provides the Go dependency github.com/cloudflare/circl, which requires custom
# patches beyond what Gazelle can generate.
bazel_dep(name = "circl", version = "1.3.7")
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
# Validate a go.mod replace directive works.
go_deps.from_file(go_mod = "//:go.mod")
go_deps.gazelle_default_attributes(
directives = [
"gazelle:proto disable",
],
)
# Verify that the gazelle:go_naming_convention directive in an override is
# respected.
go_deps.module(
path = "github.com/stretchr/testify",
sum = "h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=",
version = "v1.8.0",
)
go_deps.gazelle_override(
directives = [
"gazelle:go_naming_convention go_default_library",
],
path = "github.com/stretchr/testify",
)
# Apply a patch to test the `module_override` tags.
go_deps.module_override(
patch_strip = 1,
patches = [
"//patches:testify.patch",
],
path = "github.com/stretchr/testify",
)
# Test an archive override from a known archive.
go_deps.gazelle_override(
directives = [
"gazelle:go_naming_convention go_default_library",
],
path = "github.com/bazelbuild/buildtools",
)
go_deps.archive_override(
urls = [
"https://github.com/bazelbuild/buildtools/archive/ae8e3206e815d086269eb208b01f300639a4b194.tar.gz",
],
patch_strip = 1,
patches = [
"//patches:buildtools.patch",
],
strip_prefix = "buildtools-ae8e3206e815d086269eb208b01f300639a4b194",
path = "github.com/bazelbuild/buildtools",
sha256 = "05d7c3d2bd3cc0b02d15672fefa0d6be48c7aebe459c1c99dced7ac5e598508f",
)
# Transitive dependencies have to be listed here explicitly.
go_deps.module(
indirect = True,
path = "gopkg.in/yaml.v3",
sum = "h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=",
version = "v3.0.1",
)
go_deps.gazelle_override(
path = "gopkg.in/yaml.v3",
directives = [
# Verify that the build naming convention is picked up by Gazelle when it
# emits references to this repo.
"gazelle:go_naming_convention go_default_library",
],
)
go_deps.module(
indirect = True,
path = "github.com/davecgh/go-spew",
sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=",
version = "v1.1.1",
)
use_repo(
go_deps,
"com_github_bazelbuild_buildtools",
"com_github_bmatcuk_doublestar_v4",
"com_github_datadog_sketches_go",
"com_github_envoyproxy_protoc_gen_validate",
"com_github_fmeum_dep_on_gazelle",
"com_github_google_safetext",
"com_github_stretchr_testify",
"org_golang_x_sys",
# It is not necessary to list transitive dependencies here, only direct ones.
# "in_gopkg_yaml_v3",
# Only used for testing.
"bazel_gazelle_go_repository_config",
)
# Use an isolated usage to bring in Go tools from the tools package with their own dependency
# closure.
go_tools = use_extension("@gazelle//:extensions.bzl", "go_deps", isolate = True)
go_tools.from_file(go_mod = "//tools:go.mod")
use_repo(
go_tools,
buildtools = "com_github_bazelbuild_buildtools",
gqlgen = "com_github_99designs_gqlgen",
)