1- //! Support for downloading and executing `ssvmc `
1+ //! Support for downloading and executing `wasmedgec `
22
33use crate :: child;
44use crate :: emoji;
@@ -9,17 +9,17 @@ use log::debug;
99use std:: path:: { Path , PathBuf } ;
1010use std:: process:: Command ;
1111
12- /// Execute `ssvmc ` over wasm binaries found in `out_dir`, downloading if
13- /// necessary into `cache`. Passes `args` to each invocation of `ssvmc `.
12+ /// Execute `wasmedgec ` over wasm binaries found in `out_dir`, downloading if
13+ /// necessary into `cache`. Passes `args` to each invocation of `wasmedgec `.
1414pub fn run (
1515 cache : & Cache ,
1616 out_dir : & Path ,
1717 install_permitted : bool ,
1818) -> Result < ( ) , failure:: Error > {
19- let ssvmc = match find_ssvmc ( cache, install_permitted) ? {
19+ let wasmedgec = match find_wasmedgec ( cache, install_permitted) ? {
2020 SsvmcOpt :: Found ( path) => path,
2121 SsvmcOpt :: CannotInstall => {
22- PBAR . info ( "Skipping ssvmc as no downloading was requested" ) ;
22+ PBAR . info ( "Skipping wasmedgec as no downloading was requested" ) ;
2323 return Ok ( ( ) ) ;
2424 }
2525 SsvmcOpt :: PlatformNotSupported => {
@@ -28,7 +28,7 @@ pub fn run(
2828 }
2929 } ;
3030
31- PBAR . info ( "Compiling AOT binaries with `ssvmc `..." ) ;
31+ PBAR . info ( "Compiling AOT binaries with `wasmedgec `..." ) ;
3232
3333 for file in out_dir. read_dir ( ) ? {
3434 let file = file?;
@@ -38,9 +38,9 @@ pub fn run(
3838 }
3939
4040 let tmp = path. with_extension ( "so" ) ;
41- let mut cmd = Command :: new ( & ssvmc ) ;
41+ let mut cmd = Command :: new ( & wasmedgec ) ;
4242 cmd. arg ( & path) . arg ( & tmp) ;
43- if let Err ( e) = child:: run ( cmd, "ssvmc " ) {
43+ if let Err ( e) = child:: run ( cmd, "wasmedgec " ) {
4444 PBAR . info ( "You need Ubuntu 20.04 to compile the AOT binary. Please see https://www.secondstate.io/articles/setup-rust-nodejs/" ) ;
4545 return Err ( e)
4646 }
@@ -49,27 +49,27 @@ pub fn run(
4949 Ok ( ( ) )
5050}
5151
52- /// Possible results of `find_ssvmc `
52+ /// Possible results of `find_wasmedgec `
5353pub enum SsvmcOpt {
54- /// Couldn't install ssvmc because downloads are forbidden
54+ /// Couldn't install wasmedgec because downloads are forbidden
5555 CannotInstall ,
5656 /// The current platform doesn't support precompiled binaries
5757 PlatformNotSupported ,
58- /// We found `ssvmc ` at the specified path
58+ /// We found `wasmedgec ` at the specified path
5959 Found ( PathBuf ) ,
6060}
6161
62- /// Attempts to find `ssvmc ` in `PATH` locally, or failing that downloads a
62+ /// Attempts to find `wasmedgec ` in `PATH` locally, or failing that downloads a
6363/// precompiled binary.
6464///
6565/// Returns `Some` if a binary was found or it was successfully downloaded.
6666/// Returns `None` if a binary wasn't found in `PATH` and this platform doesn't
6767/// have precompiled binaries. Returns an error if we failed to download the
6868/// binary.
69- pub fn find_ssvmc ( cache : & Cache , install_permitted : bool ) -> Result < SsvmcOpt , failure:: Error > {
69+ pub fn find_wasmedgec ( cache : & Cache , install_permitted : bool ) -> Result < SsvmcOpt , failure:: Error > {
7070 // First attempt to look up in PATH. If found assume it works.
71- if let Ok ( path) = which:: which ( "ssvmc " ) {
72- debug ! ( "found ssvmc at {:?}" , path) ;
71+ if let Ok ( path) = which:: which ( "wasmedgec " ) {
72+ debug ! ( "found wasmedgec at {:?}" , path) ;
7373 return Ok ( SsvmcOpt :: Found ( path) ) ;
7474 }
7575
@@ -80,17 +80,17 @@ pub fn find_ssvmc(cache: &Cache, install_permitted: bool) -> Result<SsvmcOpt, fa
8080 return Ok ( SsvmcOpt :: PlatformNotSupported ) ;
8181 } ;
8282 let url = format ! (
83- "https://github.com/second-state/SSVM /releases/download/{vers}/ssvm -{vers}-linux-x64 .tar.gz" ,
84- vers = "0.7 .0" ,
83+ "https://github.com/WasmEdge/WasmEdge /releases/download/{vers}/WasmEdge -{vers}-manylinux2014_x86_64 .tar.gz" ,
84+ vers = "0.8 .0" ,
8585 ) ;
8686
87- let download = |permit_install| cache. download ( permit_install, "ssvmc " , & [ "ssvmc " ] , & url) ;
87+ let download = |permit_install| cache. download ( permit_install, "wasmedgec " , & [ "wasmedgec " ] , & url) ;
8888
8989 let dl = match download ( false ) ? {
9090 Some ( dl) => dl,
9191 None if !install_permitted => return Ok ( SsvmcOpt :: CannotInstall ) ,
9292 None => {
93- let msg = format ! ( "{}Installing ssvmc ..." , emoji:: DOWN_ARROW ) ;
93+ let msg = format ! ( "{}Installing wasmedgec ..." , emoji:: DOWN_ARROW ) ;
9494 PBAR . info ( & msg) ;
9595
9696 match download ( install_permitted) ? {
@@ -100,5 +100,5 @@ pub fn find_ssvmc(cache: &Cache, install_permitted: bool) -> Result<SsvmcOpt, fa
100100 }
101101 } ;
102102
103- Ok ( SsvmcOpt :: Found ( dl. binary ( "ssvmc " ) ?) )
103+ Ok ( SsvmcOpt :: Found ( dl. binary ( "wasmedgec " ) ?) )
104104}
0 commit comments