1use crate::{
5 details::{FixtureDetails, LinkDetails, PackageDetails, PlatformResults},
6 package_id,
7};
8use ahash::AHashMap;
9use camino::{Utf8Component, Utf8Path, Utf8PathBuf};
10use guppy::{
11 CargoMetadata, DependencyKind,
12 errors::{FeatureBuildStage, FeatureGraphWarning},
13 graph::{BuildTargetId, BuildTargetKind, PackageGraph},
14 platform::{EnabledTernary, Platform, TargetFeatures},
15};
16use once_cell::sync::{Lazy, OnceCell};
17use std::{collections::BTreeMap, fs};
18
19pub static METADATA1_PATH: &str = "../small/metadata1.json";
21pub static METADATA1_TESTCRATE: &str = "testcrate 0.1.0 (path+file:///fakepath/testcrate)";
22pub static METADATA1_DATATEST: &str =
23 "datatest 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)";
24pub static METADATA1_REGION: &str =
25 "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)";
26pub static METADATA1_DTOA: &str =
27 "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)";
28
29pub static METADATA2_PATH: &str = "../small/metadata2.json";
30pub static METADATA2_TESTCRATE: &str =
31 "testworkspace-crate 0.1.0 (path+file:///Users/fakeuser/local/testworkspace/testcrate)";
32pub static METADATA2_WALKDIR: &str =
33 "walkdir 2.2.9 (path+file:///Users/fakeuser/local/testworkspace/walkdir)";
34pub static METADATA2_QUOTE: &str = "quote 1.0.2 (path+file:///Users/fakeuser/local/quote)";
35
36pub static METADATA_BUILDDEP_PATH: &str = "../small/builddep.json";
37
38pub static METADATA_DUPS_PATH: &str = "../small/metadata_dups.json";
39pub static METADATA_DUPS_TESTCRATE: &str =
40 "testcrate-dups 0.1.0 (path+file:///Users/fakeuser/local/testcrates/testcrate-dups)";
41pub static METADATA_DUPS_LAZY_STATIC_1: &str =
42 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)";
43pub static METADATA_DUPS_LAZY_STATIC_02: &str =
44 "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)";
45pub static METADATA_DUPS_BYTES_03: &str =
46 "bytes 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)";
47pub static METADATA_DUPS_BYTES_05: &str =
48 "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)";
49
50pub static METADATA_CYCLE1_PATH: &str = "../small/metadata_cycle1.json";
51pub static METADATA_CYCLE1_BASE: &str = "testcycles-base 0.1.0 (path+file:///Users/fakeuser/local/testcrates/testcycles/testcycles-base)";
52pub static METADATA_CYCLE1_HELPER: &str = "testcycles-helper 0.1.0 (path+file:///Users/fakeuser/local/testcrates/testcycles/testcycles-helper)";
53
54pub static METADATA_CYCLE1_WINDOWS_PATH: &str = "../small/metadata_cycle1_windows.json";
55pub static METADATA_CYCLE1_WINDOWS_BASE: &str = "testcycles-base 0.1.0 (path+file:///C:/Users/fakeuser/local/testcrates/testcycles/testcycles-base)";
56pub static METADATA_CYCLE1_WINDOWS_HELPER: &str = "testcycles-helper 0.1.0 (path+file:///C:/Users/fakeuser/local/testcrates/testcycles/testcycles-helper)";
57
58pub static METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_PATH: &str =
59 "../small/metadata_cycle1_windows_different_drives.json";
60pub static METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE: &str = "testcycles-base 0.1.0 (path+file:///C:/Users/fakeuser/local/testcrates/testcycles/testcycles-base)";
61pub static METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER: &str =
62 "testcycles-helper 0.1.0 (path+file:///D:/libs/testcycles-helper)";
63
64pub static METADATA_CYCLE2_PATH: &str = "../small/metadata_cycle2.json";
65pub static METADATA_CYCLE2_UPPER_A: &str =
66 "upper-a 0.1.0 (path+file:///Users/fakeuser/local/testcrates/cycle2/upper-a)";
67pub static METADATA_CYCLE2_UPPER_B: &str =
68 "upper-b 0.1.0 (path+file:///Users/fakeuser/local/testcrates/cycle2/upper-b)";
69pub static METADATA_CYCLE2_LOWER_A: &str =
70 "lower-a 0.1.0 (path+file:///Users/fakeuser/local/testcrates/cycle2/lower-a)";
71pub static METADATA_CYCLE2_LOWER_B: &str =
72 "lower-b 0.1.0 (path+file:///Users/fakeuser/local/testcrates/cycle2/lower-b)";
73
74pub static METADATA_CYCLE_FEATURES_PATH: &str = "../small/metadata_cycle_features.json";
75pub static METADATA_CYCLE_FEATURES_BASE: &str =
76 "testcycles-base 0.1.0 (path+file:///fakepath/testcycles-features/testcycles-base)";
77pub static METADATA_CYCLE_FEATURES_HELPER: &str =
78 "testcycles-helper 0.1.0 (path+file:///fakepath/testcycles-features/testcycles-helper)";
79
80pub static METADATA_TARGETS1_PATH: &str = "../small/metadata_targets1.json";
81pub static METADATA_TARGETS1_TESTCRATE: &str =
82 "testcrate-targets 0.1.0 (path+file:///Users/fakeuser/local/testcrates/testcrate-targets)";
83pub static METADATA_TARGETS1_LAZY_STATIC_1: &str =
84 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)";
85pub static METADATA_TARGETS1_LAZY_STATIC_02: &str =
86 "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)";
87pub static METADATA_TARGETS1_LAZY_STATIC_01: &str =
88 "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)";
89pub static METADATA_TARGETS1_BYTES: &str =
90 "bytes 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)";
91pub static METADATA_TARGETS1_DEP_A: &str =
92 "dep-a 0.1.0 (path+file:///Users/fakeuser/local/testcrates/dep-a)";
93
94pub static METADATA_BUILD_TARGETS1_PATH: &str = "../small/metadata_build_targets1.json";
95pub static METADATA_BUILD_TARGETS1_TESTCRATE: &str =
96 "testcrate 0.1.0 (path+file:///Users/fakeuser/local/testcrates/test-build-targets)";
97
98pub static METADATA_PROC_MACRO1_PATH: &str = "../small/metadata_proc_macro1.json";
99pub static METADATA_PROC_MACRO1_MACRO: &str =
100 "macro 0.1.0 (path+file:///Users/fakeuser/local/testcrates/proc-macro/macro)";
101pub static METADATA_PROC_MACRO1_NORMAL_USER: &str =
102 "normal-user 0.1.0 (path+file:///Users/fakeuser/local/testcrates/proc-macro/normal-user)";
103pub static METADATA_PROC_MACRO1_BUILD_USER: &str =
104 "build-user 0.1.0 (path+file:///Users/fakeuser/local/testcrates/proc-macro/build-user)";
105pub static METADATA_PROC_MACRO1_DEV_USER: &str =
106 "dev-user 0.1.0 (path+file:///Users/fakeuser/local/testcrates/proc-macro/dev-user)";
107
108pub static METADATA_ALTERNATE_REGISTRIES_PATH: &str = "../small/alternate-registries.json";
109pub static METADATA_ALTERNATE_REGISTRY_URL: &str = "https://github.com/fakeorg/crates.io-index";
110
111pub static METADATA_WEAK_NAMESPACED_FEATURES_PATH: &str = "../small/weak-namespaced-features.json";
112pub static METADATA_WEAK_NAMESPACED_ID: &str =
113 "namespaced-weak 0.1.0 (path+file:///home/fakeuser/dev/tmp/test-workspaces/namespaced-weak)";
114pub static METADATA_WEAK_NAMESPACED_SMALLVEC: &str =
115 "smallvec 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)";
116pub static METADATA_WEAK_NAMESPACED_ARRAYVEC: &str =
117 "arrayvec 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)";
118pub static METADATA_WEAK_NAMESPACED_TINYVEC: &str =
119 "tinyvec 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)";
120
121pub static METADATA_LIBRA_PATH: &str = "../large/metadata_libra.json";
122pub static METADATA_LIBRA_ADMISSION_CONTROL_SERVICE: &str = "admission-control-service 0.1.0 (path+file:///Users/fakeuser/local/libra/admission_control/admission-control-service)";
123pub static METADATA_LIBRA_COMPILER: &str =
124 "compiler 0.1.0 (path+file:///Users/fakeuser/local/libra/language/compiler)";
125pub static METADATA_LIBRA_E2E_TESTS: &str =
126 "language-e2e-tests 0.1.0 (path+file:///Users/fakeuser/local/libra/language/e2e-tests)";
127pub static METADATA_LIBRA_EXECUTOR: &str =
128 "executor 0.1.0 (path+file:///Users/fakeuser/local/libra/execution/executor)";
129pub static METADATA_LIBRA_EXECUTOR_UTILS: &str =
130 "executor-utils 0.1.0 (path+file:///Users/fakeuser/local/libra/execution/executor-utils)";
131pub static METADATA_LIBRA_COST_SYNTHESIS: &str =
132 "cost-synthesis 0.1.0 (path+file:///Users/fakeuser/local/libra/language/tools/cost-synthesis)";
133pub static METADATA_LIBRA_FUNCTIONAL_TESTS: &str =
134 "functional_tests 0.1.0 (path+file:///Users/fakeuser/local/libra/language/functional_tests)";
135pub static METADATA_LIBRA_FUNCTIONAL_HYPHEN_TESTS: &str =
136 "functional-tests 0.1.0 (path+file:///Users/fakeuser/local/libra/language/functional-tests)";
137pub static METADATA_LIBRA_LIBRA_VM: &str =
138 "libra-vm 0.1.0 (path+file:///Users/fakeuser/local/libra/language/libra-vm)";
139pub static METADATA_LIBRA_MOVE_LANG: &str =
140 "move-lang 0.0.1 (path+file:///Users/fakeuser/local/libra/language/move-lang)";
141pub static METADATA_LIBRA_MOVE_LANG_STDLIB: &str =
142 "move-lang-stdlib 0.1.0 (path+file:///Users/fakeuser/local/libra/language/move-lang/stdlib)";
143pub static METADATA_LIBRA_MOVE_VM_RUNTIME: &str =
144 "move-vm-runtime 0.1.0 (path+file:///Users/fakeuser/local/libra/language/move-vm/runtime)";
145pub static METADATA_LIBRA_STDLIB: &str =
146 "stdlib 0.1.0 (path+file:///Users/fakeuser/local/libra/language/stdlib)";
147pub static METADATA_LIBRA_TEST_GENERATION: &str = "test-generation 0.1.0 (path+file:///Users/fakeuser/local/libra/language/tools/test-generation)";
148pub static METADATA_LIBRA_TRANSACTION_BUILDER: &str = "transaction-builder 0.1.0 (path+file:///Users/fakeuser/local/libra/language/transaction-builder)";
149pub static METADATA_LIBRA_VM_GENESIS: &str =
150 "vm-genesis 0.1.0 (path+file:///Users/fakeuser/local/libra/language/tools/vm-genesis)";
151pub static METADATA_LIBRA_LANGUAGE_BENCHMARKS: &str =
152 "language_benchmarks 0.1.0 (path+file:///Users/fakeuser/local/libra/language/benchmarks)";
153pub static METADATA_LIBRA_TREE_HEAP: &str = "tree_heap 0.1.0 (path+file:///Users/fakeuser/local/libra/language/stackless-bytecode/tree_heap)";
154pub static METADATA_LIBRA_LAZY_STATIC: &str =
155 "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)";
156pub static METADATA_LIBRA_BACKTRACE: &str =
157 "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)";
158pub static METADATA_LIBRA_CFG_IF: &str =
159 "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)";
160
161pub static METADATA_LIBRA_F0091A4_PATH: &str = "../large/metadata_libra_f0091a4.json";
162
163pub static METADATA_LIBRA_9FFD93B_PATH: &str = "../large/metadata_libra_9ffd93b.json";
164
165pub static MNEMOS_B3B4DA9_PATH: &str = "../large/mnemos_b3b4da9.json";
166
167pub static HYPER_UTIL_7AFB1ED_PATH: &str = "../large/hyper_util_7afb1ed.json";
168
169pub static METADATA_GUPPY_78CB7E8_PATH: &str = "../guppy/metadata_guppy_78cb7e8.json";
170
171pub static METADATA_GUPPY_869476C_PATH: &str = "../guppy/metadata_guppy_869476c.json";
172
173pub static METADATA_GUPPY_C9B4F76_PATH: &str = "../guppy/metadata_guppy_c9b4f76.json";
174
175pub static METADATA_GUPPY_44B62FA_PATH: &str = "../guppy/metadata_guppy_44b62fa.json";
176pub static METADATA_GUPPY_CARGO_GUPPY: &str =
177 "cargo-guppy 0.1.0 (path+file:///home/fakeuser/dev/cargo-guppy/cargo-guppy)";
178
179pub static FAKE_AUTHOR: &str = "Fake Author <fakeauthor@example.com>";
180
181const FIXTURE_MANAGER_EXCLUDES: &[&str] = &[
184 "metadata_cycle1_windows",
185 "metadata_cycle1_windows_different_drives",
186];
187
188macro_rules! define_fixtures {
189 ($($name: ident => $json_path: ident,)*) => {
190 impl JsonFixture {
191 pub fn all_fixtures() -> &'static BTreeMap<&'static str, JsonFixture> {
193 static ALL_FIXTURES: Lazy<BTreeMap<&'static str, JsonFixture>> = Lazy::new(|| {
195 let mut map = BTreeMap::new();
196
197 $(map.insert(
198 stringify!($name),
199 JsonFixture::new(stringify!($name), $json_path, FixtureDetails::$name()),
200 );)*
201
202 map
203 });
204
205 &*ALL_FIXTURES
206 }
207
208 pub fn fixture_manager_fixtures() -> impl Iterator<Item = &'static JsonFixture> {
212 Self::all_fixtures()
213 .iter()
214 .filter(|(name, _)| !FIXTURE_MANAGER_EXCLUDES.contains(name))
215 .map(|(_, fixture)| fixture)
216 }
217
218 $(pub fn $name() -> &'static Self {
220 &JsonFixture::all_fixtures()[stringify!($name)]
221 })*
222 }
223 };
224}
225
226define_fixtures! {
227 metadata1 => METADATA1_PATH,
228 metadata2 => METADATA2_PATH,
229 metadata_builddep => METADATA_BUILDDEP_PATH,
230 metadata_dups => METADATA_DUPS_PATH,
231 metadata_cycle1 => METADATA_CYCLE1_PATH,
232 metadata_cycle1_windows => METADATA_CYCLE1_WINDOWS_PATH,
233 metadata_cycle1_windows_different_drives => METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_PATH,
234 metadata_cycle2 => METADATA_CYCLE2_PATH,
235 metadata_cycle_features => METADATA_CYCLE_FEATURES_PATH,
236 metadata_targets1 => METADATA_TARGETS1_PATH,
237 metadata_build_targets1 => METADATA_BUILD_TARGETS1_PATH,
238 metadata_proc_macro1 => METADATA_PROC_MACRO1_PATH,
239 metadata_alternate_registries => METADATA_ALTERNATE_REGISTRIES_PATH,
240 metadata_weak_namespaced_features => METADATA_WEAK_NAMESPACED_FEATURES_PATH,
241 metadata_libra => METADATA_LIBRA_PATH,
242 metadata_libra_f0091a4 => METADATA_LIBRA_F0091A4_PATH,
243 metadata_libra_9ffd93b => METADATA_LIBRA_9FFD93B_PATH,
244 mnemos_b3b4da9 => MNEMOS_B3B4DA9_PATH,
245 hyper_util_7afb1ed => HYPER_UTIL_7AFB1ED_PATH,
246 metadata_guppy_78cb7e8 => METADATA_GUPPY_78CB7E8_PATH,
247 metadata_guppy_869476c => METADATA_GUPPY_869476C_PATH,
248 metadata_guppy_c9b4f76 => METADATA_GUPPY_C9B4F76_PATH,
249 metadata_guppy_44b62fa => METADATA_GUPPY_44B62FA_PATH,
250}
251
252pub struct JsonFixture {
253 name: &'static str,
254 workspace_path: Utf8PathBuf,
255 abs_path: Utf8PathBuf,
256 json_graph: OnceCell<(String, PackageGraph)>,
257 details: FixtureDetails,
258}
259
260impl JsonFixture {
261 fn new(name: &'static str, rel_path: &'static str, details: FixtureDetails) -> Self {
262 let rel_path = Utf8Path::new(rel_path);
263 let fixtures_dir = Utf8Path::new(env!("CARGO_MANIFEST_DIR"));
264 let mut abs_path = fixtures_dir.join("src");
266 abs_path.push(rel_path);
267 let abs_path = Utf8PathBuf::from_path_buf(
268 abs_path
269 .canonicalize()
270 .expect("fixture path canonicalization succeeded"),
271 )
272 .expect("valid UTF-8 path");
273
274 let workspace_root = fixtures_dir.parent().expect("up to workspace root");
275 let workspace_path = Utf8PathBuf::from_path_buf(
276 pathdiff::diff_paths(&abs_path, workspace_root)
277 .expect("both abs_path and workspace root are absolute"),
278 )
279 .expect("diff of UTF-8 paths is UTF-8");
280
281 let workspace_path = normalize_assuming_no_symlinks(workspace_path);
283
284 Self {
285 name,
286 workspace_path,
287 abs_path,
288 json_graph: OnceCell::new(),
289 details,
290 }
291 }
292
293 pub fn by_name(name: &str) -> Option<&'static Self> {
295 Self::all_fixtures().get(name)
296 }
297
298 pub fn name(&self) -> &'static str {
300 self.name
301 }
302
303 pub fn abs_path(&self) -> &Utf8Path {
305 &self.abs_path
306 }
307
308 pub fn workspace_path(&self) -> &Utf8Path {
310 &self.workspace_path
311 }
312
313 pub fn json(&self) -> &str {
315 self.init_graph().0
316 }
317
318 pub fn graph(&self) -> &PackageGraph {
320 self.init_graph().1
321 }
322
323 pub fn details(&self) -> &FixtureDetails {
325 &self.details
326 }
327
328 pub fn verify(&self) {
330 let graph = self.graph();
331
332 graph.verify().expect("graph verification should succeed");
333
334 for package in graph.packages() {
336 let source = package.source();
337 if source.is_external() {
338 let external = source
339 .parse_external()
340 .unwrap_or_else(|| panic!("cannot parse external source {source}"));
341 assert_eq!(
342 format!("{external}"),
343 source.external_source().expect("is_external is true"),
344 "roundtrip with ExternalSource"
345 );
346 }
347 }
348
349 self.details.assert_cycles(graph, "cycles");
350
351 self.details.assert_workspace(graph.workspace());
352 self.details.assert_topo(graph);
353
354 for id in self.details.known_ids() {
355 let msg = format!("error while verifying package '{id}'");
356 let metadata = graph.metadata(id).expect(&msg);
357 self.details.assert_metadata(id, metadata, &msg);
358
359 if self.details.has_build_targets(id) {
361 self.details.assert_build_targets(metadata, &msg);
362 }
363
364 if self.details.has_deps(id) {
366 self.details.assert_deps(graph, id, &msg);
367 }
368 if self.details.has_reverse_deps(id) {
369 self.details.assert_reverse_deps(graph, id, &msg);
370 }
371
372 if self.details.has_transitive_deps(id) {
374 self.details
375 .assert_transitive_deps(graph, id, &format!("{msg} (transitive deps)"));
376 }
377 if self.details.has_transitive_reverse_deps(id) {
378 self.details.assert_transitive_reverse_deps(
379 graph,
380 id,
381 &format!("{msg} (transitive reverse deps)"),
382 );
383 }
384
385 if self.details.has_named_features(id) {
387 self.details
388 .assert_named_features(graph, id, &format!("{msg} (named features)"));
389 }
390 }
391
392 self.details.assert_link_details(graph, "link details");
393
394 self.details
396 .assert_feature_graph_warnings(graph, "feature graph warnings");
397 }
398
399 fn init_graph(&self) -> (&str, &PackageGraph) {
400 let (json, package_graph) = self.json_graph.get_or_init(|| {
401 let json = fs::read_to_string(&self.abs_path)
402 .unwrap_or_else(|err| panic!("reading file '{}' failed: {}", self.abs_path, err));
403 let graph = Self::parse_graph(&json);
404 (json, graph)
405 });
406 (json.as_str(), package_graph)
407 }
408
409 fn parse_graph(json: &str) -> PackageGraph {
410 let metadata =
411 CargoMetadata::parse_json(json).expect("parsing metadata JSON should succeed");
412 PackageGraph::from_metadata(metadata).expect("constructing package graph should succeed")
413 }
414}
415
416fn normalize_assuming_no_symlinks(p: impl AsRef<Utf8Path>) -> Utf8PathBuf {
418 let mut out = Utf8PathBuf::new();
419 for c in p.as_ref().components() {
420 match c {
421 Utf8Component::ParentDir => {
422 out.pop();
423 }
424 c => out.push(c),
425 }
426 }
427 out
428}
429
430#[allow(clippy::redundant_clone)]
432impl FixtureDetails {
433 pub(crate) fn metadata1() -> Self {
436 let mut details = AHashMap::new();
437
438 PackageDetails::new(
439 METADATA1_TESTCRATE,
440 "testcrate",
441 "0.1.0",
442 vec![FAKE_AUTHOR],
443 None,
444 None,
445 )
446 .with_workspace_path("")
447 .with_build_targets(vec![(
448 BuildTargetId::Binary("testcrate"),
449 BuildTargetKind::Binary,
450 "src/main.rs",
451 )])
452 .with_deps(vec![("datatest", METADATA1_DATATEST)])
453 .with_reverse_deps(vec![])
454 .insert_into(&mut details);
455
456 #[rustfmt::skip]
457 let datatest_deps =
458 vec![
459 ("ctor", "ctor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)"),
460 ("datatest-derive", "datatest-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)"),
461 ("regex", "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)"),
462 ("region", "region 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)"),
463 ("serde", "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)"),
464 ("serde_yaml", "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)"),
465 ("version_check", "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)"),
466 ("walkdir", "walkdir 2.2.9 (git+https://github.com/BurntSushi/walkdir?tag=2.2.9#7c7013259eb9db400b3e5c7bc60330ca08068826)"),
469 ("yaml-rust", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)")
470 ];
471
472 static LIB_TYPE: Lazy<Vec<String>> = Lazy::new(|| vec!["lib".into()]);
473
474 PackageDetails::new(
475 METADATA1_DATATEST,
476 "datatest",
477 "0.4.2",
478 vec!["Ivan Dubrov <ivan@commure.com>"],
479 Some("Data-driven tests in Rust\n"),
480 Some("MIT/Apache-2.0"),
481 )
482 .with_crates_io()
483 .with_build_targets(vec![
484 (
485 BuildTargetId::Library,
486 BuildTargetKind::LibraryOrExample(&LIB_TYPE),
487 "src/lib.rs",
488 ),
489 (
490 BuildTargetId::BuildScript,
491 BuildTargetKind::Binary,
492 "build.rs",
493 ),
494 (
495 BuildTargetId::Test("bench"),
496 BuildTargetKind::Binary,
497 "tests/bench.rs",
498 ),
499 (
500 BuildTargetId::Test("datatest"),
501 BuildTargetKind::Binary,
502 "tests/datatest.rs",
503 ),
504 (
505 BuildTargetId::Test("datatest_stable"),
506 BuildTargetKind::Binary,
507 "tests/datatest_stable.rs",
508 ),
509 (
510 BuildTargetId::Test("datatest_stable_unsafe"),
511 BuildTargetKind::Binary,
512 "tests/datatest_stable_unsafe.rs",
513 ),
514 (
515 BuildTargetId::Test("unicode"),
516 BuildTargetKind::Binary,
517 "tests/unicode.rs",
518 ),
519 ])
520 .with_deps(datatest_deps)
521 .with_reverse_deps(vec![("datatest", METADATA1_TESTCRATE)])
522 .insert_into(&mut details);
523
524 Self::new(details).with_workspace_members(vec![("", METADATA1_TESTCRATE)])
525 }
526
527 pub(crate) fn metadata2() -> Self {
528 let mut details = AHashMap::new();
529
530 PackageDetails::new(
531 METADATA2_TESTCRATE,
532 "testworkspace-crate",
533 "0.1.0",
534 vec![FAKE_AUTHOR],
535 None,
536 None,
537 )
538 .with_workspace_path("testcrate")
539 .with_deps(vec![
540 (
541 "datatest",
542 "datatest 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
543 ),
544 ("walkdir", METADATA2_WALKDIR),
547 (
548 "walkdir-crates-io",
549 "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
550 ),
551 (
552 "walkdir-nuevo",
553 "walkdir 0.1.0 (path+file:///Users/fakeuser/local/walkdir)",
554 ),
555 ])
556 .with_reverse_deps(vec![])
557 .insert_into(&mut details);
558
559 PackageDetails::new(
560 METADATA2_WALKDIR,
561 "walkdir",
562 "2.2.9",
563 vec![FAKE_AUTHOR],
564 None,
565 None,
566 )
567 .with_workspace_path("walkdir")
568 .with_deps(vec![])
569 .with_reverse_deps(vec![("walkdir", METADATA2_TESTCRATE)])
570 .insert_into(&mut details);
571
572 PackageDetails::new(
574 METADATA2_QUOTE,
575 "quote",
576 "1.0.2",
577 vec!["David Tolnay <dtolnay@gmail.com>"],
578 Some("Quasi-quoting macro quote!(...)"),
579 Some("MIT OR Apache-2.0"),
580 )
581 .with_local_path("../quote")
582 .with_deps(vec![(
583 "proc-macro2",
584 "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
585 )])
586 .with_reverse_deps(vec![
587 (
588 "quote",
589 "ctor 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
590 ),
591 (
592 "quote",
593 "datatest-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
594 ),
595 (
596 "quote",
597 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
598 ),
599 ])
600 .with_named_features(vec!["default", "proc-macro"])
601 .insert_into(&mut details);
602
603 Self::new(details).with_workspace_members(vec![
604 ("testcrate", METADATA2_TESTCRATE),
605 ("walkdir", METADATA2_WALKDIR),
606 ])
607 }
608
609 pub(crate) fn metadata_builddep() -> Self {
610 let details = AHashMap::new();
611
612 Self::new(details)
613 }
614
615 pub(crate) fn metadata_dups() -> Self {
616 let mut details = AHashMap::new();
617
618 PackageDetails::new(
619 METADATA_DUPS_TESTCRATE,
620 "testcrate-dups",
621 "0.1.0",
622 vec![FAKE_AUTHOR],
623 None,
624 None,
625 )
626 .with_workspace_path("")
627 .with_deps(vec![
628 ("lazy_static", METADATA_DUPS_LAZY_STATIC_1),
629 ("lazy_static", METADATA_DUPS_LAZY_STATIC_02),
630 ("bytes-package", METADATA_DUPS_BYTES_03),
631 ("bytes-package", METADATA_DUPS_BYTES_05),
632 ])
633 .insert_into(&mut details);
634
635 Self::new(details).with_workspace_members(vec![("", METADATA_DUPS_TESTCRATE)])
636 }
637
638 pub(crate) fn metadata_cycle1() -> Self {
639 let mut details = AHashMap::new();
640
641 PackageDetails::new(
642 METADATA_CYCLE1_BASE,
643 "testcycles-base",
644 "0.1.0",
645 vec![FAKE_AUTHOR],
646 None,
647 None,
648 )
649 .with_workspace_path("")
650 .with_deps(vec![("testcycles-helper", METADATA_CYCLE1_HELPER)])
651 .with_transitive_deps(vec![METADATA_CYCLE1_BASE, METADATA_CYCLE1_HELPER])
652 .with_transitive_reverse_deps(vec![METADATA_CYCLE1_BASE, METADATA_CYCLE1_HELPER])
653 .insert_into(&mut details);
654
655 PackageDetails::new(
656 METADATA_CYCLE1_HELPER,
657 "testcycles-helper",
658 "0.1.0",
659 vec![FAKE_AUTHOR],
660 None,
661 None,
662 )
663 .with_local_path("../testcycles-helper")
664 .with_deps(vec![("testcycles-base", METADATA_CYCLE1_BASE)])
665 .with_transitive_deps(vec![METADATA_CYCLE1_BASE, METADATA_CYCLE1_HELPER])
666 .with_transitive_reverse_deps(vec![METADATA_CYCLE1_BASE, METADATA_CYCLE1_HELPER])
667 .insert_into(&mut details);
668
669 Self::new(details)
670 .with_workspace_members(vec![("", METADATA_CYCLE1_BASE)])
671 .with_cycles(vec![vec![METADATA_CYCLE1_HELPER, METADATA_CYCLE1_BASE]])
672 }
673
674 pub(crate) fn metadata_cycle1_windows() -> Self {
675 let mut details = AHashMap::new();
676
677 PackageDetails::new(
678 METADATA_CYCLE1_WINDOWS_BASE,
679 "testcycles-base",
680 "0.1.0",
681 vec![FAKE_AUTHOR],
682 None,
683 None,
684 )
685 .with_workspace_path("")
686 .with_deps(vec![("testcycles-helper", METADATA_CYCLE1_WINDOWS_HELPER)])
687 .with_transitive_deps(vec![
688 METADATA_CYCLE1_WINDOWS_BASE,
689 METADATA_CYCLE1_WINDOWS_HELPER,
690 ])
691 .with_transitive_reverse_deps(vec![
692 METADATA_CYCLE1_WINDOWS_BASE,
693 METADATA_CYCLE1_WINDOWS_HELPER,
694 ])
695 .insert_into(&mut details);
696
697 PackageDetails::new(
698 METADATA_CYCLE1_WINDOWS_HELPER,
699 "testcycles-helper",
700 "0.1.0",
701 vec![FAKE_AUTHOR],
702 None,
703 None,
704 )
705 .with_local_path("../testcycles-helper")
706 .with_deps(vec![("testcycles-base", METADATA_CYCLE1_WINDOWS_BASE)])
707 .with_transitive_deps(vec![
708 METADATA_CYCLE1_WINDOWS_BASE,
709 METADATA_CYCLE1_WINDOWS_HELPER,
710 ])
711 .with_transitive_reverse_deps(vec![
712 METADATA_CYCLE1_WINDOWS_BASE,
713 METADATA_CYCLE1_WINDOWS_HELPER,
714 ])
715 .insert_into(&mut details);
716
717 Self::new(details)
718 .with_workspace_members(vec![("", METADATA_CYCLE1_WINDOWS_BASE)])
719 .with_cycles(vec![vec![
720 METADATA_CYCLE1_WINDOWS_HELPER,
721 METADATA_CYCLE1_WINDOWS_BASE,
722 ]])
723 }
724
725 pub(crate) fn metadata_cycle1_windows_different_drives() -> Self {
726 let mut details = AHashMap::new();
727
728 PackageDetails::new(
729 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE,
730 "testcycles-base",
731 "0.1.0",
732 vec![FAKE_AUTHOR],
733 None,
734 None,
735 )
736 .with_workspace_path("")
737 .with_deps(vec![(
738 "testcycles-helper",
739 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER,
740 )])
741 .with_transitive_deps(vec![
742 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE,
743 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER,
744 ])
745 .with_transitive_reverse_deps(vec![
746 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE,
747 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER,
748 ])
749 .insert_into(&mut details);
750
751 #[cfg(windows)]
753 let helper_path = r"D:\libs\testcycles-helper";
754 #[cfg(not(windows))]
755 let helper_path = "D:/libs/testcycles-helper";
756
757 PackageDetails::new(
758 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER,
759 "testcycles-helper",
760 "0.1.0",
761 vec![FAKE_AUTHOR],
762 None,
763 None,
764 )
765 .with_local_path(helper_path)
766 .with_deps(vec![(
767 "testcycles-base",
768 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE,
769 )])
770 .with_transitive_deps(vec![
771 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE,
772 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER,
773 ])
774 .with_transitive_reverse_deps(vec![
775 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE,
776 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER,
777 ])
778 .insert_into(&mut details);
779
780 Self::new(details)
781 .with_workspace_members(vec![("", METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE)])
782 .with_cycles(vec![vec![
783 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_HELPER,
784 METADATA_CYCLE1_WINDOWS_DIFFERENT_DRIVES_BASE,
785 ]])
786 }
787
788 pub(crate) fn metadata_cycle2() -> Self {
789 let mut details = AHashMap::new();
794
795 PackageDetails::new(
797 METADATA_CYCLE2_UPPER_A,
798 "upper-a",
799 "0.1.0",
800 vec![FAKE_AUTHOR],
801 None,
802 None,
803 )
804 .with_workspace_path("upper-a")
805 .with_deps(vec![("upper-b", METADATA_CYCLE2_UPPER_B)])
806 .with_reverse_deps(vec![("upper-a", METADATA_CYCLE2_UPPER_B)])
807 .with_transitive_deps(vec![
808 METADATA_CYCLE2_UPPER_A,
809 METADATA_CYCLE2_UPPER_B,
810 METADATA_CYCLE2_LOWER_A,
811 METADATA_CYCLE2_LOWER_B,
812 ])
813 .with_transitive_reverse_deps(vec![METADATA_CYCLE2_UPPER_A, METADATA_CYCLE2_UPPER_B])
814 .insert_into(&mut details);
815
816 PackageDetails::new(
818 METADATA_CYCLE2_UPPER_B,
819 "upper-b",
820 "0.1.0",
821 vec![FAKE_AUTHOR],
822 None,
823 None,
824 )
825 .with_workspace_path("upper-b")
826 .with_deps(vec![
827 ("upper-a", METADATA_CYCLE2_UPPER_A),
828 ("lower-a", METADATA_CYCLE2_LOWER_A),
829 ])
830 .with_reverse_deps(vec![("upper-b", METADATA_CYCLE2_UPPER_A)])
831 .with_transitive_deps(vec![
832 METADATA_CYCLE2_UPPER_A,
833 METADATA_CYCLE2_UPPER_B,
834 METADATA_CYCLE2_LOWER_A,
835 METADATA_CYCLE2_LOWER_B,
836 ])
837 .with_transitive_reverse_deps(vec![METADATA_CYCLE2_UPPER_A, METADATA_CYCLE2_UPPER_B])
838 .insert_into(&mut details);
839
840 PackageDetails::new(
842 METADATA_CYCLE2_LOWER_A,
843 "lower-a",
844 "0.1.0",
845 vec![FAKE_AUTHOR],
846 None,
847 None,
848 )
849 .with_workspace_path("lower-a")
850 .with_deps(vec![("lower-b", METADATA_CYCLE2_LOWER_B)])
851 .with_reverse_deps(vec![
852 ("lower-a", METADATA_CYCLE2_UPPER_B),
853 ("lower-a", METADATA_CYCLE2_LOWER_B),
854 ])
855 .with_transitive_deps(vec![METADATA_CYCLE2_LOWER_A, METADATA_CYCLE2_LOWER_B])
856 .with_transitive_reverse_deps(vec![
857 METADATA_CYCLE2_UPPER_A,
858 METADATA_CYCLE2_UPPER_B,
859 METADATA_CYCLE2_LOWER_A,
860 METADATA_CYCLE2_LOWER_B,
861 ])
862 .insert_into(&mut details);
863
864 PackageDetails::new(
866 METADATA_CYCLE2_LOWER_B,
867 "lower-b",
868 "0.1.0",
869 vec![FAKE_AUTHOR],
870 None,
871 None,
872 )
873 .with_workspace_path("lower-b")
874 .with_deps(vec![("lower-a", METADATA_CYCLE2_LOWER_A)])
875 .with_reverse_deps(vec![("lower-b", METADATA_CYCLE2_LOWER_A)])
876 .with_transitive_deps(vec![METADATA_CYCLE2_LOWER_A, METADATA_CYCLE2_LOWER_B])
877 .with_transitive_reverse_deps(vec![
878 METADATA_CYCLE2_UPPER_A,
879 METADATA_CYCLE2_UPPER_B,
880 METADATA_CYCLE2_LOWER_A,
881 METADATA_CYCLE2_LOWER_B,
882 ])
883 .insert_into(&mut details);
884
885 Self::new(details)
886 .with_workspace_members(vec![
887 ("upper-a", METADATA_CYCLE2_UPPER_A),
888 ("upper-b", METADATA_CYCLE2_UPPER_B),
889 ("lower-a", METADATA_CYCLE2_LOWER_A),
890 ("lower-b", METADATA_CYCLE2_LOWER_B),
891 ])
892 .with_cycles(vec![
893 vec![METADATA_CYCLE2_UPPER_A, METADATA_CYCLE2_UPPER_B],
895 vec![METADATA_CYCLE2_LOWER_A, METADATA_CYCLE2_LOWER_B],
897 ])
898 }
899
900 pub(crate) fn metadata_cycle_features() -> Self {
901 let details = AHashMap::new();
902
903 Self::new(details)
904 .with_workspace_members(vec![
905 ("testcycles-base", METADATA_CYCLE_FEATURES_BASE),
906 ("testcycles-helper", METADATA_CYCLE_FEATURES_HELPER),
907 ])
908 .with_cycles(vec![vec![
909 METADATA_CYCLE_FEATURES_HELPER,
910 METADATA_CYCLE_FEATURES_BASE,
911 ]])
912 }
913
914 pub(crate) fn metadata_targets1() -> Self {
915 let mut details = AHashMap::new();
963
964 PackageDetails::new(
965 METADATA_TARGETS1_TESTCRATE,
966 "testcrate-targets",
967 "0.1.0",
968 vec![FAKE_AUTHOR],
969 None,
970 None,
971 )
972 .with_workspace_path("")
973 .with_deps(vec![
974 ("lazy_static", METADATA_TARGETS1_LAZY_STATIC_1),
975 ("lazy_static", METADATA_TARGETS1_LAZY_STATIC_02),
976 ("lazy_static", METADATA_TARGETS1_LAZY_STATIC_01),
977 ("bytes", METADATA_TARGETS1_BYTES),
978 ("dep-a", METADATA_TARGETS1_DEP_A),
979 ])
980 .insert_into(&mut details);
981
982 let x86_64_linux =
983 Platform::new("x86_64-unknown-linux-gnu", TargetFeatures::Unknown).unwrap();
984 let i686_windows = Platform::new(
985 "i686-pc-windows-msvc",
986 TargetFeatures::features(["sse", "sse2"].iter().copied()),
987 )
988 .unwrap();
989 let x86_64_windows =
990 Platform::new("x86_64-pc-windows-msvc", TargetFeatures::Unknown).unwrap();
991
992 let mut link_details = AHashMap::new();
993
994 use EnabledTernary::*;
995
996 LinkDetails::new(
998 package_id(METADATA_TARGETS1_TESTCRATE),
999 package_id(METADATA_TARGETS1_LAZY_STATIC_1),
1000 )
1001 .with_platform_status(
1002 DependencyKind::Normal,
1003 x86_64_linux.clone(),
1004 PlatformResults::new((Enabled, Enabled), (Enabled, Enabled)),
1005 )
1006 .with_platform_status(
1007 DependencyKind::Normal,
1008 i686_windows.clone(),
1009 PlatformResults::new((Enabled, Enabled), (Enabled, Enabled)),
1010 )
1011 .insert_into(&mut link_details);
1012
1013 LinkDetails::new(
1016 package_id(METADATA_TARGETS1_TESTCRATE),
1017 package_id(METADATA_TARGETS1_LAZY_STATIC_02),
1018 )
1019 .with_platform_status(
1020 DependencyKind::Normal,
1021 x86_64_linux.clone(),
1022 PlatformResults::new((Enabled, Enabled), (Enabled, Enabled)),
1023 )
1024 .with_platform_status(
1025 DependencyKind::Normal,
1026 i686_windows.clone(),
1027 PlatformResults::new((Disabled, Disabled), (Disabled, Disabled)),
1028 )
1029 .insert_into(&mut link_details);
1030
1031 LinkDetails::new(
1034 package_id(METADATA_TARGETS1_TESTCRATE),
1035 package_id(METADATA_TARGETS1_LAZY_STATIC_01),
1036 )
1037 .with_platform_status(
1038 DependencyKind::Development,
1039 x86_64_linux.clone(),
1040 PlatformResults::new((Disabled, Disabled), (Disabled, Disabled)),
1041 )
1042 .with_platform_status(
1043 DependencyKind::Development,
1044 i686_windows.clone(),
1045 PlatformResults::new((Enabled, Enabled), (Enabled, Enabled)),
1046 )
1047 .insert_into(&mut link_details);
1048
1049 LinkDetails::new(
1053 package_id(METADATA_TARGETS1_TESTCRATE),
1054 package_id(METADATA_TARGETS1_BYTES),
1055 )
1056 .with_platform_status(
1057 DependencyKind::Normal,
1058 x86_64_linux.clone(),
1059 PlatformResults::new((Enabled, Enabled), (Disabled, Disabled))
1060 .with_feature_status("serde", (Enabled, Enabled))
1061 .with_feature_status("std", (Disabled, Disabled)),
1062 )
1063 .with_platform_status(
1064 DependencyKind::Normal,
1065 i686_windows.clone(),
1066 PlatformResults::new((Enabled, Enabled), (Enabled, Enabled))
1067 .with_feature_status("serde", (Enabled, Enabled))
1068 .with_feature_status("std", (Disabled, Disabled)),
1069 )
1070 .with_features(DependencyKind::Normal, vec!["serde"])
1071 .with_platform_status(
1072 DependencyKind::Build,
1073 x86_64_linux.clone(),
1074 PlatformResults::new((Disabled, Enabled), (Disabled, Disabled))
1075 .with_feature_status("serde", (Disabled, Disabled))
1076 .with_feature_status("std", (Disabled, Enabled)),
1077 )
1078 .with_platform_status(
1079 DependencyKind::Build,
1080 i686_windows.clone(),
1081 PlatformResults::new((Disabled, Disabled), (Disabled, Disabled))
1082 .with_feature_status("serde", (Disabled, Disabled))
1083 .with_feature_status("std", (Disabled, Disabled)),
1084 )
1085 .with_features(DependencyKind::Build, vec!["std"])
1086 .insert_into(&mut link_details);
1087
1088 LinkDetails::new(
1093 package_id(METADATA_TARGETS1_TESTCRATE),
1094 package_id(METADATA_TARGETS1_DEP_A),
1095 )
1096 .with_platform_status(
1097 DependencyKind::Normal,
1098 x86_64_linux.clone(),
1099 PlatformResults::new((Enabled, Enabled), (Enabled, Enabled))
1100 .with_feature_status("foo", (Enabled, Enabled))
1101 .with_feature_status("bar", (Disabled, Disabled))
1102 .with_feature_status("baz", (Disabled, Disabled))
1103 .with_feature_status("quux", (Disabled, Disabled)),
1104 )
1105 .with_platform_status(
1106 DependencyKind::Normal,
1107 i686_windows.clone(),
1108 PlatformResults::new((Enabled, Enabled), (Enabled, Enabled))
1109 .with_feature_status("foo", (Disabled, Disabled))
1110 .with_feature_status("bar", (Enabled, Enabled))
1111 .with_feature_status("baz", (Disabled, Disabled))
1112 .with_feature_status("quux", (Disabled, Disabled)),
1113 )
1114 .with_platform_status(
1115 DependencyKind::Normal,
1116 x86_64_windows.clone(),
1117 PlatformResults::new((Disabled, Enabled), (Disabled, Enabled))
1118 .with_feature_status("foo", (Disabled, Disabled))
1119 .with_feature_status("bar", (Disabled, Disabled))
1120 .with_feature_status("baz", (Disabled, Disabled))
1121 .with_feature_status("quux", (Disabled, Disabled)),
1122 )
1123 .with_platform_status(
1124 DependencyKind::Development,
1125 x86_64_linux.clone(),
1126 PlatformResults::new((Enabled, Enabled), (Unknown, Unknown))
1128 .with_feature_status("foo", (Disabled, Disabled))
1129 .with_feature_status("bar", (Disabled, Disabled))
1130 .with_feature_status("baz", (Unknown, Unknown))
1131 .with_feature_status("quux", (Enabled, Enabled)),
1132 )
1133 .with_platform_status(
1134 DependencyKind::Development,
1135 i686_windows.clone(),
1136 PlatformResults::new((Enabled, Enabled), (Disabled, Disabled))
1138 .with_feature_status("foo", (Disabled, Disabled))
1139 .with_feature_status("bar", (Disabled, Disabled))
1140 .with_feature_status("baz", (Enabled, Enabled))
1141 .with_feature_status("quux", (Enabled, Enabled)),
1142 )
1143 .with_platform_status(
1144 DependencyKind::Development,
1145 x86_64_windows.clone(),
1146 PlatformResults::new((Unknown, Unknown), (Disabled, Disabled))
1148 .with_feature_status("foo", (Disabled, Disabled))
1149 .with_feature_status("bar", (Disabled, Disabled))
1150 .with_feature_status("baz", (Unknown, Unknown))
1151 .with_feature_status("quux", (Unknown, Unknown)),
1152 )
1153 .with_platform_status(
1154 DependencyKind::Build,
1155 x86_64_linux.clone(),
1156 PlatformResults::new((Unknown, Enabled), (Disabled, Enabled))
1158 .with_feature_status("foo", (Unknown, Unknown))
1159 .with_feature_status("bar", (Disabled, Unknown))
1160 .with_feature_status("baz", (Disabled, Disabled))
1161 .with_feature_status("quux", (Disabled, Disabled)),
1162 )
1163 .with_platform_status(
1164 DependencyKind::Build,
1165 i686_windows.clone(),
1166 PlatformResults::new((Enabled, Enabled), (Disabled, Enabled))
1168 .with_feature_status("foo", (Enabled, Enabled))
1169 .with_feature_status("bar", (Disabled, Disabled))
1170 .with_feature_status("baz", (Disabled, Disabled))
1171 .with_feature_status("quux", (Disabled, Disabled)),
1172 )
1173 .with_platform_status(
1174 DependencyKind::Build,
1175 x86_64_windows.clone(),
1176 PlatformResults::new((Unknown, Unknown), (Disabled, Unknown))
1178 .with_feature_status("foo", (Unknown, Unknown))
1179 .with_feature_status("bar", (Disabled, Disabled))
1180 .with_feature_status("baz", (Disabled, Disabled))
1181 .with_feature_status("quux", (Disabled, Disabled)),
1182 )
1183 .insert_into(&mut link_details);
1184
1185 Self::new(details)
1186 .with_workspace_members(vec![("", METADATA_TARGETS1_TESTCRATE)])
1187 .with_link_details(link_details)
1188 }
1189
1190 pub(crate) fn metadata_build_targets1() -> Self {
1191 let mut details = AHashMap::new();
1216
1217 static BIN_CDYLIB_TYPES: Lazy<Vec<String>> =
1218 Lazy::new(|| vec!["bin".into(), "cdylib".into()]);
1219 static DYLIB_RLIB_TYPES: Lazy<Vec<String>> =
1220 Lazy::new(|| vec!["dylib".into(), "rlib".into()]);
1221
1222 PackageDetails::new(
1223 METADATA_BUILD_TARGETS1_TESTCRATE,
1224 "testcrate",
1225 "0.1.0",
1226 vec![FAKE_AUTHOR],
1227 None,
1228 None,
1229 )
1230 .with_workspace_path("")
1231 .with_build_targets(vec![
1232 (
1233 BuildTargetId::Library,
1234 BuildTargetKind::LibraryOrExample(&BIN_CDYLIB_TYPES),
1235 "src/lib.rs",
1236 ),
1237 (
1238 BuildTargetId::BuildScript,
1239 BuildTargetKind::Binary,
1240 "build.rs",
1241 ),
1242 (
1243 BuildTargetId::Binary("testcrate"),
1244 BuildTargetKind::Binary,
1245 "src/main.rs",
1246 ),
1247 (
1248 BuildTargetId::Example("example1"),
1249 BuildTargetKind::LibraryOrExample(&DYLIB_RLIB_TYPES),
1250 "src/lib.rs",
1251 ),
1252 (
1253 BuildTargetId::Benchmark("bench1"),
1254 BuildTargetKind::Binary,
1255 "src/main.rs",
1256 ),
1257 (
1258 BuildTargetId::Benchmark("bench2"),
1259 BuildTargetKind::Binary,
1260 "src/main2.rs",
1261 ),
1262 ])
1263 .insert_into(&mut details);
1264
1265 Self::new(details)
1266 }
1267
1268 pub(crate) fn metadata_proc_macro1() -> Self {
1269 let mut details = AHashMap::new();
1270
1271 PackageDetails::new(
1272 METADATA_PROC_MACRO1_MACRO,
1273 "macro",
1274 "0.1.0",
1275 vec![FAKE_AUTHOR],
1276 None,
1277 None,
1278 )
1279 .with_workspace_path("macro")
1280 .with_reverse_deps(vec![
1281 ("macro", METADATA_PROC_MACRO1_NORMAL_USER),
1282 ("macro", METADATA_PROC_MACRO1_BUILD_USER),
1283 ("macro", METADATA_PROC_MACRO1_DEV_USER),
1284 ])
1285 .insert_into(&mut details);
1286
1287 Self::new(details)
1288 }
1289
1290 pub(crate) fn metadata_alternate_registries() -> Self {
1291 let details = AHashMap::new();
1292 Self::new(details)
1293 }
1294
1295 pub(crate) fn metadata_weak_namespaced_features() -> Self {
1296 let details = AHashMap::new();
1297 Self::new(details)
1298 }
1299
1300 pub(crate) fn metadata_libra() -> Self {
1301 let mut details = AHashMap::new();
1302
1303 PackageDetails::new(
1304 METADATA_LIBRA_E2E_TESTS,
1305 "language-e2e-tests",
1306 "0.1.0",
1307 vec!["Libra Association <opensource@libra.org>"],
1308 Some("Libra language e2e tests"),
1309 Some("Apache-2.0"),
1310 )
1311 .with_workspace_path("language/e2e-tests")
1312 .with_transitive_reverse_deps(vec![
1313 METADATA_LIBRA_E2E_TESTS,
1314 METADATA_LIBRA_COST_SYNTHESIS,
1315 METADATA_LIBRA_FUNCTIONAL_TESTS,
1316 METADATA_LIBRA_TEST_GENERATION,
1317 METADATA_LIBRA_LANGUAGE_BENCHMARKS,
1318 METADATA_LIBRA_TREE_HEAP,
1319 ])
1320 .insert_into(&mut details);
1321
1322 PackageDetails::new(
1323 METADATA_LIBRA_LAZY_STATIC,
1324 "lazy_static",
1325 "1.4.0",
1326 vec!["Marvin Löbel <loebel.marvin@gmail.com>"],
1327 Some("A macro for declaring lazily evaluated statics in Rust."),
1328 Some("MIT/Apache-2.0"),
1329 )
1330 .with_crates_io()
1331 .with_transitive_deps(vec![
1332 METADATA_LIBRA_LAZY_STATIC,
1333 "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
1334 ])
1337 .insert_into(&mut details);
1338
1339 #[rustfmt::skip]
1340 let workspace_members = vec![
1341 ("admission_control/admission-control-proto", "admission-control-proto 0.1.0 (path+file:///Users/fakeuser/local/libra/admission_control/admission-control-proto)"),
1342 ("admission_control/admission-control-service", METADATA_LIBRA_ADMISSION_CONTROL_SERVICE),
1343 ("benchmark", "benchmark 0.1.0 (path+file:///Users/fakeuser/local/libra/benchmark)"),
1344 ("client", "client 0.1.0 (path+file:///Users/fakeuser/local/libra/client)"),
1345 ("client/libra_wallet", "libra-wallet 0.1.0 (path+file:///Users/fakeuser/local/libra/client/libra_wallet)"),
1346 ("common/bounded-executor", "bounded-executor 0.1.0 (path+file:///Users/fakeuser/local/libra/common/bounded-executor)"),
1347 ("common/channel", "channel 0.1.0 (path+file:///Users/fakeuser/local/libra/common/channel)"),
1348 ("common/crash-handler", "crash-handler 0.1.0 (path+file:///Users/fakeuser/local/libra/common/crash-handler)"),
1349 ("common/datatest-stable", "datatest-stable 0.1.0 (path+file:///Users/fakeuser/local/libra/common/datatest-stable)"),
1350 ("common/debug-interface", "debug-interface 0.1.0 (path+file:///Users/fakeuser/local/libra/common/debug-interface)"),
1351 ("common/executable-helpers", "executable-helpers 0.1.0 (path+file:///Users/fakeuser/local/libra/common/executable-helpers)"),
1352 ("common/failure-ext", "libra-failure-ext 0.1.0 (path+file:///Users/fakeuser/local/libra/common/failure-ext)"),
1353 ("common/failure-ext/failure-macros", "libra-failure-macros 0.1.0 (path+file:///Users/fakeuser/local/libra/common/failure-ext/failure-macros)"),
1354 ("common/futures-semaphore", "futures-semaphore 0.1.0 (path+file:///Users/fakeuser/local/libra/common/futures-semaphore)"),
1355 ("common/grpc-helpers", "grpc-helpers 0.1.0 (path+file:///Users/fakeuser/local/libra/common/grpc-helpers)"),
1356 ("common/lcs", "libra-canonical-serialization 0.1.0 (path+file:///Users/fakeuser/local/libra/common/lcs)"),
1357 ("common/logger", "libra-logger 0.1.0 (path+file:///Users/fakeuser/local/libra/common/logger)"),
1358 ("common/metrics", "libra-metrics 0.1.0 (path+file:///Users/fakeuser/local/libra/common/metrics)"),
1359 ("common/nibble", "libra-nibble 0.1.0 (path+file:///Users/fakeuser/local/libra/common/nibble)"),
1360 ("common/proptest-helpers", "libra-proptest-helpers 0.1.0 (path+file:///Users/fakeuser/local/libra/common/proptest-helpers)"),
1361 ("common/prost-ext", "libra-prost-ext 0.1.0 (path+file:///Users/fakeuser/local/libra/common/prost-ext)"),
1362 ("common/tools", "libra-tools 0.1.0 (path+file:///Users/fakeuser/local/libra/common/tools)"),
1363 ("config", "libra-config 0.1.0 (path+file:///Users/fakeuser/local/libra/config)"),
1364 ("config/config-builder", "config-builder 0.1.0 (path+file:///Users/fakeuser/local/libra/config/config-builder)"),
1365 ("config/generate-keypair", "generate-keypair 0.1.0 (path+file:///Users/fakeuser/local/libra/config/generate-keypair)"),
1366 ("consensus", "consensus 0.1.0 (path+file:///Users/fakeuser/local/libra/consensus)"),
1367 ("consensus/consensus-types", "consensus-types 0.1.0 (path+file:///Users/fakeuser/local/libra/consensus/consensus-types)"),
1368 ("consensus/safety-rules", "safety-rules 0.1.0 (path+file:///Users/fakeuser/local/libra/consensus/safety-rules)"),
1369 ("crypto/crypto", "libra-crypto 0.1.0 (path+file:///Users/fakeuser/local/libra/crypto/crypto)"),
1370 ("crypto/crypto-derive", "libra-crypto-derive 0.1.0 (path+file:///Users/fakeuser/local/libra/crypto/crypto-derive)"),
1371 ("crypto/secret-service", "secret-service 0.1.0 (path+file:///Users/fakeuser/local/libra/crypto/secret-service)"),
1372 ("executor", "executor 0.1.0 (path+file:///Users/fakeuser/local/libra/executor)"),
1373 ("language/benchmarks", METADATA_LIBRA_LANGUAGE_BENCHMARKS),
1374 ("language/bytecode-verifier", "bytecode-verifier 0.1.0 (path+file:///Users/fakeuser/local/libra/language/bytecode-verifier)"),
1375 ("language/bytecode-verifier/bytecode_verifier_tests", "bytecode_verifier_tests 0.1.0 (path+file:///Users/fakeuser/local/libra/language/bytecode-verifier/bytecode_verifier_tests)"),
1376 ("language/bytecode-verifier/invalid-mutations", "invalid-mutations 0.1.0 (path+file:///Users/fakeuser/local/libra/language/bytecode-verifier/invalid-mutations)"),
1377 ("language/compiler", METADATA_LIBRA_COMPILER),
1378 ("language/compiler/bytecode-source-map", "bytecode-source-map 0.1.0 (path+file:///Users/fakeuser/local/libra/language/compiler/bytecode-source-map)"),
1379 ("language/compiler/ir-to-bytecode", "ir-to-bytecode 0.1.0 (path+file:///Users/fakeuser/local/libra/language/compiler/ir-to-bytecode)"),
1380 ("language/compiler/ir-to-bytecode/syntax", "ir-to-bytecode-syntax 0.1.0 (path+file:///Users/fakeuser/local/libra/language/compiler/ir-to-bytecode/syntax)"),
1381 ("language/e2e-tests", METADATA_LIBRA_E2E_TESTS),
1382 ("language/functional_tests", METADATA_LIBRA_FUNCTIONAL_TESTS),
1383 ("language/stackless-bytecode/bytecode-to-boogie", "bytecode-to-boogie 0.1.0 (path+file:///Users/fakeuser/local/libra/language/stackless-bytecode/bytecode-to-boogie)"),
1384 ("language/stackless-bytecode/generator", "stackless-bytecode-generator 0.1.0 (path+file:///Users/fakeuser/local/libra/language/stackless-bytecode/generator)"),
1385 ("language/stackless-bytecode/tree_heap", METADATA_LIBRA_TREE_HEAP),
1386 ("language/stdlib", METADATA_LIBRA_STDLIB),
1387 ("language/tools/cost-synthesis", METADATA_LIBRA_COST_SYNTHESIS),
1388 ("language/tools/test-generation", METADATA_LIBRA_TEST_GENERATION),
1389 ("language/transaction-builder", METADATA_LIBRA_TRANSACTION_BUILDER),
1390 ("language/vm", "vm 0.1.0 (path+file:///Users/fakeuser/local/libra/language/vm)"),
1391 ("language/vm/serializer_tests", "serializer_tests 0.1.0 (path+file:///Users/fakeuser/local/libra/language/vm/serializer_tests)"),
1392 ("language/vm/vm-genesis", "vm-genesis 0.1.0 (path+file:///Users/fakeuser/local/libra/language/vm/vm-genesis)"),
1393 ("language/vm/vm-runtime", "vm-runtime 0.1.0 (path+file:///Users/fakeuser/local/libra/language/vm/vm-runtime)"),
1394 ("language/vm/vm-runtime/vm-cache-map", "vm-cache-map 0.1.0 (path+file:///Users/fakeuser/local/libra/language/vm/vm-runtime/vm-cache-map)"),
1395 ("language/vm/vm-runtime/vm-runtime-types", "vm-runtime-types 0.1.0 (path+file:///Users/fakeuser/local/libra/language/vm/vm-runtime/vm-runtime-types)"),
1396 ("libra-node", "libra-node 0.1.0 (path+file:///Users/fakeuser/local/libra/libra-node)"),
1397 ("libra-swarm", "libra-swarm 0.1.0 (path+file:///Users/fakeuser/local/libra/libra-swarm)"),
1398 ("mempool", "libra-mempool 0.1.0 (path+file:///Users/fakeuser/local/libra/mempool)"),
1399 ("mempool/mempool-shared-proto", "libra-mempool-shared-proto 0.1.0 (path+file:///Users/fakeuser/local/libra/mempool/mempool-shared-proto)"),
1400 ("network", "network 0.1.0 (path+file:///Users/fakeuser/local/libra/network)"),
1401 ("network/memsocket", "memsocket 0.1.0 (path+file:///Users/fakeuser/local/libra/network/memsocket)"),
1402 ("network/netcore", "netcore 0.1.0 (path+file:///Users/fakeuser/local/libra/network/netcore)"),
1403 ("network/noise", "noise 0.1.0 (path+file:///Users/fakeuser/local/libra/network/noise)"),
1404 ("network/socket-bench-server", "socket-bench-server 0.1.0 (path+file:///Users/fakeuser/local/libra/network/socket-bench-server)"),
1405 ("state-synchronizer", "state-synchronizer 0.1.0 (path+file:///Users/fakeuser/local/libra/state-synchronizer)"),
1406 ("storage/accumulator", "accumulator 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/accumulator)"),
1407 ("storage/jellyfish-merkle", "jellyfish-merkle 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/jellyfish-merkle)"),
1408 ("storage/libradb", "libradb 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/libradb)"),
1409 ("storage/schemadb", "schemadb 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/schemadb)"),
1410 ("storage/scratchpad", "scratchpad 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/scratchpad)"),
1411 ("storage/state-view", "libra-state-view 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/state-view)"),
1412 ("storage/storage-client", "storage-client 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/storage-client)"),
1413 ("storage/storage-proto", "storage-proto 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/storage-proto)"),
1414 ("storage/storage-service", "storage-service 0.1.0 (path+file:///Users/fakeuser/local/libra/storage/storage-service)"),
1415 ("testsuite", "testsuite 0.1.0 (path+file:///Users/fakeuser/local/libra/testsuite)"),
1416 ("testsuite/cluster-test", "cluster-test 0.1.0 (path+file:///Users/fakeuser/local/libra/testsuite/cluster-test)"),
1417 ("testsuite/libra-fuzzer", "libra-fuzzer 0.1.0 (path+file:///Users/fakeuser/local/libra/testsuite/libra-fuzzer)"),
1418 ("types", "libra-types 0.1.0 (path+file:///Users/fakeuser/local/libra/types)"),
1419 ("vm-validator", "vm-validator 0.1.0 (path+file:///Users/fakeuser/local/libra/vm-validator)"),
1420 ("x", "x 0.1.0 (path+file:///Users/fakeuser/local/libra/x)"),
1421 ];
1422
1423 Self::new(details)
1424 .with_workspace_members(workspace_members)
1425 .with_feature_graph_warnings(vec![
1426 FeatureGraphWarning::MissingFeature {
1428 stage: FeatureBuildStage::AddNamedFeatureEdges {
1429 package_id: package_id(METADATA_LIBRA_BACKTRACE),
1430 from_feature: "rustc-dep-of-std".to_string(),
1431 },
1432 package_id: package_id(METADATA_LIBRA_CFG_IF),
1433 feature_name: "rustc-dep-of-std".to_string(),
1434 },
1435 ])
1436 }
1437
1438 pub(crate) fn metadata_libra_f0091a4() -> Self {
1439 let details = AHashMap::new();
1440
1441 Self::new(details).with_cycles(vec![vec![
1442 METADATA_LIBRA_FUNCTIONAL_HYPHEN_TESTS,
1443 METADATA_LIBRA_E2E_TESTS,
1444 METADATA_LIBRA_VM_GENESIS,
1445 METADATA_LIBRA_MOVE_LANG_STDLIB,
1446 METADATA_LIBRA_MOVE_LANG,
1447 ]])
1448 }
1449
1450 pub(crate) fn metadata_libra_9ffd93b() -> Self {
1451 let details = AHashMap::new();
1452
1453 Self::new(details).with_cycles(vec![
1454 vec![METADATA_LIBRA_EXECUTOR_UTILS, METADATA_LIBRA_EXECUTOR],
1455 vec![
1456 METADATA_LIBRA_FUNCTIONAL_HYPHEN_TESTS,
1457 METADATA_LIBRA_E2E_TESTS,
1458 METADATA_LIBRA_VM_GENESIS,
1459 METADATA_LIBRA_TRANSACTION_BUILDER,
1460 METADATA_LIBRA_LIBRA_VM,
1461 METADATA_LIBRA_MOVE_VM_RUNTIME,
1462 METADATA_LIBRA_COMPILER,
1463 METADATA_LIBRA_STDLIB,
1464 METADATA_LIBRA_MOVE_LANG,
1465 ],
1466 ])
1467 }
1468
1469 pub(crate) fn mnemos_b3b4da9() -> Self {
1470 let details = AHashMap::new();
1471
1472 Self::new(details)
1473 }
1474
1475 pub(crate) fn hyper_util_7afb1ed() -> Self {
1476 let details = AHashMap::new();
1477
1478 Self::new(details)
1479 }
1480
1481 pub(crate) fn metadata_guppy_78cb7e8() -> Self {
1482 let details = AHashMap::new();
1483
1484 Self::new(details)
1485 }
1486
1487 pub(crate) fn metadata_guppy_869476c() -> Self {
1488 let details = AHashMap::new();
1489
1490 Self::new(details)
1491 }
1492
1493 pub(crate) fn metadata_guppy_c9b4f76() -> Self {
1494 let details = AHashMap::new();
1495
1496 Self::new(details)
1497 }
1498
1499 pub(crate) fn metadata_guppy_44b62fa() -> Self {
1500 let details = AHashMap::new();
1501
1502 Self::new(details)
1503 }
1504}