mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Simplify build system for rustdoc-gui test crates
This commit is contained in:
parent
8ccee61d38
commit
da6d82e465
3
.gitignore
vendored
3
.gitignore
vendored
@ -72,4 +72,7 @@ __pycache__/
|
||||
**node_modules
|
||||
**package-lock.json
|
||||
|
||||
## Rustdoc GUI tests
|
||||
src/test/rustdoc-gui/src/**.lock
|
||||
|
||||
# Before adding new lines, see the comment at the top.
|
||||
|
@ -907,27 +907,25 @@ impl Step for RustdocGUI {
|
||||
// We remove existing folder to be sure there won't be artifacts remaining.
|
||||
let _ = fs::remove_dir_all(&out_dir);
|
||||
|
||||
let mut nb_generated = 0;
|
||||
let src_path = "src/test/rustdoc-gui/src";
|
||||
// We generate docs for the libraries present in the rustdoc-gui's src folder.
|
||||
let libs_dir = builder.build.src.join("src/test/rustdoc-gui/src");
|
||||
for entry in libs_dir.read_dir().expect("read_dir call failed") {
|
||||
let entry = entry.expect("invalid entry");
|
||||
let path = entry.path();
|
||||
if path.extension().map(|e| e == "rs").unwrap_or(false) {
|
||||
let mut command = builder.rustdoc_cmd(self.compiler);
|
||||
command.arg(path).arg("-o").arg(&out_dir);
|
||||
builder.run(&mut command);
|
||||
nb_generated += 1;
|
||||
}
|
||||
}
|
||||
assert!(nb_generated > 0, "no documentation was generated...");
|
||||
let mut cargo = Command::new(&builder.initial_cargo);
|
||||
cargo
|
||||
.arg("doc")
|
||||
.arg("--workspace")
|
||||
.arg("--target-dir")
|
||||
.arg(&out_dir)
|
||||
.env("RUSTDOC", builder.rustdoc(self.compiler))
|
||||
.env("RUSTC", builder.rustc(self.compiler))
|
||||
.current_dir(&builder.build.src.join(src_path));
|
||||
builder.run(&mut cargo);
|
||||
|
||||
// We now run GUI tests.
|
||||
let mut command = Command::new(&nodejs);
|
||||
command
|
||||
.arg(builder.build.src.join("src/tools/rustdoc-gui/tester.js"))
|
||||
.arg("--doc-folder")
|
||||
.arg(out_dir)
|
||||
.arg(out_dir.join("doc"))
|
||||
.arg("--tests-folder")
|
||||
.arg(builder.build.src.join("src/test/rustdoc-gui"));
|
||||
for path in &builder.paths {
|
||||
|
18
src/test/rustdoc-gui/src/Cargo.lock
Normal file
18
src/test/rustdoc-gui/src/Cargo.lock
Normal file
@ -0,0 +1,18 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "implementors"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "lib2"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"implementors",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test_docs"
|
||||
version = "0.1.0"
|
6
src/test/rustdoc-gui/src/Cargo.toml
Normal file
6
src/test/rustdoc-gui/src/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"test_docs",
|
||||
"lib2",
|
||||
"implementors",
|
||||
]
|
10
src/test/rustdoc-gui/src/lib2/Cargo.toml
Normal file
10
src/test/rustdoc-gui/src/lib2/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "lib2"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
implementors = { path = "../implementors" }
|
@ -31,3 +31,5 @@ impl Trait for Foo {
|
||||
type X = u32;
|
||||
const Y: u32 = 0;
|
||||
}
|
||||
|
||||
impl implementors::Whatever for Foo {}
|
7
src/test/rustdoc-gui/src/lib2/src/lib.rs
Normal file
7
src/test/rustdoc-gui/src/lib2/src/lib.rs
Normal file
@ -0,0 +1,7 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
7
src/test/rustdoc-gui/src/test_docs/Cargo.toml
Normal file
7
src/test/rustdoc-gui/src/test_docs/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "test_docs"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
Loading…
Reference in New Issue
Block a user