Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge rustup's crates #1704

Merged
merged 6 commits into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 5 additions & 61 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 12 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,48 +30,52 @@ vendored-openssl = ['openssl/vendored']
no-self-update = []

[dependencies]
rustup-dist = { path = "src/rustup-dist" }
rustup-utils = { path = "src/rustup-utils" }
download = { path = "src/download" }
dirs = "1.0"
download = { path = "download" }
clap = "2.18.0"
error-chain = "0.12.0"
flate2 = "1.0.1"
itertools = "0.7.6"
libc = "0.2.0"
markdown = "0.2"
ole32-sys = "0.2.0"
rand = "0.5.2"
regex = "1.0.1"
remove_dir_all = "0.5.1"
same-file = "1.0"
semver = "0.9.0"
scopeguard = "0.3"
sha2 = "0.7.0"
tar = "0.4.0"
tempdir = "0.3.4"
term = "0.5.1"
time = "0.1.34"
toml = "0.4"
url = "1.1.0"
wait-timeout = "0.1.5"
walkdir = "2.0"
xz2 = "0.1.3"
openssl = { version = '0.10.15', optional = true }

[target."cfg(windows)".dependencies]
winapi = { version = "0.3", features = ["jobapi", "jobapi2", "processthreadsapi", "psapi", "synchapi", "winuser"] }
winapi = { version = "0.3", features = ["combaseapi", "errhandlingapi", "fileapi", "handleapi", "ioapiset", "jobapi", "jobapi2", "minwindef", "processthreadsapi", "psapi", "shlobj", "shtypes", "synchapi", "sysinfoapi", "tlhelp32", "userenv", "winbase", "winerror", "winioctl", "winnt", "winuser"] }
winreg = "0.5.0"
gcc = "0.3.50"

[dev-dependencies]
rustup-mock = { path = "src/rustup-mock", version = "1.1.0" }
lazy_static = "1.0.0"

[workspace]
members = ["src/download"]
members = ["download"]

[lib]
name = "rustup"
path = "src/rustup/lib.rs"
path = "src/lib.rs"
test = false # no unit tests

[[bin]]
name = "rustup-init"
path = "src/rustup-cli/main.rs"
path = "src/cli/main.rs"
test = false # no unit tests

[profile.release]
Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ build: false

test_script:
- cargo build --release --target %TARGET% --locked
- cargo test --release -p rustup-dist --target %TARGET%
- cargo test --release --target %TARGET%
- cargo fmt --all -- --check

Expand Down
5 changes: 4 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ where
}

fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
let target = env::var("TARGET").unwrap();
println!("cargo:rustc-env=TARGET={}", target);

let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out_dir.join("commit-info.txt"))
.unwrap()
.write_all(commit_info().as_bytes())
.unwrap();

println!("cargo:rerun-if-changed=build.rs");
}

Expand Down
1 change: 0 additions & 1 deletion ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ cargo build --locked -v --release --target "$TARGET" --features vendored-openssl

if [ -z "$SKIP_TESTS" ]; then
cargo test --release -p download --target "$TARGET" --features vendored-openssl
cargo test --release -p rustup-dist --target "$TARGET" --features vendored-openssl
cargo test --release --target "$TARGET" --features vendored-openssl
fi

Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/download/src/lib.rs → download/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use std::path::Path;
use url::Url;

#[allow(deprecated)] // WORKAROUND https://github.com/rust-lang-nursery/error-chain/issues/254
mod errors;
pub use crate::errors::*;

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/rustup-cli/common.rs → src/cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
use crate::errors::*;
use crate::self_update;
use crate::term2;
use rustup::utils::notify::NotificationLevel;
use rustup::utils::utils;
use rustup::{Cfg, Notification, Toolchain, UpdateStatus};
use rustup_utils::notify::NotificationLevel;
use rustup_utils::utils;
use std::io::{BufRead, BufReader, Write};
use std::path::Path;
use std::process::{Command, Stdio};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustup::dist::Notification as In;
use rustup::utils::tty;
use rustup::utils::Notification as Un;
use rustup::Notification;
use rustup_dist::Notification as In;
use rustup_utils::tty;
use rustup_utils::Notification as Un;
use std::collections::VecDeque;
use std::fmt;
use time::precise_time_s;
Expand Down
6 changes: 3 additions & 3 deletions src/rustup-cli/errors.rs → src/cli/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use std::path::PathBuf;
use error_chain::error_chain;
use error_chain::error_chain_processing;
use error_chain::{impl_error_chain_kind, impl_error_chain_processed, impl_extract_backtrace};
use rustup_dist::temp;
use rustup::dist::temp;

