Skip to content

Commit 5be3cfd

Browse files
matthewtlamcopybara-github
authored andcommitted
[P4 Infra] Make p4_pd_proto provide an absolute bazel path to the deps when calling this function from another workspace.
PiperOrigin-RevId: 792691215
1 parent 60f2a02 commit 5be3cfd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

p4_pdpi/pdgen.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414

1515
"""Rule for invoking the PD generator."""
1616

17+
def clean_dep(dep):
18+
"""Returns an absolute Bazel path to 'dep'.
19+
20+
This is necessary when calling these functions from another workspace.
21+
"""
22+
return str(Label(dep))
23+
1724
def p4_pd_proto(name, src, out, package, roles = [""], format = True, visibility = None):
1825
"""Generates PD proto from p4info file.
1926
@@ -26,7 +33,7 @@ def p4_pd_proto(name, src, out, package, roles = [""], format = True, visibility
2633
format: whether to format output file.
2734
visibility: genrule visibility.
2835
"""
29-
pdgen = "//p4_pdpi:pdgen"
36+
pdgen = clean_dep("//p4_pdpi:pdgen")
3037
p4info = ":" + src
3138
tools = [pdgen]
3239
cmd = """

0 commit comments

Comments
 (0)