Skip to content

Commit 415846e

Browse files
authored
Merge pull request #1704 from dwijnand/merge-crates
Merge rustup's crates
2 parents bc74eb4 + f4b2250 commit 415846e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+270
-403
lines changed

Cargo.lock

+5-61
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+12-8
Original file line numberDiff line numberDiff line change
@@ -30,48 +30,52 @@ vendored-openssl = ['openssl/vendored']
3030
no-self-update = []
3131

3232
[dependencies]
33-
rustup-dist = { path = "src/rustup-dist" }
34-
rustup-utils = { path = "src/rustup-utils" }
35-
download = { path = "src/download" }
33+
dirs = "1.0"
34+
download = { path = "download" }
3635
clap = "2.18.0"
3736
error-chain = "0.12.0"
37+
flate2 = "1.0.1"
3838
itertools = "0.7.6"
3939
libc = "0.2.0"
4040
markdown = "0.2"
41+
ole32-sys = "0.2.0"
4142
rand = "0.5.2"
4243
regex = "1.0.1"
4344
remove_dir_all = "0.5.1"
4445
same-file = "1.0"
46+
semver = "0.9.0"
4547
scopeguard = "0.3"
4648
sha2 = "0.7.0"
49+
tar = "0.4.0"
4750
tempdir = "0.3.4"
4851
term = "0.5.1"
4952
time = "0.1.34"
5053
toml = "0.4"
5154
url = "1.1.0"
5255
wait-timeout = "0.1.5"
56+
walkdir = "2.0"
57+
xz2 = "0.1.3"
5358
openssl = { version = '0.10.15', optional = true }
5459

5560
[target."cfg(windows)".dependencies]
56-
winapi = { version = "0.3", features = ["jobapi", "jobapi2", "processthreadsapi", "psapi", "synchapi", "winuser"] }
61+
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"] }
5762
winreg = "0.5.0"
5863
gcc = "0.3.50"
5964

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

6468
[workspace]
65-
members = ["src/download"]
69+
members = ["download"]
6670

6771
[lib]
6872
name = "rustup"
69-
path = "src/rustup/lib.rs"
73+
path = "src/lib.rs"
7074
test = false # no unit tests
7175

7276
[[bin]]
7377
name = "rustup-init"
74-
path = "src/rustup-cli/main.rs"
78+
path = "src/cli/main.rs"
7579
test = false # no unit tests
7680

7781
[profile.release]

appveyor.yml

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ build: false
7070

7171
test_script:
7272
- cargo build --release --target %TARGET% --locked
73-
- cargo test --release -p rustup-dist --target %TARGET%
7473
- cargo test --release --target %TARGET%
7574
- cargo fmt --all -- --check
7675

build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ where
1717
}
1818

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

23+
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
2224
File::create(out_dir.join("commit-info.txt"))
2325
.unwrap()
2426
.write_all(commit_info().as_bytes())
2527
.unwrap();
28+
2629
println!("cargo:rerun-if-changed=build.rs");
2730
}
2831

ci/run.sh

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ cargo build --locked -v --release --target "$TARGET" --features vendored-openssl
1212

1313
if [ -z "$SKIP_TESTS" ]; then
1414
cargo test --release -p download --target "$TARGET" --features vendored-openssl
15-
cargo test --release -p rustup-dist --target "$TARGET" --features vendored-openssl
1615
cargo test --release --target "$TARGET" --features vendored-openssl
1716
fi
1817

File renamed without changes.
File renamed without changes.

src/download/src/lib.rs renamed to download/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use std::path::Path;
44
use url::Url;
55

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

File renamed without changes.

src/rustup-cli/common.rs renamed to src/cli/common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use crate::errors::*;
44
use crate::self_update;
55
use crate::term2;
6+
use rustup::utils::notify::NotificationLevel;
7+
use rustup::utils::utils;
68
use rustup::{Cfg, Notification, Toolchain, UpdateStatus};
7-
use rustup_utils::notify::NotificationLevel;
8-
use rustup_utils::utils;
99
use std::io::{BufRead, BufReader, Write};
1010
use std::path::Path;
1111
use std::process::{Command, Stdio};

