-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
46 lines (42 loc) · 1.51 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use blueprint_sdk::build;
use blueprint_sdk::tangle::blueprint;
use secure_code_execution_lib::execute_code;
use std::path::Path;
use std::process;
fn main() {
// Automatically update dependencies with `soldeer` (if available), and build the contracts.
//
// Note that this is provided for convenience, and is not necessary if you wish to handle the
// contract build step yourself.
let contract_dirs: Vec<&str> = vec!["../contracts"];
build::utils::soldeer_install();
build::utils::soldeer_update();
build::utils::build_contracts(contract_dirs);
println!("cargo::rerun-if-changed=../secure-code-execution-lib");
// The `blueprint!` macro generates the info necessary for the `blueprint.json`.
// See its docs for all available metadata fields.
let blueprint = blueprint! {
name: "experiment",
master_manager_revision: "Latest",
manager: { Evm = "HelloBlueprint" },
jobs: [execute_code]
};
match blueprint {
Ok(blueprint) => {
// TODO: Should be a helper function probably
let json = blueprint_sdk::tangle::metadata::macros::ext::serde_json::to_string_pretty(
&blueprint,
)
.unwrap();
std::fs::write(
Path::new(env!("CARGO_WORKSPACE_DIR")).join("blueprint.json"),
json.as_bytes(),
)
.unwrap();
}
Err(e) => {
println!("cargo::error={e:?}");
process::exit(1);
}
}
}