Skip to content

Commit

Permalink
Export .bzl files for Stardoc (#16)
Browse files Browse the repository at this point in the history
Rulesets that rely on `bazel_features` and also use Stardoc need to
provide all `.bzl` files that are transitively loaded to the `stardoc`
rule. Since we do not want to add a dependency on `bazel_skylib`, we
instead export a `filegroup`.
  • Loading branch information
fmeum authored Jul 27, 2023
1 parent 8fbef9f commit 4df92da
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
11 changes: 11 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
filegroup(
name = "bzl_files",
srcs = glob(["*.bzl"]) + [
"//private:bzl_files",
"@bazel_features_globals//:globals.bzl",
"@bazel_features_version//:version.bzl",
],
visibility = ["//visibility:public"],
)

exports_files(["features.bzl"])
5 changes: 5 additions & 0 deletions private/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filegroup(
name = "bzl_files",
srcs = glob(["*.bzl"]),
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion private/globals_repo.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("//private:parse.bzl", "parse_version")

def _globals_repo_impl(rctx):
rctx.file("BUILD.bazel")
rctx.file("BUILD.bazel", "exports_files([\"globals.bzl\"])")

bazel_version = parse_version(native.bazel_version)

Expand Down
2 changes: 1 addition & 1 deletion private/version_repo.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def _version_repo_impl(rctx):
rctx.file("BUILD.bazel")
rctx.file("BUILD.bazel", "exports_files([\"version.bzl\"])")
rctx.file("version.bzl", "version = '" + native.bazel_version + "'")

version_repo = repository_rule(_version_repo_impl)

0 comments on commit 4df92da

Please sign in to comment.