Skip to content

Commit

Permalink
Support adding path dependencies
Browse files Browse the repository at this point in the history
Just hardlinks the path
  • Loading branch information
DvvCz committed Apr 15, 2024
1 parent 4fbac37 commit 293e66f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cpkg"
description = "A dead simple C package manager."
version = "0.8.2"
version = "0.8.3"
edition = "2021"

authors = ["David Cruz <[email protected]>"]
Expand Down
25 changes: 14 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,20 +571,23 @@ fn main() -> anyhow::Result<()> {
let now = std::time::Instant::now();

for (name, dep) in &config.dependencies {
let dep_path = build.join(name);

if dep_path.exists() {
continue;
}

match dep {
ConfigDependency::Git { git } => {
let path = build.join(name);

if !path.exists() {
std::process::Command::new(&git_cmd)
.arg("clone")
.arg(git)
.arg(path)
.spawn()?;
}
std::process::Command::new(&git_cmd)
.arg("clone")
.arg(git)
.arg(dep_path)
.spawn()?;
},
_ => {
anyhow::bail!("Unsupported dependency type");

ConfigDependency::Path { path } => {
std::fs::hard_link(path, dep_path)?;
}
}
}
Expand Down

0 comments on commit 293e66f

Please sign in to comment.