Skip to content

Commit

Permalink
Auto merge of #106320 - jyn514:revert-merge-check, r=jyn514
Browse files Browse the repository at this point in the history
Revert "Auto merge of #105058 - Nilstrieb:no-merge-commits, r=jyn514"

This reverts commit 4839886, reversing changes made to ce85c98.

Fixes #106232 (comment).

r? `@jyn514`
  • Loading branch information
bors committed Dec 31, 2022
2 parents 4839886 + 90a10ca commit 5570cda
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 195 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "checkout the `master` branch for tidy"
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1
- name: configure the PR in which the error message will be posted
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
Expand Down Expand Up @@ -490,11 +485,6 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "checkout the `master` branch for tidy"
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1
- name: configure the PR in which the error message will be posted
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
Expand Down Expand Up @@ -610,11 +600,6 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "checkout the `master` branch for tidy"
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1
- name: configure the PR in which the error message will be posted
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
Expand Down
5 changes: 0 additions & 5 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,6 @@ dependencies = [
"toml",
]

[[package]]
name = "build_helper"
version = "0.1.0"

[[package]]
name = "bump-stage0"
version = "0.1.0"
Expand Down Expand Up @@ -5308,7 +5304,6 @@ dependencies = [
name = "tidy"
version = "0.1.0"
dependencies = [
"build_helper",
"cargo_metadata 0.14.0",
"ignore",
"lazy_static",
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ members = [
"library/std",
"library/test",
"src/rustdoc-json-types",
"src/tools/build_helper",
"src/tools/cargotest",
"src/tools/clippy",
"src/tools/clippy/clippy_dev",
Expand Down
5 changes: 0 additions & 5 deletions src/bootstrap/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ dependencies = [
name = "bootstrap"
version = "0.0.0"
dependencies = [
"build_helper",
"cc",
"cmake",
"fd-lock",
Expand Down Expand Up @@ -71,10 +70,6 @@ dependencies = [
"regex-automata",
]

[[package]]
name = "build_helper"
version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.73"
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ path = "bin/sccache-plus-cl.rs"
test = false

[dependencies]
build_helper = { path = "../tools/build_helper" }
cmake = "0.1.38"
fd-lock = "3.0.8"
filetime = "0.2"
Expand Down
30 changes: 29 additions & 1 deletion src/bootstrap/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use crate::builder::Builder;
use crate::util::{output, program_out_of_date, t};
use build_helper::git::get_rust_lang_rust_remote;
use ignore::WalkBuilder;
use std::collections::VecDeque;
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -101,6 +100,35 @@ fn get_modified_rs_files(build: &Builder<'_>) -> Option<Vec<String>> {
)
}

/// Finds the remote for rust-lang/rust.
/// For example for these remotes it will return `upstream`.
/// ```text
/// origin https://github.com/Nilstrieb/rust.git (fetch)
/// origin https://github.com/Nilstrieb/rust.git (push)
/// upstream https://github.com/rust-lang/rust (fetch)
/// upstream https://github.com/rust-lang/rust (push)
/// ```
fn get_rust_lang_rust_remote() -> Result<String, String> {
let mut git = Command::new("git");
git.args(["config", "--local", "--get-regex", "remote\\..*\\.url"]);

let output = git.output().map_err(|err| format!("{err:?}"))?;
if !output.status.success() {
return Err("failed to execute git config command".to_owned());
}

let stdout = String::from_utf8(output.stdout).map_err(|err| format!("{err:?}"))?;

let rust_lang_remote = stdout
.lines()
.find(|remote| remote.contains("rust-lang"))
.ok_or_else(|| "rust-lang/rust remote not found".to_owned())?;

let remote_name =
rust_lang_remote.split('.').nth(1).ok_or_else(|| "remote name not found".to_owned())?;
Ok(remote_name.into())
}

#[derive(serde::Deserialize)]
struct RustfmtConfig {
ignore: Vec<String>,
Expand Down
3 changes: 1 addition & 2 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::str;

use build_helper::ci::CiEnv;
use channel::GitInfo;
use config::{DryRun, Target};
use filetime::FileTime;
Expand All @@ -122,7 +121,7 @@ use once_cell::sync::OnceCell;
use crate::builder::Kind;
use crate::config::{LlvmLibunwind, TargetSelection};
use crate::util::{
exe, libdir, mtime, output, run, run_suppressed, symlink_dir, try_run_suppressed,
exe, libdir, mtime, output, run, run_suppressed, symlink_dir, try_run_suppressed, CiEnv,
};

mod bolt;
Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ use crate::util::get_clang_cl_resource_dir;
use crate::util::{self, exe, output, t, up_to_date};
use crate::{CLang, GitRepo};

use build_helper::ci::CiEnv;

#[derive(Clone)]
pub struct LlvmResult {
/// Path to llvm-config binary.
Expand Down Expand Up @@ -219,7 +217,7 @@ pub(crate) fn is_ci_llvm_available(config: &Config, asserts: bool) -> bool {
return false;
}

if CiEnv::is_ci() {
if crate::util::CiEnv::is_ci() {
// We assume we have access to git, so it's okay to unconditionally pass
// `true` here.
let llvm_sha = detect_llvm_sha(config, true);
Expand Down
29 changes: 29 additions & 0 deletions src/bootstrap/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,35 @@ pub enum CiEnv {
GitHubActions,
}

impl CiEnv {
/// Obtains the current CI environment.
pub fn current() -> CiEnv {
if env::var("TF_BUILD").map_or(false, |e| e == "True") {
CiEnv::AzurePipelines
} else if env::var("GITHUB_ACTIONS").map_or(false, |e| e == "true") {
CiEnv::GitHubActions
} else {
CiEnv::None
}
}

pub fn is_ci() -> bool {
Self::current() != CiEnv::None
}

/// If in a CI environment, forces the command to run with colors.
pub fn force_coloring_in_ci(self, cmd: &mut Command) {
if self != CiEnv::None {
// Due to use of stamp/docker, the output stream of rustbuild is not
// a TTY in CI, so coloring is by-default turned off.
// The explicit `TERM=xterm` environment is needed for
// `--color always` to actually work. This env var was lost when
// compiling through the Makefile. Very strange.
cmd.env("TERM", "xterm").args(&["--color", "always"]);
}
}
}

pub fn forcing_clang_based_tests() -> bool {
if let Some(var) = env::var_os("RUSTBUILD_FORCE_CLANG_BASED_TESTS") {
match &var.to_string_lossy().to_lowercase()[..] {
Expand Down
6 changes: 0 additions & 6 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ x--expand-yaml-anchors--remove:
with:
fetch-depth: 2

- name: checkout the `master` branch for tidy
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1

# Rust Log Analyzer can't currently detect the PR number of a GitHub
# Actions build on its own, so a hint in the log message is needed to
# point it in the right direction.
Expand Down
8 changes: 0 additions & 8 deletions src/tools/build_helper/Cargo.toml

This file was deleted.

40 changes: 0 additions & 40 deletions src/tools/build_helper/src/ci.rs

This file was deleted.

30 changes: 0 additions & 30 deletions src/tools/build_helper/src/git.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/tools/build_helper/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/tools/tidy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ edition = "2021"
autobins = false

[dependencies]
build_helper = { path = "../build_helper" }
cargo_metadata = "0.14"
regex = "1"
miropt-test-tools = { path = "../miropt-test-tools" }
Expand Down
1 change: 0 additions & 1 deletion src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ pub mod errors;
pub mod extdeps;
pub mod features;
pub mod mir_opt_tests;
pub mod no_merge;
pub mod pal;
pub mod primitive_docs;
pub mod style;
Expand Down
2 changes: 0 additions & 2 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ fn main() {
check!(alphabetical, &compiler_path);
check!(alphabetical, &library_path);

check!(no_merge, ());

let collected = {
drain_handles(&mut handles);

Expand Down
72 changes: 0 additions & 72 deletions src/tools/tidy/src/no_merge.rs

This file was deleted.

0 comments on commit 5570cda

Please sign in to comment.