@@ -514,25 +514,31 @@ fn prepare_toml_for_vendor(
514514 . package
515515 . as_mut ( )
516516 . expect ( "venedored manifests must have packages" ) ;
517- // Validates if build script file exists. If not, warn and ignore.
518- if let Some ( TomlPackageBuild :: SingleScript ( path) ) = & package. build {
519- let path = paths:: normalize_path ( Path :: new ( path) ) ;
520- let included = packaged_files. contains ( & path) ;
521- let build = if included {
522- let path = path
523- . into_os_string ( )
524- . into_string ( )
525- . map_err ( |_err| anyhow:: format_err!( "non-UTF8 `package.build`" ) ) ?;
526- let path = crate :: util:: toml:: normalize_path_string_sep ( path) ;
527- TomlPackageBuild :: SingleScript ( path)
528- } else {
529- gctx. shell ( ) . warn ( format ! (
530- "ignoring `package.build` as `{}` is not included in the published package" ,
531- path. display( )
532- ) ) ?;
533- TomlPackageBuild :: Auto ( false )
534- } ;
535- package. build = Some ( build) ;
517+ // Validates if build script file is included in package. If not, warn and ignore.
518+ if let Some ( custom_build_scripts) = package. normalized_build ( ) . expect ( "previously normalized" ) {
519+ let mut included_scripts = Vec :: new ( ) ;
520+ for script in custom_build_scripts {
521+ let path = paths:: normalize_path ( Path :: new ( script) ) ;
522+ let included = packaged_files. contains ( & path) ;
523+ if included {
524+ let path = path
525+ . into_os_string ( )
526+ . into_string ( )
527+ . map_err ( |_err| anyhow:: format_err!( "non-UTF8 `package.build`" ) ) ?;
528+ let path = crate :: util:: toml:: normalize_path_string_sep ( path) ;
529+ included_scripts. push ( path) ;
530+ } else {
531+ gctx. shell ( ) . warn ( format ! (
532+ "ignoring `package.build` entry `{}` as it is not included in the published package" ,
533+ path. display( )
534+ ) ) ?;
535+ }
536+ }
537+ package. build = Some ( match included_scripts. len ( ) {
538+ 0 => TomlPackageBuild :: Auto ( false ) ,
539+ 1 => TomlPackageBuild :: SingleScript ( included_scripts[ 0 ] . clone ( ) ) ,
540+ _ => TomlPackageBuild :: MultipleScript ( included_scripts) ,
541+ } ) ;
536542 }
537543
538544 let lib = if let Some ( target) = & me. lib {
0 commit comments