We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
VersionInfo
ProjectMetadata
1 parent cae2a1e commit c5828d4Copy full SHA for c5828d4
scarb/src/metadata/mod.rs
@@ -16,6 +16,7 @@ use crate::core::manifest::{
16
};
17
use crate::core::{ManifestDependency, Package, PackageId, SourceId, Workspace};
18
use crate::ops::resolve_workspace;
19
+use crate::version::VersionInfo;
20
21
mod metadata_version;
22
@@ -34,6 +35,7 @@ pub enum Metadata {
34
35
pub struct ProjectMetadata {
36
pub version: MetadataVersionPin<1>,
37
pub app_exe: Option<PathBuf>,
38
+ pub app_version_info: VersionInfo,
39
pub target_dir: Option<Utf8PathBuf>,
40
pub workspace: WorkspaceMetadata,
41
pub packages: Vec<PackageMetadata>,
@@ -108,6 +110,7 @@ impl ProjectMetadata {
108
110
Ok(Self {
109
111
version: MetadataVersionPin::<1>,
112
app_exe: ws.config().app_exe().ok().map(Into::into),
113
+ app_version_info: crate::version::get(),
114
target_dir: Some(ws.target_dir().path_unchecked().to_path_buf()),
115
workspace: WorkspaceMetadata::new(ws)?,
116
packages,
scarb/src/version.rs
@@ -2,20 +2,25 @@
2
3
use std::fmt;
4
5
+use serde::{Deserialize, Serialize};
6
+
7
/// Scarb's version.
8
+#[derive(Serialize, Deserialize, Debug)]
9
pub struct VersionInfo {
10
pub version: String,
11
pub commit_info: Option<CommitInfo>,
12
pub cairo: CairoVersionInfo,
13
}
14
15
/// Cairo's version.
pub struct CairoVersionInfo {
/// Information about the Git repository where the crate was built from.
23
24
pub struct CommitInfo {
25
pub short_commit_hash: String,
26
pub commit_hash: String,
scarb/tests/e2e/metadata.rs
@@ -53,6 +53,22 @@ fn simple() {
53
r#"{
54
"version": 1,
55
"app_exe": "[..]",
56
+ "app_version_info": {
57
+ "version": "[..]",
58
+ "commit_info": {
59
+ "short_commit_hash": "[..]",
60
+ "commit_hash": "[..]",
61
+ "commit_date": "[..]"
62
+ },
63
+ "cairo": {
64
65
66
67
68
+ "commit_date": [..]
69
+ }
70
71
72
"target_dir": "[..]/target",
73
"workspace": {
74
"root": "[..]",
0 commit comments