-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.rs
29 lines (24 loc) · 935 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use sails_client_gen::ClientGenerator;
use std::{env, path::PathBuf};
fn main() {
let out_dir_path = PathBuf::from(env::var("OUT_DIR").unwrap());
let client_rs_file_path = out_dir_path.join("rmrk_catalog.rs");
#[cfg(not(target_family = "windows"))]
let idl_file_path = out_dir_path.join("rmrk-catalog.idl");
#[cfg(not(target_family = "windows"))]
git_download::repo("https://github.com/gear-tech/sails")
.branch_name("master")
.add_file(
"examples/rmrk/catalog/wasm/rmrk-catalog.idl",
&idl_file_path,
)
.exec()
.unwrap();
#[cfg(target_family = "windows")]
let idl_file_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.join("..\\..\\catalog\\wasm\\rmrk-catalog.idl");
ClientGenerator::from_idl_path(&idl_file_path)
.with_mocks("mockall")
.generate_to(client_rs_file_path)
.unwrap();
}