mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Merge remote-tracking branch 'origin/master' into links
This commit is contained in:
commit
68a40ad42b
@ -109,13 +109,16 @@ and [merges][mergequeue] it into Cargo's `master` branch.
|
||||
|
||||
To contribute to the documentation, all you need to do is change the markdown
|
||||
files in the `src/doc` directory. To view the rendered version of changes you
|
||||
have made locally, run:
|
||||
have made locally, make sure you have `mdbook` installed and run:
|
||||
|
||||
```sh
|
||||
sh src/ci/dox.sh
|
||||
open target/doc/index.html
|
||||
cd src/doc
|
||||
mdbook build
|
||||
open book/index.html
|
||||
```
|
||||
|
||||
To install `mdbook` run `cargo install mdbook`.
|
||||
|
||||
|
||||
## Issue Triage
|
||||
|
||||
|
13
Cargo.toml
13
Cargo.toml
@ -33,8 +33,9 @@ git2-curl = "0.7"
|
||||
glob = "0.2"
|
||||
hex = "0.3"
|
||||
home = "0.3"
|
||||
ignore = "0.3"
|
||||
ignore = "0.4"
|
||||
jobserver = "0.1.9"
|
||||
lazycell = "0.6"
|
||||
libc = "0.2"
|
||||
libgit2-sys = "0.6"
|
||||
log = "0.4"
|
||||
@ -54,10 +55,10 @@ toml = "0.4"
|
||||
url = "1.1"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
core-foundation = { version = "0.4.4", features = ["mac_os_10_7_support"] }
|
||||
core-foundation = { version = "0.5.1", features = ["mac_os_10_7_support"] }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
miow = "0.2"
|
||||
miow = "0.3"
|
||||
|
||||
[target.'cfg(windows)'.dependencies.winapi]
|
||||
version = "0.3"
|
||||
@ -79,7 +80,7 @@ features = [
|
||||
|
||||
[dev-dependencies]
|
||||
bufstream = "0.1"
|
||||
cargotest = { path = "tests/cargotest", version = "0.1" }
|
||||
cargotest = { path = "tests/testsuite/cargotest", version = "0.1" }
|
||||
filetime = "0.1"
|
||||
hamcrest = "=0.1.1"
|
||||
|
||||
@ -87,3 +88,7 @@ hamcrest = "=0.1.1"
|
||||
name = "cargo"
|
||||
test = false
|
||||
doc = false
|
||||
|
||||
[[test]]
|
||||
name = "testsuite"
|
||||
path = "tests/testsuite/lib.rs"
|
@ -9,6 +9,8 @@ Learn more at https://doc.rust-lang.org/cargo/
|
||||
[](https://travis-ci.org/rust-lang/cargo)
|
||||
[](https://ci.appveyor.com/project/rust-lang-libs/cargo)
|
||||
|
||||
Code documentation: https://docs.rs/cargo/
|
||||
|
||||
## Installing Cargo
|
||||
|
||||
Cargo is distributed by default with Rust, so if you've got `rustc` installed
|
||||
|
@ -180,7 +180,15 @@ fn execute(flags: Flags, config: &mut Config) -> CliResult {
|
||||
if flags.flag_list {
|
||||
println!("Installed Commands:");
|
||||
for command in list_commands(config) {
|
||||
println!(" {}", command);
|
||||
let (command, path) = command;
|
||||
if flags.flag_verbose > 0 {
|
||||
match path {
|
||||
Some(p) => println!(" {:<20} {}", command, p),
|
||||
None => println!(" {:<20}", command),
|
||||
}
|
||||
} else {
|
||||
println!(" {}", command);
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
@ -301,7 +309,7 @@ fn find_closest(config: &Config, cmd: &str) -> Option<String> {
|
||||
// Only consider candidates with a lev_distance of 3 or less so we don't
|
||||
// suggest out-of-the-blue options.
|
||||
let mut filtered = cmds.iter()
|
||||
.map(|c| (lev_distance(c, cmd), c))
|
||||
.map(|&(ref c, _)| (lev_distance(c, cmd), c))
|
||||
.filter(|&(d, _)| d < 4)
|
||||
.collect::<Vec<_>>();
|
||||
filtered.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
@ -347,7 +355,7 @@ fn execute_external_subcommand(config: &Config, cmd: &str, args: &[String]) -> C
|
||||
}
|
||||
|
||||
/// List all runnable commands
|
||||
fn list_commands(config: &Config) -> BTreeSet<String> {
|
||||
fn list_commands(config: &Config) -> BTreeSet<(String, Option<String>)> {
|
||||
let prefix = "cargo-";
|
||||
let suffix = env::consts::EXE_SUFFIX;
|
||||
let mut commands = BTreeSet::new();
|
||||
@ -367,13 +375,16 @@ fn list_commands(config: &Config) -> BTreeSet<String> {
|
||||
}
|
||||
if is_executable(entry.path()) {
|
||||
let end = filename.len() - suffix.len();
|
||||
commands.insert(filename[prefix.len()..end].to_string());
|
||||
commands.insert(
|
||||
(filename[prefix.len()..end].to_string(),
|
||||
Some(path.display().to_string()))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! add_cmd {
|
||||
($cmd:ident) => ({ commands.insert(stringify!($cmd).replace("_", "-")); })
|
||||
($cmd:ident) => ({ commands.insert((stringify!($cmd).replace("_", "-"), None)); })
|
||||
}
|
||||
each_subcommand!(add_cmd);
|
||||
commands
|
||||
|
@ -32,8 +32,8 @@ Options:
|
||||
control system (git, hg, pijul, or fossil) or do not
|
||||
initialize any version control at all (none), overriding
|
||||
a global configuration.
|
||||
--bin Use a binary (application) template
|
||||
--lib Use a library template [default]
|
||||
--bin Use a binary (application) template [default]
|
||||
--lib Use a library template
|
||||
--name NAME Set the resulting package name
|
||||
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
|
||||
-q, --quiet No output printed to stdout
|
||||
@ -56,17 +56,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
|
||||
|
||||
let path = &arg_path.unwrap_or_else(|| String::from("."));
|
||||
let opts = ops::NewOptions::new(flag_vcs,
|
||||
flag_bin,
|
||||
flag_lib,
|
||||
path,
|
||||
flag_name.as_ref().map(|s| s.as_ref()));
|
||||
flag_bin,
|
||||
flag_lib,
|
||||
path,
|
||||
flag_name.as_ref().map(|s| s.as_ref()))?;
|
||||
|
||||
let opts_lib = opts.lib;
|
||||
ops::init(&opts, config)?;
|
||||
|
||||
config.shell().status("Created", format!("{} project",
|
||||
if opts_lib { "library" }
|
||||
else {"binary (application)"}))?;
|
||||
config.shell().status("Created", format!("{} project", opts.kind))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ Options:
|
||||
control system (git, hg, pijul, or fossil) or do not
|
||||
initialize any version control at all (none), overriding
|
||||
a global configuration.
|
||||
--bin Use a binary (application) template
|
||||
--lib Use a library template [default]
|
||||
--bin Use a binary (application) template [default]
|
||||
--lib Use a library template
|
||||
--name NAME Set the resulting package name, defaults to the value of <path>
|
||||
-v, --verbose ... Use verbose output (-vv very verbose/build.rs output)
|
||||
-q, --quiet No output printed to stdout
|
||||
@ -58,15 +58,11 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
|
||||
flag_bin,
|
||||
flag_lib,
|
||||
&arg_path,
|
||||
flag_name.as_ref().map(|s| s.as_ref()));
|
||||
flag_name.as_ref().map(|s| s.as_ref()))?;
|
||||
|
||||
let opts_lib = opts.lib;
|
||||
ops::new(&opts, config)?;
|
||||
|
||||
config.shell().status("Created", format!("{} `{}` project",
|
||||
if opts_lib { "library" }
|
||||
else {"binary (application)"},
|
||||
arg_path))?;
|
||||
config.shell().status("Created", format!("{} `{}` project", opts.kind, arg_path))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ struct Inner {
|
||||
specified_req: bool,
|
||||
kind: Kind,
|
||||
only_match_name: bool,
|
||||
rename: Option<String>,
|
||||
|
||||
optional: bool,
|
||||
default_features: bool,
|
||||
@ -49,6 +50,7 @@ struct SerializedDependency<'a> {
|
||||
source: &'a SourceId,
|
||||
req: String,
|
||||
kind: Kind,
|
||||
rename: Option<&'a str>,
|
||||
|
||||
optional: bool,
|
||||
uses_default_features: bool,
|
||||
@ -69,6 +71,7 @@ impl ser::Serialize for Dependency {
|
||||
uses_default_features: self.uses_default_features(),
|
||||
features: self.features(),
|
||||
target: self.platform(),
|
||||
rename: self.rename(),
|
||||
}.serialize(s)
|
||||
}
|
||||
}
|
||||
@ -182,6 +185,7 @@ impl Dependency {
|
||||
default_features: true,
|
||||
specified_req: false,
|
||||
platform: None,
|
||||
rename: None,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@ -221,6 +225,10 @@ impl Dependency {
|
||||
self.inner.platform.as_ref()
|
||||
}
|
||||
|
||||
pub fn rename(&self) -> Option<&str> {
|
||||
self.inner.rename.as_ref().map(|s| &**s)
|
||||
}
|
||||
|
||||
pub fn set_kind(&mut self, kind: Kind) -> &mut Dependency {
|
||||
Rc::make_mut(&mut self.inner).kind = kind;
|
||||
self
|
||||
@ -261,6 +269,11 @@ impl Dependency {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn set_rename(&mut self, rename: &str) -> &mut Dependency {
|
||||
Rc::make_mut(&mut self.inner).rename = Some(rename.to_string());
|
||||
self
|
||||
}
|
||||
|
||||
/// Lock this dependency to depending on the specified package id
|
||||
pub fn lock_to(&mut self, id: &PackageId) -> &mut Dependency {
|
||||
assert_eq!(self.inner.source_id, *id.source_id());
|
||||
|
@ -159,6 +159,9 @@ features! {
|
||||
|
||||
// Using epochs
|
||||
[unstable] epoch: bool,
|
||||
|
||||
// Renaming a package in the manifest via the `package` key
|
||||
[unstable] rename_dependency: bool,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,11 +7,12 @@ use std::path::{Path, PathBuf};
|
||||
use semver::Version;
|
||||
use serde::ser;
|
||||
use toml;
|
||||
use lazycell::LazyCell;
|
||||
|
||||
use core::{Dependency, Manifest, PackageId, SourceId, Target};
|
||||
use core::{Summary, SourceMap};
|
||||
use ops;
|
||||
use util::{Config, LazyCell, internal, lev_distance};
|
||||
use util::{Config, internal, lev_distance};
|
||||
use util::errors::{CargoResult, CargoResultExt};
|
||||
|
||||
/// Information about a package that is available somewhere in the file system.
|
||||
|
@ -21,6 +21,7 @@ extern crate hex;
|
||||
extern crate home;
|
||||
extern crate ignore;
|
||||
extern crate jobserver;
|
||||
extern crate lazycell;
|
||||
extern crate libc;
|
||||
extern crate libgit2_sys;
|
||||
extern crate num_cpus;
|
||||
@ -39,7 +40,7 @@ extern crate core_foundation;
|
||||
|
||||
use std::fmt;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::ser;
|
||||
use docopt::Docopt;
|
||||
use failure::Error;
|
||||
@ -102,7 +103,7 @@ impl fmt::Display for VersionInfo {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn call_main_without_stdin<'de, Flags: Deserialize<'de>>(
|
||||
pub fn call_main_without_stdin<Flags: DeserializeOwned>(
|
||||
exec: fn(Flags, &mut Config) -> CliResult,
|
||||
config: &mut Config,
|
||||
usage: &str,
|
||||
|
@ -1,6 +1,7 @@
|
||||
use std::collections::BTreeMap;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::fmt;
|
||||
use std::path::Path;
|
||||
|
||||
use serde::{Deserialize, Deserializer};
|
||||
@ -23,12 +24,32 @@ pub enum VersionControl { Git, Hg, Pijul, Fossil, NoVcs }
|
||||
#[derive(Debug)]
|
||||
pub struct NewOptions<'a> {
|
||||
pub version_control: Option<VersionControl>,
|
||||
pub bin: bool,
|
||||
pub lib: bool,
|
||||
pub kind: NewProjectKind,
|
||||
pub path: &'a str,
|
||||
pub name: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum NewProjectKind {
|
||||
Bin,
|
||||
Lib,
|
||||
}
|
||||
|
||||
impl NewProjectKind {
|
||||
fn is_bin(&self) -> bool {
|
||||
*self == NewProjectKind::Bin
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for NewProjectKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
NewProjectKind::Bin => "binary (application)",
|
||||
NewProjectKind::Lib => "library",
|
||||
}.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
struct SourceFileInformation {
|
||||
relative_path: String,
|
||||
target_name: String,
|
||||
@ -62,26 +83,21 @@ impl<'de> Deserialize<'de> for VersionControl {
|
||||
|
||||
impl<'a> NewOptions<'a> {
|
||||
pub fn new(version_control: Option<VersionControl>,
|
||||
bin: bool,
|
||||
lib: bool,
|
||||
path: &'a str,
|
||||
name: Option<&'a str>) -> NewOptions<'a> {
|
||||
bin: bool,
|
||||
lib: bool,
|
||||
path: &'a str,
|
||||
name: Option<&'a str>) -> CargoResult<NewOptions<'a>> {
|
||||
|
||||
// default to lib
|
||||
let is_lib = if !bin {
|
||||
true
|
||||
}
|
||||
else {
|
||||
lib
|
||||
let kind = match (bin, lib) {
|
||||
(true, true) => bail!("can't specify both lib and binary outputs"),
|
||||
(true, false) => NewProjectKind::Bin,
|
||||
(false, true) => NewProjectKind::Lib,
|
||||
// default to bin
|
||||
(false, false) => NewProjectKind::Bin,
|
||||
};
|
||||
|
||||
NewOptions {
|
||||
version_control: version_control,
|
||||
bin: bin,
|
||||
lib: is_lib,
|
||||
path: path,
|
||||
name: name,
|
||||
}
|
||||
let opts = NewOptions { version_control, kind, path, name };
|
||||
Ok(opts)
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +143,7 @@ fn check_name(name: &str, opts: &NewOptions) -> CargoResult<()> {
|
||||
"super", "test", "trait", "true", "type", "typeof",
|
||||
"unsafe", "unsized", "use", "virtual", "where",
|
||||
"while", "yield"];
|
||||
if blacklist.contains(&name) || (opts.bin && is_bad_artifact_name(name)) {
|
||||
if blacklist.contains(&name) || (opts.kind.is_bin() && is_bad_artifact_name(name)) {
|
||||
bail!("The name `{}` cannot be used as a crate name{}",
|
||||
name,
|
||||
name_help)
|
||||
@ -269,10 +285,6 @@ pub fn new(opts: &NewOptions, config: &Config) -> CargoResult<()> {
|
||||
)
|
||||
}
|
||||
|
||||
if opts.lib && opts.bin {
|
||||
bail!("can't specify both lib and binary outputs")
|
||||
}
|
||||
|
||||
let name = get_name(&path, opts)?;
|
||||
check_name(name, opts)?;
|
||||
|
||||
@ -280,8 +292,8 @@ pub fn new(opts: &NewOptions, config: &Config) -> CargoResult<()> {
|
||||
version_control: opts.version_control,
|
||||
path: &path,
|
||||
name: name,
|
||||
source_files: vec![plan_new_source_file(opts.bin, name.to_string())],
|
||||
bin: opts.bin,
|
||||
source_files: vec![plan_new_source_file(opts.kind.is_bin(), name.to_string())],
|
||||
bin: opts.kind.is_bin(),
|
||||
};
|
||||
|
||||
mk(config, &mkopts).chain_err(|| {
|
||||
@ -299,10 +311,6 @@ pub fn init(opts: &NewOptions, config: &Config) -> CargoResult<()> {
|
||||
bail!("`cargo init` cannot be run on existing Cargo projects")
|
||||
}
|
||||
|
||||
if opts.lib && opts.bin {
|
||||
bail!("can't specify both lib and binary outputs");
|
||||
}
|
||||
|
||||
let name = get_name(&path, opts)?;
|
||||
check_name(name, opts)?;
|
||||
|
||||
@ -311,7 +319,7 @@ pub fn init(opts: &NewOptions, config: &Config) -> CargoResult<()> {
|
||||
detect_source_paths_and_types(&path, name, &mut src_paths_types)?;
|
||||
|
||||
if src_paths_types.is_empty() {
|
||||
src_paths_types.push(plan_new_source_file(opts.bin, name.to_string()));
|
||||
src_paths_types.push(plan_new_source_file(opts.kind.is_bin(), name.to_string()));
|
||||
} else {
|
||||
// --bin option may be ignored if lib.rs or src/lib.rs present
|
||||
// Maybe when doing `cargo init --bin` inside a library project stub,
|
||||
@ -353,9 +361,9 @@ pub fn init(opts: &NewOptions, config: &Config) -> CargoResult<()> {
|
||||
}
|
||||
|
||||
let mkopts = MkOptions {
|
||||
version_control: version_control,
|
||||
version_control,
|
||||
path: &path,
|
||||
name: name,
|
||||
name,
|
||||
bin: src_paths_types.iter().any(|x|x.bin),
|
||||
source_files: src_paths_types,
|
||||
};
|
||||
|
@ -1,10 +1,12 @@
|
||||
use std::collections::{HashMap, HashSet, BTreeSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use semver::Version;
|
||||
use lazycell::LazyCell;
|
||||
|
||||
use core::{PackageId, Package, Target, TargetKind};
|
||||
use util::{self, CargoResult, Config, LazyCell, ProcessBuilder, process, join_paths};
|
||||
use util::{self, CargoResult, Config, ProcessBuilder, process, join_paths};
|
||||
|
||||
/// A structure returning the result of a compilation.
|
||||
pub struct Compilation<'cfg> {
|
||||
@ -101,7 +103,7 @@ impl<'cfg> Compilation<'cfg> {
|
||||
}
|
||||
|
||||
fn target_runner(&self) -> CargoResult<&Option<(PathBuf, Vec<String>)>> {
|
||||
self.target_runner.get_or_try_init(|| {
|
||||
self.target_runner.try_borrow_with(|| {
|
||||
let key = format!("target.{}.runner", self.target);
|
||||
Ok(self.config.get_path_and_args(&key)?.map(|v| v.val))
|
||||
})
|
||||
|
@ -947,12 +947,12 @@ Cargo.toml. This warning might turn into a hard error in the future.",
|
||||
}
|
||||
}
|
||||
|
||||
for unit in dep_targets {
|
||||
if unit.profile.run_custom_build {
|
||||
cmd.env("OUT_DIR", &cx.build_script_out_dir(&unit));
|
||||
for dep in dep_targets {
|
||||
if dep.profile.run_custom_build {
|
||||
cmd.env("OUT_DIR", &cx.build_script_out_dir(&dep));
|
||||
}
|
||||
if unit.target.linkable() && !unit.profile.doc {
|
||||
link_to(cmd, cx, &unit)?;
|
||||
if dep.target.linkable() && !dep.profile.doc {
|
||||
link_to(cmd, cx, &unit, &dep)?;
|
||||
}
|
||||
}
|
||||
|
||||
@ -960,15 +960,31 @@ Cargo.toml. This warning might turn into a hard error in the future.",
|
||||
|
||||
fn link_to<'a, 'cfg>(cmd: &mut ProcessBuilder,
|
||||
cx: &mut Context<'a, 'cfg>,
|
||||
unit: &Unit<'a>) -> CargoResult<()> {
|
||||
for &(ref dst, _, file_type) in cx.target_filenames(unit)?.iter() {
|
||||
current: &Unit<'a>,
|
||||
dep: &Unit<'a>) -> CargoResult<()> {
|
||||
for &(ref dst, _, file_type) in cx.target_filenames(dep)?.iter() {
|
||||
if file_type != TargetFileType::Linkable {
|
||||
continue
|
||||
}
|
||||
let mut v = OsString::new();
|
||||
v.push(&unit.target.crate_name());
|
||||
|
||||
// Unfortunately right now Cargo doesn't have a great way to get a
|
||||
// 1:1 mapping of entries in `dependencies()` to the actual crate
|
||||
// we're depending on. Instead we're left to do some guesswork here
|
||||
// to figure out what `Dependency` the `dep` unit corresponds to in
|
||||
// `current` to see if we're renaming it.
|
||||
//
|
||||
// This I believe mostly works out for now, but we'll likely want
|
||||
// to tighten up this in the future.
|
||||
let name = current.pkg.dependencies()
|
||||
.iter()
|
||||
.filter(|d| d.matches_ignoring_source(dep.pkg.summary()))
|
||||
.filter_map(|d| d.rename())
|
||||
.next();
|
||||
|
||||
v.push(name.unwrap_or(&dep.target.crate_name()));
|
||||
v.push("=");
|
||||
v.push(cx.out_dir(unit));
|
||||
v.push(cx.out_dir(dep));
|
||||
v.push(&path::MAIN_SEPARATOR.to_string());
|
||||
v.push(&dst.file_name().unwrap());
|
||||
cmd.arg("--extern").arg(&v);
|
||||
|
@ -9,12 +9,13 @@ use std::str;
|
||||
use git2;
|
||||
use hex;
|
||||
use serde_json;
|
||||
use lazycell::LazyCell;
|
||||
|
||||
use core::{PackageId, SourceId};
|
||||
use sources::git;
|
||||
use sources::registry::{RegistryData, RegistryConfig, INDEX_LOCK, CRATE_TEMPLATE, VERSION_TEMPLATE};
|
||||
use util::network;
|
||||
use util::{FileLock, Filesystem, LazyCell};
|
||||
use util::{FileLock, Filesystem};
|
||||
use util::{Config, Sha256, ToUrl, Progress};
|
||||
use util::errors::{CargoResult, CargoResultExt, HttpNot200};
|
||||
|
||||
@ -43,7 +44,7 @@ impl<'cfg> RemoteRegistry<'cfg> {
|
||||
}
|
||||
|
||||
fn repo(&self) -> CargoResult<&git2::Repository> {
|
||||
self.repo.get_or_try_init(|| {
|
||||
self.repo.try_borrow_with(|| {
|
||||
let path = self.index_path.clone().into_path_unlocked();
|
||||
|
||||
// Fast path without a lock
|
||||
|
@ -16,6 +16,7 @@ use curl::easy::Easy;
|
||||
use jobserver;
|
||||
use serde::{Serialize, Serializer};
|
||||
use toml;
|
||||
use lazycell::LazyCell;
|
||||
|
||||
use core::shell::Verbosity;
|
||||
use core::{Shell, CliUnstable};
|
||||
@ -26,7 +27,7 @@ use util::Rustc;
|
||||
use util::errors::{CargoResult, CargoResultExt, CargoError, internal};
|
||||
use util::paths;
|
||||
use util::toml as cargo_toml;
|
||||
use util::{Filesystem, LazyCell};
|
||||
use util::Filesystem;
|
||||
|
||||
use self::ConfigValue as CV;
|
||||
|
||||
@ -144,18 +145,18 @@ impl Config {
|
||||
|
||||
/// Get the path to the `rustdoc` executable
|
||||
pub fn rustdoc(&self) -> CargoResult<&Path> {
|
||||
self.rustdoc.get_or_try_init(|| self.get_tool("rustdoc")).map(AsRef::as_ref)
|
||||
self.rustdoc.try_borrow_with(|| self.get_tool("rustdoc")).map(AsRef::as_ref)
|
||||
}
|
||||
|
||||
/// Get the path to the `rustc` executable
|
||||
pub fn rustc(&self) -> CargoResult<&Rustc> {
|
||||
self.rustc.get_or_try_init(|| Rustc::new(self.get_tool("rustc")?,
|
||||
self.rustc.try_borrow_with(|| Rustc::new(self.get_tool("rustc")?,
|
||||
self.maybe_get_tool("rustc_wrapper")?))
|
||||
}
|
||||
|
||||
/// Get the path to the `cargo` executable
|
||||
pub fn cargo_exe(&self) -> CargoResult<&Path> {
|
||||
self.cargo_exe.get_or_try_init(|| {
|
||||
self.cargo_exe.try_borrow_with(|| {
|
||||
fn from_current_exe() -> CargoResult<PathBuf> {
|
||||
// Try fetching the path to `cargo` using env::current_exe().
|
||||
// The method varies per operating system and might fail; in particular,
|
||||
@ -207,7 +208,7 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn values(&self) -> CargoResult<&HashMap<String, ConfigValue>> {
|
||||
self.values.get_or_try_init(|| self.load_values())
|
||||
self.values.try_borrow_with(|| self.load_values())
|
||||
}
|
||||
|
||||
pub fn set_values(&self, values: HashMap<String, ConfigValue>) -> CargoResult<()> {
|
||||
@ -648,7 +649,7 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn http(&self) -> CargoResult<&RefCell<Easy>> {
|
||||
let http = self.easy.get_or_try_init(|| {
|
||||
let http = self.easy.try_borrow_with(|| {
|
||||
ops::http_handle(self).map(RefCell::new)
|
||||
})?;
|
||||
{
|
||||
|
@ -1,74 +0,0 @@
|
||||
//! A lazily fill Cell, but with frozen contents.
|
||||
//!
|
||||
//! With a `RefCell`, the inner contents cannot be borrowed for the lifetime of
|
||||
//! the entire object, but only of the borrows returned. A `LazyCell` is a
|
||||
//! variation on `RefCell` which allows borrows tied to the lifetime of the
|
||||
//! outer object.
|
||||
//!
|
||||
//! The limitation of a `LazyCell` is that after initialized, it can never be
|
||||
//! modified unless you've otherwise got a `&mut` reference
|
||||
|
||||
use std::cell::UnsafeCell;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct LazyCell<T> {
|
||||
inner: UnsafeCell<Option<T>>,
|
||||
}
|
||||
|
||||
impl<T> LazyCell<T> {
|
||||
/// Creates a new empty lazy cell.
|
||||
pub fn new() -> LazyCell<T> {
|
||||
LazyCell { inner: UnsafeCell::new(None) }
|
||||
}
|
||||
|
||||
/// Put a value into this cell.
|
||||
///
|
||||
/// This function will fail if the cell has already been filled.
|
||||
pub fn fill(&self, t: T) -> Result<(), T> {
|
||||
unsafe {
|
||||
let slot = self.inner.get();
|
||||
if (*slot).is_none() {
|
||||
*slot = Some(t);
|
||||
Ok(())
|
||||
} else {
|
||||
Err(t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Borrows the contents of this lazy cell for the duration of the cell
|
||||
/// itself.
|
||||
///
|
||||
/// This function will return `Some` if the cell has been previously
|
||||
/// initialized, and `None` if it has not yet been initialized.
|
||||
pub fn borrow(&self) -> Option<&T> {
|
||||
unsafe {
|
||||
(*self.inner.get()).as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
/// Same as `borrow`, but the mutable version
|
||||
pub fn borrow_mut(&mut self) -> Option<&mut T> {
|
||||
unsafe {
|
||||
(*self.inner.get()).as_mut()
|
||||
}
|
||||
}
|
||||
|
||||
/// Consumes this `LazyCell`, returning the underlying value.
|
||||
#[allow(unused_unsafe)]
|
||||
pub fn into_inner(self) -> Option<T> {
|
||||
unsafe {
|
||||
self.inner.into_inner()
|
||||
}
|
||||
}
|
||||
|
||||
/// Borrows the contents of this lazy cell, initializing it if necessary.
|
||||
pub fn get_or_try_init<Error, F>(&self, init: F) -> Result<&T, Error>
|
||||
where F: FnOnce() -> Result<T, Error>
|
||||
{
|
||||
if self.borrow().is_none() && self.fill(init()?).is_err() {
|
||||
unreachable!();
|
||||
}
|
||||
Ok(self.borrow().unwrap())
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ pub use self::errors::{process_error, internal};
|
||||
pub use self::flock::{FileLock, Filesystem};
|
||||
pub use self::graph::Graph;
|
||||
pub use self::hex::{to_hex, short_hash, hash_u64};
|
||||
pub use self::lazy_cell::LazyCell;
|
||||
pub use self::lev_distance::{lev_distance};
|
||||
pub use self::paths::{join_paths, path2bytes, bytes2path, dylib_path};
|
||||
pub use self::paths::{normalize_path, dylib_path_envvar, without_prefix};
|
||||
@ -40,7 +39,6 @@ mod dependency_queue;
|
||||
mod rustc;
|
||||
mod sha256;
|
||||
mod vcs;
|
||||
mod lazy_cell;
|
||||
mod flock;
|
||||
mod read2;
|
||||
mod progress;
|
||||
|
@ -27,9 +27,12 @@ mod imp {
|
||||
fds[0].events = libc::POLLIN;
|
||||
fds[1].fd = err_pipe.as_raw_fd();
|
||||
fds[1].events = libc::POLLIN;
|
||||
loop {
|
||||
let mut nfds = 2;
|
||||
let mut errfd = 1;
|
||||
|
||||
while nfds > 0 {
|
||||
// wait for either pipe to become readable using `select`
|
||||
let r = unsafe { libc::poll(fds.as_mut_ptr(), 2, -1) };
|
||||
let r = unsafe { libc::poll(fds.as_mut_ptr(), nfds, -1) };
|
||||
if r == -1 {
|
||||
let err = io::Error::last_os_error();
|
||||
if err.kind() == io::ErrorKind::Interrupted {
|
||||
@ -55,19 +58,20 @@ mod imp {
|
||||
}
|
||||
}
|
||||
};
|
||||
if !out_done && fds[0].revents != 0 && handle(out_pipe.read_to_end(&mut out))? {
|
||||
out_done = true;
|
||||
}
|
||||
data(true, &mut out, out_done);
|
||||
if !err_done && fds[1].revents != 0 && handle(err_pipe.read_to_end(&mut err))? {
|
||||
if !err_done && fds[errfd].revents != 0 && handle(err_pipe.read_to_end(&mut err))? {
|
||||
err_done = true;
|
||||
nfds -= 1;
|
||||
}
|
||||
data(false, &mut err, err_done);
|
||||
|
||||
if out_done && err_done {
|
||||
return Ok(())
|
||||
if !out_done && fds[0].revents != 0 && handle(out_pipe.read_to_end(&mut out))? {
|
||||
out_done = true;
|
||||
fds[0].fd = err_pipe.as_raw_fd();
|
||||
errfd = 0;
|
||||
nfds -= 1;
|
||||
}
|
||||
data(true, &mut out, out_done);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ type TomlBenchTarget = TomlTarget;
|
||||
#[serde(untagged)]
|
||||
pub enum TomlDependency {
|
||||
Simple(String),
|
||||
Detailed(DetailedTomlDependency)
|
||||
Detailed(DetailedTomlDependency),
|
||||
}
|
||||
|
||||
impl<'de> de::Deserialize<'de> for TomlDependency {
|
||||
@ -193,6 +193,7 @@ pub struct DetailedTomlDependency {
|
||||
default_features: Option<bool>,
|
||||
#[serde(rename = "default_features")]
|
||||
default_features2: Option<bool>,
|
||||
package: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
@ -918,16 +919,28 @@ impl TomlDependency {
|
||||
cx: &mut Context,
|
||||
kind: Option<Kind>)
|
||||
-> CargoResult<Dependency> {
|
||||
let details = match *self {
|
||||
TomlDependency::Simple(ref version) => DetailedTomlDependency {
|
||||
version: Some(version.clone()),
|
||||
.. Default::default()
|
||||
},
|
||||
TomlDependency::Detailed(ref details) => details.clone(),
|
||||
};
|
||||
match *self {
|
||||
TomlDependency::Simple(ref version) => {
|
||||
DetailedTomlDependency {
|
||||
version: Some(version.clone()),
|
||||
..Default::default()
|
||||
}.to_dependency(name, cx, kind)
|
||||
}
|
||||
TomlDependency::Detailed(ref details) => {
|
||||
details.to_dependency(name, cx, kind)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if details.version.is_none() && details.path.is_none() &&
|
||||
details.git.is_none() {
|
||||
impl DetailedTomlDependency {
|
||||
fn to_dependency(&self,
|
||||
name: &str,
|
||||
cx: &mut Context,
|
||||
kind: Option<Kind>)
|
||||
-> CargoResult<Dependency> {
|
||||
if self.version.is_none() && self.path.is_none() &&
|
||||
self.git.is_none() {
|
||||
let msg = format!("dependency ({}) specified without \
|
||||
providing a local path, Git repository, or \
|
||||
version to use. This will be considered an \
|
||||
@ -935,11 +948,11 @@ impl TomlDependency {
|
||||
cx.warnings.push(msg);
|
||||
}
|
||||
|
||||
if details.git.is_none() {
|
||||
if self.git.is_none() {
|
||||
let git_only_keys = [
|
||||
(&details.branch, "branch"),
|
||||
(&details.tag, "tag"),
|
||||
(&details.rev, "rev")
|
||||
(&self.branch, "branch"),
|
||||
(&self.tag, "tag"),
|
||||
(&self.rev, "rev")
|
||||
];
|
||||
|
||||
for &(key, key_name) in &git_only_keys {
|
||||
@ -952,7 +965,7 @@ impl TomlDependency {
|
||||
}
|
||||
}
|
||||
|
||||
let registry_id = match details.registry {
|
||||
let registry_id = match self.registry {
|
||||
Some(ref registry) => {
|
||||
cx.features.require(Feature::alternative_registries())?;
|
||||
SourceId::alt_registry(cx.config, registry)?
|
||||
@ -961,10 +974,10 @@ impl TomlDependency {
|
||||
};
|
||||
|
||||
let new_source_id = match (
|
||||
details.git.as_ref(),
|
||||
details.path.as_ref(),
|
||||
details.registry.as_ref(),
|
||||
details.registry_index.as_ref(),
|
||||
self.git.as_ref(),
|
||||
self.path.as_ref(),
|
||||
self.registry.as_ref(),
|
||||
self.registry_index.as_ref(),
|
||||
) {
|
||||
(Some(_), _, Some(_), _) |
|
||||
(Some(_), _, _, Some(_))=> bail!("dependency ({}) specification is ambiguous. \
|
||||
@ -979,7 +992,7 @@ impl TomlDependency {
|
||||
cx.warnings.push(msg)
|
||||
}
|
||||
|
||||
let n_details = [&details.branch, &details.tag, &details.rev]
|
||||
let n_details = [&self.branch, &self.tag, &self.rev]
|
||||
.iter()
|
||||
.filter(|d| d.is_some())
|
||||
.count();
|
||||
@ -991,9 +1004,9 @@ impl TomlDependency {
|
||||
cx.warnings.push(msg)
|
||||
}
|
||||
|
||||
let reference = details.branch.clone().map(GitReference::Branch)
|
||||
.or_else(|| details.tag.clone().map(GitReference::Tag))
|
||||
.or_else(|| details.rev.clone().map(GitReference::Rev))
|
||||
let reference = self.branch.clone().map(GitReference::Branch)
|
||||
.or_else(|| self.tag.clone().map(GitReference::Tag))
|
||||
.or_else(|| self.rev.clone().map(GitReference::Rev))
|
||||
.unwrap_or_else(|| GitReference::Branch("master".to_string()));
|
||||
let loc = git.to_url()?;
|
||||
SourceId::for_git(&loc, reference)?
|
||||
@ -1024,24 +1037,33 @@ impl TomlDependency {
|
||||
(None, None, None, None) => SourceId::crates_io(cx.config)?,
|
||||
};
|
||||
|
||||
let version = details.version.as_ref().map(|v| &v[..]);
|
||||
let (pkg_name, rename) = match self.package {
|
||||
Some(ref s) => (&s[..], Some(name)),
|
||||
None => (name, None),
|
||||
};
|
||||
|
||||
let version = self.version.as_ref().map(|v| &v[..]);
|
||||
let mut dep = match cx.pkgid {
|
||||
Some(id) => {
|
||||
Dependency::parse(name, version, &new_source_id,
|
||||
Dependency::parse(pkg_name, version, &new_source_id,
|
||||
id, cx.config)?
|
||||
}
|
||||
None => Dependency::parse_no_deprecated(name, version, &new_source_id)?,
|
||||
};
|
||||
dep.set_features(details.features.unwrap_or_default())
|
||||
.set_default_features(details.default_features
|
||||
.or(details.default_features2)
|
||||
dep.set_features(self.features.clone().unwrap_or_default())
|
||||
.set_default_features(self.default_features
|
||||
.or(self.default_features2)
|
||||
.unwrap_or(true))
|
||||
.set_optional(details.optional.unwrap_or(false))
|
||||
.set_optional(self.optional.unwrap_or(false))
|
||||
.set_platform(cx.platform.clone())
|
||||
.set_registry_id(®istry_id);
|
||||
if let Some(kind) = kind {
|
||||
dep.set_kind(kind);
|
||||
}
|
||||
if let Some(rename) = rename {
|
||||
cx.features.require(Feature::rename_dependency())?;
|
||||
dep.set_rename(rename);
|
||||
}
|
||||
Ok(dep)
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ $ cargo new hello_world --bin
|
||||
```
|
||||
|
||||
We’re passing `--bin` because we’re making a binary program: if we
|
||||
were making a library, we’d leave it off.
|
||||
were making a library, we’d pass `--lib`.
|
||||
|
||||
Let’s check out what Cargo has generated for us:
|
||||
|
||||
|
@ -1,38 +1,37 @@
|
||||
## Installation
|
||||
|
||||
### Install Stable Rust and Cargo
|
||||
### Install Rust and Cargo
|
||||
|
||||
The easiest way to get Cargo is to get the current stable release of [Rust] by
|
||||
using the `rustup` script:
|
||||
The easiest way to get Cargo is to install the current stable release of [Rust]
|
||||
by using `rustup`.
|
||||
|
||||
On Linux and macOS systems, this is done as follows:
|
||||
|
||||
```console
|
||||
$ curl -sSf https://static.rust-lang.org/rustup.sh | sh
|
||||
```
|
||||
|
||||
It will download a script, and start the installation. If everything goes well,
|
||||
you’ll see this appear:
|
||||
|
||||
```console
|
||||
Rust is installed now. Great!
|
||||
```
|
||||
|
||||
On Windows, download and run [rustup-init.exe]. It will start the installation
|
||||
in a console and present the above message on success.
|
||||
|
||||
After this, you can use the `rustup` command to also install `beta` or `nightly`
|
||||
channels for Rust and Cargo.
|
||||
|
||||
### Install Nightly Cargo
|
||||
|
||||
To install just Cargo, the current recommended installation method is through
|
||||
the official nightly builds. Note that Cargo will also require that [Rust] is
|
||||
already installed on the system.
|
||||
|
||||
| Platform | 64-bit | 32-bit |
|
||||
|------------------|-------------------|-------------------|
|
||||
| Linux binaries | [tar.gz][linux64] | [tar.gz][linux32] |
|
||||
| MacOS binaries | [tar.gz][mac64] | [tar.gz][mac32] |
|
||||
| Windows binaries | [tar.gz][win64] | [tar.gz][win32] |
|
||||
For other installation options and information, visit the
|
||||
[install][install-rust] page of the Rust website.
|
||||
|
||||
### Build and Install Cargo from Source
|
||||
|
||||
Alternatively, you can [build Cargo from source][compiling-from-source].
|
||||
|
||||
[rust]: https://www.rust-lang.org/
|
||||
[linux64]: https://static.rust-lang.org/cargo-dist/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz
|
||||
[linux32]: https://static.rust-lang.org/cargo-dist/cargo-nightly-i686-unknown-linux-gnu.tar.gz
|
||||
[mac64]: https://static.rust-lang.org/cargo-dist/cargo-nightly-x86_64-apple-darwin.tar.gz
|
||||
[mac32]: https://static.rust-lang.org/cargo-dist/cargo-nightly-i686-apple-darwin.tar.gz
|
||||
[win64]: https://static.rust-lang.org/cargo-dist/cargo-nightly-x86_64-pc-windows-gnu.tar.gz
|
||||
[win32]: https://static.rust-lang.org/cargo-dist/cargo-nightly-i686-pc-windows-gnu.tar.gz
|
||||
[rustup-init.exe]: https://win.rustup.rs/
|
||||
[install-rust]: https://www.rust-lang.org/install.html
|
||||
[compiling-from-source]: https://github.com/rust-lang/cargo#compiling-from-source
|
||||
|
@ -7,7 +7,7 @@ $ cargo new hello_world --bin
|
||||
```
|
||||
|
||||
We’re passing `--bin` because we’re making a binary program: if we
|
||||
were making a library, we’d leave it off. This also initializes a new `git`
|
||||
were making a library, we’d pass `--lib`. This also initializes a new `git`
|
||||
repository by default. If you don't want it to do that, pass `--vcs none`.
|
||||
|
||||
Let’s check out what Cargo has generated for us:
|
||||
@ -23,9 +23,7 @@ $ tree .
|
||||
1 directory, 2 files
|
||||
```
|
||||
|
||||
If we had just used `cargo new hello_world` without the `--bin` flag, then
|
||||
we would have a `lib.rs` instead of a `main.rs`. For now, however, this is all
|
||||
we need to get started. First, let’s check out `Cargo.toml`:
|
||||
Let’s take a closer look at `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[package]
|
||||
|
@ -299,7 +299,7 @@ lto = false # Link Time Optimization usually reduces size of binaries
|
||||
# be passed
|
||||
debug-assertions = true # controls whether debug assertions are enabled
|
||||
# (e.g. debug_assert!() and arithmetic overflow checks)
|
||||
codegen-units = 1 # if > 1 enables parallel code generation which improves
|
||||
codegen-units = 16 # if > 1 enables parallel code generation which improves
|
||||
# compile times, but prevents some optimizations.
|
||||
# Passes `-C codegen-units`.
|
||||
panic = 'unwind' # panic strategy (`-C panic=...`), can also be 'abort'
|
||||
@ -314,7 +314,7 @@ debug = false
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = false
|
||||
codegen-units = 1
|
||||
codegen-units = 16
|
||||
panic = 'unwind'
|
||||
incremental = false
|
||||
overflow-checks = false
|
||||
@ -326,7 +326,7 @@ debug = 2
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = true
|
||||
codegen-units = 1
|
||||
codegen-units = 16
|
||||
panic = 'unwind'
|
||||
incremental = true
|
||||
overflow-checks = true
|
||||
@ -338,7 +338,7 @@ debug = false
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = false
|
||||
codegen-units = 1
|
||||
codegen-units = 16
|
||||
panic = 'unwind'
|
||||
incremental = false
|
||||
overflow-checks = false
|
||||
@ -350,7 +350,7 @@ debug = 2
|
||||
rpath = false
|
||||
lto = false
|
||||
debug-assertions = true
|
||||
codegen-units = 1
|
||||
codegen-units = 16
|
||||
panic = 'unwind'
|
||||
incremental = true
|
||||
overflow-checks = true
|
||||
|
@ -42,6 +42,7 @@ be allowed with them:
|
||||
^1.2 := >=1.2.0 <2.0.0
|
||||
^1 := >=1.0.0 <2.0.0
|
||||
^0.2.3 := >=0.2.3 <0.3.0
|
||||
^0.2 := >= 0.2.0 < 0.3.0
|
||||
^0.0.3 := >=0.0.3 <0.0.4
|
||||
^0.0 := >=0.0.0 <0.1.0
|
||||
^0 := >=0.0.0 <1.0.0
|
||||
|
120
tests/rename-deps.rs
Normal file
120
tests/rename-deps.rs
Normal file
@ -0,0 +1,120 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs};
|
||||
use cargotest::support::registry::Package;
|
||||
use cargotest::ChannelChanger;
|
||||
use hamcrest::assert_that;
|
||||
|
||||
#[test]
|
||||
fn gated() {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", r#"
|
||||
[project]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[dependencies]
|
||||
bar = { package = "foo", version = "0.1" }
|
||||
"#)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
assert_that(p.cargo("build").masquerade_as_nightly_cargo(),
|
||||
execs().with_status(101)
|
||||
.with_stderr("\
|
||||
error: failed to parse manifest at `[..]`
|
||||
|
||||
Caused by:
|
||||
feature `rename-dependency` is required
|
||||
|
||||
consider adding `cargo-features = [\"rename-dependency\"]` to the manifest
|
||||
"));
|
||||
|
||||
let p = project("bar")
|
||||
.file("Cargo.toml", r#"
|
||||
[project]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[dependencies]
|
||||
bar = { version = "0.1", package = "baz" }
|
||||
"#)
|
||||
.file("src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
assert_that(p.cargo("build").masquerade_as_nightly_cargo(),
|
||||
execs().with_status(101)
|
||||
.with_stderr("\
|
||||
error: failed to parse manifest at `[..]`
|
||||
|
||||
Caused by:
|
||||
feature `rename-dependency` is required
|
||||
|
||||
consider adding `cargo-features = [\"rename-dependency\"]` to the manifest
|
||||
"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rename_dependency() {
|
||||
Package::new("bar", "0.1.0").publish();
|
||||
Package::new("bar", "0.2.0").publish();
|
||||
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", r#"
|
||||
cargo-features = ["rename-dependency"]
|
||||
|
||||
[project]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[dependencies]
|
||||
bar = { version = "0.1.0" }
|
||||
baz = { version = "0.2.0", package = "bar" }
|
||||
"#)
|
||||
.file("src/lib.rs", "
|
||||
extern crate bar;
|
||||
extern crate baz;
|
||||
")
|
||||
.build();
|
||||
|
||||
assert_that(p.cargo("build").masquerade_as_nightly_cargo(),
|
||||
execs().with_status(0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rename_with_different_names() {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", r#"
|
||||
cargo-features = ["rename-dependency"]
|
||||
|
||||
[project]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[dependencies]
|
||||
baz = { path = "bar", package = "bar" }
|
||||
"#)
|
||||
.file("src/lib.rs", "
|
||||
extern crate baz;
|
||||
")
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
name = "bar"
|
||||
version = "0.0.1"
|
||||
authors = []
|
||||
|
||||
[lib]
|
||||
name = "random_name"
|
||||
"#)
|
||||
.file("bar/src/lib.rs", "")
|
||||
.build();
|
||||
|
||||
assert_that(p.cargo("build").masquerade_as_nightly_cargo(),
|
||||
execs().with_status(0));
|
||||
}
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::ChannelChanger;
|
||||
use cargotest::support::registry::{self, Package, alt_api_path};
|
||||
use cargotest::support::{paths, project, execs};
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs};
|
||||
use cargotest::support::registry::Package;
|
||||
use hamcrest::assert_that;
|
@ -1,6 +1,3 @@
|
||||
extern crate hamcrest;
|
||||
extern crate cargotest;
|
||||
|
||||
use cargotest::support::{project, execs, main_file, basic_bin_manifest};
|
||||
use hamcrest::{assert_that};
|
||||
|
@ -1,7 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate cargo;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::str;
|
||||
|
||||
use cargo::util::process;
|
@ -1,9 +1,3 @@
|
||||
extern crate cargo;
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate tempdir;
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
@ -1,13 +1,10 @@
|
||||
extern crate bufstream;
|
||||
extern crate git2;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std;
|
||||
use std::collections::HashSet;
|
||||
use std::io::prelude::*;
|
||||
use std::net::TcpListener;
|
||||
use std::thread;
|
||||
|
||||
use git2;
|
||||
use bufstream::BufStream;
|
||||
use cargotest::support::paths;
|
||||
use cargotest::support::{project, execs};
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs::File;
|
||||
|
||||
use cargotest::sleep_ms;
|
@ -1,5 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
use cargotest::support::{project, execs, basic_bin_manifest};
|
||||
use hamcrest::{assert_that};
|
||||
|
@ -1,13 +1,10 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str;
|
||||
|
||||
use cargo;
|
||||
use cargotest::cargo_process;
|
||||
use cargotest::support::paths::{self, CargoPathExt};
|
||||
use cargotest::support::{execs, project, Project, basic_bin_manifest};
|
||||
@ -74,7 +71,7 @@ fn list_command_looks_at_path() {
|
||||
.env("PATH", &path);
|
||||
let output = output.exec_with_output().unwrap();
|
||||
let output = str::from_utf8(&output.stdout).unwrap();
|
||||
assert!(output.contains("\n 1\n"), "missing 1: {}", output);
|
||||
assert!(output.contains("\n 1 "), "missing 1: {}", output);
|
||||
}
|
||||
|
||||
// windows and symlinks don't currently agree that well
|
||||
@ -95,7 +92,7 @@ fn list_command_resolves_symlinks() {
|
||||
.env("PATH", &path);
|
||||
let output = output.exec_with_output().unwrap();
|
||||
let output = str::from_utf8(&output.stdout).unwrap();
|
||||
assert!(output.contains("\n 2\n"), "missing 2: {}", output);
|
||||
assert!(output.contains("\n 2 "), "missing 2: {}", output);
|
||||
}
|
||||
|
||||
#[test]
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::ChannelChanger;
|
||||
use cargotest::support::{project, execs};
|
||||
use hamcrest::assert_that;
|
@ -7,12 +7,12 @@ authors = ["Alex Crichton <alex@alexcrichton.com>"]
|
||||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
cargo = { path = "../.." }
|
||||
cargo = { path = "../../.." }
|
||||
filetime = "0.1"
|
||||
flate2 = "1.0"
|
||||
git2 = { version = "0.6", default-features = false }
|
||||
hamcrest = "=0.1.1"
|
||||
hex = "0.2"
|
||||
hex = "0.3"
|
||||
log = "0.4"
|
||||
serde_json = "1.0"
|
||||
tar = { version = "0.4", default-features = false }
|
@ -6,7 +6,7 @@ use std::path::{PathBuf, Path};
|
||||
use flate2::Compression;
|
||||
use flate2::write::GzEncoder;
|
||||
use git2;
|
||||
use hex::ToHex;
|
||||
use hex;
|
||||
use tar::{Builder, Header};
|
||||
use url::Url;
|
||||
|
||||
@ -320,5 +320,5 @@ impl Package {
|
||||
pub fn cksum(s: &[u8]) -> String {
|
||||
let mut sha = Sha256::new();
|
||||
sha.update(s);
|
||||
sha.finish().to_hex()
|
||||
hex::encode(&sha.finish())
|
||||
}
|
@ -1,7 +1,3 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::str::FromStr;
|
||||
use std::fmt;
|
||||
|
@ -1,7 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate glob;
|
||||
|
||||
use cargotest::is_nightly;
|
||||
use cargotest::support::{execs, project};
|
||||
use cargotest::support::registry::Package;
|
@ -1,6 +1,3 @@
|
||||
extern crate hamcrest;
|
||||
extern crate cargotest;
|
||||
|
||||
use std::env;
|
||||
|
||||
use cargotest::support::{git, project, execs, main_file, basic_bin_manifest};
|
@ -1,7 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate git2;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::{env, str};
|
||||
use std::fs::{self, File};
|
||||
use std::io::Write;
|
||||
@ -11,6 +7,8 @@ use std::thread;
|
||||
use std::sync::mpsc::channel;
|
||||
use std::time::Duration;
|
||||
|
||||
use git2;
|
||||
use cargotest;
|
||||
use cargotest::install::{has_installed_exe, cargo_home};
|
||||
use cargotest::support::git;
|
||||
use cargotest::support::registry::Package;
|
@ -1,6 +1,3 @@
|
||||
extern crate hamcrest;
|
||||
extern crate cargotest;
|
||||
|
||||
use cargotest::support::{project, execs};
|
||||
use hamcrest::assert_that;
|
||||
|
@ -1,7 +1,3 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargo::util::process;
|
||||
use cargotest::{is_nightly, rustc_host};
|
||||
use cargotest::support::{project, execs, basic_bin_manifest, cross_compile};
|
@ -1,9 +1,3 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate flate2;
|
||||
extern crate tar;
|
||||
|
||||
use std::fs::File;
|
||||
use std::path::PathBuf;
|
||||
use std::io::prelude::*;
|
@ -1,8 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate libc;
|
||||
#[cfg(windows)]
|
||||
extern crate winapi;
|
||||
|
||||
use std::fs;
|
||||
use std::io::{self, Read};
|
||||
use std::net::TcpListener;
|
||||
@ -33,8 +28,8 @@ fn enabled() -> bool {
|
||||
let me = processthreadsapi::GetCurrentProcess();
|
||||
let mut ret = 0;
|
||||
let r = jobapi::IsProcessInJob(me, 0 as *mut _, &mut ret);
|
||||
assert!(r != 0);
|
||||
if ret == winapi::shared::minwindef::FALSE {
|
||||
assert_ne!(r, 0);
|
||||
if ret == ::winapi::shared::minwindef::FALSE {
|
||||
return true
|
||||
}
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{basic_bin_manifest, main_file, execs, project};
|
||||
use hamcrest::{assert_that, existing_file};
|
||||
|
@ -1,10 +1,4 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
|
||||
use serde_json;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
@ -1,7 +1,4 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate cargo;
|
||||
|
||||
use cargotest;
|
||||
use std::str;
|
||||
use std::fs::{self, File};
|
||||
use std::io::Read;
|
@ -1,7 +1,3 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs};
|
||||
use hamcrest::assert_that;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
|
@ -1,8 +1,4 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate git2;
|
||||
extern crate hamcrest;
|
||||
|
||||
use git2;
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
use std::net::{TcpListener, TcpStream};
|
@ -1,8 +1,4 @@
|
||||
extern crate cargotest;
|
||||
extern crate cargo;
|
||||
extern crate tempdir;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest;
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
use std::env;
|
@ -1,7 +1,4 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest;
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::prelude::*;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::net::TcpListener;
|
||||
use std::thread;
|
||||
use std::process::Command;
|
82
tests/testsuite/lib.rs
Normal file
82
tests/testsuite/lib.rs
Normal file
@ -0,0 +1,82 @@
|
||||
extern crate cargo;
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate tempdir;
|
||||
extern crate bufstream;
|
||||
extern crate git2;
|
||||
extern crate glob;
|
||||
extern crate flate2;
|
||||
extern crate tar;
|
||||
extern crate libc;
|
||||
#[cfg(windows)]
|
||||
extern crate winapi;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
extern crate toml;
|
||||
extern crate url;
|
||||
|
||||
|
||||
mod alt_registry;
|
||||
mod bad_config;
|
||||
mod bad_manifest_path;
|
||||
mod bench;
|
||||
mod build_auth;
|
||||
mod build_lib;
|
||||
mod build;
|
||||
mod build_script_env;
|
||||
mod build_script;
|
||||
mod cargo_alias_config;
|
||||
mod cargo_features;
|
||||
mod cargo_command;
|
||||
mod cfg;
|
||||
mod check;
|
||||
mod clean;
|
||||
mod concurrent;
|
||||
mod config;
|
||||
mod cross_compile;
|
||||
mod cross_publish;
|
||||
mod death;
|
||||
mod dep_info;
|
||||
mod directory;
|
||||
mod doc;
|
||||
mod features;
|
||||
mod fetch;
|
||||
mod freshness;
|
||||
mod generate_lockfile;
|
||||
mod git;
|
||||
mod init;
|
||||
mod install;
|
||||
mod jobserver;
|
||||
mod local_registry;
|
||||
mod lockfile_compat;
|
||||
mod login;
|
||||
mod metadata;
|
||||
mod net_config;
|
||||
mod new;
|
||||
mod overrides;
|
||||
mod package;
|
||||
mod patch;
|
||||
mod path;
|
||||
mod plugins;
|
||||
mod proc_macro;
|
||||
mod profiles;
|
||||
mod publish;
|
||||
mod read_manifest;
|
||||
mod registry;
|
||||
mod required_features;
|
||||
mod resolve;
|
||||
mod run;
|
||||
mod rustc;
|
||||
mod rustdocflags;
|
||||
mod rustdoc;
|
||||
mod rustflags;
|
||||
mod search;
|
||||
mod small_fd_limits;
|
||||
mod test;
|
||||
mod tool_paths;
|
||||
mod verify_project;
|
||||
mod version;
|
||||
mod warn_on_failure;
|
||||
mod workspaces;
|
@ -1,7 +1,3 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::git;
|
||||
use cargotest::support::registry::Package;
|
||||
use cargotest::support::{execs, project, lines_match};
|
@ -1,12 +1,7 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate cargo;
|
||||
extern crate hamcrest;
|
||||
extern crate toml;
|
||||
|
||||
use std::io::prelude::*;
|
||||
use std::fs::{self, File};
|
||||
|
||||
use toml;
|
||||
use cargotest::{ChannelChanger, cargo_process};
|
||||
use cargotest::support::execs;
|
||||
use cargotest::support::registry::registry;
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use hamcrest::assert_that;
|
||||
use cargotest::support::registry::Package;
|
||||
use cargotest::support::{project, execs, basic_bin_manifest, basic_lib_manifest, main_file};
|
||||
@ -193,7 +190,8 @@ fn cargo_metadata_with_deps_and_version() {
|
||||
"req": "^0.0.1",
|
||||
"source": "registry+[..]",
|
||||
"target": null,
|
||||
"uses_default_features": true
|
||||
"uses_default_features": true,
|
||||
"rename": null
|
||||
}
|
||||
],
|
||||
"features": {},
|
||||
@ -228,7 +226,8 @@ fn cargo_metadata_with_deps_and_version() {
|
||||
"req": "*",
|
||||
"source": "registry+[..]",
|
||||
"target": null,
|
||||
"uses_default_features": true
|
||||
"uses_default_features": true,
|
||||
"rename": null
|
||||
}
|
||||
],
|
||||
"features": {},
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs};
|
||||
use hamcrest::assert_that;
|
||||
|
@ -1,12 +1,8 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate tempdir;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
use std::env;
|
||||
|
||||
use cargotest;
|
||||
use cargo::util::ProcessBuilder;
|
||||
use cargotest::process;
|
||||
use cargotest::support::{execs, paths};
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::git;
|
||||
use cargotest::support::paths;
|
||||
use cargotest::support::registry::Package;
|
@ -1,14 +1,9 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate flate2;
|
||||
extern crate git2;
|
||||
extern crate hamcrest;
|
||||
extern crate tar;
|
||||
|
||||
use std;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use git2;
|
||||
use cargotest::{cargo_process, process, ChannelChanger};
|
||||
use cargotest::support::{project, execs, paths, git, path2url, cargo_exe, registry};
|
||||
use cargotest::support::registry::Package;
|
||||
@ -330,10 +325,6 @@ See [..]
|
||||
See [..]
|
||||
[WARNING] [..] file `some_dir[/]dir_deep_3[/]some_dir[/]file` WILL be excluded [..]
|
||||
See [..]
|
||||
[WARNING] [..] file `some_dir[/]dir_deep_4[/]some_dir[/]file` WILL be excluded [..]
|
||||
See [..]
|
||||
[WARNING] [..] file `some_dir[/]dir_deep_5[/]some_dir[/]file` WILL be excluded [..]
|
||||
See [..]
|
||||
[WARNING] [..] file `some_dir[/]file_deep_1` WILL be excluded [..]
|
||||
See [..]
|
||||
[ARCHIVING] [..]
|
||||
@ -1003,4 +994,4 @@ Caused by:
|
||||
|
||||
consider adding `cargo-features = [\"epoch\"]` to the manifest
|
||||
")));
|
||||
}
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate toml;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::{Read, Write};
|
||||
|
||||
use toml;
|
||||
use cargotest::support::git;
|
||||
use cargotest::support::paths;
|
||||
use cargotest::support::registry::Package;
|
@ -1,12 +1,8 @@
|
||||
extern crate cargo;
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
|
||||
use cargo::util::process;
|
||||
use cargotest;
|
||||
use cargotest::sleep_ms;
|
||||
use cargotest::support::paths::{self, CargoPathExt};
|
||||
use cargotest::support::{project, execs, main_file};
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs;
|
||||
use std::env;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::is_nightly;
|
||||
use cargotest::support::{project, execs};
|
||||
use hamcrest::assert_that;
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::env;
|
||||
|
||||
use cargotest::is_nightly;
|
@ -1,8 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate flate2;
|
||||
extern crate hamcrest;
|
||||
extern crate tar;
|
||||
|
||||
use std::io::prelude::*;
|
||||
use std::fs::{self, File};
|
||||
use std::io::SeekFrom;
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs, main_file, basic_bin_manifest};
|
||||
use hamcrest::{assert_that};
|
||||
|
@ -1,8 +1,3 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate url;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
use std::path::PathBuf;
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::is_nightly;
|
||||
use cargotest::install::{cargo_home, has_installed_exe};
|
||||
use cargotest::support::{project, execs};
|
@ -1,8 +1,5 @@
|
||||
#![deny(warnings)]
|
||||
|
||||
extern crate hamcrest;
|
||||
extern crate cargo;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use hamcrest::{assert_that, equal_to, contains, not};
|
@ -1,7 +1,3 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargo::util::paths::dylib_path_envvar;
|
||||
use cargotest::support::{project, execs, path2url};
|
||||
use hamcrest::{assert_that, existing_file};
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{execs, project};
|
||||
use hamcrest::assert_that;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{execs, project};
|
||||
use hamcrest::{assert_that};
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs};
|
||||
use hamcrest::assert_that;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::io::Write;
|
||||
use std::fs::{self, File};
|
||||
|
@ -1,13 +1,9 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
extern crate url;
|
||||
|
||||
use std::fs::{self, File};
|
||||
use std::io::prelude::*;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use cargo::util::ProcessBuilder;
|
||||
use cargotest;
|
||||
use cargotest::support::execs;
|
||||
use cargotest::support::git::repo;
|
||||
use cargotest::support::paths;
|
@ -1,13 +1,9 @@
|
||||
extern crate cargotest;
|
||||
extern crate git2;
|
||||
extern crate hamcrest;
|
||||
extern crate url;
|
||||
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
use git2;
|
||||
use cargotest::support::{execs, project};
|
||||
use cargotest::support::registry::Package;
|
||||
use cargotest::support::paths;
|
@ -1,11 +1,8 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::str;
|
||||
|
||||
use cargo;
|
||||
use cargotest::{sleep_ms, is_nightly, rustc_host};
|
||||
use cargotest::support::{project, execs, basic_bin_manifest, basic_lib_manifest, cargo_exe};
|
||||
use cargotest::support::paths::CargoPathExt;
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::rustc_host;
|
||||
use cargotest::support::{path2url, project, execs};
|
||||
use hamcrest::assert_that;
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs, main_file, basic_bin_manifest};
|
||||
use hamcrest::{assert_that};
|
||||
|
@ -1,7 +1,4 @@
|
||||
extern crate cargo;
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargo;
|
||||
use cargotest::support::{project, execs};
|
||||
use hamcrest::assert_that;
|
||||
|
@ -1,6 +1,3 @@
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use cargotest::support::{project, execs, Project};
|
||||
use cargotest::support::registry::Package;
|
||||
use hamcrest::assert_that;
|
@ -1,7 +1,3 @@
|
||||
#[macro_use]
|
||||
extern crate cargotest;
|
||||
extern crate hamcrest;
|
||||
|
||||
use std::env;
|
||||
use std::fs::{self, File};
|
||||
use std::io::{Read, Write};
|
Loading…
x
Reference in New Issue
Block a user