Move is_ci to cargo-util.

This commit is contained in:
Eric Huss 2021-03-20 12:04:25 -07:00
parent 888100352a
commit dbfdd49559
8 changed files with 14 additions and 12 deletions

View File

@ -15,8 +15,8 @@ use std::process::{Command, Output};
use std::str;
use std::time::{self, Duration};
use cargo::util::{is_ci, CargoResult, Rustc};
use cargo_util::{ProcessBuilder, ProcessError};
use cargo::util::{CargoResult, Rustc};
use cargo_util::{is_ci, ProcessBuilder, ProcessError};
use serde_json::{self, Value};
use url::Url;

View File

@ -7,3 +7,8 @@ pub use process_error::{exit_status_to_string, is_simple_exit_code, ProcessError
mod process_builder;
mod process_error;
mod read2;
/// Whether or not this running in a Continuous Integration environment.
pub fn is_ci() -> bool {
std::env::var("CI").is_ok() || std::env::var("TF_BUILD").is_ok()
}

View File

@ -6,6 +6,7 @@ edition = "2018"
[dependencies]
cargo = { path = "../.." }
cargo-util = { path = "../cargo-util" }
proptest = "0.9.1"
lazy_static = "1.3.0"
varisat = "0.2.1"

View File

@ -1,6 +1,7 @@
use cargo::core::dependency::DepKind;
use cargo::core::Dependency;
use cargo::util::{is_ci, Config};
use cargo::util::Config;
use cargo_util::is_ci;
use resolver_tests::{
assert_contains, assert_same, dep, dep_kind, dep_loc, dep_req, dep_req_kind, loc_names, names,

View File

@ -70,11 +70,6 @@ pub fn elapsed(duration: Duration) -> String {
}
}
/// Whether or not this running in a Continuous Integration environment.
pub fn is_ci() -> bool {
std::env::var("CI").is_ok() || std::env::var("TF_BUILD").is_ok()
}
pub fn indented_lines(text: &str) -> String {
text.lines()
.map(|line| {

View File

@ -4,8 +4,8 @@ use std::time::{Duration, Instant};
use crate::core::shell::Verbosity;
use crate::util::config::ProgressWhen;
use crate::util::{is_ci, CargoResult, Config};
use crate::util::{CargoResult, Config};
use cargo_util::is_ci;
use unicode_width::UnicodeWidthChar;
pub struct Progress<'cfg> {

View File

@ -4,7 +4,7 @@ use std::fs;
#[test]
fn check_forbidden_code() {
// Do not use certain macros, functions, etc.
if !cargo::util::is_ci() {
if !cargo_util::is_ci() {
// Only check these on CI, otherwise it could be annoying.
use std::io::Write;
writeln!(

View File

@ -69,7 +69,7 @@ fn std_docs() {
// For local developers, skip this test if docs aren't installed.
let docs = std::path::Path::new(&paths::sysroot()).join("share/doc/rust/html");
if !docs.exists() {
if cargo::util::is_ci() {
if cargo_util::is_ci() {
panic!("std docs are not installed, check that the rust-docs component is installed");
} else {
eprintln!(