@@ -324,37 +324,79 @@ def install_prefix(self) -> Path:
324324
325325 @property
326326 def path (self ) -> Path :
327- return self .install_prefix / self .suffix
327+ return self .install_prefix / self .id
328328
329329 @property
330330 def stats_dir (self ) -> Path :
331331 return self .experiment .results .parent / "stats" / self .suite .name
332332
333333 @property
334334 def build_dir (self ) -> Path :
335- return BUILD_DIR / "benchmarks" / self .suite .name / self .suffix
335+ return BUILD_DIR / "benchmarks" / self .suite .name / self .id
336+
337+ @property
338+ def installed (self ) -> bool :
339+ return self .path .exists ()
340+
341+ @property
342+ def patch_suffix (self ) -> Optional [str ]:
343+ if self .alloy .profile == GCVS .BASELINE :
344+ return None
345+ elif self .alloy .profile in [PremOpt .NAIVE , PremOpt .NONE , Elision .NAIVE ]:
346+ return "gc"
347+ else :
348+ return self .alloy .profile .value
336349
337350 @property
338351 def env (self ):
339352 return {"RUSTC" : self .alloy .path }
340353
341- @prepare_build
354+ @command_runner (description = "Building" , dry_run = DRY_RUN )
355+ def _cargo_build (self ):
356+ return [
357+ "cargo" ,
358+ "build" ,
359+ "--release" ,
360+ "--manifest-path" ,
361+ self .suite .crate .cargo_toml ,
362+ "--target-dir" ,
363+ self .build_dir ,
364+ ]
365+
366+ @property
367+ def build_steps (self ):
368+ return self .suite .crate .steps
369+
342370 def build (self ):
371+ if self .installed :
372+ logging .info (
373+ f"Skipping { self .name } : { os .path .relpath (self .path )} already exists"
374+ )
375+ return
376+
377+ self .suite .crate .repo .fetch ()
378+ logging .info (f"Starting build: { self .name } " )
379+ self .install_prefix .mkdir (parents = True , exist_ok = True )
380+ self .build_dir .mkdir (parents = True , exist_ok = True )
343381 for lib in self .suite .deps :
344382 if lib .repo :
345383 lib .repo .fetch ()
346384
347385 with ExitStack () as patchstack :
348- crates = self .suite .deps + [ self ]
349- [patchstack .enter_context (c .repo .patch (self .profile )) for c in crates ]
386+ crates = self .suite .deps + ( self . suite . crate ,)
387+ [patchstack .enter_context (c .repo .patch (self .patch_suffix )) for c in crates ]
350388 self ._cargo_build ()
351- target_bin = self .build_dir / "release" / super () .name
389+ target_bin = self .build_dir / "release" / self . suite . crate .name
352390 if not target_bin .exists ():
353- print (target_bin )
391+ print (str ( target_bin ) )
354392 raise BuildError (f"Build target does not exist" )
355393 logging .info (f"Symlinking { target_bin } -> { self .path } " )
356394 os .symlink (target_bin , self .path )
357395
396+ logging .info (
397+ f"Build finished: { self .name } , installed at '{ os .path .relpath (self .path )} '"
398+ )
399+
358400
359401class CustomExperiment (Experiment ):
360402 _name : str
@@ -428,6 +470,10 @@ def alloy_variants(self, only_installed=False, only_missing=False):
428470 l = [a for a in l if not a .installed ]
429471 return list ({a .name : a for a in l }.values ())
430472
473+ @property
474+ def build_steps (self ):
475+ return sum (cfg .build_steps for cfg in self .configurations (only_missing = True ))
476+
431477 @property
432478 def config (self ) -> Path :
433479 if self ._config and self ._config .exists ():
@@ -477,10 +523,6 @@ def config(self) -> Path:
477523 self ._config = REBENCH_CONF
478524 return self ._config
479525
480- @property
481- def build_steps (self ) -> int :
482- return sum ([e .build_steps for e in self .experiments ])
483-
484526 @property
485527 def run_steps (self ) -> int :
486528 return sum ([e .steps for e in self .experiments ])
0 commit comments