|
2 | 2 |
|
3 | 3 | use super::check;
|
4 | 4 | use super::compile::{run_cargo, rustc_cargo, std_cargo};
|
5 |
| -use super::tool::{SourceType, prepare_tool_cargo}; |
| 5 | +use super::tool::{RustcPrivateCompilers, SourceType, prepare_tool_cargo}; |
6 | 6 | use crate::builder::{Builder, ShouldRun};
|
7 | 7 | use crate::core::build_steps::compile::std_crates_for_run_make;
|
8 | 8 | use crate::core::builder;
|
9 |
| -use crate::core::builder::{Alias, Kind, RunConfig, Step, crate_description}; |
| 9 | +use crate::core::builder::{Alias, Kind, RunConfig, Step, StepMetadata, crate_description}; |
10 | 10 | use crate::utils::build_stamp::{self, BuildStamp};
|
11 | 11 | use crate::{Mode, Subcommand, TargetSelection};
|
12 | 12 |
|
@@ -253,6 +253,82 @@ impl Step for Rustc {
|
253 | 253 | }
|
254 | 254 | }
|
255 | 255 |
|
| 256 | +#[derive(Debug, Clone, Hash, PartialEq, Eq)] |
| 257 | +pub struct CodegenGcc { |
| 258 | + compilers: RustcPrivateCompilers, |
| 259 | + target: TargetSelection, |
| 260 | + config: LintConfig, |
| 261 | +} |
| 262 | + |
| 263 | +impl CodegenGcc { |
| 264 | + fn new(builder: &Builder<'_>, target: TargetSelection, config: LintConfig) -> Self { |
| 265 | + Self { |
| 266 | + compilers: RustcPrivateCompilers::new(builder, builder.top_stage, target), |
| 267 | + target, |
| 268 | + config, |
| 269 | + } |
| 270 | + } |
| 271 | +} |
| 272 | + |
| 273 | +impl Step for CodegenGcc { |
| 274 | + type Output = (); |
| 275 | + |
| 276 | + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { |
| 277 | + run.alias("rustc_codegen_gcc") |
| 278 | + } |
| 279 | + |
| 280 | + fn make_run(run: RunConfig<'_>) { |
| 281 | + let builder = run.builder; |
| 282 | + let config = LintConfig::new(builder); |
| 283 | + builder.ensure(CodegenGcc::new(builder, run.target, config)); |
| 284 | + } |
| 285 | + |
| 286 | + fn run(self, builder: &Builder<'_>) -> Self::Output { |
| 287 | + let build_compiler = self.compilers.build_compiler(); |
| 288 | + let target = self.target; |
| 289 | + |
| 290 | + let cargo = prepare_tool_cargo( |
| 291 | + builder, |
| 292 | + build_compiler, |
| 293 | + Mode::Codegen, |
| 294 | + target, |
| 295 | + Kind::Clippy, |
| 296 | + "compiler/rustc_codegen_gcc", |
| 297 | + SourceType::InTree, |
| 298 | + &[], |
| 299 | + ); |
| 300 | + |
| 301 | + let _guard = builder.msg_tool( |
| 302 | + Kind::Clippy, |
| 303 | + Mode::ToolRustc, |
| 304 | + "rustc_codegen_gcc", |
| 305 | + build_compiler.stage, |
| 306 | + &build_compiler.host, |
| 307 | + &target, |
| 308 | + ); |
| 309 | + |
| 310 | + let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::Codegen, target)) |
| 311 | + .with_prefix("rustc_codegen_gcc-check"); |
| 312 | + |
| 313 | + run_cargo( |
| 314 | + builder, |
| 315 | + cargo, |
| 316 | + lint_args(builder, &self.config, &[]), |
| 317 | + &stamp, |
| 318 | + vec![], |
| 319 | + true, |
| 320 | + false, |
| 321 | + ); |
| 322 | + } |
| 323 | + |
| 324 | + fn metadata(&self) -> Option<StepMetadata> { |
| 325 | + Some( |
| 326 | + StepMetadata::clippy("rustc_codegen_gcc", self.target) |
| 327 | + .built_by(self.compilers.build_compiler()), |
| 328 | + ) |
| 329 | + } |
| 330 | +} |
| 331 | + |
256 | 332 | macro_rules! lint_any {
|
257 | 333 | ($(
|
258 | 334 | $name:ident, $path:expr, $readable_name:expr
|
@@ -337,7 +413,6 @@ lint_any!(
|
337 | 413 | CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri";
|
338 | 414 | Clippy, "src/tools/clippy", "clippy";
|
339 | 415 | CollectLicenseMetadata, "src/tools/collect-license-metadata", "collect-license-metadata";
|
340 |
| - CodegenGcc, "compiler/rustc_codegen_gcc", "rustc-codegen-gcc"; |
341 | 416 | Compiletest, "src/tools/compiletest", "compiletest";
|
342 | 417 | CoverageDump, "src/tools/coverage-dump", "coverage-dump";
|
343 | 418 | Jsondocck, "src/tools/jsondocck", "jsondocck";
|
@@ -440,9 +515,10 @@ impl Step for CI {
|
440 | 515 | deny: vec!["warnings".into()],
|
441 | 516 | forbid: vec![],
|
442 | 517 | };
|
443 |
| - builder.ensure(CodegenGcc { |
444 |
| - target: self.target, |
445 |
| - config: self.config.merge(&rustc_codegen_gcc), |
446 |
| - }); |
| 518 | + builder.ensure(CodegenGcc::new( |
| 519 | + builder, |
| 520 | + self.target, |
| 521 | + self.config.merge(&rustc_codegen_gcc), |
| 522 | + )); |
447 | 523 | }
|
448 | 524 | }
|
0 commit comments