diff --git a/Cargo.lock b/Cargo.lock index 5057bca291c..d0fcd6812f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,12 +1,3 @@ -[root] -name = "rustup-win-installer" -version = "1.7.0" -dependencies = [ - "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", - "rustup 1.7.0", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "adler32" version = "1.0.2" @@ -899,6 +890,15 @@ dependencies = [ "winreg 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustup-win-installer" +version = "1.7.0" +dependencies = [ + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "rustup 1.7.0", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "safemem" version = "0.2.0" diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index 272e2e74801..341e61cd80d 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -184,7 +184,7 @@ Studio 2013 and during install select the "C++ tools": _Install the C++ build tools before proceeding_. -If you will be targetting the GNU ABI or otherwise know what you are +If you will be targeting the GNU ABI or otherwise know what you are doing then it is fine to continue installation without the build tools, but otherwise, install the C++ build tools before proceeding. "#; @@ -192,6 +192,8 @@ tools, but otherwise, install the C++ build tools before proceeding. static TOOLS: &'static [&'static str] = &["rustc", "rustdoc", "cargo", "rust-lldb", "rust-gdb", "rls"]; +static DUP_TOOLS: &'static [&'static str] = &["rustfmt", "cargo-fmt"]; + static UPDATE_ROOT: &'static str = "https://static.rust-lang.org/rustup"; @@ -652,6 +654,18 @@ fn install_bins() -> Result<()> { let ref tool_path = bin_path.join(&format!("{}{}", tool, EXE_SUFFIX)); try!(utils::hard_or_symlink_file(rustup_path, tool_path)); } + for tool in DUP_TOOLS { + let ref token_path = bin_path.join(&format!("{}.rustup", tool)); + let ref tool_path = bin_path.join(&format!("{}{}", tool, EXE_SUFFIX)); + if tool_path.exists() && !token_path.exists() { + warn!("tool `{}` is already installed, remove it from `{}`, then run `rustup update` \ + to have rustup manage this tool.", + tool, bin_path.to_string_lossy()); + } else { + try!(utils::hard_or_symlink_file(rustup_path, tool_path)); + try!(utils::write_file("", token_path, "")); + } + } Ok(()) } @@ -752,7 +766,7 @@ pub fn uninstall(no_prompt: bool) -> Result<()> { // Then everything in bin except rustup and tools. These can't be unlinked // until this process exits (on windows). - let tools = TOOLS.iter().map(|t| format!("{}{}", t, EXE_SUFFIX)); + let tools = TOOLS.iter().chain(DUP_TOOLS.iter()).map(|t| format!("{}{}", t, EXE_SUFFIX)); let tools: Vec<_> = tools.chain(vec![format!("rustup{}", EXE_SUFFIX)]).collect(); for dirent in try!(fs::read_dir(&cargo_home.join("bin")).chain_err(|| read_dir_err)) { let dirent = try!(dirent.chain_err(|| read_dir_err)); diff --git a/src/rustup-win-installer/src/lib.rs b/src/rustup-win-installer/src/lib.rs index 90d2e3bb077..beee59f3f72 100644 --- a/src/rustup-win-installer/src/lib.rs +++ b/src/rustup-win-installer/src/lib.rs @@ -16,7 +16,7 @@ pub const LOGMSG_STANDARD: i32 = 2; // TODO: share this with self_update.rs static TOOLS: &'static [&'static str] - = &["rustc", "rustdoc", "cargo", "rust-lldb", "rust-gdb", "rls"]; + = &["rustc", "rustdoc", "cargo", "rust-lldb", "rust-gdb", "rls", "rustfmt", "cargo-fmt"]; #[no_mangle] /// This is be run as a `deferred` action after `InstallFiles` on install and upgrade