@@ -21,20 +21,9 @@ use crate::utils::starlark::Label;
2121use self :: cargo_config:: CargoConfig ;
2222pub use self :: splicer:: * ;
2323
24- #[ derive( Debug , Default , Serialize , Deserialize ) ]
25- pub struct ExtraManifestInfo {
26- // The path to a Cargo Manifest
27- pub manifest : PathBuf ,
28-
29- // The URL where the manifest's package can be downloaded
30- pub url : String ,
31-
32- // The Sha256 checksum of the downloaded package located at `url`.
33- pub sha256 : String ,
34- }
35-
3624type DirectPackageManifest = BTreeMap < String , cargo_toml:: DependencyDetail > ;
3725
26+ /// A collection of information used for splicing together a new Cargo manifest.
3827#[ derive( Debug , Default , Serialize , Deserialize , Clone ) ]
3928#[ serde( deny_unknown_fields) ]
4029pub struct SplicingManifest {
@@ -104,6 +93,7 @@ impl SplicingManifest {
10493 }
10594}
10695
96+ /// The result of fully resolving a [SplicingManifest] in preparation for splicing.
10797#[ derive( Debug , Serialize , Default ) ]
10898pub struct SplicingMetadata {
10999 /// A set of all packages directly written to the rule
@@ -149,32 +139,6 @@ impl TryFrom<SplicingManifest> for SplicingMetadata {
149139 }
150140}
151141
152- /// A collection of information required for reproducible "extra worksspace members".
153- #[ derive( Debug , Default , Serialize , Deserialize ) ]
154- #[ serde( deny_unknown_fields) ]
155- pub struct ExtraManifestsManifest {
156- pub manifests : Vec < ExtraManifestInfo > ,
157- }
158-
159- impl FromStr for ExtraManifestsManifest {
160- type Err = serde_json:: Error ;
161-
162- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
163- serde_json:: from_str ( s)
164- }
165- }
166-
167- impl ExtraManifestsManifest {
168- pub fn try_from_path < T : AsRef < Path > > ( path : T ) -> Result < Self > {
169- let content = fs:: read_to_string ( path. as_ref ( ) ) ?;
170- Self :: from_str ( & content) . context ( "Failed to load ExtraManifestsManifest" )
171- }
172-
173- pub fn absolutize ( self ) -> Self {
174- self
175- }
176- }
177-
178142#[ derive( Debug , Default , Serialize , Deserialize , Clone ) ]
179143pub struct SourceInfo {
180144 /// A url where to a `.crate` file.
@@ -229,30 +193,9 @@ impl TryFrom<serde_json::Value> for WorkspaceMetadata {
229193impl WorkspaceMetadata {
230194 fn new (
231195 splicing_manifest : & SplicingManifest ,
232- extra_manifests_manifest : & ExtraManifestsManifest ,
233- injected_manifests : HashMap < & PathBuf , String > ,
196+ member_manifests : HashMap < & PathBuf , String > ,
234197 ) -> Result < Self > {
235- let mut sources = BTreeMap :: new ( ) ;
236-
237- for config in extra_manifests_manifest. manifests . iter ( ) {
238- let package = match read_manifest ( & config. manifest ) {
239- Ok ( manifest) => match manifest. package {
240- Some ( pkg) => pkg,
241- None => continue ,
242- } ,
243- Err ( e) => return Err ( e) ,
244- } ;
245-
246- let id = CrateId :: new ( package. name , package. version ) ;
247- let info = SourceInfo {
248- url : config. url . clone ( ) ,
249- sha256 : config. sha256 . clone ( ) ,
250- } ;
251-
252- sources. insert ( id, info) ;
253- }
254-
255- let mut package_prefixes: BTreeMap < String , String > = injected_manifests
198+ let mut package_prefixes: BTreeMap < String , String > = member_manifests
256199 . iter ( )
257200 . filter_map ( |( original_manifest, cargo_pkg_name) | {
258201 let label = match splicing_manifest. manifests . get ( * original_manifest) {
@@ -287,7 +230,7 @@ impl WorkspaceMetadata {
287230 . collect ( ) ;
288231
289232 Ok ( Self {
290- sources,
233+ sources : BTreeMap :: new ( ) ,
291234 workspace_prefix,
292235 package_prefixes,
293236 } )
0 commit comments