Skip to content

Commit 61bbc45

Browse files
committed
Put back in the protobuf Windows fix.
1 parent 979a456 commit 61bbc45

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

build/protobuf.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
from build.utils import filenamesmatchingof, collectattrs
33
from os.path import join, abspath, dirname, relpath
44
from build.pkg import has_package
5+
import platform
56

67
G.setdefault("PROTOC", "protoc")
78
G.setdefault("HOSTPROTOC", "hostprotoc")
89

910
assert has_package("protobuf"), "required package 'protobuf' not installed"
1011

12+
PROTO_SEPARATOR = ";" if (platform.system() == "Windows") else ":"
1113

1214
def _getprotodeps(deps):
1315
r = set()
@@ -19,7 +21,7 @@ def _getprotodeps(deps):
1921
@Rule
2022
def proto(self, name, srcs: Targets = [], deps: Targets = []):
2123
protodeps = _getprotodeps(deps)
22-
descriptorlist = ":".join(
24+
descriptorlist = PROTO_SEPARATOR.join(
2325
[
2426
relpath(f, start=self.dir)
2527
for f in filenamesmatchingof(protodeps, "*.descriptor")
@@ -46,7 +48,7 @@ def proto(self, name, srcs: Targets = [], deps: Targets = []):
4648
f"--descriptor_set_out={self.localname}.descriptor",
4749
]
4850
+ (
49-
[f"--descriptor_set_in={descriptorlist}"]
51+
[f"--descriptor_set_in='{descriptorlist}'"]
5052
if descriptorlist
5153
else []
5254
)
@@ -89,7 +91,7 @@ def protocc(self, name, srcs: Targets = [], deps: Targets = []):
8991
outs += ["=" + cc, "=" + h]
9092

9193
protodeps = _getprotodeps(deps + srcs)
92-
descriptorlist = ":".join(
94+
descriptorlist = PROTO_SEPARATOR.join(
9395
[
9496
relpath(f, start=self.dir)
9597
for f in filenamesmatchingof(protodeps, "*.descriptor")
@@ -110,7 +112,7 @@ def protocc(self, name, srcs: Targets = [], deps: Targets = []):
110112
"$(PROTOC)",
111113
"--proto_path=.",
112114
"--cpp_out=.",
113-
f"--descriptor_set_in={descriptorlist}",
115+
f"--descriptor_set_in='{descriptorlist}'",
114116
]
115117
+ protos
116118
)
@@ -142,7 +144,7 @@ def protojava(self, name, srcs: Targets = [], deps: Targets = []):
142144
protos += [f]
143145
srcs += [f]
144146

145-
descriptorlist = ":".join(
147+
descriptorlist = PROTO_SEPARATOR.join(
146148
[abspath(f) for f in filenamesmatchingof(srcs + deps, "*.descriptor")]
147149
)
148150

@@ -161,7 +163,7 @@ def protojava(self, name, srcs: Targets = [], deps: Targets = []):
161163
"$(PROTOC)",
162164
"--proto_path=.",
163165
"--java_out=.",
164-
f"--descriptor_set_in={descriptorlist}",
166+
f"--descriptor_set_in='{descriptorlist}'",
165167
]
166168
+ protos
167169
)

0 commit comments

Comments
 (0)