Skip to content

Commit 484d681

Browse files
committed
create misc dir and move related sources there
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent 55bbce9 commit 484d681

21 files changed

+61
-61
lines changed

src/bootstrap/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ use std::path::{Path, PathBuf};
1212
use std::process::Command;
1313
use std::time::{Duration, Instant};
1414

15-
use crate::cache::{Cache, Interned, INTERNER};
1615
use crate::config::{DryRun, SplitDebuginfo, TargetSelection};
1716
use crate::doc;
1817
use crate::flags::{Color, Subcommand};
1918
use crate::install;
2019
use crate::llvm;
20+
use crate::misc::cache::{Cache, Interned, INTERNER};
2121
use crate::run;
2222
use crate::setup;
2323
use crate::test;

src/bootstrap/src/check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! Implementation of compiling the compiler and standard library, in "check"-based modes.
22
33
use crate::builder::{crate_description, Alias, Builder, Kind, RunConfig, ShouldRun, Step};
4-
use crate::cache::Interned;
54
use crate::compile::{add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo};
65
use crate::config::TargetSelection;
6+
use crate::misc::cache::Interned;
77
use crate::tool::{prepare_tool_cargo, SourceType};
88
use crate::INTERNER;
99
use crate::{Compiler, Mode, Subcommand};

src/bootstrap/src/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::io::{self, ErrorKind};
1010
use std::path::Path;
1111

1212
use crate::builder::{crate_description, Builder, RunConfig, ShouldRun, Step};
13-
use crate::cache::Interned;
13+
use crate::misc::cache::Interned;
1414
use crate::util::t;
1515
use crate::{Build, Compiler, Mode, Subcommand};
1616

src/bootstrap/src/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ use serde_derive::Deserialize;
2222
use crate::builder::crate_description;
2323
use crate::builder::Cargo;
2424
use crate::builder::{Builder, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath};
25-
use crate::cache::{Interned, INTERNER};
2625
use crate::config::{DebuginfoLevel, LlvmLibunwind, RustcLto, TargetSelection};
2726
use crate::dist;
2827
use crate::llvm;
28+
use crate::misc::cache::{Interned, INTERNER};
2929
use crate::tool::SourceType;
3030
use crate::util::get_clang_cl_resource_dir;
3131
use crate::util::{exe, is_debug_info, is_dylib, output, symlink_dir, t, up_to_date};

src/bootstrap/src/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ use std::path::{Path, PathBuf};
1818
use std::process::Command;
1919
use std::str::FromStr;
2020

21-
use crate::cache::{Interned, INTERNER};
22-
use crate::cc_detect::{ndk_compiler, Language};
23-
use crate::channel::{self, GitInfo};
2421
use crate::compile::CODEGEN_BACKEND_PREFIX;
2522
pub use crate::flags::Subcommand;
2623
use crate::flags::{Color, Flags, Warnings};
24+
use crate::misc::cache::{Interned, INTERNER};
25+
use crate::misc::cc_detect::{ndk_compiler, Language};
26+
use crate::misc::channel::{self, GitInfo};
2727
use crate::util::{exe, output, t};
2828
use build_helper::exit;
2929
use once_cell::sync::OnceCell;

src/bootstrap/src/dist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ use object::read::archive::ArchiveFile;
2020
use object::BinaryFormat;
2121

2222
use crate::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
23-
use crate::cache::{Interned, INTERNER};
24-
use crate::channel;
2523
use crate::compile;
2624
use crate::config::TargetSelection;
2725
use crate::doc::DocumentationFormat;
2826
use crate::llvm;
27+
use crate::misc::cache::{Interned, INTERNER};
28+
use crate::misc::channel;
2929
use crate::tarball::{GeneratedTarball, OverlayKind, Tarball};
3030
use crate::tool::{self, Tool};
3131
use crate::util::{exe, is_dylib, output, t, timeit};

src/bootstrap/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use std::path::{Path, PathBuf};
1212

