Skip to content

Commit

Permalink
Fix runtime_manifest field not working with Scarb <0.5.0 (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaput authored Sep 18, 2023
1 parent 3c859c6 commit 9ee00a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions scarb-metadata/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ pub struct Metadata {
pub target_dir: Option<Utf8PathBuf>,

/// Path to the manifest of package or workspace that Scarb has been run from.
///
/// ## Compatibility
///
/// With very old Scarb versions (`<0.5.0`), this field may end up being empty path upon
/// deserializing from `scarb metadata` call.
/// In this case, fall back to [`WorkspaceMetadata.manifest`][WorkspaceMetadata] field value.
#[serde(default)]
pub runtime_manifest: Utf8PathBuf,

/// Current workspace metadata.
Expand Down
7 changes: 6 additions & 1 deletion utils/scarb-ui/src/args/packages_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ impl PackagesSource for Metadata {
}

fn runtime_manifest(&self) -> Utf8PathBuf {
self.runtime_manifest.clone()
let path = self.runtime_manifest.clone();
if !path.as_str().is_empty() {
path
} else {
self.workspace.manifest_path.clone()
}
}
}

0 comments on commit 9ee00a4

Please sign in to comment.