@@ -1035,7 +1035,7 @@ pub struct Rls {
1035
1035
}
1036
1036
1037
1037
impl Step for Rls {
1038
- type Output = PathBuf ;
1038
+ type Output = Option < PathBuf > ;
1039
1039
const ONLY_BUILD_TARGETS : bool = true ;
1040
1040
const ONLY_HOSTS : bool = true ;
1041
1041
@@ -1050,12 +1050,17 @@ impl Step for Rls {
1050
1050
} ) ;
1051
1051
}
1052
1052
1053
- fn run ( self , builder : & Builder ) -> PathBuf {
1053
+ fn run ( self , builder : & Builder ) -> Option < PathBuf > {
1054
1054
let build = builder. build ;
1055
1055
let stage = self . stage ;
1056
1056
let target = self . target ;
1057
1057
assert ! ( build. config. extended) ;
1058
1058
1059
+ if !builder. config . toolstate . rls . testing ( ) {
1060
+ println ! ( "skipping Dist RLS stage{} ({})" , stage, target) ;
1061
+ return None
1062
+ }
1063
+
1059
1064
println ! ( "Dist RLS stage{} ({})" , stage, target) ;
1060
1065
let src = build. src . join ( "src/tools/rls" ) ;
1061
1066
let release_num = build. release_num ( "rls" ) ;
@@ -1102,7 +1107,7 @@ impl Step for Rls {
1102
1107
. arg ( "--component-name=rls-preview" ) ;
1103
1108
1104
1109
build. run ( & mut cmd) ;
1105
- distdir ( build) . join ( format ! ( "{}-{}.tar.gz" , name, target) )
1110
+ Some ( distdir ( build) . join ( format ! ( "{}-{}.tar.gz" , name, target) ) )
1106
1111
}
1107
1112
}
1108
1113
@@ -1202,8 +1207,12 @@ impl Step for Extended {
1202
1207
// upgrades rustc was upgraded before rust-std. To avoid rustc clobbering
1203
1208
// the std files during uninstall. To do this ensure that rustc comes
1204
1209
// before rust-std in the list below.
1205
- let mut tarballs = vec ! [ rustc_installer, cargo_installer, rls_installer,
1206
- analysis_installer, std_installer] ;
1210
+ let mut tarballs = Vec :: new ( ) ;
1211
+ tarballs. push ( rustc_installer) ;
1212
+ tarballs. push ( cargo_installer) ;
1213
+ tarballs. extend ( rls_installer. clone ( ) ) ;
1214
+ tarballs. push ( analysis_installer) ;
1215
+ tarballs. push ( std_installer) ;
1207
1216
if build. config . docs {
1208
1217
tarballs. push ( docs_installer) ;
1209
1218
}
@@ -1245,35 +1254,38 @@ impl Step for Extended {
1245
1254
}
1246
1255
rtf. push_str ( "}" ) ;
1247
1256
1257
+ fn filter ( contents : & str , marker : & str ) -> String {
1258
+ let start = format ! ( "tool-{}-start" , marker) ;
1259
+ let end = format ! ( "tool-{}-end" , marker) ;
1260
+ let mut lines = Vec :: new ( ) ;
1261
+ let mut omitted = false ;
1262
+ for line in contents. lines ( ) {
1263
+ if line. contains ( & start) {
1264
+ omitted = true ;
1265
+ } else if line. contains ( & end) {
1266
+ omitted = false ;
1267
+ } else if !omitted {
1268
+ lines. push ( line) ;
1269
+ }
1270
+ }
1271
+
1272
+ lines. join ( "\n " )
1273
+ }
1274
+
1275
+ let xform = |p : & Path | {
1276
+ let mut contents = String :: new ( ) ;
1277
+ t ! ( t!( File :: open( p) ) . read_to_string( & mut contents) ) ;
1278
+ if rls_installer. is_none ( ) {
1279
+ contents = filter ( & contents, "rls" ) ;
1280
+ }
1281
+ let ret = tmp. join ( p. file_name ( ) . unwrap ( ) ) ;
1282
+ t ! ( t!( File :: create( & ret) ) . write_all( contents. as_bytes( ) ) ) ;
1283
+ return ret
1284
+ } ;
1285
+
1248
1286
if target. contains ( "apple-darwin" ) {
1249
1287
let pkg = tmp. join ( "pkg" ) ;
1250
1288
let _ = fs:: remove_dir_all ( & pkg) ;
1251
- t ! ( fs:: create_dir_all( pkg. join( "rustc" ) ) ) ;
1252
- t ! ( fs:: create_dir_all( pkg. join( "cargo" ) ) ) ;
1253
- t ! ( fs:: create_dir_all( pkg. join( "rust-docs" ) ) ) ;
1254
- t ! ( fs:: create_dir_all( pkg. join( "rust-std" ) ) ) ;
1255
- t ! ( fs:: create_dir_all( pkg. join( "rls" ) ) ) ;
1256
- t ! ( fs:: create_dir_all( pkg. join( "rust-analysis" ) ) ) ;
1257
-
1258
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rustc" ) , target) ) ,
1259
- & pkg. join ( "rustc" ) ) ;
1260
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "cargo" ) , target) ) ,
1261
- & pkg. join ( "cargo" ) ) ;
1262
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rust-docs" ) , target) ) ,
1263
- & pkg. join ( "rust-docs" ) ) ;
1264
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rust-std" ) , target) ) ,
1265
- & pkg. join ( "rust-std" ) ) ;
1266
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rls" ) , target) ) ,
1267
- & pkg. join ( "rls" ) ) ;
1268
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rust-analysis" ) , target) ) ,
1269
- & pkg. join ( "rust-analysis" ) ) ;
1270
-
1271
- install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( "rustc" ) , 0o755 ) ;
1272
- install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( "cargo" ) , 0o755 ) ;
1273
- install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( "rust-docs" ) , 0o755 ) ;
1274
- install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( "rust-std" ) , 0o755 ) ;
1275
- install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( "rls" ) , 0o755 ) ;
1276
- install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( "rust-analysis" ) , 0o755 ) ;
1277
1289
1278
1290
let pkgbuild = |component : & str | {
1279
1291
let mut cmd = Command :: new ( "pkgbuild" ) ;
@@ -1283,12 +1295,23 @@ impl Step for Extended {
1283
1295
. arg ( pkg. join ( component) . with_extension ( "pkg" ) ) ;
1284
1296
build. run ( & mut cmd) ;
1285
1297
} ;
1286
- pkgbuild ( "rustc" ) ;
1287
- pkgbuild ( "cargo" ) ;
1288
- pkgbuild ( "rust-docs" ) ;
1289
- pkgbuild ( "rust-std" ) ;
1290
- pkgbuild ( "rls" ) ;
1291
- pkgbuild ( "rust-analysis" ) ;
1298
+
1299
+ let prepare = |name : & str | {
1300
+ t ! ( fs:: create_dir_all( pkg. join( name) ) ) ;
1301
+ cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, name) , target) ) ,
1302
+ & pkg. join ( name) ) ;
1303
+ install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( name) , 0o755 ) ;
1304
+ pkgbuild ( name) ;
1305
+ } ;
1306
+ prepare ( "rustc" ) ;
1307
+ prepare ( "cargo" ) ;
1308
+ prepare ( "rust-docs" ) ;
1309
+ prepare ( "rust-std" ) ;
1310
+ prepare ( "rust-analysis" ) ;
1311
+
1312
+ if rls_installer. is_some ( ) {
1313
+ prepare ( "rls" ) ;
1314
+ }
1292
1315
1293
1316
// create an 'uninstall' package
1294
1317
install ( & etc. join ( "pkg/postinstall" ) , & pkg. join ( "uninstall" ) , 0o755 ) ;
@@ -1298,7 +1321,7 @@ impl Step for Extended {
1298
1321
t ! ( t!( File :: create( pkg. join( "res/LICENSE.txt" ) ) ) . write_all( license. as_bytes( ) ) ) ;
1299
1322
install ( & etc. join ( "gfx/rust-logo.png" ) , & pkg. join ( "res" ) , 0o644 ) ;
1300
1323
let mut cmd = Command :: new ( "productbuild" ) ;
1301
- cmd. arg ( "--distribution" ) . arg ( etc. join ( "pkg/Distribution.xml" ) )
1324
+ cmd. arg ( "--distribution" ) . arg ( xform ( & etc. join ( "pkg/Distribution.xml" ) ) )
1302
1325
. arg ( "--resources" ) . arg ( pkg. join ( "res" ) )
1303
1326
. arg ( distdir ( build) . join ( format ! ( "{}-{}.pkg" ,
1304
1327
pkgname( build, "rust" ) ,
@@ -1310,46 +1333,34 @@ impl Step for Extended {
1310
1333
if target. contains ( "windows" ) {
1311
1334
let exe = tmp. join ( "exe" ) ;
1312
1335
let _ = fs:: remove_dir_all ( & exe) ;
1313
- t ! ( fs:: create_dir_all( exe. join( "rustc" ) ) ) ;
1314
- t ! ( fs:: create_dir_all( exe. join( "cargo" ) ) ) ;
1315
- t ! ( fs:: create_dir_all( exe. join( "rls" ) ) ) ;
1316
- t ! ( fs:: create_dir_all( exe. join( "rust-analysis" ) ) ) ;
1317
- t ! ( fs:: create_dir_all( exe. join( "rust-docs" ) ) ) ;
1318
- t ! ( fs:: create_dir_all( exe. join( "rust-std" ) ) ) ;
1319
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rustc" ) , target) )
1320
- . join ( "rustc" ) ,
1321
- & exe. join ( "rustc" ) ) ;
1322
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "cargo" ) , target) )
1323
- . join ( "cargo" ) ,
1324
- & exe. join ( "cargo" ) ) ;
1325
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rust-docs" ) , target) )
1326
- . join ( "rust-docs" ) ,
1327
- & exe. join ( "rust-docs" ) ) ;
1328
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rust-std" ) , target) )
1329
- . join ( format ! ( "rust-std-{}" , target) ) ,
1330
- & exe. join ( "rust-std" ) ) ;
1331
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rls" ) , target) ) . join ( "rls-preview" ) ,
1332
- & exe. join ( "rls" ) ) ;
1333
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rust-analysis" ) , target) )
1334
- . join ( format ! ( "rust-analysis-{}" , target) ) ,
1335
- & exe. join ( "rust-analysis" ) ) ;
1336
-
1337
- t ! ( fs:: remove_file( exe. join( "rustc/manifest.in" ) ) ) ;
1338
- t ! ( fs:: remove_file( exe. join( "cargo/manifest.in" ) ) ) ;
1339
- t ! ( fs:: remove_file( exe. join( "rust-docs/manifest.in" ) ) ) ;
1340
- t ! ( fs:: remove_file( exe. join( "rust-std/manifest.in" ) ) ) ;
1341
- t ! ( fs:: remove_file( exe. join( "rls/manifest.in" ) ) ) ;
1342
- t ! ( fs:: remove_file( exe. join( "rust-analysis/manifest.in" ) ) ) ;
1343
1336
1337
+ let prepare = |name : & str | {
1338
+ t ! ( fs:: create_dir_all( exe. join( name) ) ) ;
1339
+ let dir = if name == "rust-std" || name == "rust-analysis" {
1340
+ format ! ( "{}-{}" , name, target)
1341
+ } else if name == "rls" {
1342
+ "rls-preview" . to_string ( )
1343
+ } else {
1344
+ name. to_string ( )
1345
+ } ;
1346
+ cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, name) , target) )
1347
+ . join ( dir) ,
1348
+ & exe. join ( name) ) ;
1349
+ t ! ( fs:: remove_file( exe. join( name) . join( "manifest.in" ) ) ) ;
1350
+ } ;
1351
+ prepare ( "rustc" ) ;
1352
+ prepare ( "cargo" ) ;
1353
+ prepare ( "rust-analysis" ) ;
1354
+ prepare ( "rust-docs" ) ;
1355
+ prepare ( "rust-std" ) ;
1356
+ if rls_installer. is_some ( ) {
1357
+ prepare ( "rls" ) ;
1358
+ }
1344
1359
if target. contains ( "windows-gnu" ) {
1345
- t ! ( fs:: create_dir_all( exe. join( "rust-mingw" ) ) ) ;
1346
- cp_r ( & work. join ( & format ! ( "{}-{}" , pkgname( build, "rust-mingw" ) , target) )
1347
- . join ( "rust-mingw" ) ,
1348
- & exe. join ( "rust-mingw" ) ) ;
1349
- t ! ( fs:: remove_file( exe. join( "rust-mingw/manifest.in" ) ) ) ;
1360
+ prepare ( "rust-mingw" ) ;
1350
1361
}
1351
1362
1352
- install ( & etc. join ( "exe/rust.iss" ) , & exe, 0o644 ) ;
1363
+ install ( & xform ( & etc. join ( "exe/rust.iss" ) ) , & exe, 0o644 ) ;
1353
1364
install ( & etc. join ( "exe/modpath.iss" ) , & exe, 0o644 ) ;
1354
1365
install ( & etc. join ( "exe/upgrade.iss" ) , & exe, 0o644 ) ;
1355
1366
install ( & etc. join ( "gfx/rust-logo.ico" ) , & exe, 0o644 ) ;
@@ -1413,16 +1424,18 @@ impl Step for Extended {
1413
1424
. arg ( "-dr" ) . arg ( "Std" )
1414
1425
. arg ( "-var" ) . arg ( "var.StdDir" )
1415
1426
. arg ( "-out" ) . arg ( exe. join ( "StdGroup.wxs" ) ) ) ;
1416
- build. run ( Command :: new ( & heat)
1417
- . current_dir ( & exe)
1418
- . arg ( "dir" )
1419
- . arg ( "rls" )
1420
- . args ( & heat_flags)
1421
- . arg ( "-cg" ) . arg ( "RlsGroup" )
1422
- . arg ( "-dr" ) . arg ( "Rls" )
1423
- . arg ( "-var" ) . arg ( "var.RlsDir" )
1424
- . arg ( "-out" ) . arg ( exe. join ( "RlsGroup.wxs" ) )
1425
- . arg ( "-t" ) . arg ( etc. join ( "msi/remove-duplicates.xsl" ) ) ) ;
1427
+ if rls_installer. is_some ( ) {
1428
+ build. run ( Command :: new ( & heat)
1429
+ . current_dir ( & exe)
1430
+ . arg ( "dir" )
1431
+ . arg ( "rls" )
1432
+ . args ( & heat_flags)
1433
+ . arg ( "-cg" ) . arg ( "RlsGroup" )
1434
+ . arg ( "-dr" ) . arg ( "Rls" )
1435
+ . arg ( "-var" ) . arg ( "var.RlsDir" )
1436
+ . arg ( "-out" ) . arg ( exe. join ( "RlsGroup.wxs" ) )
1437
+ . arg ( "-t" ) . arg ( etc. join ( "msi/remove-duplicates.xsl" ) ) ) ;
1438
+ }
1426
1439
build. run ( Command :: new ( & heat)
1427
1440
. current_dir ( & exe)
1428
1441
. arg ( "dir" )
@@ -1456,26 +1469,30 @@ impl Step for Extended {
1456
1469
. arg ( "-dDocsDir=rust-docs" )
1457
1470
. arg ( "-dCargoDir=cargo" )
1458
1471
. arg ( "-dStdDir=rust-std" )
1459
- . arg ( "-dRlsDir=rls" )
1460
1472
. arg ( "-dAnalysisDir=rust-analysis" )
1461
1473
. arg ( "-arch" ) . arg ( & arch)
1462
1474
. arg ( "-out" ) . arg ( & output)
1463
1475
. arg ( & input) ;
1464
1476
add_env ( build, & mut cmd, target) ;
1465
1477
1478
+ if rls_installer. is_some ( ) {
1479
+ cmd. arg ( "-dRlsDir=rls" ) ;
1480
+ }
1466
1481
if target. contains ( "windows-gnu" ) {
1467
1482
cmd. arg ( "-dGccDir=rust-mingw" ) ;
1468
1483
}
1469
1484
build. run ( & mut cmd) ;
1470
1485
} ;
1471
- candle ( & etc. join ( "msi/rust.wxs" ) ) ;
1486
+ candle ( & xform ( & etc. join ( "msi/rust.wxs" ) ) ) ;
1472
1487
candle ( & etc. join ( "msi/ui.wxs" ) ) ;
1473
1488
candle ( & etc. join ( "msi/rustwelcomedlg.wxs" ) ) ;
1474
1489
candle ( "RustcGroup.wxs" . as_ref ( ) ) ;
1475
1490
candle ( "DocsGroup.wxs" . as_ref ( ) ) ;
1476
1491
candle ( "CargoGroup.wxs" . as_ref ( ) ) ;
1477
1492
candle ( "StdGroup.wxs" . as_ref ( ) ) ;
1478
- candle ( "RlsGroup.wxs" . as_ref ( ) ) ;
1493
+ if rls_installer. is_some ( ) {
1494
+ candle ( "RlsGroup.wxs" . as_ref ( ) ) ;
1495
+ }
1479
1496
candle ( "AnalysisGroup.wxs" . as_ref ( ) ) ;
1480
1497
1481
1498
if target. contains ( "windows-gnu" ) {
@@ -1499,10 +1516,13 @@ impl Step for Extended {
1499
1516
. arg ( "DocsGroup.wixobj" )
1500
1517
. arg ( "CargoGroup.wixobj" )
1501
1518
. arg ( "StdGroup.wixobj" )
1502
- . arg ( "RlsGroup.wixobj" )
1503
1519
. arg ( "AnalysisGroup.wixobj" )
1504
1520
. current_dir ( & exe) ;
1505
1521
1522
+ if rls_installer. is_some ( ) {
1523
+ cmd. arg ( "RlsGroup.wixobj" ) ;
1524
+ }
1525
+
1506
1526
if target. contains ( "windows-gnu" ) {
1507
1527
cmd. arg ( "GccGroup.wixobj" ) ;
1508
1528
}
0 commit comments