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

Export bzl files with bzl_library to be able to use stardoc #1092

Closed
wants to merge 4 commits into from
Closed
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
27 changes: 27 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "nogo")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("//:def.bzl", "gazelle", "gazelle_binary")

# gazelle:prefix github.com/bazelbuild/bazel-gazelle
Expand All @@ -21,6 +22,7 @@ gazelle_binary(
"//language/proto",
"//language/go",
"//internal/language/test_filegroup",
"@bazel_skylib//gazelle/bzl",
],
)

Expand Down Expand Up @@ -71,3 +73,28 @@ filegroup(
],
visibility = ["//visibility:public"],
)

bzl_library(
name = "def",
srcs = ["def.bzl"],
visibility = ["//visibility:public"],
deps = [
"//internal:gazelle_binary",
"//internal:go_repository",
"//internal:overlay_repository",
"@bazel_skylib//lib:shell",
],
)

bzl_library(
name = "deps",
srcs = ["deps.bzl"],
visibility = ["//visibility:public"],
deps = [
"@bazel_gazelle//internal:go_repository",
"@bazel_gazelle//internal:go_repository_cache",
"@bazel_gazelle//internal:go_repository_config",
"@bazel_gazelle//internal:go_repository_tools",
"@bazel_tools//tools/build_defs/repo:git.bzl",
],
)
10 changes: 10 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
workspace(name = "bazel_gazelle")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
"@bazel_tools//tools/build_defs/repo:git.bzl",
"git_repository",
)

git_repository(
name = "bazel_skylib",
commit = "df3c9e2735f02a7fe8cd80db4db00fec8e13d25f", # `master` as of 2021-08-19
remote = "https://github.com/bazelbuild/bazel-skylib",
)

http_archive(
name = "io_bazel_rules_go",
Expand Down
7 changes: 0 additions & 7 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ def gazelle_dependencies(
config = go_repository_default_config,
)

_maybe(
_tools_git_repository,
name = "bazel_skylib",
remote = "https://github.com/bazelbuild/bazel-skylib",
commit = "3fea8cb680f4a53a129f7ebace1a5a4d1e035914", # 0.5.0 as of 2018-11-01
)

_maybe(
go_repository,
name = "com_github_bazelbuild_buildtools",
Expand Down
56 changes: 56 additions & 0 deletions internal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

# gazelle:exclude *_test.go
go_bazel_test(
Expand Down Expand Up @@ -47,3 +48,58 @@ filegroup(
],
visibility = ["//visibility:public"],
)

bzl_library(
name = "gazelle_binary",
srcs = ["gazelle_binary.bzl"],
visibility = ["//:__subpackages__"],
deps = ["@io_bazel_rules_go//go:def"],
)

bzl_library(
name = "go_repository",
srcs = ["go_repository.bzl"],
visibility = ["//:__subpackages__"],
deps = [
"@bazel_gazelle//internal:go_repository_cache",
"@bazel_tools//tools/build_defs/repo:utils.bzl",
],
)

bzl_library(
name = "go_repository_cache",
srcs = ["go_repository_cache.bzl"],
visibility = ["//:__subpackages__"],
deps = [],
)

bzl_library(
name = "go_repository_config",
srcs = ["go_repository_config.bzl"],
visibility = ["//:__subpackages__"],
deps = [
"@bazel_gazelle//internal:go_repository_cache",
],
)

bzl_library(
name = "go_repository_tools",
srcs = ["go_repository_tools.bzl"],
visibility = ["//:__subpackages__"],
deps = [
"@bazel_gazelle//internal:go_repository_cache",
"@bazel_gazelle//internal:go_repository_tools_srcs",
],
)

bzl_library(
name = "go_repository_tools_srcs",
srcs = ["go_repository_tools_srcs.bzl"],
visibility = ["//:__subpackages__"],
)

bzl_library(
name = "overlay_repository",
srcs = ["overlay_repository.bzl"],
visibility = ["//:__subpackages__"],
)
8 changes: 8 additions & 0 deletions language/go/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load(":def.bzl", "std_package_list")

Expand Down Expand Up @@ -120,3 +121,10 @@ alias(
actual = ":go",
visibility = ["//visibility:public"],
)

bzl_library(
name = "def",
srcs = ["def.bzl"],
visibility = ["//visibility:public"],
deps = ["@io_bazel_rules_go//go:def"],
)
7 changes: 7 additions & 0 deletions language/proto/gen/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
Expand Down Expand Up @@ -25,3 +26,9 @@ filegroup(
],
visibility = ["//visibility:public"],
)

bzl_library(
name = "def",
srcs = ["def.bzl"],
visibility = ["//visibility:public"],
)