error_chain! {
links {
Rustup(rustup::Error, rustup::ErrorKind);
Dist(rustup_dist::Error, rustup_dist::ErrorKind);
Utils(rustup_utils::Error, rustup_utils::ErrorKind);
Dist(rustup::dist::Error, rustup::dist::ErrorKind);
Utils(rustup::utils::Error, rustup::utils::ErrorKind);
}

foreign_links {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions src/rustup-cli/main.rs → src/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
mod log;
mod common;
mod download_tracker;
#[allow(deprecated)] // WORKAROUND https://github.com/rust-lang-nursery/error-chain/issues/254
mod errors;
mod help;
mod job;
Expand All @@ -28,8 +29,8 @@ mod setup_mode;
mod term2;

use crate::errors::*;
use rustup::dist::dist::TargetTriple;
use rustup::env_var::RUST_RECURSION_COUNT_MAX;
use rustup_dist::dist::TargetTriple;
use std::alloc::System;
use std::env;
use std::path::PathBuf;
Expand Down Expand Up @@ -171,7 +172,7 @@ fn fix_windows_reg_key() {}

// rustup used to be called 'multirust'. This deletes the old bin.
fn delete_multirust_bin() {
use rustup_utils::utils;
use rustup::utils::utils;
use std::env::consts::EXE_SUFFIX;
use std::fs;

Expand Down
2 changes: 1 addition & 1 deletion src/rustup-cli/proxy_mode.rs → src/cli/proxy_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use crate::common::set_globals;
use crate::errors::*;
use crate::job;
use rustup::command::run_command_for_dir;
use rustup::utils::utils::{self, ExitCode};
use rustup::Cfg;
use rustup_utils::utils::{self, ExitCode};
use std::env;
use std::ffi::OsString;
use std::path::PathBuf;
Expand Down
6 changes: 3 additions & 3 deletions src/rustup-cli/rustup_mode.rs → src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use crate::help::*;
use crate::self_update;
use crate::term2;
use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, Shell, SubCommand};
use rustup::dist::dist::{PartialTargetTriple, PartialToolchainDesc, TargetTriple};
use rustup::dist::manifest::Component;
use rustup::utils::utils::{self, ExitCode};
use rustup::{command, Cfg, Toolchain};
use rustup_dist::dist::{PartialTargetTriple, PartialToolchainDesc, TargetTriple};
use rustup_dist::manifest::Component;
use rustup_utils::utils::{self, ExitCode};
use std::error::Error;
use std::io::{self, Write};
use std::iter;
Expand Down
6 changes: 3 additions & 3 deletions src/rustup-cli/self_update.rs → src/cli/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ use crate::common::{self, Confirm};
use crate::errors::*;
use crate::term2;
use regex::Regex;
use rustup::dist::dist;
use rustup::utils::utils;
use rustup::{DUP_TOOLS, TOOLS};
use rustup_dist::dist;
use rustup_utils::utils;
use same_file::Handle;
use std::env;
use std::env::consts::EXE_SUFFIX;
Expand Down Expand Up @@ -689,7 +689,7 @@ fn cleanup_legacy() -> Result<()> {

#[cfg(windows)]
fn legacy_multirust_home_dir() -> Result<PathBuf> {
use rustup_utils::raw::windows::{get_special_folder, FOLDERID_LocalAppData};
use rustup::utils::raw::windows::{get_special_folder, FOLDERID_LocalAppData};

// FIXME: This looks bogus. Where is the .multirust dir?
Ok(get_special_folder(&FOLDERID_LocalAppData).unwrap_or(PathBuf::from(".")))
Expand Down
2 changes: 1 addition & 1 deletion src/rustup-cli/setup_mode.rs → src/cli/setup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::common;
use crate::errors::*;
use crate::self_update::{self, InstallOpts};
use clap::{App, AppSettings, Arg};
use rustup_dist::dist::TargetTriple;
use rustup::dist::dist::TargetTriple;
use std::env;

pub fn main() -> Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion src/rustup-cli/term2.rs → src/cli/term2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use markdown::tokenize;
use markdown::{Block, ListItem, Span};
use rustup_utils::tty;
use rustup::utils::tty;
use std::io;

pub use term::color;
Expand Down
4 changes: 2 additions & 2 deletions src/rustup/command.rs → src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io;
use std::process::{self, Command};

use crate::errors::*;
use rustup_utils::utils::ExitCode;
use crate::utils::utils::ExitCode;

pub fn run_command_for_dir<S: AsRef<OsStr>>(
mut cmd: Command,
Expand All @@ -16,7 +16,7 @@ pub fn run_command_for_dir<S: AsRef<OsStr>>(
// when and why this is needed.
cmd.stdin(process::Stdio::inherit());

return exec(&mut cmd).chain_err(|| rustup_utils::ErrorKind::RunningCommand {
return exec(&mut cmd).chain_err(|| crate::utils::ErrorKind::RunningCommand {
name: OsStr::new(arg0).to_owned(),
});

Expand Down
4 changes: 2 additions & 2 deletions src/rustup/config.rs → src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::sync::Arc;

use crate::dist::{dist, temp};
use crate::errors::*;
use crate::notifications::*;
use crate::settings::{Settings, SettingsFile, DEFAULT_METADATA_VERSION};
use crate::toolchain::{Toolchain, UpdateStatus};
use rustup_dist::{dist, temp};
use rustup_utils::utils;
use crate::utils::utils;

#[derive(Debug)]
pub enum OverrideReason {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use crate::errors::*;
use crate::prefix::InstallPrefix;
use crate::dist::errors::*;
use crate::dist::prefix::InstallPrefix;
/// The representation of the installed toolchain and its components.
/// `Components` and `DirectoryPackage` are the two sides of the
/// installation / uninstallation process.
use rustup_utils::utils;
use crate::utils::utils;

use crate::component::package::{INSTALLER_VERSION, VERSION_FILE};
use crate::component::transaction::Transaction;
use crate::dist::component::package::{INSTALLER_VERSION, VERSION_FILE};
use crate::dist::component::transaction::Transaction;

use std::fs::File;
use std::path::{Path, PathBuf};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
//! for installing from a directory or tarball to an installation
//! prefix, represented by a `Components` instance.

use crate::component::components::*;
use crate::component::transaction::*;
use crate::dist::component::components::*;
use crate::dist::component::transaction::*;

use crate::errors::*;
use crate::temp;
use rustup_utils::utils;
use crate::dist::errors::*;
use crate::dist::temp;
use crate::utils::utils;

use std::collections::HashSet;
use std::fmt;
Expand Down
Loading