@@ -334,14 +334,14 @@ pub fn run(config: &Config, name: &str, args: &[&str], env: &[(&str, &str)]) ->
334
334
fn create_mock_dist_server ( path : & Path , s : Scenario ) {
335
335
let mut chans = Vec :: new ( ) ;
336
336
if s == Scenario :: Full || s == Scenario :: ArchivesV1 || s == Scenario :: ArchivesV2 {
337
- let c1 = build_mock_channel ( s, "nightly" , "2015-01-01" , "1.2.0" , "hash-n-1" ) ;
338
- let c2 = build_mock_channel ( s, "beta" , "2015-01-01" , "1.1.0" , "hash-b-1" ) ;
339
- let c3 = build_mock_channel ( s, "stable" , "2015-01-01" , "1.0.0" , "hash-s-1" ) ;
337
+ let c1 = build_mock_channel ( s, "nightly" , "2015-01-01" , "1.2.0" , "hash-n-1" , false ) ;
338
+ let c2 = build_mock_channel ( s, "beta" , "2015-01-01" , "1.1.0" , "hash-b-1" , false ) ;
339
+ let c3 = build_mock_channel ( s, "stable" , "2015-01-01" , "1.0.0" , "hash-s-1" , false ) ;
340
340
chans. extend ( vec ! [ c1, c2, c3] ) ;
341
341
}
342
- let c4 = build_mock_channel ( s, "nightly" , "2015-01-02" , "1.3.0" , "hash-n-2" ) ;
343
- let c5 = build_mock_channel ( s, "beta" , "2015-01-02" , "1.2.0" , "hash-b-2" ) ;
344
- let c6 = build_mock_channel ( s, "stable" , "2015-01-02" , "1.1.0" , "hash-s-2" ) ;
342
+ let c4 = build_mock_channel ( s, "nightly" , "2015-01-02" , "1.3.0" , "hash-n-2" , true ) ;
343
+ let c5 = build_mock_channel ( s, "beta" , "2015-01-02" , "1.2.0" , "hash-b-2" , false ) ;
344
+ let c6 = build_mock_channel ( s, "stable" , "2015-01-02" , "1.1.0" , "hash-s-2" , false ) ;
345
345
chans. extend ( vec ! [ c4, c5, c6] ) ;
346
346
347
347
let ref vs = match s {
@@ -383,13 +383,12 @@ fn create_mock_dist_server(path: &Path, s: Scenario) {
383
383
}
384
384
385
385
fn build_mock_channel ( s : Scenario , channel : & str , date : & str ,
386
- version : & ' static str , version_hash : & str ) -> MockChannel {
386
+ version : & ' static str , version_hash : & str , rename_rls : bool ) -> MockChannel {
387
387
// Build the mock installers
388
388
let ref host_triple = this_host_triple ( ) ;
389
389
let std = build_mock_std_installer ( host_triple) ;
390
390
let rustc = build_mock_rustc_installer ( host_triple, version, version_hash) ;
391
391
let cargo = build_mock_cargo_installer ( version, version_hash) ;
392
- let rls = build_mock_rls_installer ( version, version_hash) ;
393
392
let rust_docs = build_mock_rust_doc_installer ( ) ;
394
393
let rust = build_combined_installer ( & [ & std, & rustc, & cargo, & rust_docs] ) ;
395
394
let cross_std1 = build_mock_cross_std_installer ( CROSS_ARCH1 , date) ;
@@ -403,18 +402,26 @@ fn build_mock_channel(s: Scenario, channel: &str, date: &str,
403
402
( cross_std1, CROSS_ARCH1 . to_string( ) ) ,
404
403
( cross_std2, CROSS_ARCH2 . to_string( ) ) ] ) ,
405
404
( "rustc" , vec![ ( rustc, host_triple. clone( ) ) ] ) ,
406
- ( "cargo" , vec![ ( cargo, host_triple. clone( ) ) ] ) ,
407
- ( "rls" , vec![ ( rls, host_triple. clone( ) ) ] ) ,
408
- ( "rust-docs" , vec![ ( rust_docs, host_triple. clone( ) ) ] ) ,
409
- ( "rust-src" , vec![ ( rust_src, "*" . to_string( ) ) ] ) ,
410
- ( "rust-analysis" , vec![ ( rust_analysis, "*" . to_string( ) ) ] ) ,
411
- ( "rust" , vec![ ( rust, host_triple. clone( ) ) ] ) ] ;
405
+ ( "cargo" , vec![ ( cargo, host_triple. clone( ) ) ] ) ] ;
406
+
407
+ if rename_rls {
408
+ let rls = build_mock_rls_installer ( version, version_hash, false ) ;
409
+ all. push ( ( "rls" , vec ! [ ( rls, host_triple. clone( ) ) ] ) ) ;
410
+ } else {
411
+ let rls_preview = build_mock_rls_installer ( version, version_hash, true ) ;
412
+ all. push ( ( "rls-preview" , vec ! [ ( rls_preview, host_triple. clone( ) ) ] ) ) ;
413
+ }
414
+
415
+ let more = vec ! [ ( "rust-docs" , vec![ ( rust_docs, host_triple. clone( ) ) ] ) ,
416
+ ( "rust-src" , vec![ ( rust_src, "*" . to_string( ) ) ] ) ,
417
+ ( "rust-analysis" , vec![ ( rust_analysis, "*" . to_string( ) ) ] ) ,
418
+ ( "rust" , vec![ ( rust, host_triple. clone( ) ) ] ) ] ;
419
+ all. extend ( more) ;
412
420
413
421
if s == Scenario :: MultiHost {
414
422
let std = build_mock_std_installer ( MULTI_ARCH1 ) ;
415
423
let rustc = build_mock_rustc_installer ( MULTI_ARCH1 , version, version_hash) ;
416
424
let cargo = build_mock_cargo_installer ( version, version_hash) ;
417
- let rls = build_mock_rls_installer ( version, version_hash) ;
418
425
let rust_docs = build_mock_rust_doc_installer ( ) ;
419
426
let rust = build_combined_installer ( & [ & std, & rustc, & cargo, & rust_docs] ) ;
420
427
let cross_std1 = build_mock_cross_std_installer ( CROSS_ARCH1 , date) ;
@@ -426,9 +433,18 @@ fn build_mock_channel(s: Scenario, channel: &str, date: &str,
426
433
( cross_std1, CROSS_ARCH1 . to_string( ) ) ,
427
434
( cross_std2, CROSS_ARCH2 . to_string( ) ) ] ) ,
428
435
( "rustc" , vec![ ( rustc, triple. clone( ) ) ] ) ,
429
- ( "cargo" , vec![ ( cargo, triple. clone( ) ) ] ) ,
430
- ( "rls" , vec![ ( rls, triple. clone( ) ) ] ) ,
431
- ( "rust-docs" , vec![ ( rust_docs, triple. clone( ) ) ] ) ,
436
+ ( "cargo" , vec![ ( cargo, triple. clone( ) ) ] ) ] ;
437
+ all. extend ( more) ;
438
+
439
+ if rename_rls {
440
+ let rls = build_mock_rls_installer ( version, version_hash, false ) ;
441
+ all. push ( ( "rls" , vec ! [ ( rls, triple. clone( ) ) ] ) ) ;
442
+ } else {
443
+ let rls_preview = build_mock_rls_installer ( version, version_hash, true ) ;
444
+ all. push ( ( "rls-preview" , vec ! [ ( rls_preview, triple. clone( ) ) ] ) ) ;
445
+ }
446
+
447
+ let more = vec ! [ ( "rust-docs" , vec![ ( rust_docs, triple. clone( ) ) ] ) ,
432
448
( "rust-src" , vec![ ( rust_src, "*" . to_string( ) ) ] ) ,
433
449
( "rust" , vec![ ( rust, triple. clone( ) ) ] ) ] ;
434
450
@@ -475,10 +491,17 @@ fn build_mock_channel(s: Scenario, channel: &str, date: &str,
475
491
name : "rust-docs" . to_string ( ) ,
476
492
target : target. to_string ( )
477
493
} ) ;
478
- target_pkg. extensions . push ( MockComponent {
479
- name : "rls" . to_string ( ) ,
480
- target : target. to_string ( )
481
- } ) ;
494
+ if rename_rls {
495
+ target_pkg. extensions . push ( MockComponent {
496
+ name : "rls" . to_string ( ) ,
497
+ target : target. to_string ( )
498
+ } ) ;
499
+ } else {
500
+ target_pkg. extensions . push ( MockComponent {
501
+ name : "rls-preview" . to_string ( ) ,
502
+ target : target. to_string ( )
503
+ } ) ;
504
+ }
482
505
target_pkg. extensions . push ( MockComponent {
483
506
name : "rust-std" . to_string ( ) ,
484
507
target : CROSS_ARCH1 . to_string ( ) ,
@@ -498,11 +521,16 @@ fn build_mock_channel(s: Scenario, channel: &str, date: &str,
498
521
}
499
522
}
500
523
524
+ let mut renames = HashMap :: new ( ) ;
525
+ if rename_rls {
526
+ renames. insert ( "rls-preview" . to_owned ( ) , "rls" . to_owned ( ) ) ;
527
+ }
528
+
501
529
MockChannel {
502
530
name : channel. to_string ( ) ,
503
531
date : date. to_string ( ) ,
504
532
packages : packages,
505
- renames : HashMap :: new ( ) ,
533
+ renames,
506
534
}
507
535
}
508
536
@@ -580,10 +608,15 @@ fn build_mock_cargo_installer(version: &str, version_hash: &str) -> MockInstalle
580
608
}
581
609
}
582
610
583
- fn build_mock_rls_installer ( version : & str , version_hash : & str ) -> MockInstallerBuilder {
611
+ fn build_mock_rls_installer ( version : & str , version_hash : & str , preview : bool ) -> MockInstallerBuilder {
612
+ let name = if preview {
613
+ "rls-preview"
614
+ } else {
615
+ "rls"
616
+ } ;
584
617
MockInstallerBuilder {
585
618
components : vec ! [ MockComponentBuilder {
586
- name: "rls" . to_string( ) ,
619
+ name: name . to_string( ) ,
587
620
files: mock_bin( "rls" , version, version_hash) ,
588
621
} ] ,
589
622
}
0 commit comments