Skip to content

Commit 9ca382f

Browse files
ahmedcharlesalexcrichton
authored andcommitted
Use workspaces and switch to a single Cargo.lock.
This involves hacking the code used to run cargo test on various packages, because it reads Cargo.lock to determine which packages should be tested. This change implements a blacklist, since that will catch new crates when they are added in the future.
1 parent ca76c7e commit 9ca382f

File tree

14 files changed

+864
-951
lines changed

14 files changed

+864
-951
lines changed

src/Cargo.lock

+808
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cargo.toml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[workspace]
2+
members = [
3+
"bootstrap",
4+
"rustc",
5+
"rustc/std_shim",
6+
"rustc/test_shim",
7+
"tools/cargotest",
8+
"tools/compiletest",
9+
"tools/error_index_generator",
10+
"tools/linkchecker",
11+
"tools/rustbook",
12+
"tools/tidy",
13+
]

src/bootstrap/Cargo.lock

-180
This file was deleted.

src/bootstrap/check.rs

+43-9
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,47 @@ pub fn krate(build: &Build,
268268
compiler: &Compiler,
269269
target: &str,
270270
mode: Mode) {
271-
let (name, path, features) = match mode {
272-
Mode::Libstd => ("libstd", "src/rustc/std_shim", build.std_features()),
273-
Mode::Libtest => ("libtest", "src/rustc/test_shim", String::new()),
274-
Mode::Librustc => ("librustc", "src/rustc", build.rustc_features()),
271+
let (name, path, features, excluded) = match mode {
272+
Mode::Libstd => {
273+
let excluded = vec![
274+
"alloc_jemalloc", "arena", "bootstrap", "cargotest", "compiletest",
275+
"error_index_generator", "flate", "fmt_macros", "getopts", "graphviz",
276+
"linkchecker", "log", "proc_macro", "rbml", "rustbook", "rustc", "rustc-main",
277+
"rustc_back", "rustc_bitflags", "rustc_borrowck", "rustc_const_eval",
278+
"rustc_const_math", "rustc_data_structures", "rustc_driver", "rustc_errors",
279+
"rustc_incremental", "rustc_lint", "rustc_llvm", "rustc_metadata", "rustc_mir",
280+
"rustc_passes", "rustc_platform_intrinsics", "rustc_plugin", "rustc_privacy",
281+
"rustc_resolve", "rustc_save_analysis", "rustc_trans", "rustc_typeck", "rustdoc",
282+
"serialize", "syntax", "syntax_ext", "syntax_pos", "term", "test", "test_shim",
283+
"tidy", "unwind",
284+
];
285+
("libstd", "src/rustc/std_shim", build.std_features(), excluded)
286+
}
287+
Mode::Libtest => {
288+
let excluded = vec![
289+
"alloc", "alloc_jemalloc", "alloc_system", "arena", "bootstrap", "build_helper",
290+
"cargotest", "collections", "compiletest", "core", "error_index_generator",
291+
"flate", "fmt_macros", "graphviz", "libc", "linkchecker", "log", "panic_abort",
292+
"panic_unwind", "proc_macro", "rand", "rbml", "rustbook", "rustc", "rustc-main",
293+
"rustc_back", "rustc_bitflags", "rustc_borrowck", "rustc_const_eval",
294+
"rustc_const_math", "rustc_data_structures", "rustc_driver", "rustc_errors",
295+
"rustc_incremental", "rustc_lint", "rustc_llvm", "rustc_metadata", "rustc_mir",
296+
"rustc_passes", "rustc_platform_intrinsics", "rustc_plugin", "rustc_privacy",
297+
"rustc_resolve", "rustc_save_analysis", "rustc_trans", "rustc_typeck",
298+
"rustc_unicode", "rustdoc", "serialize", "std", "std_shim", "syntax", "syntax_ext",
299+
"syntax_pos", "tidy", "unwind",
300+
];
301+
("libtest", "src/rustc/test_shim", String::new(), excluded)
302+
}
303+
Mode::Librustc => {
304+
let excluded = vec![
305+
"alloc", "alloc_jemalloc", "alloc_system", "bootstrap", "cargotest", "collections",
306+
"compiletest", "core", "error_index_generator", "getopts", "libc", "linkchecker",
307+
"panic_abort", "panic_unwind", "rand", "rustbook", "rustc_unicode", "std",
308+
"std_shim", "term", "test", "test_shim", "tidy", "unwind",
309+
];
310+
("librustc", "src/rustc", build.rustc_features(), excluded)
311+
}
275312
_ => panic!("can only test libraries"),
276313
};
277314
println!("Testing {} stage{} ({} -> {})", name, compiler.stage,
@@ -285,7 +322,7 @@ pub fn krate(build: &Build,
285322

286323
// Generate a list of `-p` arguments to pass to the `cargo test` invocation
287324
// by crawling the corresponding Cargo.lock file.
288-
let lockfile = build.src.join(path).join("Cargo.lock");
325+
let lockfile = build.src.join("src").join("Cargo.lock");
289326
let mut contents = String::new();
290327
t!(t!(File::open(&lockfile)).read_to_string(&mut contents));
291328
let mut lines = contents.lines();
@@ -305,10 +342,7 @@ pub fn krate(build: &Build,
305342

306343
let crate_name = &line[prefix.len()..line.len() - 1];
307344

308-
// Right now jemalloc is our only target-specific crate in the sense
309-
// that it's not present on all platforms. Custom skip it here for now,
310-
// but if we add more this probably wants to get more generalized.
311-
if crate_name.contains("jemalloc") {
345+
if excluded.contains(&crate_name) {
312346
continue
313347
}
314348

src/libpanic_unwind/Cargo.lock

-36
This file was deleted.

0 commit comments

Comments
 (0)