@@ -999,13 +999,15 @@ def __init__(
999999 inst_dir ,
10001000 build_doc ,
10011001 workspace_dir ,
1002+ manifests_to_build ,
10021003 loader ,
10031004 ):
10041005 super (CargoBuilder , self ).__init__ (
10051006 build_opts , ctx , manifest , src_dir , build_dir , inst_dir
10061007 )
10071008 self .build_doc = build_doc
10081009 self .ws_dir = workspace_dir
1010+ self .manifests_to_build = manifests_to_build and manifests_to_build .split ("," )
10091011 self .loader = loader
10101012
10111013 def run_cargo (self , install_dirs , operation , args = None ):
@@ -1026,7 +1028,10 @@ def build_source_dir(self):
10261028 return os .path .join (self .build_dir , "source" )
10271029
10281030 def workspace_dir (self ):
1029- return os .path .join (self .build_source_dir (), self .ws_dir )
1031+ return os .path .join (self .build_source_dir (), self .ws_dir or "" )
1032+
1033+ def manifest_dir (self , manifest ):
1034+ return os .path .join (self .build_source_dir (), manifest )
10301035
10311036 def recreate_dir (self , src , dst ):
10321037 if os .path .isdir (dst ):
@@ -1058,7 +1063,8 @@ def _build(self, install_dirs, reconfigure):
10581063 )
10591064 )
10601065
1061- self ._patchup_workspace ()
1066+ if self .ws_dir is not None :
1067+ self ._patchup_workspace ()
10621068
10631069 try :
10641070 from getdeps .facebook .rust import vendored_crates
@@ -1069,11 +1075,26 @@ def _build(self, install_dirs, reconfigure):
10691075 # so just rely on cargo downloading crates on it's own
10701076 pass
10711077
1072- self .run_cargo (
1073- install_dirs ,
1074- "build" ,
1075- ["--out-dir" , os .path .join (self .inst_dir , "bin" ), "-Zunstable-options" ],
1076- )
1078+ if self .manifests_to_build is None :
1079+ self .run_cargo (
1080+ install_dirs ,
1081+ "build" ,
1082+ ["--out-dir" , os .path .join (self .inst_dir , "bin" ), "-Zunstable-options" ],
1083+ )
1084+ else :
1085+ for manifest in self .manifests_to_build :
1086+ self .run_cargo (
1087+ install_dirs ,
1088+ "build" ,
1089+ [
1090+ "--out-dir" ,
1091+ os .path .join (self .inst_dir , "bin" ),
1092+ "-Zunstable-options" ,
1093+ "--manifest-path" ,
1094+ self .manifest_dir (manifest ),
1095+ ],
1096+ )
1097+
10771098 self .recreate_dir (build_source_dir , os .path .join (self .inst_dir , "source" ))
10781099
10791100 def run_tests (
@@ -1082,11 +1103,18 @@ def run_tests(
10821103 if test_filter :
10831104 args = ["--" , test_filter ]
10841105 else :
1085- args = None
1106+ args = []
10861107
1087- self .run_cargo (install_dirs , "test" , args )
1088- if self .build_doc :
1089- self .run_cargo (install_dirs , "doc" , ["--no-deps" ])
1108+ if self .manifests_to_build is None :
1109+ self .run_cargo (install_dirs , "test" , args )
1110+ if self .build_doc :
1111+ self .run_cargo (install_dirs , "doc" , ["--no-deps" ])
1112+ else :
1113+ for manifest in self .manifests_to_build :
1114+ margs = ["--manifest-path" , self .manifest_dir (manifest )]
1115+ self .run_cargo (install_dirs , "test" , args + margs )
1116+ if self .build_doc :
1117+ self .run_cargo (install_dirs , "doc" , ["--no-deps" ] + margs )
10901118
10911119 def _patchup_workspace (self ):
10921120 """
0 commit comments