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

Dry build rs #458

Merged
merged 6 commits into from
Sep 1, 2023
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
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tempdir = "0.3"
portpicker = "0.1"
incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "bae25ad89c0c192bee625252d2d419bd56638e48" }
shardtree = { git = "https://github.com/zcash/incrementalmerkletree", rev = "bae25ad89c0c192bee625252d2d419bd56638e48" }
build_utils = { path = "./build_utils" }

[profile.release]
debug = false
Expand Down
8 changes: 8 additions & 0 deletions build_utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "build_utils"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
22 changes: 22 additions & 0 deletions build_utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use std::io::Write;
use std::{env, fs::File, path::Path, process::Command};

pub fn git_description() {
let output = Command::new("git")
.args(["describe", "--dirty"])
.output()
.expect("Failed to execute git command");

let git_description = String::from_utf8(output.stdout).unwrap();

// Write the git description to a file which will be included in the crate
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("git_description.rs");
let mut f = File::create(dest_path).unwrap();
writeln!(
f,
"pub fn git_description() -> &'static str {{\"{}\"}}",
git_description
)
.unwrap();
}
1 change: 1 addition & 0 deletions zingolib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ concat-idents = "1.1.3"

[build-dependencies]
tonic-build = { workspace = true }
build_utils = { workspace = true }
24 changes: 1 addition & 23 deletions zingolib/build.rs
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
// build.rs
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::Path;
use std::process::Command;

fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::configure().build_server(true).compile(
&["proto/service.proto", "proto/compact_formats.proto"],
&["proto"],
)?;
println!("cargo:rerun-if-changed=proto/service.proto");
// Run `git describe --dirty` to get the description
let output = Command::new("git")
.args(["describe", "--dirty"])
.output()
.expect("Failed to execute git command");

let git_description = String::from_utf8(output.stdout).unwrap();

// Write the git description to a file which will be included in the crate
let out_dir = env::var("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("git_description.rs");
let mut f = File::create(dest_path).unwrap();
writeln!(
f,
"pub fn git_description() -> &'static str {{\"{}\"}}",
git_description
)
.unwrap();
build_utils::git_description();
Ok(())
}
1 change: 0 additions & 1 deletion zingolib/src/wallet/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ impl TransactionMetadataSet {
}
};

dbg!(&witness_trees);
Ok(Self {
current,
some_txid_from_highest_wallet_block,
Expand Down
Loading