@@ -39,6 +39,8 @@ use util::{cp_r, libdir, is_dylib, cp_filtered, copy, exe};
3939fn pkgname ( build : & Build , component : & str ) -> String {
4040 if component == "cargo" {
4141 format ! ( "{}-{}" , component, build. cargo_package_vers( ) )
42+ } else if component == "rls" {
43+ format ! ( "{}-{}" , component, build. package_vers( & build. release_num( "rls" ) ) )
4244 } else {
4345 assert ! ( component. starts_with( "rust" ) ) ;
4446 format ! ( "{}-{}" , component, build. rust_package_vers( ) )
@@ -315,15 +317,12 @@ pub fn rust_src_location(build: &Build) -> PathBuf {
315317
316318/// Creates a tarball of save-analysis metadata, if available.
317319pub fn analysis ( build : & Build , compiler : & Compiler , target : & str ) {
318- if !build. config . rust_save_analysis {
319- return
320- }
321-
320+ assert ! ( build. config. extended) ;
322321 println ! ( "Dist analysis" ) ;
323322
324323 if compiler. host != build. config . build {
325324 println ! ( "\t skipping, not a build host" ) ;
326- return
325+ return ;
327326 }
328327
329328 // Package save-analysis from stage1 if not doing a full bootstrap, as the
@@ -393,6 +392,7 @@ pub fn rust_src(build: &Build) {
393392 "man" ,
394393 "src" ,
395394 "cargo" ,
395+ "rls" ,
396396 ] ;
397397
398398 let filter_fn = move |path : & Path | {
@@ -539,7 +539,7 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
539539
540540 let src = build. src . join ( "cargo" ) ;
541541 let etc = src. join ( "src/etc" ) ;
542- let release_num = build. cargo_release_num ( ) ;
542+ let release_num = build. release_num ( "cargo" ) ;
543543 let name = pkgname ( build, "cargo" ) ;
544544 let version = build. cargo_info . version ( build, & release_num) ;
545545
@@ -593,6 +593,55 @@ pub fn cargo(build: &Build, stage: u32, target: &str) {
593593 build. run ( & mut cmd) ;
594594}
595595
596+ pub fn rls ( build : & Build , stage : u32 , target : & str ) {
597+ assert ! ( build. config. extended) ;
598+ println ! ( "Dist RLS stage{} ({})" , stage, target) ;
599+ let compiler = Compiler :: new ( stage, & build. config . build ) ;
600+
601+ let src = build. src . join ( "rls" ) ;
602+ let release_num = build. release_num ( "rls" ) ;
603+ let name = pkgname ( build, "rls" ) ;
604+ let version = build. rls_info . version ( build, & release_num) ;
605+
606+ let tmp = tmpdir ( build) ;
607+ let image = tmp. join ( "rls-image" ) ;
608+ drop ( fs:: remove_dir_all ( & image) ) ;
609+ t ! ( fs:: create_dir_all( & image) ) ;
610+
611+ // Prepare the image directory
612+ let rls = build. cargo_out ( & compiler, Mode :: Tool , target)
613+ . join ( exe ( "rls" , target) ) ;
614+ install ( & rls, & image. join ( "bin" ) , 0o755 ) ;
615+ let doc = image. join ( "share/doc/rls" ) ;
616+ install ( & src. join ( "README.md" ) , & doc, 0o644 ) ;
617+ install ( & src. join ( "LICENSE-MIT" ) , & doc, 0o644 ) ;
618+ install ( & src. join ( "LICENSE-APACHE" ) , & doc, 0o644 ) ;
619+
620+ // Prepare the overlay
621+ let overlay = tmp. join ( "rls-overlay" ) ;
622+ drop ( fs:: remove_dir_all ( & overlay) ) ;
623+ t ! ( fs:: create_dir_all( & overlay) ) ;
624+ install ( & src. join ( "README.md" ) , & overlay, 0o644 ) ;
625+ install ( & src. join ( "LICENSE-MIT" ) , & overlay, 0o644 ) ;
626+ install ( & src. join ( "LICENSE-APACHE" ) , & overlay, 0o644 ) ;
627+ t ! ( t!( File :: create( overlay. join( "version" ) ) ) . write_all( version. as_bytes( ) ) ) ;
628+
629+ // Generate the installer tarball
630+ let mut cmd = Command :: new ( "sh" ) ;
631+ cmd. arg ( sanitize_sh ( & build. src . join ( "src/rust-installer/gen-installer.sh" ) ) )
632+ . arg ( "--product-name=Rust" )
633+ . arg ( "--rel-manifest-dir=rustlib" )
634+ . arg ( "--success-message=RLS-ready-to-serve." )
635+ . arg ( format ! ( "--image-dir={}" , sanitize_sh( & image) ) )
636+ . arg ( format ! ( "--work-dir={}" , sanitize_sh( & tmpdir( build) ) ) )
637+ . arg ( format ! ( "--output-dir={}" , sanitize_sh( & distdir( build) ) ) )
638+ . arg ( format ! ( "--non-installed-overlay={}" , sanitize_sh( & overlay) ) )
639+ . arg ( format ! ( "--package-name={}-{}" , name, target) )
640+ . arg ( "--component-name=rls" )
641+ . arg ( "--legacy-manifest-dirs=rustlib,cargo" ) ;
642+ build. run ( & mut cmd) ;
643+ }
644+
596645/// Creates a combined installer for the specified target in the provided stage.
597646pub fn extended ( build : & Build , stage : u32 , target : & str ) {
598647 println ! ( "Dist extended stage{} ({})" , stage, target) ;
@@ -604,6 +653,12 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
604653 let cargo_installer = dist. join ( format ! ( "{}-{}.tar.gz" ,
605654 pkgname( build, "cargo" ) ,
606655 target) ) ;
656+ let rls_installer = dist. join ( format ! ( "{}-{}.tar.gz" ,
657+ pkgname( build, "rls" ) ,
658+ target) ) ;
659+ let analysis_installer = dist. join ( format ! ( "{}-{}.tar.gz" ,
660+ pkgname( build, "rust-analysis" ) ,
661+ target) ) ;
607662 let docs_installer = dist. join ( format ! ( "{}-{}.tar.gz" ,
608663 pkgname( build, "rust-docs" ) ,
609664 target) ) ;
@@ -631,9 +686,11 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
631686 // upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
632687 // the std files during uninstall. To do this ensure that rustc comes
633688 // before rust-std in the list below.
634- let mut input_tarballs = format ! ( "{},{},{},{}" ,
689+ let mut input_tarballs = format ! ( "{},{},{},{},{},{} " ,
635690 sanitize_sh( & rustc_installer) ,
636691 sanitize_sh( & cargo_installer) ,
692+ sanitize_sh( & rls_installer) ,
693+ sanitize_sh( & analysis_installer) ,
637694 sanitize_sh( & docs_installer) ,
638695 sanitize_sh( & std_installer) ) ;
639696 if target. contains ( "pc-windows-gnu" ) {
@@ -946,7 +1003,8 @@ pub fn hash_and_sign(build: &Build) {
9461003 cmd. arg ( distdir ( build) ) ;
9471004 cmd. arg ( today. trim ( ) ) ;
9481005 cmd. arg ( build. rust_package_vers ( ) ) ;
949- cmd. arg ( build. package_vers ( & build. cargo_release_num ( ) ) ) ;
1006+ cmd. arg ( build. package_vers ( & build. release_num ( "cargo" ) ) ) ;
1007+ cmd. arg ( build. package_vers ( & build. release_num ( "rls" ) ) ) ;
9501008 cmd. arg ( addr) ;
9511009
9521010 t ! ( fs:: create_dir_all( distdir( build) ) ) ;
0 commit comments