@@ -186,6 +186,7 @@ macro_rules! t {
186186
187187struct Builder {
188188 versions : Versions ,
189+ shipped_files : HashSet < String > ,
189190
190191 input : PathBuf ,
191192 output : PathBuf ,
@@ -239,6 +240,7 @@ fn main() {
239240
240241 Builder {
241242 versions : Versions :: new ( & channel, & input) . unwrap ( ) ,
243+ shipped_files : HashSet :: new ( ) ,
242244
243245 input,
244246 output,
@@ -259,16 +261,21 @@ impl Builder {
259261 }
260262 let manifest = self . build_manifest ( ) ;
261263
262- self . write_channel_files ( self . versions . channel ( ) , & manifest) ;
263- if self . versions . channel ( ) == "stable" {
264+ let channel = self . versions . channel ( ) . to_string ( ) ;
265+ self . write_channel_files ( & channel, & manifest) ;
266+ if channel == "stable" {
264267 // channel-rust-1.XX.YY.toml
265- let rust_version = self . versions . rustc_version ( ) ;
266- self . write_channel_files ( rust_version, & manifest) ;
268+ let rust_version = self . versions . rustc_version ( ) . to_string ( ) ;
269+ self . write_channel_files ( & rust_version, & manifest) ;
267270
268271 // channel-rust-1.XX.toml
269272 let major_minor = rust_version. split ( '.' ) . take ( 2 ) . collect :: < Vec < _ > > ( ) . join ( "." ) ;
270273 self . write_channel_files ( & major_minor, & manifest) ;
271274 }
275+
276+ if let Some ( path) = std:: env:: var_os ( "BUILD_MANIFEST_SHIPPED_FILES_PATH" ) {
277+ self . write_shipped_files ( & Path :: new ( & path) ) ;
278+ }
272279 }
273280
274281 /// If a tool does not pass its tests, don't ship it.
@@ -623,7 +630,7 @@ impl Builder {
623630 } )
624631 }
625632
626- fn write_channel_files ( & self , channel_name : & str , manifest : & Manifest ) {
633+ fn write_channel_files ( & mut self , channel_name : & str , manifest : & Manifest ) {
627634 self . write ( & toml:: to_string ( & manifest) . unwrap ( ) , channel_name, ".toml" ) ;
628635 self . write ( & manifest. date , channel_name, "-date.txt" ) ;
629636 self . write (
@@ -633,14 +640,25 @@ impl Builder {
633640 ) ;
634641 }
635642
636- fn write ( & self , contents : & str , channel_name : & str , suffix : & str ) {
637- let dst = self . output . join ( format ! ( "channel-rust-{}{}" , channel_name, suffix) ) ;
643+ fn write ( & mut self , contents : & str , channel_name : & str , suffix : & str ) {
644+ let name = format ! ( "channel-rust-{}{}" , channel_name, suffix) ;
645+ self . shipped_files . insert ( name. clone ( ) ) ;
646+
647+ let dst = self . output . join ( name) ;
638648 t ! ( fs:: write( & dst, contents) ) ;
639649 if self . legacy {
640650 self . hash ( & dst) ;
641651 self . sign ( & dst) ;
642652 }
643653 }
654+
655+ fn write_shipped_files ( & self , path : & Path ) {
656+ let mut files = self . shipped_files . iter ( ) . map ( |s| s. as_str ( ) ) . collect :: < Vec < _ > > ( ) ;
657+ files. sort ( ) ;
658+ let content = format ! ( "{}\n " , files. join( "\n " ) ) ;
659+
660+ t ! ( std:: fs:: write( path, content. as_bytes( ) ) ) ;
661+ }
644662}
645663
646664fn fetch_hash ( path : & Path ) -> Result < String , Box < dyn Error > > {
0 commit comments