@@ -22,7 +22,7 @@ use std::env;
2222use std:: fs:: { self , File } ;
2323use std:: io:: { Read , Write } ;
2424use std:: path:: { PathBuf , Path } ;
25- use std:: process:: Command ;
25+ use std:: process:: { Command , Stdio } ;
2626
2727use build_helper:: output;
2828
@@ -827,7 +827,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
827827 cmd. arg ( "-nologo" )
828828 . arg ( "-ext" ) . arg ( "WixUIExtension" )
829829 . arg ( "-ext" ) . arg ( "WixUtilExtension" )
830- . arg ( "-out" ) . arg ( distdir ( build ) . join ( filename) )
830+ . arg ( "-out" ) . arg ( exe . join ( & filename) )
831831 . arg ( "rust.wixobj" )
832832 . arg ( "ui.wixobj" )
833833 . arg ( "rustwelcomedlg.wixobj" )
@@ -844,6 +844,8 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
844844 cmd. arg ( "-sice:ICE57" ) ;
845845
846846 build. run ( & mut cmd) ;
847+
848+ t ! ( fs:: rename( exe. join( & filename) , distdir( build) . join( & filename) ) ) ;
847849 }
848850}
849851
@@ -876,3 +878,34 @@ fn add_env(build: &Build, cmd: &mut Command, target: &str) {
876878 cmd. env ( "CFG_PLATFORM" , "x86" ) ;
877879 }
878880}
881+
882+ pub fn hash_and_sign ( build : & Build ) {
883+ let compiler = Compiler :: new ( 0 , & build. config . build ) ;
884+ let mut cmd = build. tool_cmd ( & compiler, "build-manifest" ) ;
885+ let sign = build. config . dist_sign_folder . as_ref ( ) . unwrap_or_else ( || {
886+ panic ! ( "\n \n failed to specify `dist.sign-folder` in `config.toml`\n \n " )
887+ } ) ;
888+ let addr = build. config . dist_upload_addr . as_ref ( ) . unwrap_or_else ( || {
889+ panic ! ( "\n \n failed to specify `dist.upload-addr` in `config.toml`\n \n " )
890+ } ) ;
891+ let file = build. config . dist_gpg_password_file . as_ref ( ) . unwrap_or_else ( || {
892+ panic ! ( "\n \n failed to specify `dist.gpg-password-file` in `config.toml`\n \n " )
893+ } ) ;
894+ let mut pass = String :: new ( ) ;
895+ t ! ( t!( File :: open( & file) ) . read_to_string( & mut pass) ) ;
896+
897+ let today = output ( Command :: new ( "date" ) . arg ( "+%Y-%m-%d" ) ) ;
898+
899+ cmd. arg ( sign) ;
900+ cmd. arg ( distdir ( build) ) ;
901+ cmd. arg ( today. trim ( ) ) ;
902+ cmd. arg ( package_vers ( build) ) ;
903+ cmd. arg ( addr) ;
904+
905+ t ! ( fs:: create_dir_all( distdir( build) ) ) ;
906+
907+ let mut child = t ! ( cmd. stdin( Stdio :: piped( ) ) . spawn( ) ) ;
908+ t ! ( child. stdin. take( ) . unwrap( ) . write_all( pass. as_bytes( ) ) ) ;
909+ let status = t ! ( child. wait( ) ) ;
910+ assert ! ( status. success( ) ) ;
911+ }
0 commit comments