1313
use crate::builder::crate_description;
1414
use crate::builder::{Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
15-
use crate::cache::{Interned, INTERNER};
1615
use crate::compile;
1716
use crate::config::{Config, TargetSelection};
17+
use crate::misc::cache::{Interned, INTERNER};
1818
use crate::tool::{self, prepare_tool_cargo, SourceType, Tool};
1919
use crate::util::{dir_is_empty, symlink_dir, t, up_to_date};
2020
use crate::Mode;

src/bootstrap/src/lib.rs

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ use std::str;
2828

2929
use build_helper::ci::{gha, CiEnv};
3030
use build_helper::exit;
31-
use channel::GitInfo;
3231
use config::{DryRun, Target};
3332
use filetime::FileTime;
33+
use misc::channel::GitInfo;
3434
use once_cell::sync::OnceCell;
3535

3636
use crate::builder::Kind;
@@ -40,9 +40,6 @@ use crate::util::{
4040
};
4141

4242
mod builder;
43-
mod cache;
44-
mod cc_detect;
45-
mod channel;
4643
mod check;
4744
mod clean;
4845
mod compile;
@@ -55,6 +52,7 @@ mod format;
5552
mod install;
5653
mod llvm;
5754
mod metadata;
55+
pub(crate) mod misc;
5856
mod render_tests;
5957
mod run;
6058
mod sanity;
@@ -70,27 +68,10 @@ pub mod util;
7068
#[cfg(feature = "build-metrics")]
7169
mod metrics;
7270

73-
#[cfg(windows)]
74-
mod job;
75-
76-
#[cfg(all(unix, not(target_os = "haiku")))]
77-
mod job {
78-
pub unsafe fn setup(build: &mut crate::Build) {
79-
if build.config.low_priority {
80-
libc::setpriority(libc::PRIO_PGRP as _, 0, 10);
81-
}
82-
}
83-
}
84-
85-
#[cfg(any(target_os = "haiku", target_os = "hermit", not(any(unix, windows))))]
86-
mod job {
87-
pub unsafe fn setup(_build: &mut crate::Build) {}
88-
}
89-
9071
pub use crate::builder::PathSet;
91-
use crate::cache::{Interned, INTERNER};
9272
pub use crate::config::Config;
9373
pub use crate::flags::Subcommand;
74+
use crate::misc::cache::{Interned, INTERNER};
9475
use termcolor::{ColorChoice, StandardStream, WriteColor};
9576

9677
const LLVM_TOOLS: &[&str] = &[
@@ -211,12 +192,12 @@ pub struct Build {
211192
src: PathBuf,
212193
out: PathBuf,
213194
bootstrap_out: PathBuf,
214-
cargo_info: channel::GitInfo,
215-
rust_analyzer_info: channel::GitInfo,
216-
clippy_info: channel::GitInfo,
217-
miri_info: channel::GitInfo,
218-
rustfmt_info: channel::GitInfo,
219-
in_tree_llvm_info: channel::GitInfo,
195+
cargo_info: GitInfo,
196+
rust_analyzer_info: GitInfo,
197+
clippy_info: GitInfo,
198+
miri_info: GitInfo,
199+
rustfmt_info: GitInfo,
200+
in_tree_llvm_info: GitInfo,
220201
local_rebuild: bool,
221202
fail_fast: bool,
222203
doc_tests: DocTests,
@@ -369,16 +350,15 @@ impl Build {
369350
let is_sudo = false;
370351

371352
let omit_git_hash = config.omit_git_hash;
372-
let rust_info = channel::GitInfo::new(omit_git_hash, &src);
373-
let cargo_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/cargo"));
374-
let rust_analyzer_info =
375-
channel::GitInfo::new(omit_git_hash, &src.join("src/tools/rust-analyzer"));
376-
let clippy_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/clippy"));
377-
let miri_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/miri"));
378-
let rustfmt_info = channel::GitInfo::new(omit_git_hash, &src.join("src/tools/rustfmt"));
353+
let rust_info = GitInfo::new(omit_git_hash, &src);
354+
let cargo_info = GitInfo::new(omit_git_hash, &src.join("src/tools/cargo"));
355+
let rust_analyzer_info = GitInfo::new(omit_git_hash, &src.join("src/tools/rust-analyzer"));
356+
let clippy_info = GitInfo::new(omit_git_hash, &src.join("src/tools/clippy"));
357+
let miri_info = GitInfo::new(omit_git_hash, &src.join("src/tools/miri"));
358+
let rustfmt_info = GitInfo::new(omit_git_hash, &src.join("src/tools/rustfmt"));
379359

380360
// we always try to use git for LLVM builds
381-
let in_tree_llvm_info = channel::GitInfo::new(false, &src.join("src/llvm-project"));
361+
let in_tree_llvm_info = GitInfo::new(false, &src.join("src/llvm-project"));
382362

383363
let initial_target_libdir_str = if config.dry_run() {
384364
"/dummy/lib/path/to/lib/".to_string()
@@ -490,7 +470,7 @@ impl Build {
490470
}
491471

492472
build.verbose("finding compilers");
493-
cc_detect::find(&build);
473+
crate::misc::cc_detect::find(&build);
494474
// When running `setup`, the profile is about to change, so any requirements we have now may
495475
// be different on the next invocation. Don't check for them until the next time x.py is
496476
// run. This is ok because `setup` never runs any build commands, so it won't fail if commands are missing.
@@ -546,7 +526,7 @@ impl Build {
546526

547527
// NOTE: The check for the empty directory is here because when running x.py the first time,
548528
// the submodule won't be checked out. Check it out now so we can build it.
549-
if !channel::GitInfo::new(false, &absolute_path).is_managed_git_subrepository()
529+
if !GitInfo::new(false, &absolute_path).is_managed_git_subrepository()
550530
&& !dir_is_empty(&absolute_path)
551531
{
552532
return;
@@ -660,7 +640,7 @@ impl Build {
660640
// Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
661641
let submodule = Path::new(line.splitn(2, ' ').nth(1).unwrap());
662642
// Don't update the submodule unless it's already been cloned.
663-
if channel::GitInfo::new(false, submodule).is_managed_git_subrepository() {
643+
if GitInfo::new(false, submodule).is_managed_git_subrepository() {
664644
self.update_submodule(submodule);
665645
}
666646
}
@@ -669,7 +649,7 @@ impl Build {
669649
/// Executes the entire build, as configured by the flags and configuration.
670650
pub fn build(&mut self) {
671651
unsafe {
672-
job::setup(self);
652+
crate::misc::job::setup(self);
673653
}
674654

675655
// Download rustfmt early so that it can be used in rust-analyzer configs.

src/bootstrap/src/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use std::path::{Path, PathBuf};
1717
use std::process::Command;
1818

1919
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
20-
use crate::channel;
2120
use crate::config::{Config, TargetSelection};
21+
use crate::misc::channel;
2222
use crate::util::get_clang_cl_resource_dir;
2323
use crate::util::{self, exe, output, t, up_to_date};
2424
use crate::{CLang, GitRepo, Kind};

src/bootstrap/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::process::Command;
33

44
use serde_derive::Deserialize;
55

6-
use crate::cache::INTERNER;
6+
use crate::misc::cache::INTERNER;
77
use crate::util::output;
88
use crate::{t, Build, Crate};
99

0 commit comments

Comments
 (0)