src/rustup-cli/download_tracker.rs renamed to src/cli/download_tracker.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
use rustup::dist::Notification as In;
2+
use rustup::utils::tty;
3+
use rustup::utils::Notification as Un;
14
use rustup::Notification;
2-
use rustup_dist::Notification as In;
3-
use rustup_utils::tty;
4-
use rustup_utils::Notification as Un;
55
use std::collections::VecDeque;
66
use std::fmt;
77
use time::precise_time_s;

src/rustup-cli/errors.rs renamed to src/cli/errors.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use std::path::PathBuf;
66
use error_chain::error_chain;
77
use error_chain::error_chain_processing;
88
use error_chain::{impl_error_chain_kind, impl_error_chain_processed, impl_extract_backtrace};
9-
use rustup_dist::temp;
9+
use rustup::dist::temp;
1010

1111
error_chain! {
1212
links {
1313
Rustup(rustup::Error, rustup::ErrorKind);
14-
Dist(rustup_dist::Error, rustup_dist::ErrorKind);
15-
Utils(rustup_utils::Error, rustup_utils::ErrorKind);
14+
Dist(rustup::dist::Error, rustup::dist::ErrorKind);
15+
Utils(rustup::utils::Error, rustup::utils::ErrorKind);
1616
}
1717

1818
foreign_links {
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/rustup-cli/main.rs renamed to src/cli/main.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
mod log;
1919
mod common;
2020
mod download_tracker;
21+
#[allow(deprecated)] // WORKAROUND https://github.com/rust-lang-nursery/error-chain/issues/254
2122
mod errors;
2223
mod help;
2324
mod job;
@@ -28,8 +29,8 @@ mod setup_mode;
2829
mod term2;
2930

3031
use crate::errors::*;
32+
use rustup::dist::dist::TargetTriple;
3133
use rustup::env_var::RUST_RECURSION_COUNT_MAX;
32-
use rustup_dist::dist::TargetTriple;
3334
use std::alloc::System;
3435
use std::env;
3536
use std::path::PathBuf;
@@ -171,7 +172,7 @@ fn fix_windows_reg_key() {}
171172

172173
// rustup used to be called 'multirust'. This deletes the old bin.
173174
fn delete_multirust_bin() {
174-
use rustup_utils::utils;
175+
use rustup::utils::utils;
175176
use std::env::consts::EXE_SUFFIX;
176177
use std::fs;
177178

src/rustup-cli/proxy_mode.rs renamed to src/cli/proxy_mode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::common::set_globals;
22
use crate::errors::*;
33
use crate::job;
44
use rustup::command::run_command_for_dir;
5+
use rustup::utils::utils::{self, ExitCode};
56
use rustup::Cfg;
6-
use rustup_utils::utils::{self, ExitCode};
77
use std::env;
88
use std::ffi::OsString;
99
use std::path::PathBuf;

src/rustup-cli/rustup_mode.rs renamed to src/cli/rustup_mode.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ use crate::help::*;
44
use crate::self_update;
55
use crate::term2;
66
use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, Shell, SubCommand};
7+
use rustup::dist::dist::{PartialTargetTriple, PartialToolchainDesc, TargetTriple};
8+
use rustup::dist::manifest::Component;
9+
use rustup::utils::utils::{self, ExitCode};
710
use rustup::{command, Cfg, Toolchain};
8-
use rustup_dist::dist::{PartialTargetTriple, PartialToolchainDesc, TargetTriple};
9-
use rustup_dist::manifest::Component;
10-
use rustup_utils::utils::{self, ExitCode};
1111
use std::error::Error;
1212
use std::io::{self, Write};
1313
use std::iter;

src/rustup-cli/self_update.rs renamed to src/cli/self_update.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ use crate::common::{self, Confirm};
3434
use crate::errors::*;
3535
use crate::term2;
3636
use regex::Regex;
37+
use rustup::dist::dist;
38+
use rustup::utils::utils;
3739
use rustup::{DUP_TOOLS, TOOLS};
38-
use rustup_dist::dist;
39-
use rustup_utils::utils;
4040
use same_file::Handle;
4141
use std::env;
4242
use std::env::consts::EXE_SUFFIX;
@@ -689,7 +689,7 @@ fn cleanup_legacy() -> Result<()> {
689689

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

694694
// FIXME: This looks bogus. Where is the .multirust dir?
695695
Ok(get_special_folder(&FOLDERID_LocalAppData).unwrap_or(PathBuf::from(".")))

src/rustup-cli/setup_mode.rs renamed to src/cli/setup_mode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::common;
22
use crate::errors::*;
33
use crate::self_update::{self, InstallOpts};
44
use clap::{App, AppSettings, Arg};
5-
use rustup_dist::dist::TargetTriple;
5+
use rustup::dist::dist::TargetTriple;
66
use std::env;
77

88
pub fn main() -> Result<()> {

src/rustup-cli/term2.rs renamed to src/cli/term2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use markdown::tokenize;
66
use markdown::{Block, ListItem, Span};
7-
use rustup_utils::tty;
7+
use rustup::utils::tty;
88
use std::io;
99

1010
pub use term::color;

src/rustup/command.rs renamed to src/command.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::io;
33
use std::process::{self, Command};
44

55
use crate::errors::*;
6-
use rustup_utils::utils::ExitCode;
6+
use crate::utils::utils::ExitCode;
77

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

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

src/rustup/config.rs renamed to src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ use std::path::{Path, PathBuf};
66
use std::process::Command;
77
use std::sync::Arc;
88

9+
use crate::dist::{dist, temp};
910
use crate::errors::*;
1011
use crate::notifications::*;
1112
use crate::settings::{Settings, SettingsFile, DEFAULT_METADATA_VERSION};
1213
use crate::toolchain::{Toolchain, UpdateStatus};
13-
use rustup_dist::{dist, temp};
14-
use rustup_utils::utils;
14+
use crate::utils::utils;
1515

1616
#[derive(Debug)]
1717
pub enum OverrideReason {

src/rustup-dist/src/component/components.rs renamed to src/dist/component/components.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
use crate::errors::*;
2-
use crate::prefix::InstallPrefix;
1+
use crate::dist::errors::*;
2+
use crate::dist::prefix::InstallPrefix;
33
/// The representation of the installed toolchain and its components.
44
/// `Components` and `DirectoryPackage` are the two sides of the
55
/// installation / uninstallation process.
6-
use rustup_utils::utils;
6+
use crate::utils::utils;
77

8-
use crate::component::package::{INSTALLER_VERSION, VERSION_FILE};
9-
use crate::component::transaction::Transaction;
8+
use crate::dist::component::package::{INSTALLER_VERSION, VERSION_FILE};
9+
use crate::dist::component::transaction::Transaction;
1010

1111
use std::fs::File;
1212
use std::path::{Path, PathBuf};
File renamed without changes.

src/rustup-dist/src/component/package.rs renamed to src/dist/component/package.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
//! for installing from a directory or tarball to an installation
33
//! prefix, represented by a `Components` instance.
44
5-
use crate::component::components::*;
6-
use crate::component::transaction::*;
5+
use crate::dist::component::components::*;
6+
use crate::dist::component::transaction::*;
77

8-
use crate::errors::*;
9-
use crate::temp;
10-
use rustup_utils::utils;
8+
use crate::dist::errors::*;
9+
use crate::dist::temp;
10+
use crate::utils::utils;
1111

1212
use std::collections::HashSet;
1313
use std::fmt;

0 commit comments

Comments
 (0)