@@ -274,12 +274,16 @@ def copy_fuzzing_engine() -> Path:
274274def build_project (
275275 targets_to_index : Sequence [str ] | None = None ,
276276 compile_args : Sequence [str ] | None = None ,
277+ binaries_only : bool = False ,
277278):
278279 """Build the actual project."""
279280 set_env_vars ()
280281 if targets_to_index :
281282 os .environ ['INDEXER_TARGETS' ] = ',' .join (targets_to_index )
282283
284+ if binaries_only :
285+ os .environ ['INDEXER_BINARIES_ONLY' ] = '1'
286+
283287 fuzzing_engine_path = copy_fuzzing_engine ()
284288
285289 build_fuzzing_engine_command = [
@@ -606,6 +610,11 @@ def main():
606610 action = 'store_true' ,
607611 help = 'Use gzipped tar (.tgz) for the output snapshot' ,
608612 )
613+ parser .add_argument (
614+ '--binaries-only' ,
615+ action = 'store_true' ,
616+ help = 'Build target binaries only, and not index archives.' ,
617+ )
609618 args = parser .parse_args ()
610619
611620 # Clean up the existing OUT by default, otherwise we may run into various
@@ -631,7 +640,7 @@ def main():
631640 SNAPSHOT_DIR .mkdir (exist_ok = True )
632641 # We don't have an existing /out dir on oss-fuzz's build infra.
633642 OUT .mkdir (parents = True , exist_ok = True )
634- build_project (targets_to_index , args .compile_arg )
643+ build_project (targets_to_index , args .compile_arg , args . binaries_only )
635644
636645 if args .target_arg :
637646 target_args = args .target_arg
@@ -647,11 +656,12 @@ def main():
647656 logging .info ('No target env specified.' )
648657 target_env = {}
649658
650- file_extension = '.tgz' if args .compressed else '.tar'
651- test_and_archive (target_args , target_env , targets_to_index , file_extension )
659+ if not args .binaries_only :
660+ file_extension = '.tgz' if args .compressed else '.tar'
661+ test_and_archive (target_args , target_env , targets_to_index , file_extension )
652662
653- for snapshot in SNAPSHOT_DIR .iterdir ():
654- shutil .move (str (snapshot ), OUT )
663+ for snapshot in SNAPSHOT_DIR .iterdir ():
664+ shutil .move (str (snapshot ), OUT )
655665
656666 # By default, this directory has o-rwx and its contents can't be deleted
657667 # by a non-root user from outside the container. The rest of the files are
0 commit comments