Skip to content

Commit

Permalink
feat: Support Cargo workspace inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
bb010g committed Jun 23, 2023
1 parent 8c978a1 commit 05881e2
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 168 deletions.
44 changes: 22 additions & 22 deletions Cargo.lock

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

19 changes: 12 additions & 7 deletions src/cargo_ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,34 @@ pub use self::{elaborate_workspace::ElaborateWorkspace, pkg_status::*, temp_proj

/// A continent struct for quick parsing and manipulating manifest
#[derive(Debug, serde_derive::Serialize, serde_derive::Deserialize)]
#[serde(rename_all = "kebab-case")]
struct Manifest {
#[serde(rename = "cargo-features", skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub cargo_features: Option<Value>,
pub package: Table,
#[serde(skip_serializing_if = "Option::is_none")]
pub package: Option<Table>,
#[serde(skip_serializing_if = "Option::is_none")]
pub dependencies: Option<Table>,
#[serde(rename = "dev-dependencies", skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub dev_dependencies: Option<Table>,
#[serde(rename = "build-dependencies", skip_serializing_if = "Option::is_none")]
#[serde(skip_serializing_if = "Option::is_none")]
pub build_dependencies: Option<Table>,
#[serde(skip_serializing_if = "Option::is_none")]
pub lib: Option<Table>,
#[serde(skip_serializing_if = "Option::is_none")]
pub bin: Option<Vec<Table>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub workspace: Option<Table>,
#[serde(skip_serializing_if = "Option::is_none")]
pub target: Option<Table>,
#[serde(skip_serializing_if = "Option::is_none")]
pub features: Option<Value>,
}

impl Manifest {
pub fn name(&self) -> String {
match self.package["name"] {
Value::String(ref name) => name.clone(),
pub fn name(&self) -> Option<String> {
match self.package.as_ref()?["name"] {
Value::String(ref name) => Some(name.clone()),
_ => unreachable!(),
}
}
Expand Down
Loading

0 comments on commit 05881e2

Please sign in to comment.