22from build .utils import filenamesmatchingof , collectattrs
33from os .path import join , abspath , dirname , relpath
44from build .pkg import has_package
5+ import platform
56
67G .setdefault ("PROTOC" , "protoc" )
78G .setdefault ("HOSTPROTOC" , "hostprotoc" )
89
910assert has_package ("protobuf" ), "required package 'protobuf' not installed"
1011
12+ PROTO_SEPARATOR = ";" if (platform .system () == "Windows" ) else ":"
1113
1214def _getprotodeps (deps ):
1315 r = set ()
@@ -19,7 +21,7 @@ def _getprotodeps(deps):
1921@Rule
2022def 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" )
@@ -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" )
@@ -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
0 commit comments