Skip to content

Instantly share code, notes, and snippets.

@s0me0ne-unkn0wn
Created August 2, 2023 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s0me0ne-unkn0wn/bbd83fe32ce10327086adbf13e750eec to your computer and use it in GitHub Desktop.
Save s0me0ne-unkn0wn/bbd83fe32ce10327086adbf13e750eec to your computer and use it in GitHub Desktop.
Build additional artifacts if a single package build is explicitly requested
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