Strip internal test fake repository for MODULE.bazel in distribution. (#976)
Fixes #953
diff --git a/BUILD b/BUILD
index 5d05b04..52505df 100644
--- a/BUILD
+++ b/BUILD
@@ -27,9 +27,10 @@
license_text = "LICENSE",
)
-exports_files(
- ["WORKSPACE"],
-)
+exports_files([
+ "MODULE.bazel",
+ "WORKSPACE",
+])
exports_files(
glob([
@@ -44,7 +45,6 @@
]) + [
"BUILD",
"LICENSE",
- "MODULE.bazel",
],
visibility = ["//distro:__pkg__"],
)
diff --git a/MODULE.bazel b/MODULE.bazel
index a5a257d..6eaf859 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -25,6 +25,8 @@
dev_dependency = True,
)
+### INTERNAL ONLY - lines after this are not included in the release packaging.
+
# Find the system Git if one is available.
find_git = use_extension("//toolchains/git:git_configure.bzl", "experimental_find_system_git_extension", dev_dependency = True)
use_repo(find_git, "rules_pkg_git")
diff --git a/distro/BUILD b/distro/BUILD
index 47693f7..0d8b63a 100644
--- a/distro/BUILD
+++ b/distro/BUILD
@@ -32,6 +32,7 @@
pkg_tar(
name = "rules_pkg-%s" % version,
srcs = [
+ ":small_module",
":small_workspace",
"//:standard_package",
"//pkg:standard_package",
@@ -53,6 +54,13 @@
)
genrule(
+ name = "small_module",
+ srcs = ["//:MODULE.bazel"],
+ outs = ["MODULE.bazel"],
+ cmd = "sed -e '/### INTERNAL ONLY/,$$d' $(location //:MODULE.bazel) >$@",
+)
+
+genrule(
name = "small_workspace",
srcs = ["//:WORKSPACE"],
outs = ["WORKSPACE"],