File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ use log::debug;
9
9
use log:: { info, warn} ;
10
10
use manifest:: CrateData ;
11
11
use progressbar:: Step ;
12
+ use std:: env;
12
13
use std:: fs;
13
14
use std:: path:: { Path , PathBuf } ;
14
15
use std:: process:: Command ;
@@ -143,7 +144,28 @@ pub fn cargo_install_wasm_bindgen(
143
144
144
145
child:: run ( cmd, "cargo install" ) . context ( "Installing wasm-bindgen with cargo" ) ?;
145
146
147
+ // `cargo install` will put the installed binaries in `$root/bin/*`, but we
148
+ // just want them in `$root/*` directly (which matches how the tarballs are
149
+ // laid out, and where the rest of our code expects them to be). So we do a
150
+ // little renaming here.
151
+ for f in [ "wasm-bindgen" , "wasm-bindgen-test-runner" ] . iter ( ) . cloned ( ) {
152
+ let from = tmp
153
+ . join ( "bin" )
154
+ . join ( f)
155
+ . with_extension ( env:: consts:: EXE_EXTENSION ) ;
156
+ let to = tmp. join ( from. file_name ( ) . unwrap ( ) ) ;
157
+ fs:: rename ( & from, & to) . with_context ( |_| {
158
+ format ! (
159
+ "failed to move {} to {} for `cargo install`ed `wasm-bindgen`" ,
160
+ from. display( ) ,
161
+ to. display( )
162
+ )
163
+ } ) ?;
164
+ }
165
+
166
+ // Finally, move the `tmp` directory into our binary cache.
146
167
fs:: rename ( & tmp, & destination) ?;
168
+
147
169
Ok ( Download :: at ( & destination) )
148
170
}
149
171
You can’t perform that action at this time.
0 commit comments