Add in_tree macro literal

Signed-off-by: InfRandomness <infrandomness@gmail.com>
This commit is contained in:
InfRandomness 2022-06-06 17:21:39 +02:00
parent dbe77e856a
commit 45a69cc215
No known key found for this signature in database
GPG Key ID: 60B6C81EF033441A

View File

@ -643,7 +643,7 @@ fn run(self, builder: &Builder<'_>) {
}
macro_rules! tool_doc {
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?] $(,)?) => {
($tool: ident, $should_run: literal, $path: literal, [$($krate: literal),+ $(,)?], in_tree = $in_tree:expr $(,)?) => {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct $tool {
target: TargetSelection,
@ -699,6 +699,12 @@ fn run(self, builder: &Builder<'_>) {
t!(fs::create_dir_all(&out_dir));
t!(symlink_dir_force(&builder.config, &out, &out_dir));
let source_type = if $in_tree == true {
SourceType::InTree
} else {
SourceType::Submodule
};
// Build cargo command.
let mut cargo = prepare_tool_cargo(
builder,
@ -707,7 +713,7 @@ fn run(self, builder: &Builder<'_>) {
target,
"doc",
$path,
SourceType::InTree,
source_type,
&[],
);
@ -729,15 +735,22 @@ fn run(self, builder: &Builder<'_>) {
}
}
tool_doc!(Rustdoc, "rustdoc-tool", "src/tools/rustdoc", ["rustdoc", "rustdoc-json-types"]);
tool_doc!(
Rustdoc,
"rustdoc-tool",
"src/tools/rustdoc",
["rustdoc", "rustdoc-json-types"],
in_tree = true
);
tool_doc!(
Rustfmt,
"rustfmt-nightly",
"src/tools/rustfmt",
["rustfmt-nightly", "rustfmt-config_proc_macro"],
in_tree = true
);
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"]);
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"]);
tool_doc!(Clippy, "clippy", "src/tools/clippy", ["clippy_utils"], in_tree = true);
tool_doc!(Miri, "miri", "src/tools/miri", ["miri"], in_tree = false);
#[derive(Ord, PartialOrd, Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ErrorIndex {