From f53d43663814f63f1979c27085abb27aa9a183df Mon Sep 17 00:00:00 2001 From: Cassandra Fridkin Date: Mon, 5 Oct 2020 18:59:47 -0400 Subject: [PATCH] Remove the rust stuff and just make it a simple shell script It's ok, now I'm writing enough Rust that i'm able to get my fix elsewhere --- Cargo.lock | 4 ---- Cargo.toml | 1 - src/bootstrap/builder.rs | 2 +- src/bootstrap/run.rs | 23 ----------------------- src/bootstrap/tool.rs | 1 - src/tools/install-git-hook/Cargo.toml | 5 ----- src/tools/install-git-hook/src/main.rs | 16 ---------------- 7 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 src/tools/install-git-hook/Cargo.toml delete mode 100644 src/tools/install-git-hook/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 6bff377a660..d216b09c66a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1458,10 +1458,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "install-git-hook" -version = "0.1.0" - [[package]] name = "installer" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index 35e26695bdc..02794d1028b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,6 @@ members = [ "src/tools/clippy", "src/tools/compiletest", "src/tools/error_index_generator", - "src/tools/install-git-hook", "src/tools/linkchecker", "src/tools/lint-docs", "src/tools/rustbook", diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 1359b162853..4bc162abee6 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -477,7 +477,7 @@ impl<'a> Builder<'a> { install::Src, install::Rustc ), - Kind::Run => describe!(run::ExpandYamlAnchors, run::BuildManifest, run::InstallGitHook), + Kind::Run => describe!(run::ExpandYamlAnchors, run::BuildManifest), } } diff --git a/src/bootstrap/run.rs b/src/bootstrap/run.rs index da34d8b9d70..80c093e713e 100644 --- a/src/bootstrap/run.rs +++ b/src/bootstrap/run.rs @@ -44,29 +44,6 @@ fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool { true } -#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -pub struct InstallGitHook; - -impl Step for InstallGitHook { - type Output = (); - - /// Runs the `install-git-hook` tool. - /// - /// This tool in `src/tools` installs a git hook to automatically run - /// `tidy --bless` before each commit, so you don't forget to do it - fn run(self, builder: &Builder<'_>) { - builder.info("Installing git hook"); - try_run(builder, &mut builder.tool_cmd(Tool::InstallGitHook).arg(&builder.src)); - } - - fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("src/tools/install-git-hook") - } - - fn make_run(run: RunConfig<'_>) { - run.builder.ensure(InstallGitHook); - } -} #[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] pub struct BuildManifest; diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 790e324a55f..290e3744852 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -366,7 +366,6 @@ bootstrap_tool!( RustInstaller, "src/tools/rust-installer", "fabricate", is_external_tool = true; RustdocTheme, "src/tools/rustdoc-themes", "rustdoc-themes"; ExpandYamlAnchors, "src/tools/expand-yaml-anchors", "expand-yaml-anchors"; - InstallGitHook, "src/tools/install-git-hook", "install-git-hook"; LintDocs, "src/tools/lint-docs", "lint-docs"; ); diff --git a/src/tools/install-git-hook/Cargo.toml b/src/tools/install-git-hook/Cargo.toml deleted file mode 100644 index 1b089a84da8..00000000000 --- a/src/tools/install-git-hook/Cargo.toml +++ /dev/null @@ -1,5 +0,0 @@ -[package] -name = "install-git-hook" -version = "0.1.0" -authors = ["Cass Fridkin "] -edition = "2018" \ No newline at end of file diff --git a/src/tools/install-git-hook/src/main.rs b/src/tools/install-git-hook/src/main.rs deleted file mode 100644 index 64b5233dfb3..00000000000 --- a/src/tools/install-git-hook/src/main.rs +++ /dev/null @@ -1,16 +0,0 @@ -//! Small helper program to install a git hook to automatically run -//! `x.py test tidy --bless` before each commit. - -use std::env; -use std::fs; -use std::path::PathBuf; - -fn main() { - let root_path: PathBuf = env::args_os().nth(1).expect("need path to root of repo").into(); - let script_path: PathBuf = root_path.join("src/tools/install-git-hook/src/pre-commit.sh"); - let hook_path: PathBuf = root_path.join(".git/hooks/pre-commit"); - - fs::copy(&script_path, &hook_path).expect( - format!("Failed to copy pre-commit script to {}", &hook_path.to_string_lossy()).as_str(), - ); -}