Skip to content

Commit c18e424

Browse files
committed
flow/designs/design.bzl: export gds/gds.gz + factor helper
Two small follow-ups to the cross-package exports_files() change: - Include gds and gds.gz in _EXPORTED_EXTS so cross-package ADDITIONAL_GDS references resolve. Brings the exported set in line with the _GROUPS["gds"] entry that already filegroups them. - Factor the duplicated exports_files() glob in design() and files() into a private _export_design_files() helper. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 2ebd38e commit c18e424

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

‎flow/designs/design.bzl‎

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,25 @@ _GROUPS = {
1616
# Extensions exported as individual labels so bazel-orfs's per-file
1717
# cross-package references resolve. Kept tight on purpose: globbing "*"
1818
# silently exposes LICENSE/.gitignore/etc. as the public API surface.
19-
_EXPORTED_EXTS = ["v", "sv", "svh", "tcl", "sdc", "def", "cfg", "lef", "lib"]
19+
# gds/gds.gz are inputs in hierarchical flows via ADDITIONAL_GDS.
20+
_EXPORTED_EXTS = ["v", "sv", "svh", "tcl", "sdc", "def", "cfg", "lef", "lib", "gds", "gds.gz"]
21+
22+
def _export_design_files():
23+
"""Publicly export per-file labels for cross-package references.
24+
25+
bazel-orfs's config_mk_parser turns $(DESIGN_HOME)/... and
26+
$(PLATFORM_DIR)/... paths in a config.mk into per-file bazel labels
27+
like //flow/designs/<plat>/<other>:constraint.sdc. Those labels
28+
resolve only if the source package calls exports_files() on the
29+
individual files — being part of a public filegroup is not
30+
sufficient.
31+
"""
32+
exported = native.glob(
33+
["*.{}".format(e) for e in _EXPORTED_EXTS],
34+
allow_empty = True,
35+
)
36+
if exported:
37+
native.exports_files(exported, visibility = ["//visibility:public"])
2038

2139
def design(config = "config.mk", user_arguments = [], local_arguments = []):
2240
"""Standard BUILD body for flow/designs/<platform>/<design>/.
@@ -31,19 +49,7 @@ def design(config = "config.mk", user_arguments = [], local_arguments = []):
3149
within the same config.mk, never read by ORFS or by user
3250
.tcl/.mk). Dropped entirely before orfs_flow() is invoked.
3351
"""
34-
35-
# Some designs share another design's SDC, Verilog, or constraint
36-
# files via $(DESIGN_HOME)/<platform>/<other-design>/... paths in
37-
# config.mk. bazel-orfs translates these into cross-package labels
38-
# like //flow/designs/<platform>/<other-design>:constraint.sdc,
39-
# which require explicit exports_files() on the source package.
40-
exported = native.glob(
41-
["*.{}".format(e) for e in _EXPORTED_EXTS],
42-
allow_empty = True,
43-
)
44-
if exported:
45-
native.exports_files(exported, visibility = ["//visibility:public"])
46-
52+
_export_design_files()
4753
orfs_design(
4854
config = config,
4955
user_arguments = user_arguments,
@@ -66,9 +72,4 @@ def files(group, extra_srcs = None):
6672
srcs = srcs,
6773
visibility = ["//visibility:public"],
6874
)
69-
exported = native.glob(
70-
["*.{}".format(e) for e in _EXPORTED_EXTS],
71-
allow_empty = True,
72-
)
73-
if exported:
74-
native.exports_files(exported, visibility = ["//visibility:public"])
75+
_export_design_files()

0 commit comments

Comments
 (0)