Skip to content

Commit feddd1a

Browse files
cgrindelclaude
andauthored
fix: add support for incompatible_no_implicit_file_export flag (#596)
## Summary Adds support for Bazel's `--incompatible_no_implicit_file_export` flag to comply with the new visibility requirements for file exports. ## Changes - ✅ Enabled `incompatible_no_implicit_file_export` flag in `shared.bazelrc` - ✅ Added explicit `exports_files()` declarations for all `.bzl` files referenced across package boundaries: - `bazeldoc/BUILD.bazel` - exports `defs.bzl` - `bzlformat/BUILD.bazel` - exports `defs.bzl` - `bzllib/BUILD.bazel` - exports `defs.bzl` - `bzlrelease/BUILD.bazel` - exports `defs.bzl` - `bzltidy/BUILD.bazel` - exports `defs.bzl` - `ci/BUILD.bazel` - exports `defs.bzl` - `markdown/BUILD.bazel` - exports `defs.bzl` - `updatesrc/BUILD.bazel` - exports `defs.bzl` - `shlib/rules/BUILD.bazel` - exports `execute_binary.bzl` - ✅ Upgraded `buildifier_prebuilt` from `7.3.1` to `8.2.1.1` for compatibility - ✅ Added explicit `rules_python` `1.8.0` dependency to override transitive `1.0.0` (includes [PR #3471](bazel-contrib/rules_python#3471) fix) ## Test Plan - [x] All 362 tests pass with `bazel test //...` - [x] Build succeeds with the incompatible flag enabled - [x] No visibility errors from implicit file exports ## Related Issues Fixes #566 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8c9bf62 commit feddd1a

12 files changed

Lines changed: 27 additions & 2 deletions

File tree

.bcr/patches/remove_last_green.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--- a/MODULE.bazel
22
+++ b/MODULE.bazel
3-
@@ -82,11 +82,9 @@
3+
@@ -86,11 +86,9 @@
44
dev_dependency = True,
55
)
66
bazel_binaries.download(version_file = "//:.bazelversion")

MODULE.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ bazel_dep(
3131
)
3232
bazel_dep(
3333
name = "buildifier_prebuilt",
34-
version = "7.3.1",
34+
version = "8.2.1.1",
3535
)
3636
bazel_dep(name = "platforms", version = "1.0.0")
3737
bazel_dep(name = "rules_shell", version = "0.6.1")
3838
bazel_dep(name = "rules_multitool", version = "1.0.0")
3939
bazel_dep(name = "aspect_bazel_lib", version = "2.22.4")
4040

41+
# Override transitive dependency on rules_python 1.0.0 to get
42+
# incompatible_no_implicit_file_export compatibility (PR #3471).
43+
bazel_dep(name = "rules_python", version = "1.8.0")
44+
4145
multitool = use_extension(
4246
"@rules_multitool//multitool:extension.bzl",
4347
"multitool",

bazeldoc/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ load("//bzlformat:defs.bzl", "bzlformat_pkg")
33

44
package(default_visibility = ["//visibility:public"])
55

6+
exports_files(["defs.bzl"])
7+
68
bzlformat_pkg(name = "bzlformat")
79

810
filegroup(

bzlformat/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ load("//bzlformat/private:bzlformat_pkg.bzl", "bzlformat_pkg")
33

44
package(default_visibility = ["//visibility:public"])
55

6+
exports_files(["defs.bzl"])
7+
68
bzlformat_pkg(name = "bzlformat")
79

810
filegroup(

bzllib/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ load("//bzlformat:defs.bzl", "bzlformat_pkg")
33

44
package(default_visibility = ["//visibility:public"])
55

6+
exports_files(["defs.bzl"])
7+
68
bzlformat_pkg(name = "bzlformat")
79

810
filegroup(

bzlrelease/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ load("//bzlformat:defs.bzl", "bzlformat_pkg")
33

44
package(default_visibility = ["//visibility:public"])
55

6+
exports_files(["defs.bzl"])
7+
68
bzlformat_pkg(name = "bzlformat")
79

810
filegroup(

bzltidy/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
33

44
package(default_visibility = ["//visibility:public"])
55

6+
exports_files(["defs.bzl"])
7+
68
bzl_library(
79
name = "defs",
810
srcs = ["defs.bzl"],

ci/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
22
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
33

4+
exports_files(["defs.bzl"])
5+
46
bzlformat_pkg(name = "bzlformat")
57

68
bzl_library(

markdown/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ load("//bzlformat:defs.bzl", "bzlformat_pkg")
33

44
package(default_visibility = ["//visibility:public"])
55

6+
exports_files(["defs.bzl"])
7+
68
bzlformat_pkg(name = "bzlformat")
79

810
filegroup(

shared.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ build --incompatible_strict_action_env=true
1010
# Don't allow empty glob patterns by default
1111
build --incompatible_disallow_empty_glob
1212

13+
# Require explicit exports_files() declarations instead of implicit file exports
14+
build --incompatible_no_implicit_file_export
15+
1316
# Enable bzlmod
1417
common --enable_bzlmod
1518
build --@cgrindel_bazel_starlib//bzlmod:enabled

0 commit comments

Comments
 (0)