diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-02-12 14:16:48 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2023-05-22 17:17:05 +0000 |
| commit | b1d8b7186ccee2ef57886dc3bf17225d11a3935f (patch) | |
| tree | 4813b568202c6e8911662ffd9b7da2b004dc96ae | |
| parent | 2155c0350081ae159e37aa25cfd829da950bb282 (diff) | |
| download | rust-b1d8b7186ccee2ef57886dc3bf17225d11a3935f.tar.gz rust-b1d8b7186ccee2ef57886dc3bf17225d11a3935f.zip | |
Only pass --frozen to cargo when it is passed to y.rs
| -rw-r--r-- | build_system/abi_cafe.rs | 1 | ||||
| -rw-r--r-- | build_system/mod.rs | 3 | ||||
| -rw-r--r-- | build_system/path.rs | 1 | ||||
| -rw-r--r-- | build_system/prepare.rs | 8 | ||||
| -rw-r--r-- | build_system/usage.txt | 11 | ||||
| -rw-r--r-- | build_system/utils.rs | 24 |
6 files changed, 16 insertions, 32 deletions
diff --git a/build_system/abi_cafe.rs b/build_system/abi_cafe.rs index 0da27f529b3..5b49a2e01d0 100644 --- a/build_system/abi_cafe.rs +++ b/build_system/abi_cafe.rs @@ -19,7 +19,6 @@ pub(crate) fn run( bootstrap_host_compiler: &Compiler, ) { ABI_CAFE_REPO.fetch(dirs); - spawn_and_wait(ABI_CAFE.fetch("cargo", &bootstrap_host_compiler.rustc, dirs)); eprintln!("Building sysroot for abi-cafe"); build_sysroot::build_sysroot( diff --git a/build_system/mod.rs b/build_system/mod.rs index 80a777fc00e..2f8550dbf0e 100644 --- a/build_system/mod.rs +++ b/build_system/mod.rs @@ -78,6 +78,7 @@ pub(crate) fn main() { let mut channel = "release"; let mut sysroot_kind = SysrootKind::Clif; let mut use_unstable_features = true; + let mut frozen = false; while let Some(arg) = args.next().as_deref() { match arg { "--out-dir" => { @@ -96,6 +97,7 @@ pub(crate) fn main() { } } "--no-unstable-features" => use_unstable_features = false, + "--frozen" => frozen = true, flag if flag.starts_with("-") => arg_error!("Unknown flag {}", flag), arg => arg_error!("Unexpected argument {}", arg), } @@ -132,6 +134,7 @@ pub(crate) fn main() { download_dir: out_dir.join("download"), build_dir: out_dir.join("build"), dist_dir: out_dir.join("dist"), + frozen, }; path::RelPath::BUILD.ensure_exists(&dirs); diff --git a/build_system/path.rs b/build_system/path.rs index 3290723005d..4f86c0fd29d 100644 --- a/build_system/path.rs +++ b/build_system/path.rs @@ -9,6 +9,7 @@ pub(crate) struct Dirs { pub(crate) download_dir: PathBuf, pub(crate) build_dir: PathBuf, pub(crate) dist_dir: PathBuf, + pub(crate) frozen: bool, } #[doc(hidden)] diff --git a/build_system/prepare.rs b/build_system/prepare.rs index 6769e42d44b..2754b167850 100644 --- a/build_system/prepare.rs +++ b/build_system/prepare.rs @@ -12,20 +12,12 @@ use super::utils::{copy_dir_recursively, git_command, retry_spawn_and_wait, spaw pub(crate) fn prepare(dirs: &Dirs) { RelPath::DOWNLOAD.ensure_fresh(dirs); - spawn_and_wait(super::build_backend::CG_CLIF.fetch("cargo", "rustc", dirs)); - prepare_stdlib(dirs); - spawn_and_wait(super::build_sysroot::STANDARD_LIBRARY.fetch("cargo", "rustc", dirs)); - prepare_coretests(dirs); - spawn_and_wait(super::tests::LIBCORE_TESTS.fetch("cargo", "rustc", dirs)); super::tests::RAND_REPO.fetch(dirs); - spawn_and_wait(super::tests::RAND.fetch("cargo", "rustc", dirs)); super::tests::REGEX_REPO.fetch(dirs); - spawn_and_wait(super::tests::REGEX.fetch("cargo", "rustc", dirs)); super::tests::PORTABLE_SIMD_REPO.fetch(dirs); - spawn_and_wait(super::tests::PORTABLE_SIMD.fetch("cargo", "rustc", dirs)); } fn prepare_stdlib(dirs: &Dirs) { diff --git a/build_system/usage.txt b/build_system/usage.txt index ab98ccc35a5..e7b4f0af2d9 100644 --- a/build_system/usage.txt +++ b/build_system/usage.txt @@ -2,10 +2,10 @@ The build system of cg_clif. USAGE: ./y.rs prepare [--out-dir DIR] - ./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] - ./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] - ./y.rs abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] - ./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] + ./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] + ./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] + ./y.rs abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] + ./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen] OPTIONS: --debug @@ -26,6 +26,9 @@ OPTIONS: Some features are not yet ready for production usage. This option will disable these features. This includes the JIT mode and inline assembly support. + --frozen + Require Cargo.lock and cache are up to date + REQUIREMENTS: * Rustup: The build system has a hard coded dependency on rustup to install the right nightly version and make sure it is used where necessary. diff --git a/build_system/utils.rs b/build_system/utils.rs index 6c0ecd8b02a..3e12ed22ef6 100644 --- a/build_system/utils.rs +++ b/build_system/utils.rs @@ -81,8 +81,11 @@ impl CargoProject { .arg("--manifest-path") .arg(self.manifest_path(dirs)) .arg("--target-dir") - .arg(self.target_dir(dirs)) - .arg("--frozen"); + .arg(self.target_dir(dirs)); + + if dirs.frozen { + cmd.arg("--frozen"); + } cmd } @@ -107,23 +110,6 @@ impl CargoProject { cmd } - #[must_use] - pub(crate) fn fetch( - &self, - cargo: impl AsRef<Path>, - rustc: impl AsRef<Path>, - dirs: &Dirs, - ) -> Command { - let mut cmd = Command::new(cargo.as_ref()); - - cmd.env("RUSTC", rustc.as_ref()) - .arg("fetch") - .arg("--manifest-path") - .arg(self.manifest_path(dirs)); - - cmd - } - pub(crate) fn clean(&self, dirs: &Dirs) { let _ = fs::remove_dir_all(self.target_dir(dirs)); } |
