easy_install/
manfiest.rs

1// https://github.com/axodotdev/cargo-dist/blob/main/cargo-dist-schema/src/lib.rs
2
3use serde::{Deserialize, Serialize};
4use std::collections::BTreeMap;
5pub type LocalPath = String;
6pub type RelPath = String;
7pub type SystemId = String;
8pub type AssetId = String;
9pub type ArtifactId = String;
10pub type TripleName = String;
11pub type SortedSet<T> = std::collections::BTreeSet<T>;
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct DistManifest {
15    #[serde(default)]
16    #[serde(skip_serializing_if = "BTreeMap::is_empty")]
17    pub artifacts: BTreeMap<ArtifactId, Artifact>,
18}
19
20#[derive(Debug, Clone, Serialize, Deserialize)]
21pub struct Artifact {
22    #[serde(skip_serializing_if = "Option::is_none")]
23    #[serde(default)]
24    pub kind: Option<ArtifactId>,
25
26    #[serde(skip_serializing_if = "Option::is_none")]
27    #[serde(default)]
28    pub name: Option<ArtifactId>,
29    #[serde(skip_serializing_if = "Vec::is_empty")]
30    #[serde(default)]
31    pub target_triples: Vec<TripleName>,
32    /// Assets included in the bundle (like executables and READMEs)
33    #[serde(skip_serializing_if = "Vec::is_empty")]
34    #[serde(default)]
35    pub assets: Vec<Asset>,
36}
37/// An asset contained in an artifact (executable, license, etc.)
38#[derive(Debug, Clone, Serialize, Deserialize)]
39pub struct Asset {
40    /// The executable_name name of the asset
41    #[serde(default)]
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub executable_name: Option<String>,
44
45    #[serde(default)]
46    #[serde(skip_serializing_if = "Option::is_none")]
47    pub executable_dir: Option<String>,
48
49    /// The high-level name of the asset
50    #[serde(default)]
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub name: Option<String>,
53    /// The path of the asset relative to the root of the artifact
54    #[serde(default)]
55    #[serde(skip_serializing_if = "Option::is_none")]
56    pub path: Option<RelPath>,
57    /// The kind of asset this is
58    #[serde(flatten)]
59    pub kind: AssetKind,
60}
61
62/// An artifact included in a Distributable
63#[derive(Debug, Clone, Serialize, Deserialize)]
64#[serde(tag = "kind")]
65#[non_exhaustive]
66pub enum AssetKind {
67    /// An executable artifact
68    #[serde(rename = "executable-dir")]
69    ExecutableDir(ExecutableAsset),
70    /// An executable artifact
71    #[serde(rename = "executable")]
72    Executable(ExecutableAsset),
73    /// A C dynamic library
74    #[serde(rename = "c_dynamic_library")]
75    CDynamicLibrary(DynamicLibraryAsset),
76    /// A C static library
77    #[serde(rename = "c_static_library")]
78    CStaticLibrary(StaticLibraryAsset),
79    /// A README file
80    #[serde(rename = "readme")]
81    Readme,
82    /// A LICENSE file
83    #[serde(rename = "license")]
84    License,
85    /// A CHANGELOG or RELEASES file
86    #[serde(rename = "changelog")]
87    Changelog,
88    /// Unknown to this version of cargo-dist-schema
89    ///
90    /// This is a fallback for forward/backward-compat
91    #[serde(other)]
92    #[serde(rename = "unknown")]
93    Unknown,
94}
95
96/// An executable artifact (exe/binary)
97#[derive(Debug, Clone, Serialize, Deserialize)]
98pub struct ExecutableAsset {
99    /// The name of the Artifact containing symbols for this executable
100    #[serde(skip_serializing_if = "Option::is_none")]
101    #[serde(default)]
102    pub symbols_artifact: Option<ArtifactId>,
103}
104
105/// A C dynamic library artifact (so/dylib/dll)
106#[derive(Debug, Clone, Serialize, Deserialize)]
107pub struct DynamicLibraryAsset {
108    /// The name of the Artifact containing symbols for this library
109    #[serde(skip_serializing_if = "Option::is_none")]
110    #[serde(default)]
111    pub symbols_artifact: Option<ArtifactId>,
112}
113
114/// A C static library artifact (a/lib)
115#[derive(Debug, Clone, Serialize, Deserialize)]
116pub struct StaticLibraryAsset {
117    /// The name of the Artifact containing symbols for this library
118    #[serde(skip_serializing_if = "Option::is_none")]
119    #[serde(default)]
120    pub symbols_artifact: Option<ArtifactId>,
121}
122
123/// A kind of Artifact
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(tag = "kind")]
126#[non_exhaustive]
127pub enum ArtifactKind {
128    /// A zip or a tarball
129    #[serde(rename = "executable-zip")]
130    ExecutableZip,
131    /// Standalone Symbols/Debuginfo for a build
132    #[serde(rename = "symbols")]
133    Symbols,
134    /// Installer
135    #[serde(rename = "installer")]
136    Installer,
137    /// A checksum of another artifact
138    #[serde(rename = "checksum")]
139    Checksum,
140    /// The checksums of many artifacts
141    #[serde(rename = "unified-checksum")]
142    UnifiedChecksum,
143    /// A tarball containing the source code
144    #[serde(rename = "source-tarball")]
145    SourceTarball,
146    /// Some form of extra artifact produced by a sidecar build
147    #[serde(rename = "extra-artifact")]
148    ExtraArtifact,
149    /// An updater executable
150    #[serde(rename = "updater")]
151    Updater,
152    /// A file that already exists
153    #[serde(rename = "sbom")]
154    SBOM,
155    /// Unknown to this version of cargo-dist-schema
156    ///
157    /// This is a fallback for forward/backward-compat
158    #[serde(other)]
159    #[serde(rename = "unknown")]
160    Unknown,
161}