Skip to content

Commit

Permalink
chore: remove libgit2 / last openssl deps (#278)
Browse files Browse the repository at this point in the history
* chore: remove libgit2 to remove openssl

* fix: use native git commands instead of libgit
  • Loading branch information
gakonst committed Dec 21, 2021
1 parent b092541 commit 7c8a79e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 86 deletions.
68 changes: 0 additions & 68 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ tracing = "0.1.26"
sputnik = { package = "evm", git = "https://github.com/rust-blockchain/evm", optional = true }
evmodin = { git = "https://github.com/vorot93/evmodin", optional = true }
proptest = "1.0.0"
git2 = "0.13.22"
glob = "0.3.0"
semver = "1.0.4"
once_cell = "1.8.0"
Expand Down
20 changes: 6 additions & 14 deletions cli/src/forge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,16 @@ fn main() -> eyre::Result<()> {
cmd.run()?;
}
Subcommands::Update { lib } => {
// TODO: Should we add some sort of progress bar here? Would be nice
// but not a requirement.
// open the repo
let repo = git2::Repository::open(".")?;
let mut cmd = Command::new("git");

cmd.args(&["submodule", "update", "--init", "--recursive"]);

// if a lib is specified, open it
if let Some(lib) = lib {
println!("Updating submodule {:?}", lib);
repo.find_submodule(
&lib.into_os_string().into_string().expect("invalid submodule path"),
)?
.update(true, None)?;
} else {
Command::new("git")
.args(&["submodule", "update", "--init", "--recursive"])
.spawn()?
.wait()?;
cmd.args(&["--", lib.display().to_string().as_str()]);
}

cmd.spawn()?.wait()?;
}
// TODO: Make it work with updates?
Subcommands::Install { dependencies } => {
Expand Down
7 changes: 4 additions & 3 deletions cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use eyre::{ContextCompat, WrapErr};
use std::{
env::VarError,
path::{Path, PathBuf},
process::Command,
};

#[cfg(feature = "evmodin-evm")]
Expand Down Expand Up @@ -80,9 +81,9 @@ pub fn find_dapp_json_contract(path: &str, name: &str) -> eyre::Result<Contract>
}

pub fn find_git_root_path() -> eyre::Result<PathBuf> {
let repo = git2::Repository::discover(".").wrap_err("Failed to find git root path")?;

Ok(repo.path().parent().unwrap().to_path_buf())
let path = Command::new("git").args(&["rev-parse", "--show-toplevel"]).output()?.stdout;
let path = std::str::from_utf8(&path)?.trim_end_matches('\n');
Ok(PathBuf::from(path))
}

/// Determines the source directory to use given the root path to a project's workspace.
Expand Down

0 comments on commit 7c8a79e

Please sign in to comment.