@@ -67,6 +67,14 @@ fn rust_installer(builder: &Builder) -> Command {
6767 builder. tool_cmd ( Tool :: RustInstaller )
6868}
6969
70+ fn missing_tool ( tool_name : & str , skip : bool ) {
71+ if skip {
72+ println ! ( "Unable to build {}, skipping dist" , tool_name)
73+ } else {
74+ panic ! ( "Unable to build {}" , tool_name)
75+ }
76+ }
77+
7078#[ derive( Debug , PartialOrd , Ord , Copy , Clone , Hash , PartialEq , Eq ) ]
7179pub struct Docs {
7280 pub stage : u32 ,
@@ -1166,7 +1174,7 @@ impl Step for Rls {
11661174 let rls = builder. ensure ( tool:: Rls {
11671175 compiler : builder. compiler ( stage, builder. config . build ) ,
11681176 target, extra_features : Vec :: new ( )
1169- } ) . or_else ( || { println ! ( "Unable to build RLS, skipping dist" ) ; None } ) ?;
1177+ } ) . or_else ( || { missing_tool ( " RLS" , builder . build . config . missing_tools ) ; None } ) ?;
11701178
11711179 builder. install ( & rls, & image. join ( "bin" ) , 0o755 ) ;
11721180 let doc = image. join ( "share/doc/rls" ) ;
@@ -1245,11 +1253,11 @@ impl Step for Clippy {
12451253 let clippy = builder. ensure ( tool:: Clippy {
12461254 compiler : builder. compiler ( stage, builder. config . build ) ,
12471255 target, extra_features : Vec :: new ( )
1248- } ) . or_else ( || { println ! ( "Unable to build clippy, skipping dist" ) ; None } ) ?;
1256+ } ) . or_else ( || { missing_tool ( " clippy" , builder . build . config . missing_tools ) ; None } ) ?;
12491257 let cargoclippy = builder. ensure ( tool:: CargoClippy {
12501258 compiler : builder. compiler ( stage, builder. config . build ) ,
12511259 target, extra_features : Vec :: new ( )
1252- } ) . or_else ( || { println ! ( "Unable to build cargo clippy, skipping dist" ) ; None } ) ?;
1260+ } ) . or_else ( || { missing_tool ( " cargo clippy" , builder . build . config . missing_tools ) ; None } ) ?;
12531261
12541262 builder. install ( & clippy, & image. join ( "bin" ) , 0o755 ) ;
12551263 builder. install ( & cargoclippy, & image. join ( "bin" ) , 0o755 ) ;
@@ -1324,11 +1332,11 @@ impl Step for Rustfmt {
13241332 let rustfmt = builder. ensure ( tool:: Rustfmt {
13251333 compiler : builder. compiler ( stage, builder. config . build ) ,
13261334 target, extra_features : Vec :: new ( )
1327- } ) . or_else ( || { println ! ( "Unable to build Rustfmt, skipping dist" ) ; None } ) ?;
1335+ } ) . or_else ( || { missing_tool ( " Rustfmt" , builder . build . config . missing_tools ) ; None } ) ?;
13281336 let cargofmt = builder. ensure ( tool:: Cargofmt {
13291337 compiler : builder. compiler ( stage, builder. config . build ) ,
13301338 target, extra_features : Vec :: new ( )
1331- } ) . or_else ( || { println ! ( "Unable to build Cargofmt, skipping dist" ) ; None } ) ?;
1339+ } ) . or_else ( || { missing_tool ( " Cargofmt" , builder . build . config . missing_tools ) ; None } ) ?;
13321340
13331341 builder. install ( & rustfmt, & image. join ( "bin" ) , 0o755 ) ;
13341342 builder. install ( & cargofmt, & image. join ( "bin" ) , 0o755 ) ;
0 commit comments