@@ -67,6 +67,14 @@ fn rust_installer(builder: &Builder) -> Command {
67
67
builder. tool_cmd ( Tool :: RustInstaller )
68
68
}
69
69
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
+
70
78
#[ derive( Debug , PartialOrd , Ord , Copy , Clone , Hash , PartialEq , Eq ) ]
71
79
pub struct Docs {
72
80
pub stage : u32 ,
@@ -1166,7 +1174,7 @@ impl Step for Rls {
1166
1174
let rls = builder. ensure ( tool:: Rls {
1167
1175
compiler : builder. compiler ( stage, builder. config . build ) ,
1168
1176
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 } ) ?;
1170
1178
1171
1179
builder. install ( & rls, & image. join ( "bin" ) , 0o755 ) ;
1172
1180
let doc = image. join ( "share/doc/rls" ) ;
@@ -1245,11 +1253,11 @@ impl Step for Clippy {
1245
1253
let clippy = builder. ensure ( tool:: Clippy {
1246
1254
compiler : builder. compiler ( stage, builder. config . build ) ,
1247
1255
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 } ) ?;
1249
1257
let cargoclippy = builder. ensure ( tool:: CargoClippy {
1250
1258
compiler : builder. compiler ( stage, builder. config . build ) ,
1251
1259
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 } ) ?;
1253
1261
1254
1262
builder. install ( & clippy, & image. join ( "bin" ) , 0o755 ) ;
1255
1263
builder. install ( & cargoclippy, & image. join ( "bin" ) , 0o755 ) ;
@@ -1324,11 +1332,11 @@ impl Step for Rustfmt {
1324
1332
let rustfmt = builder. ensure ( tool:: Rustfmt {
1325
1333
compiler : builder. compiler ( stage, builder. config . build ) ,
1326
1334
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 } ) ?;
1328
1336
let cargofmt = builder. ensure ( tool:: Cargofmt {
1329
1337
compiler : builder. compiler ( stage, builder. config . build ) ,
1330
1338
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 } ) ?;
1332
1340
1333
1341
builder. install ( & rustfmt, & image. join ( "bin" ) , 0o755 ) ;
1334
1342
builder. install ( & cargofmt, & image. join ( "bin" ) , 0o755 ) ;
0 commit comments