Skip to content

Commit 94fbe14

Browse files
committed
don't try to find target tools on certain commands
For commands like check/clean there is no need to check for target tools. Avoiding this check can also speed up the process. Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 9a29081 commit 94fbe14

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

‎src/bootstrap/src/utils/cc_detect.rs‎

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,29 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
8787
}
8888

8989
pubfnfind(build:&Build){
90-
// For all targets we're going to need a C compiler for building some shims
91-
// and such as well as for being a linker for Rust code.
92-
let targets = build
93-
.targets
94-
.iter()
95-
.chain(&build.hosts)
96-
.cloned()
97-
.chain(iter::once(build.build))
98-
.collect::<HashSet<_>>();
90+
let targets:HashSet<_> = match build.config.cmd{
91+
// We don't need to check cross targets for these commands.
92+
crate::Subcommand::Clean{ .. }
93+
| crate::Subcommand::Check{ .. }
94+
| crate::Subcommand::Suggest{ .. }
95+
| crate::Subcommand::Format{ .. }
96+
| crate::Subcommand::Setup{ .. } => {
97+
build.hosts.iter().cloned().chain(iter::once(build.build)).collect()
98+
}
99+
100+
_ => {
101+
// For all targets we're going to need a C compiler for building some shims
102+
// and such as well as for being a linker for Rust code.
103+
build
104+
.targets
105+
.iter()
106+
.chain(&build.hosts)
107+
.cloned()
108+
.chain(iter::once(build.build))
109+
.collect()
110+
}
111+
};
112+
99113
for target in targets.into_iter(){
100114
find_target(build, target);
101115
}

0 commit comments

Comments
 (0)