@@ -383,6 +383,7 @@ impl Shuttle {
383
383
"Building" . bold( ) . green( ) ,
384
384
working_directory. display( )
385
385
) ;
386
+
386
387
let runtime = build_crate ( working_directory, false , tx) . await ?;
387
388
388
389
trace ! ( "loading secrets" ) ;
@@ -403,7 +404,7 @@ impl Shuttle {
403
404
404
405
let service_name = self . ctx . project_name ( ) . to_string ( ) ;
405
406
406
- let ( is_wasm, so_path ) = match runtime {
407
+ let ( is_wasm, bin_path ) = match runtime {
407
408
Runtime :: Next ( path) => ( true , path) ,
408
409
Runtime :: Legacy ( path) => ( false , path) ,
409
410
} ;
@@ -414,52 +415,62 @@ impl Shuttle {
414
415
run_args. port + 1 ,
415
416
) ) ;
416
417
417
- let get_runtime_executable = || {
418
- let runtime_path = home:: cargo_home ( )
419
- . expect ( "failed to find cargo home dir" )
420
- . join ( "bin/shuttle-runtime" ) ;
421
-
422
- if cfg ! ( debug_assertions) {
423
- // Canonicalized path to shuttle-runtime for dev to work on windows
424
- let path = std:: fs:: canonicalize ( format ! ( "{MANIFEST_DIR}/../runtime" ) )
425
- . expect ( "path to shuttle-runtime does not exist or is invalid" ) ;
426
-
427
- std:: process:: Command :: new ( "cargo" )
428
- . arg ( "install" )
429
- . arg ( "shuttle-runtime" )
430
- . arg ( "--path" )
431
- . arg ( path)
432
- . output ( )
433
- . expect ( "failed to install the shuttle runtime" ) ;
434
- } else {
435
- // If the version of cargo-shuttle is different from shuttle-runtime,
436
- // or it isn't installed, try to install shuttle-runtime from the production
437
- // branch.
438
- if let Err ( err) = check_version ( & runtime_path) {
439
- trace ! ( "{}" , err) ;
418
+ let runtime_path = || {
419
+ if is_wasm {
420
+ let runtime_path = home:: cargo_home ( )
421
+ . expect ( "failed to find cargo home dir" )
422
+ . join ( "bin/shuttle-next" ) ;
423
+
424
+ if cfg ! ( debug_assertions) {
425
+ // Canonicalized path to shuttle-runtime for dev to work on windows
426
+ let path = std:: fs:: canonicalize ( format ! ( "{MANIFEST_DIR}/../runtime" ) )
427
+ . expect ( "path to shuttle-runtime does not exist or is invalid" ) ;
440
428
441
- trace ! ( "installing shuttle-runtime" ) ;
429
+ // TODO: Add --features next here when https://github.com/ shuttle-hq/shuttle/pull/688 is merged
442
430
std:: process:: Command :: new ( "cargo" )
443
431
. arg ( "install" )
444
432
. arg ( "shuttle-runtime" )
445
- . arg ( "--git " )
446
- . arg ( "https://github.com/shuttle-hq/shuttle" )
447
- . arg ( "--branch " )
448
- . arg ( "production " )
433
+ . arg ( "--path " )
434
+ . arg ( path )
435
+ . arg ( "--bin " )
436
+ . arg ( "shuttle-next " )
449
437
. output ( )
450
438
. expect ( "failed to install the shuttle runtime" ) ;
439
+ } else {
440
+ // If the version of cargo-shuttle is different from shuttle-runtime,
441
+ // or it isn't installed, try to install shuttle-runtime from the production
442
+ // branch.
443
+ if let Err ( err) = check_version ( & runtime_path) {
444
+ trace ! ( "{}" , err) ;
445
+
446
+ trace ! ( "installing shuttle-runtime" ) ;
447
+ // TODO: Add --features next here when https://github.com/shuttle-hq/shuttle/pull/688 is merged
448
+ std:: process:: Command :: new ( "cargo" )
449
+ . arg ( "install" )
450
+ . arg ( "shuttle-runtime" )
451
+ . arg ( "--bin" )
452
+ . arg ( "shuttle-next" )
453
+ . arg ( "--git" )
454
+ . arg ( "https://github.com/shuttle-hq/shuttle" )
455
+ . arg ( "--branch" )
456
+ . arg ( "production" )
457
+ . output ( )
458
+ . expect ( "failed to install the shuttle runtime" ) ;
459
+ } ;
451
460
} ;
452
- } ;
453
461
454
- runtime_path
462
+ runtime_path
463
+ } else {
464
+ bin_path. clone ( )
465
+ }
455
466
} ;
456
467
457
468
let ( mut runtime, mut runtime_client) = runtime:: start (
458
469
is_wasm,
459
470
runtime:: StorageManagerType :: WorkingDir ( working_directory. to_path_buf ( ) ) ,
460
471
& format ! ( "http://localhost:{}" , run_args. port + 1 ) ,
461
472
run_args. port + 2 ,
462
- get_runtime_executable ,
473
+ runtime_path ,
463
474
)
464
475
. await
465
476
. map_err ( |err| {
@@ -469,7 +480,7 @@ impl Shuttle {
469
480
} ) ?;
470
481
471
482
let load_request = tonic:: Request :: new ( LoadRequest {
472
- path : so_path
483
+ path : bin_path
473
484
. into_os_string ( )
474
485
. into_string ( )
475
486
. expect ( "to convert path to string" ) ,
0 commit comments