Created
August 2, 2023 14:38
-
-
Save s0me0ne-unkn0wn/bbd83fe32ce10327086adbf13e750eec to your computer and use it in GitHub Desktop.
Build additional artifacts if a single package build is explicitly requested
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::process::Command; | |
use std::env::var; | |
use std::path::Path; | |
fn main() { | |
let cargo = var("CARGO").unwrap(); | |
let target = var("TARGET").unwrap(); | |
let profile = var("PROFILE").unwrap(); | |
let out_dir = var("OUT_DIR").unwrap(); | |
let target_dir = format!("{}/workers", out_dir); | |
let mut args = vec!["build", "-p", "polkadot-execute-worker-cli", "-p", "polkadot-prepare-worker-cli", "--target", &target, "--target-dir", &target_dir]; | |
if profile != "debug" { | |
args.push("--profile"); | |
args.push(&profile); | |
} | |
Command::new(cargo).args(&args).status().unwrap(); | |
std::fs::rename(Path::new(&format!("{}/{}/{}/polkadot-execute-worker", target_dir, target, profile)), Path::new(&format!("{}/../../../../polkadot-execute-worker", target_dir))).unwrap(); | |
std::fs::rename(Path::new(&format!("{}/{}/{}/polkadot-prepare-worker", target_dir, target, profile)), Path::new(&format!("{}/../../../../polkadot-prepare-worker", target_dir))).unwrap(); | |
substrate_build_script_utils::generate_cargo_keys(); | |
// For the node/worker version check, make sure we always rebuild the node and binary workers | |
// when the version changes. | |
substrate_build_script_utils::rerun_if_git_head_changed(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment