@@ -14,13 +14,10 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- use std:: fs:: File ;
18- use std:: io:: copy;
1917use std:: path:: Path ;
2018use std:: { env, fs, path} ;
2119
2220use cargo_metadata:: { MetadataCommand , Package } ;
23- use reqwest:: blocking:: get;
2421
2522fn main ( ) {
2623 println ! ( "cargo:rerun-if-changed=." ) ;
@@ -45,32 +42,6 @@ fn main() {
4542 None => panic ! ( "wasmtime dependency not found" ) ,
4643 } ;
4744
48- // download the wasmtime wasm_platform.h header file from GitHub releases and write it to the src/include directory
49-
50- // ensure the include directory exists
51- let crate_dir = env:: var ( "CARGO_MANIFEST_DIR" ) . unwrap ( ) ;
52- let include_file = path:: Path :: new ( & crate_dir)
53- . join ( "src" )
54- . join ( "include" )
55- . join ( "wasmtime-platform.h" ) ;
56- std:: fs:: create_dir_all ( include_file. parent ( ) . unwrap ( ) ) . unwrap ( ) ;
57-
58- // get the wasm_platform.h header file from github release with matching version e.g. https://github.com/bytecodealliance/wasmtime/releases/download/v29.0.1/wasmtime-platform.h
59- let path = format ! (
60- "https://github.com/bytecodealliance/wasmtime/releases/download/v{}/wasmtime-platform.h" ,
61- version_number
62- ) ;
63- let response = get ( & path) . expect ( "Failed to download header file" ) ;
64-
65- // write the include file to the src/include directory
66- let out_file = include_file. to_str ( ) . unwrap ( ) ;
67- let mut dest = File :: create ( out_file) . expect ( "Failed to create header file" ) ;
68- copy (
69- & mut response. bytes ( ) . expect ( "Failed to read response" ) . as_ref ( ) ,
70- & mut dest,
71- )
72- . expect ( "Failed to copy content" ) ;
73-
7445 // Write the version number to the metadata.rs file so that it is included in the binary
7546
7647 let out_dir = env:: var_os ( "OUT_DIR" ) . unwrap ( ) ;
0 commit comments