Do not download GCC in tests
This commit is contained in:
parent
dcc2b307dc
commit
75a69a48f3
1 changed files with 14 additions and 6 deletions
|
@ -13,11 +13,9 @@ use std::path::{Path, PathBuf};
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
use build_helper::ci::CiEnv;
|
use build_helper::ci::CiEnv;
|
||||||
use build_helper::git::get_closest_merge_commit;
|
|
||||||
|
|
||||||
use crate::Config;
|
|
||||||
use crate::core::builder::{Builder, Cargo, Kind, RunConfig, ShouldRun, Step};
|
use crate::core::builder::{Builder, Cargo, Kind, RunConfig, ShouldRun, Step};
|
||||||
use crate::core::config::{GccCiMode, TargetSelection};
|
use crate::core::config::TargetSelection;
|
||||||
use crate::utils::build_stamp::{BuildStamp, generate_smart_stamp_hash};
|
use crate::utils::build_stamp::{BuildStamp, generate_smart_stamp_hash};
|
||||||
use crate::utils::exec::command;
|
use crate::utils::exec::command;
|
||||||
use crate::utils::helpers::{self, t};
|
use crate::utils::helpers::{self, t};
|
||||||
|
@ -93,9 +91,10 @@ pub enum GccBuildStatus {
|
||||||
/// Tries to download GCC from CI if it is enabled and GCC artifacts
|
/// Tries to download GCC from CI if it is enabled and GCC artifacts
|
||||||
/// are available for the given target.
|
/// are available for the given target.
|
||||||
/// Returns a path to the libgccjit.so file.
|
/// Returns a path to the libgccjit.so file.
|
||||||
|
#[cfg(not(test))]
|
||||||
fn try_download_gcc(builder: &Builder<'_>, target: TargetSelection) -> Option<PathBuf> {
|
fn try_download_gcc(builder: &Builder<'_>, target: TargetSelection) -> Option<PathBuf> {
|
||||||
// Try to download GCC from CI if configured and available
|
// Try to download GCC from CI if configured and available
|
||||||
if !matches!(builder.config.gcc_ci_mode, GccCiMode::DownloadFromCi) {
|
if !matches!(builder.config.gcc_ci_mode, crate::core::config::GccCiMode::DownloadFromCi) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if target != "x86_64-unknown-linux-gnu" {
|
if target != "x86_64-unknown-linux-gnu" {
|
||||||
|
@ -114,6 +113,11 @@ fn try_download_gcc(builder: &Builder<'_>, target: TargetSelection) -> Option<Pa
|
||||||
Some(root.join("libgccjit.so"))
|
Some(root.join("libgccjit.so"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
fn try_download_gcc(_builder: &Builder<'_>, _target: TargetSelection) -> Option<PathBuf> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
/// This returns information about whether GCC should be built or if it's already built.
|
/// This returns information about whether GCC should be built or if it's already built.
|
||||||
/// It transparently handles downloading GCC from CI if needed.
|
/// It transparently handles downloading GCC from CI if needed.
|
||||||
///
|
///
|
||||||
|
@ -247,12 +251,16 @@ pub fn add_cg_gcc_cargo_flags(cargo: &mut Cargo, gcc: &GccOutput) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The absolute path to the downloaded GCC artifacts.
|
/// The absolute path to the downloaded GCC artifacts.
|
||||||
fn ci_gcc_root(config: &Config) -> PathBuf {
|
#[cfg(not(test))]
|
||||||
|
fn ci_gcc_root(config: &crate::Config) -> PathBuf {
|
||||||
config.out.join(config.build).join("ci-gcc")
|
config.out.join(config.build).join("ci-gcc")
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This retrieves the GCC sha we *want* to use, according to git history.
|
/// This retrieves the GCC sha we *want* to use, according to git history.
|
||||||
fn detect_gcc_sha(config: &Config, is_git: bool) -> String {
|
#[cfg(not(test))]
|
||||||
|
fn detect_gcc_sha(config: &crate::Config, is_git: bool) -> String {
|
||||||
|
use build_helper::git::get_closest_merge_commit;
|
||||||
|
|
||||||
let gcc_sha = if is_git {
|
let gcc_sha = if is_git {
|
||||||
get_closest_merge_commit(
|
get_closest_merge_commit(
|
||||||
Some(&config.src),
|
Some(&config.src),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue