Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zkstack_cli): Build dependencies at zkstack build time #3157

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion prover/crates/bin/prover_autoscaler/src/global/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use reqwest::{
header::{HeaderMap, HeaderValue, CONTENT_TYPE},
Method,
};

use tokio::sync::Mutex;
use url::Url;
use zksync_utils::http_with_retries::send_request_with_retries;
Expand Down
1 change: 1 addition & 0 deletions zkstack_cli/crates/zkstack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,5 @@ anyhow.workspace = true
clap_complete.workspace = true
dirs.workspace = true
ethers.workspace = true
xshell.workspace = true
zksync_protobuf_build.workspace = true
17 changes: 17 additions & 0 deletions zkstack_cli/crates/zkstack/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::path::{Path, PathBuf};

use anyhow::{anyhow, Context};
use ethers::contract::Abigen;
use xshell::{cmd, Shell};

const COMPLETION_DIR: &str = "completion";

Expand All @@ -14,6 +15,11 @@ fn main() -> anyhow::Result<()> {
.write_to_file(outdir.join("consensus_registry_abi.rs"))
.context("Failed to write ABI to file")?;

if let Err(e) = build_dependencies() {
println!("cargo:error=It was not possible to install projects dependencies");
println!("cargo:error={}", e);
}

if let Err(e) = configure_shell_autocompletion() {
println!("cargo:warning=It was not possible to install autocomplete scripts. Please generate them manually with `zkstack autocomplete`");
println!("cargo:error={}", e);
Expand Down Expand Up @@ -130,3 +136,14 @@ impl ShellAutocomplete for clap_complete::Shell {
Ok(())
}
}

fn build_dependencies() -> anyhow::Result<()> {
let shell = Shell::new()?;
let code_dir = Path::new("../");

let _dir_guard = shell.push_dir(code_dir);

cmd!(shell, "yarn install")
.run()
.context("Failed to install dependencies")
}
Loading