Skip to content

Commit 144984c

Browse files
authored
build: Enable incompatible_no_implicit_file_export in bazelrc (#3477)
Identified by bazelbuild/bazel#27674 (comment), I want to see what else fails when flipping this flag on top of #3471.
1 parent 89d00af commit 144984c

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ build:rtd --stamp
3838
build:rtd --enable_bzlmod
3939

4040
common --incompatible_python_disallow_native_rules
41+
common --incompatible_no_implicit_file_export
4142

4243
build --lockfile_mode=update

python/private/pypi/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ exports_files(
2323
visibility = ["//visibility:public"],
2424
)
2525

26+
exports_files(
27+
srcs = ["deps.bzl"],
28+
visibility = ["//tools/private/update_deps:__pkg__"],
29+
)
30+
2631
filegroup(
2732
name = "distribution",
2833
srcs = glob(

python/private/pypi/generate_whl_library_build_bazel.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,18 @@ def generate_whl_library_build_bazel(
100100
])
101101

102102
additional_content = []
103+
entry_points = kwargs.get("entry_points")
104+
if entry_points:
105+
entry_point_files = sorted({
106+
entry_point_script.replace("\\", "/"): True
107+
for entry_point_script in entry_points.values()
108+
}.keys())
109+
additional_content.append(
110+
"exports_files(\n" +
111+
" srcs = {},\n".format(render.list(entry_point_files)) +
112+
" visibility = [\"//visibility:public\"],\n" +
113+
")\n",
114+
)
103115
if annotation:
104116
kwargs["data"] = annotation.data
105117
kwargs["copy_files"] = annotation.copy_files

tests/pypi/generate_whl_library_build_bazel/generate_whl_library_build_bazel_tests.bzl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ whl_library_targets(
5656
tags = ["tag1"],
5757
)
5858
59+
exports_files(
60+
srcs = ["bar.py"],
61+
visibility = ["//visibility:public"],
62+
)
63+
5964
# SOMETHING SPECIAL AT THE END
6065
"""
6166
actual = generate_whl_library_build_bazel(
@@ -122,6 +127,11 @@ whl_library_targets_from_requires(
122127
srcs_exclude = ["srcs_exclude_all"],
123128
)
124129
130+
exports_files(
131+
srcs = ["bar.py"],
132+
visibility = ["//visibility:public"],
133+
)
134+
125135
# SOMETHING SPECIAL AT THE END
126136
"""
127137
actual = generate_whl_library_build_bazel(
@@ -187,6 +197,11 @@ whl_library_targets_from_requires(
187197
srcs_exclude = ["srcs_exclude_all"],
188198
)
189199
200+
exports_files(
201+
srcs = ["bar.py"],
202+
visibility = ["//visibility:public"],
203+
)
204+
190205
# SOMETHING SPECIAL AT THE END
191206
"""
192207
actual = generate_whl_library_build_bazel(
@@ -252,6 +267,11 @@ whl_library_targets_from_requires(
252267
srcs_exclude = ["srcs_exclude_all"],
253268
)
254269
270+
exports_files(
271+
srcs = ["bar.py"],
272+
visibility = ["//visibility:public"],
273+
)
274+
255275
# SOMETHING SPECIAL AT THE END
256276
"""
257277
actual = generate_whl_library_build_bazel(

0 commit comments

Comments
 (0)