@@ -408,10 +408,6 @@ struct Build {
408408 /// Path to the output directory for the compiled shaders.
409409 #[ clap( long, short, default_value = "./" ) ]
410410 output_dir : std:: path:: PathBuf ,
411-
412- /// If set the shaders will be compiled but not put into place.
413- #[ clap( long, short) ]
414- dry_run : bool ,
415411}
416412
417413impl Build {
@@ -440,7 +436,6 @@ impl Build {
440436 no_default_features : self . no_default_features ,
441437 features : self . features . clone ( ) ,
442438 output_dir : self . output_dir . clone ( ) ,
443- dry_run : self . dry_run ,
444439 } ;
445440
446441 // UNWRAP: safe because we know this always serializes
@@ -478,37 +473,41 @@ impl Build {
478473 path : filepath,
479474 } | {
480475 let path = self . output_dir . join ( filepath. file_name ( ) . unwrap ( ) ) ;
481- if !self . dry_run {
482- std:: fs:: copy ( filepath, & path) . unwrap ( ) ;
483- }
476+ std:: fs:: copy ( filepath, & path) . unwrap ( ) ;
484477 Linkage :: new ( entry, path)
485478 } ,
486479 )
487480 . collect ( ) ;
488481
489482 // Write the shader manifest json file
490- if !self . dry_run {
491- let manifest_path = self . output_dir . join ( "manifest.json" ) ;
492- // Sort the contents so the output is deterministic
493- linkage. sort ( ) ;
494- // UNWRAP: safe because we know this always serializes
495- let json = serde_json:: to_string_pretty ( & linkage) . unwrap ( ) ;
496- let mut file = std:: fs:: File :: create ( & manifest_path) . unwrap_or_else ( |e| {
497- log:: error!(
498- "could not create shader manifest file '{}': {e}" ,
499- manifest_path. display( ) ,
500- ) ;
501- panic ! ( "{e}" )
502- } ) ;
503- file. write_all ( json. as_bytes ( ) ) . unwrap_or_else ( |e| {
504- log:: error!(
505- "could not write shader manifest file '{}': {e}" ,
506- manifest_path. display( ) ,
507- ) ;
508- panic ! ( "{e}" )
509- } ) ;
483+ let manifest_path = self . output_dir . join ( "manifest.json" ) ;
484+ // Sort the contents so the output is deterministic
485+ linkage. sort ( ) ;
486+ // UNWRAP: safe because we know this always serializes
487+ let json = serde_json:: to_string_pretty ( & linkage) . unwrap ( ) ;
488+ let mut file = std:: fs:: File :: create ( & manifest_path) . unwrap_or_else ( |e| {
489+ log:: error!(
490+ "could not create shader manifest file '{}': {e}" ,
491+ manifest_path. display( ) ,
492+ ) ;
493+ panic ! ( "{e}" )
494+ } ) ;
495+ file. write_all ( json. as_bytes ( ) ) . unwrap_or_else ( |e| {
496+ log:: error!(
497+ "could not write shader manifest file '{}': {e}" ,
498+ manifest_path. display( ) ,
499+ ) ;
500+ panic ! ( "{e}" )
501+ } ) ;
510502
511- log:: info!( "wrote manifest to '{}'" , manifest_path. display( ) ) ;
503+ log:: info!( "wrote manifest to '{}'" , manifest_path. display( ) ) ;
504+
505+ if spirv_manifest. is_file ( ) {
506+ log:: debug!(
507+ "removing spirv-manifest.json file '{}'" ,
508+ spirv_manifest. display( )
509+ ) ;
510+ std:: fs:: remove_file ( spirv_manifest) . unwrap ( ) ;
512511 }
513512 }
514513}
0 commit comments