mirror of
https://github.com/rust-lang/cargo
synced 2024-10-14 19:52:45 +00:00
Update to newest Rust
This commit is contained in:
parent
1bdfb25de6
commit
df9cf06663
128
Cargo.lock
generated
128
Cargo.lock
generated
|
@ -4,22 +4,22 @@ version = "0.0.1-pre"
|
|||
dependencies = [
|
||||
"curl 0.1.0 (git+https://github.com/carllerche/curl-rust)",
|
||||
"docopt 0.6.8 (git+https://github.com/docopt/docopt.rs)",
|
||||
"flate2 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)",
|
||||
"flate2 0.0.3 (git+https://github.com/alexcrichton/flate2-rs)",
|
||||
"git2 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
|
||||
"glob 0.0.1 (git+https://github.com/rust-lang/glob)",
|
||||
"glob 0.0.3 (git+https://github.com/rust-lang/glob)",
|
||||
"hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
|
||||
"registry 0.0.1-pre",
|
||||
"semver 0.1.0 (git+https://github.com/rust-lang/semver)",
|
||||
"tar 0.0.1 (git+https://github.com/alexcrichton/tar-rs)",
|
||||
"time 0.0.1 (git+https://github.com/rust-lang/time)",
|
||||
"toml 0.1.0 (git+https://github.com/alexcrichton/toml-rs)",
|
||||
"semver 0.1.3 (git+https://github.com/rust-lang/semver)",
|
||||
"tar 0.0.3 (git+https://github.com/alexcrichton/tar-rs)",
|
||||
"time 0.0.3 (git+https://github.com/rust-lang/time)",
|
||||
"toml 0.1.2 (git+https://github.com/alexcrichton/toml-rs)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/carllerche/curl-rust#e6e31d8d601bffdf3c9b31993e6ffe3bc8a99618"
|
||||
source = "git+https://github.com/carllerche/curl-rust#c1b96e146f6752353a1e84cca932c628e6bf73af"
|
||||
dependencies = [
|
||||
"curl-sys 0.1.0 (git+https://github.com/carllerche/curl-rust)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||
|
@ -28,7 +28,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "curl-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/carllerche/curl-rust#e6e31d8d601bffdf3c9b31993e6ffe3bc8a99618"
|
||||
source = "git+https://github.com/carllerche/curl-rust#c1b96e146f6752353a1e84cca932c628e6bf73af"
|
||||
dependencies = [
|
||||
"libz-sys 0.0.1 (git+https://github.com/alexcrichton/libz-sys)",
|
||||
"openssl-sys 0.0.1 (git+https://github.com/sfackler/rust-openssl)",
|
||||
|
@ -38,92 +38,35 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "docopt"
|
||||
version = "0.6.8"
|
||||
source = "git+https://github.com/docopt/docopt.rs#911d25c7328c0fdc6499757b9dcb831472e3cc13"
|
||||
|
||||
[[package]]
|
||||
name = "encoding"
|
||||
version = "0.2.1"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
|
||||
dependencies = [
|
||||
"encoding-index-japanese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
"encoding-index-korean 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
"encoding-index-simpchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
"encoding-index-singlebyte 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
"encoding-index-tradchinese 1.0.20140915 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-japanese"
|
||||
version = "1.0.20140915"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
|
||||
dependencies = [
|
||||
"encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-korean"
|
||||
version = "1.0.20140915"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
|
||||
dependencies = [
|
||||
"encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-simpchinese"
|
||||
version = "1.0.20140915"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
|
||||
dependencies = [
|
||||
"encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-singlebyte"
|
||||
version = "1.0.20140915"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
|
||||
dependencies = [
|
||||
"encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-tradchinese"
|
||||
version = "1.0.20140915"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
|
||||
dependencies = [
|
||||
"encoding_index_tests 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_index_tests"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#6a5a95950572590485cbbf64509036b252339205"
|
||||
source = "git+https://github.com/docopt/docopt.rs#be2e3b6b91ab1912d79f1e840d9397dead6e6a6e"
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/flate2-rs#f81e6dc401b2bf32c8274fa1b8327699fb9345c0"
|
||||
version = "0.0.3"
|
||||
source = "git+https://github.com/alexcrichton/flate2-rs#044e4dc2a766bc32fd5ae76bbe958be6e85be481"
|
||||
dependencies = [
|
||||
"miniz-sys 0.0.1 (git+https://github.com/alexcrichton/flate2-rs)",
|
||||
"miniz-sys 0.0.2 (git+https://github.com/alexcrichton/flate2-rs)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/gcc-rs#f25b3ba9c40303781189cc137fb98fffe5b56de7"
|
||||
version = "0.0.2"
|
||||
source = "git+https://github.com/alexcrichton/gcc-rs#903e8f8a2e3766ad3d514404d452dbaa1d3b2d79"
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#f188fc297b00261372bd3b4f7855cd8082e78cfc"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#d0d21ca14b4a410806b577b04c2d29f7f8e45f61"
|
||||
dependencies = [
|
||||
"libgit2-sys 0.0.1 (git+https://github.com/alexcrichton/git2-rs)",
|
||||
"time 0.0.1 (git+https://github.com/rust-lang/time)",
|
||||
"time 0.0.3 (git+https://github.com/rust-lang/time)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/rust-lang/glob#5d7ad1dc2f10f8e23b93c025cf5b984d79cf7169"
|
||||
version = "0.0.3"
|
||||
source = "git+https://github.com/rust-lang/glob#9efe98bd82ad4932819888a94eb933ac618312f0"
|
||||
|
||||
[[package]]
|
||||
name = "hamcrest"
|
||||
|
@ -133,7 +76,7 @@ source = "git+https://github.com/carllerche/hamcrest-rust.git#2b9bd6cdae5dcf08ac
|
|||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#f188fc297b00261372bd3b4f7855cd8082e78cfc"
|
||||
source = "git+https://github.com/alexcrichton/git2-rs#d0d21ca14b4a410806b577b04c2d29f7f8e45f61"
|
||||
dependencies = [
|
||||
"libssh2-sys 0.0.1 (git+https://github.com/alexcrichton/ssh2-rs)",
|
||||
"openssl-sys 0.0.1 (git+https://github.com/sfackler/rust-openssl)",
|
||||
|
@ -143,7 +86,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "libssh2-sys"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/ssh2-rs#6118d76bb383420be32160af866cbe5fc7141f42"
|
||||
source = "git+https://github.com/alexcrichton/ssh2-rs#922531da4c22abe7a216672314315d41769d7fb1"
|
||||
dependencies = [
|
||||
"libz-sys 0.0.1 (git+https://github.com/alexcrichton/libz-sys)",
|
||||
"openssl-sys 0.0.1 (git+https://github.com/sfackler/rust-openssl)",
|
||||
|
@ -160,16 +103,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "miniz-sys"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/flate2-rs#f81e6dc401b2bf32c8274fa1b8327699fb9345c0"
|
||||
version = "0.0.2"
|
||||
source = "git+https://github.com/alexcrichton/flate2-rs#044e4dc2a766bc32fd5ae76bbe958be6e85be481"
|
||||
dependencies = [
|
||||
"gcc 0.0.1 (git+https://github.com/alexcrichton/gcc-rs)",
|
||||
"gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/sfackler/rust-openssl#af5533d936558a77c2de8c5d2d572bb1f89dfada"
|
||||
source = "git+https://github.com/sfackler/rust-openssl#b084ddc7b0fe9c7816fef6e415a05db6ec43fb71"
|
||||
dependencies = [
|
||||
"pkg-config 0.0.1 (git+https://github.com/alexcrichton/pkg-config-rs)",
|
||||
]
|
||||
|
@ -188,32 +131,29 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/rust-lang/semver#1672853e20ef4bde672b08d55de40941d907649a"
|
||||
version = "0.1.3"
|
||||
source = "git+https://github.com/rust-lang/semver#29212953f839337c672d185dde74e14b5dfb1f46"
|
||||
|
||||
[[package]]
|
||||
name = "tar"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/alexcrichton/tar-rs#868632ea0dd36200377af2c445d71d387cba1702"
|
||||
version = "0.0.3"
|
||||
source = "git+https://github.com/alexcrichton/tar-rs#55fa87d43eaf2a54c55ddd245e1c13859a06193c"
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/rust-lang/time#3194d911a136a7bfa3218cdd5bd3379537de4133"
|
||||
version = "0.0.3"
|
||||
source = "git+https://github.com/rust-lang/time#533d3823dbe200aaa2a2599176a6b30579581232"
|
||||
dependencies = [
|
||||
"gcc 0.0.1 (git+https://github.com/alexcrichton/gcc-rs)",
|
||||
"gcc 0.0.2 (git+https://github.com/alexcrichton/gcc-rs)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/alexcrichton/toml-rs#4bb575fdaf5fd88580abbac6fdb057ef76d32251"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/alexcrichton/toml-rs#1e35b001094b20d2452adff305e418591d4000fb"
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-url#c3d32dae4c5641d034a848d42f88db48dd9feb96"
|
||||
dependencies = [
|
||||
"encoding 0.2.1 (git+https://github.com/lifthrasiir/rust-encoding)",
|
||||
]
|
||||
source = "git+https://github.com/servo/rust-url#a838a41263472de966f7ec8db758caa9cc4699a4"
|
||||
|
||||
|
|
|
@ -26,8 +26,9 @@ Options:
|
|||
|
||||
pub fn execute(args: ConfigForKeyFlags,
|
||||
_: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
|
||||
let value = try!(config::get_config(os::getcwd(),
|
||||
args.flag_key.as_slice()).map_err(|_| {
|
||||
let cwd = try!(os::getcwd().map_err(|_|
|
||||
CliError::new("Couldn't determine the current working directory", 1)));
|
||||
let value = try!(config::get_config(cwd, args.flag_key.as_slice()).map_err(|_| {
|
||||
CliError::new("Couldn't load configuration", 1)
|
||||
}));
|
||||
|
||||
|
|
|
@ -25,7 +25,9 @@ Options:
|
|||
|
||||
pub fn execute(args: ConfigListFlags,
|
||||
_: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
|
||||
let configs = try!(config::all_configs(os::getcwd()).map_err(|_|
|
||||
let cwd = try!(os::getcwd().map_err(|_|
|
||||
CliError::new("Couldn't determine the current working directory", 1)));
|
||||
let configs = try!(config::all_configs(cwd).map_err(|_|
|
||||
CliError::new("Couldn't load configuration", 1)));
|
||||
|
||||
if args.flag_human {
|
||||
|
|
|
@ -121,7 +121,7 @@ fn url(s: &str) -> url::ParseResult<Url> {
|
|||
|
||||
fn mapper(scheme: &str) -> url::SchemeType {
|
||||
if scheme == "cargo" {
|
||||
url::RelativeScheme(1)
|
||||
url::SchemeType::Relative(1)
|
||||
} else {
|
||||
url::whatwg_scheme_type_mapper(scheme)
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ impl<'a> PackageRegistry<'a> {
|
|||
// map a dependency though, we just pass it on through.
|
||||
fn lock(&self, summary: Summary) -> Summary {
|
||||
let pair = self.locked.get(summary.get_source_id()).and_then(|map| {
|
||||
map.find_equiv(summary.get_name())
|
||||
map.get(summary.get_name())
|
||||
}).and_then(|vec| {
|
||||
vec.iter().find(|&&(ref id, _)| id == summary.get_package_id())
|
||||
});
|
||||
|
@ -243,7 +243,7 @@ impl<'a> PackageRegistry<'a> {
|
|||
// on.
|
||||
None => {
|
||||
let v = self.locked.get(dep.get_source_id()).and_then(|map| {
|
||||
map.find_equiv(dep.get_name())
|
||||
map.get(dep.get_name())
|
||||
}).and_then(|vec| {
|
||||
vec.iter().find(|&&(ref id, _)| dep.matches_id(id))
|
||||
});
|
||||
|
|
|
@ -32,7 +32,7 @@ impl EncodableResolve {
|
|||
.map(|s| s.to_string());
|
||||
assert!(tmp.insert(pkgid.clone(), precise).is_none(),
|
||||
"a package was referenced twice in the lockfile");
|
||||
g.add(try!(pkg.to_package_id(default)), []);
|
||||
g.add(try!(pkg.to_package_id(default)), &[]);
|
||||
Ok(())
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ pub enum Method<'a> {
|
|||
impl Resolve {
|
||||
fn new(root: PackageId) -> Resolve {
|
||||
let mut g = Graph::new();
|
||||
g.add(root.clone(), []);
|
||||
g.add(root.clone(), &[]);
|
||||
Resolve { graph: g, root: root, features: HashMap::new(), metadata: None }
|
||||
}
|
||||
|
||||
|
@ -251,7 +251,7 @@ fn activate_deps<'a, R: Registry>(cx: Context,
|
|||
None => features.len() == 0,
|
||||
}
|
||||
} else {
|
||||
my_cx.resolve.graph.add(candidate.get_package_id().clone(), []);
|
||||
my_cx.resolve.graph.add(candidate.get_package_id().clone(), &[]);
|
||||
prev.push(candidate.clone());
|
||||
false
|
||||
}
|
||||
|
@ -374,11 +374,10 @@ fn resolve_features<'a>(cx: &mut Context, parent: &'a Summary,
|
|||
// features that correspond to optional dependencies
|
||||
for dep in deps {
|
||||
// weed out optional dependencies, but not those required
|
||||
if dep.is_optional() && !feature_deps.contains_key_equiv(dep.get_name()) {
|
||||
if dep.is_optional() && !feature_deps.contains_key(dep.get_name()) {
|
||||
continue
|
||||
}
|
||||
let mut base = feature_deps.pop_equiv(dep.get_name())
|
||||
.unwrap_or(Vec::new());
|
||||
let mut base = feature_deps.remove(dep.get_name()).unwrap_or(vec![]);
|
||||
for feature in dep.get_features().iter() {
|
||||
base.push(feature.clone());
|
||||
if feature.as_slice().contains("/") {
|
||||
|
@ -451,8 +450,8 @@ fn build_features(s: &Summary, method: Method)
|
|||
}
|
||||
match method {
|
||||
Method::Everything | Method::Required(_, _, true, _) => {
|
||||
if s.get_features().find_equiv("default").is_some() &&
|
||||
!visited.contains_equiv("default") {
|
||||
if s.get_features().get("default").is_some() &&
|
||||
!visited.contains("default") {
|
||||
try!(add_feature(s, "default", &mut deps, &mut used,
|
||||
&mut visited));
|
||||
}
|
||||
|
@ -490,7 +489,7 @@ fn build_features(s: &Summary, method: Method)
|
|||
feat)))
|
||||
}
|
||||
used.insert(feat.to_string());
|
||||
match s.get_features().find_equiv(feat) {
|
||||
match s.get_features().get(feat) {
|
||||
Some(recursive) => {
|
||||
for f in recursive.iter() {
|
||||
try!(add_feature(s, f.as_slice(), deps, used,
|
||||
|
|
|
@ -22,7 +22,7 @@ impl Summary {
|
|||
dependencies: Vec<Dependency>,
|
||||
features: HashMap<String, Vec<String>>) -> CargoResult<Summary> {
|
||||
for dep in dependencies.iter() {
|
||||
if features.find_equiv(dep.get_name()).is_some() {
|
||||
if features.get(dep.get_name()).is_some() {
|
||||
return Err(human(format!("Features and dependencies cannot have \
|
||||
the same name: `{}`", dep.get_name())))
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ impl Summary {
|
|||
let mut parts = dep.as_slice().splitn(1, '/');
|
||||
let dep = parts.next().unwrap();
|
||||
let is_reexport = parts.next().is_some();
|
||||
if !is_reexport && features.find_equiv(dep).is_some() { continue }
|
||||
if !is_reexport && features.get(dep).is_some() { continue }
|
||||
match dependencies.iter().find(|d| d.get_name() == dep) {
|
||||
Some(d) => {
|
||||
if d.is_optional() || is_reexport { continue }
|
||||
|
|
|
@ -41,13 +41,13 @@ pub fn clean(manifest_path: &Path, opts: &mut CleanOptions) -> CargoResult<()> {
|
|||
let pkg = {
|
||||
let mut source = pkgid.get_source_id().load(&mut cfg);
|
||||
try!(source.update());
|
||||
(try!(source.get([pkgid.clone()]))).into_iter().next().unwrap()
|
||||
(try!(source.get(&[pkgid.clone()]))).into_iter().next().unwrap()
|
||||
};
|
||||
|
||||
// Create a compilation context to have access to information like target
|
||||
// filenames and such
|
||||
let srcs = SourceMap::new();
|
||||
let pkgs = PackageSet::new([]);
|
||||
let pkgs = PackageSet::new(&[]);
|
||||
let cx = try!(Context::new("compile", &resolve, &srcs, &pkgs, &mut cfg,
|
||||
Layout::at(root.get_absolute_target_dir()),
|
||||
None, &pkg, Default::default()));
|
||||
|
|
|
@ -83,7 +83,7 @@ pub fn compile_pkg(package: &Package, options: &mut CompileOptions)
|
|||
is not being built"))
|
||||
}
|
||||
|
||||
let user_configs = try!(config::all_configs(os::getcwd()));
|
||||
let user_configs = try!(config::all_configs(try!(os::getcwd())));
|
||||
let override_ids = try!(source_ids_from_config(&user_configs,
|
||||
package.get_root()));
|
||||
let config = try!(Config::new(*shell, jobs, target.clone()));
|
||||
|
@ -159,7 +159,7 @@ fn source_ids_from_config(configs: &HashMap<String, config::ConfigValue>,
|
|||
cur_path: Path) -> CargoResult<Vec<SourceId>> {
|
||||
debug!("loaded config; configs={}", configs);
|
||||
|
||||
let config_paths = match configs.find_equiv("paths") {
|
||||
let config_paths = match configs.get("paths") {
|
||||
Some(cfg) => cfg,
|
||||
None => return Ok(Vec::new())
|
||||
};
|
||||
|
@ -182,7 +182,7 @@ fn source_ids_from_config(configs: &HashMap<String, config::ConfigValue>,
|
|||
fn scrape_build_config(config: &Config,
|
||||
configs: &HashMap<String, config::ConfigValue>)
|
||||
-> CargoResult<ops::BuildConfig> {
|
||||
let target = match configs.find_equiv("target") {
|
||||
let target = match configs.get("target") {
|
||||
None => return Ok(Default::default()),
|
||||
Some(target) => try!(target.table().chain_error(|| {
|
||||
internal("invalid configuration for the key `target`")
|
||||
|
|
|
@ -23,7 +23,7 @@ struct CargoNewConfig {
|
|||
}
|
||||
|
||||
pub fn new(opts: NewOptions, _shell: &mut MultiShell) -> CargoResult<()> {
|
||||
let path = os::getcwd().join(opts.path);
|
||||
let path = try!(os::getcwd()).join(opts.path);
|
||||
if path.exists() {
|
||||
return Err(human(format!("Destination `{}` already exists",
|
||||
path.display())))
|
||||
|
@ -130,19 +130,19 @@ fn discover_author() -> CargoResult<(String, Option<String>)> {
|
|||
}
|
||||
|
||||
fn global_config() -> CargoResult<CargoNewConfig> {
|
||||
let user_configs = try!(config::all_configs(os::getcwd()));
|
||||
let user_configs = try!(config::all_configs(try!(os::getcwd())));
|
||||
let mut cfg = CargoNewConfig {
|
||||
name: None,
|
||||
email: None,
|
||||
git: None,
|
||||
};
|
||||
let cargo_new = match user_configs.find_equiv("cargo-new") {
|
||||
let cargo_new = match user_configs.get("cargo-new") {
|
||||
None => return Ok(cfg),
|
||||
Some(target) => try!(target.table().chain_error(|| {
|
||||
internal("invalid configuration for the key `cargo-new`")
|
||||
})),
|
||||
};
|
||||
cfg.name = match cargo_new.find_equiv("name") {
|
||||
cfg.name = match cargo_new.get("name") {
|
||||
None => None,
|
||||
Some(name) => {
|
||||
Some(try!(name.string().chain_error(|| {
|
||||
|
@ -150,7 +150,7 @@ fn global_config() -> CargoResult<CargoNewConfig> {
|
|||
})).ref0().to_string())
|
||||
}
|
||||
};
|
||||
cfg.email = match cargo_new.find_equiv("email") {
|
||||
cfg.email = match cargo_new.get("email") {
|
||||
None => None,
|
||||
Some(email) => {
|
||||
Some(try!(email.string().chain_error(|| {
|
||||
|
@ -158,7 +158,7 @@ fn global_config() -> CargoResult<CargoNewConfig> {
|
|||
})).ref0().to_string())
|
||||
}
|
||||
};
|
||||
cfg.git = match cargo_new.find_equiv("git") {
|
||||
cfg.git = match cargo_new.get("git") {
|
||||
None => None,
|
||||
Some(git) => {
|
||||
Some(try!(git.boolean().chain_error(|| {
|
||||
|
|
|
@ -175,7 +175,7 @@ fn run_verify(pkg: &Package, shell: &mut MultiShell, tar: &Path)
|
|||
jobs: None,
|
||||
target: None,
|
||||
dev_deps: false,
|
||||
features: [],
|
||||
features: &[],
|
||||
no_default_features: false,
|
||||
spec: None,
|
||||
lib_only: false,
|
||||
|
|
|
@ -45,12 +45,13 @@ pub fn run(manifest_path: &Path,
|
|||
Some(s) => dst.join(s).join(bin.get_name()),
|
||||
None => dst.join(bin.get_name()),
|
||||
};
|
||||
let exe = match exe.path_relative_from(&os::getcwd()) {
|
||||
let exe = match exe.path_relative_from(&try!(os::getcwd())) {
|
||||
Some(path) => path,
|
||||
None => exe,
|
||||
};
|
||||
let process = try!(compile.process(exe, &root))
|
||||
.args(args).cwd(os::getcwd());
|
||||
.args(args)
|
||||
.cwd(try!(os::getcwd()));
|
||||
|
||||
try!(options.shell.status("Running", process.to_string()));
|
||||
Ok(process.exec().err())
|
||||
|
|
|
@ -69,8 +69,8 @@ impl Compilation {
|
|||
search_path.push(self.deps_output.clone());
|
||||
let search_path = try!(util::join_paths(search_path.as_slice(),
|
||||
DynamicLibrary::envvar()));
|
||||
let mut cmd = util::process(cmd).env(DynamicLibrary::envvar(),
|
||||
Some(search_path.as_slice()));
|
||||
let mut cmd = try!(util::process(cmd)).env(
|
||||
DynamicLibrary::envvar(), Some(search_path.as_slice()));
|
||||
for (k, v) in self.extra_env.iter() {
|
||||
cmd = cmd.env(k.as_slice(), v.as_ref().map(|s| s.as_slice()));
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ impl<'a, 'b: 'a> Context<'a, 'b> {
|
|||
/// specified as well as the exe suffix
|
||||
fn filename_parts(target: Option<&str>)
|
||||
-> CargoResult<(Option<(String, String)>, String)> {
|
||||
let process = util::process("rustc")
|
||||
let process = try!(util::process("rustc"))
|
||||
.arg("-")
|
||||
.arg("--crate-name").arg("-")
|
||||
.arg("--crate-type").arg("dylib")
|
||||
|
|
|
@ -46,8 +46,10 @@ pub struct TargetConfig {
|
|||
/// The second element of the tuple returned is the target triple that rustc
|
||||
/// is a host for.
|
||||
pub fn rustc_version() -> CargoResult<(String, String)> {
|
||||
let output = try!(util::process("rustc").arg("-v").arg("verbose")
|
||||
.exec_with_output());
|
||||
let output = try!(try!(util::process("rustc"))
|
||||
.arg("-v")
|
||||
.arg("verbose")
|
||||
.exec_with_output());
|
||||
let output = try!(String::from_utf8(output.output).map_err(|_| {
|
||||
internal("rustc -v didn't return utf8 output")
|
||||
}));
|
||||
|
@ -585,7 +587,7 @@ fn build_base_args(cx: &Context,
|
|||
cmd = cmd.arg("--opt-level").arg(profile.get_opt_level().to_string());
|
||||
}
|
||||
if (target.is_bin() || target.is_staticlib()) && profile.get_lto() {
|
||||
cmd = cmd.args(["-C", "lto"]);
|
||||
cmd = cmd.args(&["-C", "lto"]);
|
||||
} else {
|
||||
// There are some restrictions with LTO and codegen-units, so we
|
||||
// only add codegen units when LTO is not used.
|
||||
|
@ -598,7 +600,7 @@ fn build_base_args(cx: &Context,
|
|||
if profile.get_debug() {
|
||||
cmd = cmd.arg("-g");
|
||||
} else {
|
||||
cmd = cmd.args(["--cfg", "ndebug"]);
|
||||
cmd = cmd.args(&["--cfg", "ndebug"]);
|
||||
}
|
||||
|
||||
if profile.is_test() && profile.uses_test_harness() {
|
||||
|
|
|
@ -26,7 +26,7 @@ pub fn run_tests(manifest_path: &Path,
|
|||
target_name.map_or(true, |target_name| target_name == test_name.as_slice())
|
||||
});
|
||||
|
||||
let cwd = os::getcwd();
|
||||
let cwd = try!(os::getcwd());
|
||||
for &(_, ref exe) in tests_to_run {
|
||||
let to_display = match exe.path_relative_from(&cwd) {
|
||||
Some(path) => path,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::io::File;
|
||||
|
||||
use serialize::{Encodable, Decodable};
|
||||
use toml::{mod, Encoder};
|
||||
use toml::{mod, Encoder, Value};
|
||||
|
||||
use core::{Resolve, resolver, Package, SourceId};
|
||||
use util::CargoResult;
|
||||
|
@ -76,12 +76,12 @@ fn emit_package(dep: &toml::TomlTable, out: &mut String) {
|
|||
}
|
||||
|
||||
if let Some(ref s) = dep.get(&"dependencies".to_string()) {
|
||||
let slice = s.as_slice().unwrap();
|
||||
let slice = Value::as_slice(*s).unwrap();
|
||||
|
||||
if !slice.is_empty() {
|
||||
out.push_str("dependencies = [\n");
|
||||
|
||||
for child in s.as_slice().unwrap().iter() {
|
||||
for child in slice.iter() {
|
||||
out.push_str(format!(" {},\n", child).as_slice());
|
||||
}
|
||||
|
||||
|
|
|
@ -109,14 +109,14 @@ fn transmit(pkg: &Package, tarball: &Path, registry: &mut Registry)
|
|||
}
|
||||
|
||||
pub fn registry_configuration() -> CargoResult<RegistryConfig> {
|
||||
let configs = try!(config::all_configs(os::getcwd()));
|
||||
let registry = match configs.find_equiv("registry") {
|
||||
let configs = try!(config::all_configs(try!(os::getcwd())));
|
||||
let registry = match configs.get("registry") {
|
||||
None => return Ok(RegistryConfig { index: None, token: None }),
|
||||
Some(registry) => try!(registry.table().chain_error(|| {
|
||||
internal("invalid configuration for the key `registry`")
|
||||
})),
|
||||
};
|
||||
let index = match registry.find_equiv("index") {
|
||||
let index = match registry.get("index") {
|
||||
None => None,
|
||||
Some(index) => {
|
||||
Some(try!(index.string().chain_error(|| {
|
||||
|
@ -124,7 +124,7 @@ pub fn registry_configuration() -> CargoResult<RegistryConfig> {
|
|||
})).ref0().to_string())
|
||||
}
|
||||
};
|
||||
let token = match registry.find_equiv("token") {
|
||||
let token = match registry.get("token") {
|
||||
None => None,
|
||||
Some(token) => {
|
||||
Some(try!(token.string().chain_error(|| {
|
||||
|
@ -174,13 +174,13 @@ pub fn http_handle() -> CargoResult<http::Handle> {
|
|||
/// Favor cargo's `http.proxy`, then git's `http.proxy`, then finally a
|
||||
/// HTTP_PROXY env var.
|
||||
pub fn http_proxy() -> CargoResult<Option<String>> {
|
||||
let configs = try!(config::all_configs(os::getcwd()));
|
||||
match configs.find_equiv("http") {
|
||||
let configs = try!(config::all_configs(try!(os::getcwd())));
|
||||
match configs.get("http") {
|
||||
Some(http) => {
|
||||
let http = try!(http.table().chain_error(|| {
|
||||
internal("invalid configuration for the key `http`")
|
||||
}));
|
||||
match http.find_equiv("proxy") {
|
||||
match http.get("proxy") {
|
||||
Some(proxy) => {
|
||||
return Ok(Some(try!(proxy.string().chain_error(|| {
|
||||
internal("invalid configuration for key `http.proxy`")
|
||||
|
@ -207,7 +207,7 @@ pub fn registry_login(shell: &mut MultiShell, token: String) -> CargoResult<()>
|
|||
let config = try!(Config::new(shell, None, None));
|
||||
let RegistryConfig { index, token: _ } = try!(registry_configuration());
|
||||
let mut map = HashMap::new();
|
||||
let p = os::getcwd();
|
||||
let p = try!(os::getcwd());
|
||||
match index {
|
||||
Some(index) => {
|
||||
map.insert("index".to_string(), ConfigValue::String(index, p.clone()));
|
||||
|
|
|
@ -89,7 +89,7 @@ pub fn canonicalize_url(url: &Url) -> Url {
|
|||
|
||||
// Strip a trailing slash
|
||||
match url.scheme_data {
|
||||
url::RelativeSchemeData(ref mut rel) => {
|
||||
url::SchemeData::Relative(ref mut rel) => {
|
||||
if rel.path.last().map(|s| s.is_empty()).unwrap_or(false) {
|
||||
rel.path.pop();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ pub fn canonicalize_url(url: &Url) -> Url {
|
|||
if url.domain() == Some("github.com") {
|
||||
url.scheme = "https".to_string();
|
||||
match url.scheme_data {
|
||||
url::RelativeSchemeData(ref mut rel) => {
|
||||
url::SchemeData::Relative(ref mut rel) => {
|
||||
rel.port = Some(443);
|
||||
rel.default_port = Some(443);
|
||||
let path = mem::replace(&mut rel.path, Vec::new());
|
||||
|
@ -119,7 +119,7 @@ pub fn canonicalize_url(url: &Url) -> Url {
|
|||
|
||||
// Repos generally can be accessed with or w/o '.git'
|
||||
match url.scheme_data {
|
||||
url::RelativeSchemeData(ref mut rel) => {
|
||||
url::SchemeData::Relative(ref mut rel) => {
|
||||
let needs_chopping = {
|
||||
let last = rel.path.last().map(|s| s.as_slice()).unwrap_or("");
|
||||
last.ends_with(".git")
|
||||
|
|
|
@ -357,8 +357,8 @@ impl<'a, 'b> RegistrySource<'a, 'b> {
|
|||
|
||||
/// Parse the on-disk metadata for the package provided
|
||||
fn summaries(&mut self, name: &str) -> CargoResult<&Vec<(Summary, bool)>> {
|
||||
if self.cache.contains_key_equiv(name) {
|
||||
return Ok(self.cache.find_equiv(name).unwrap());
|
||||
if self.cache.contains_key(name) {
|
||||
return Ok(self.cache.get(name).unwrap());
|
||||
}
|
||||
// see module comment for why this is structured the way it is
|
||||
let path = self.checkout_path.clone();
|
||||
|
@ -385,7 +385,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> {
|
|||
Err(..) => Vec::new(),
|
||||
};
|
||||
self.cache.insert(name.to_string(), summaries);
|
||||
Ok(self.cache.find_equiv(name).unwrap())
|
||||
Ok(self.cache.get(name).unwrap())
|
||||
}
|
||||
|
||||
/// Parse a line from the registry's index file into a Summary for a
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::io::process::{ProcessOutput, ProcessExit, ExitStatus, ExitSignal};
|
||||
use std::io::IoError;
|
||||
use std::fmt::{mod, Show, Formatter, FormatError};
|
||||
use std::fmt::{mod, Show, Formatter};
|
||||
use std::str;
|
||||
use serialize::json;
|
||||
use semver;
|
||||
|
@ -107,13 +107,13 @@ impl CargoError for TomlError {
|
|||
|
||||
from_error!(TomlError)
|
||||
|
||||
impl CargoError for FormatError {
|
||||
impl CargoError for fmt::Error {
|
||||
fn description(&self) -> String {
|
||||
"formatting failed".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
from_error!(FormatError)
|
||||
from_error!(fmt::Error)
|
||||
|
||||
impl CargoError for curl::ErrCode {
|
||||
fn description(&self) -> String { self.to_string() }
|
||||
|
|
|
@ -33,14 +33,15 @@ pub fn find_project_manifest(pwd: &Path, file: &str) -> CargoResult<Path> {
|
|||
|
||||
/// Find the root Cargo.toml
|
||||
pub fn find_root_manifest_for_cwd(manifest_path: Option<String>) -> CliResult<Path> {
|
||||
match manifest_path {
|
||||
Some(path) => Ok(Path::new(path)),
|
||||
None => match find_project_manifest(&os::getcwd(), "Cargo.toml") {
|
||||
Ok(x) => Ok(x),
|
||||
Err(_) => Err(CliError::new("Could not find Cargo.toml in this \
|
||||
directory or any parent directory", 102))
|
||||
}
|
||||
}.map(|path| os::make_absolute(&path))
|
||||
manifest_path.map(|path| Ok(Path::new(path))).unwrap_or_else(|| os::getcwd()
|
||||
.map_err(|_| CliError::new("Couldn't determine the current working directory", 103))
|
||||
.and_then(|cwd| find_project_manifest(&cwd, "Cargo.toml")
|
||||
.map_err(|_| CliError::new("Could not find Cargo.toml in this \
|
||||
directory or any parent directory", 102))
|
||||
)
|
||||
)
|
||||
.and_then(|path| os::make_absolute(&path).map_err(|_|
|
||||
CliError::new("Could not determine the absolute path of the manifest", 104)))
|
||||
}
|
||||
|
||||
/// Return the path to the `file` in `pwd`, if it exists.
|
||||
|
|
|
@ -6,7 +6,7 @@ use util::{human, CargoResult};
|
|||
|
||||
pub fn realpath(original: &Path) -> io::IoResult<Path> {
|
||||
static MAX_LINKS_FOLLOWED: uint = 256;
|
||||
let original = os::make_absolute(original);
|
||||
let original = try!(os::make_absolute(original));
|
||||
|
||||
// Right now lstat on windows doesn't work quite well
|
||||
if cfg!(windows) {
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::c_str::CString;
|
|||
use std::io::process::{Command, ProcessOutput, InheritFd};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use util::{ProcessError, process_error};
|
||||
use util::{CargoResult, ProcessError, process_error};
|
||||
|
||||
#[deriving(Clone,PartialEq)]
|
||||
pub struct ProcessBuilder {
|
||||
|
@ -119,11 +119,11 @@ impl ProcessBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn process<T: ToCStr>(cmd: T) -> ProcessBuilder {
|
||||
ProcessBuilder {
|
||||
pub fn process<T: ToCStr>(cmd: T) -> CargoResult<ProcessBuilder> {
|
||||
Ok(ProcessBuilder {
|
||||
program: cmd.to_c_str(),
|
||||
args: Vec::new(),
|
||||
cwd: os::getcwd(),
|
||||
cwd: try!(os::getcwd()),
|
||||
env: HashMap::new(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ impl<'a> ToUrl for &'a Path {
|
|||
|
||||
fn mapper(s: &str) -> url::SchemeType {
|
||||
match s {
|
||||
"git" => url::RelativeScheme(9418),
|
||||
"ssh" => url::RelativeScheme(22),
|
||||
"git" => url::SchemeType::Relative(9418),
|
||||
"ssh" => url::SchemeType::Relative(22),
|
||||
s => url::whatwg_scheme_type_mapper(s),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ pub fn to_manifest(contents: &[u8],
|
|||
layout: Layout)
|
||||
-> CargoResult<(Manifest, Vec<Path>)> {
|
||||
let manifest = layout.root.join("Cargo.toml");
|
||||
let manifest = match manifest.path_relative_from(&os::getcwd()) {
|
||||
let manifest = match manifest.path_relative_from(&try!(os::getcwd())) {
|
||||
Some(path) => path,
|
||||
None => manifest,
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ impl GitRepo {
|
|||
impl HgRepo {
|
||||
pub fn init(path: &Path) -> CargoResult<HgRepo> {
|
||||
let path_str = path.as_str().unwrap();
|
||||
try!(process("hg").arg("init").arg(path_str).exec());
|
||||
try!(try!(process("hg")).arg("init").arg(path_str).exec());
|
||||
return Ok(HgRepo)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ impl Registry {
|
|||
|
||||
pub fn unyank(&mut self, krate: &str, version: &str) -> Result<()> {
|
||||
let body = try!(self.put(format!("/crates/{}/{}/unyank", krate, version),
|
||||
[]));
|
||||
&[]));
|
||||
assert!(json::decode::<R>(body.as_slice()).unwrap().ok);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
2014-11-18
|
||||
2014-11-22
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2014-11-22
|
||||
linux-i386 3204c8a38721199f69d2971db887d1dc71a63825
|
||||
linux-x86_64 39ca0d02eac184bc764ff9c1f645ca361715c5c2
|
||||
macos-i386 ebc1836424c4b3ba49f9adef271c50d2a8e134c0
|
||||
macos-x86_64 a2045e95984b65eab4a704152566f8ab9a3be518
|
||||
winnt-i386 5e0831b14d2e6ee91ef195dfbc4d9699499d5e99
|
||||
winnt-x86_64 d5fa1b58207346061898459955fa7f0b33d77474
|
||||
|
||||
2014-11-11
|
||||
linux-i386 5cbf3346309d303cb954c363097fc4abedf50610
|
||||
linux-x86_64 8c1594e227eca6f23ba02daa5f3cd6150ac88907
|
||||
|
|
|
@ -125,7 +125,7 @@ fn test_resolving_empty_dependency_list() {
|
|||
let res = resolve(pkg_id("root"), Vec::new(),
|
||||
&mut registry(vec!())).unwrap();
|
||||
|
||||
assert_that(&res, equal_to(&names(["root"])));
|
||||
assert_that(&res, equal_to(&names(&["root"])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -133,7 +133,7 @@ fn test_resolving_only_package() {
|
|||
let mut reg = registry(vec!(pkg("foo")));
|
||||
let res = resolve(pkg_id("root"), vec![dep("foo")], &mut reg);
|
||||
|
||||
assert_that(&res.unwrap(), contains(names(["root", "foo"])).exactly());
|
||||
assert_that(&res.unwrap(), contains(names(&["root", "foo"])).exactly());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -141,7 +141,7 @@ fn test_resolving_one_dep() {
|
|||
let mut reg = registry(vec!(pkg("foo"), pkg("bar")));
|
||||
let res = resolve(pkg_id("root"), vec![dep("foo")], &mut reg);
|
||||
|
||||
assert_that(&res.unwrap(), contains(names(["root", "foo"])).exactly());
|
||||
assert_that(&res.unwrap(), contains(names(&["root", "foo"])).exactly());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -150,7 +150,7 @@ fn test_resolving_multiple_deps() {
|
|||
let res = resolve(pkg_id("root"), vec![dep("foo"), dep("baz")],
|
||||
&mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names(["root", "foo", "baz"])).exactly());
|
||||
assert_that(&res, contains(names(&["root", "foo", "baz"])).exactly());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -158,7 +158,7 @@ fn test_resolving_transitive_deps() {
|
|||
let mut reg = registry(vec!(pkg!("foo"), pkg!("bar" => ["foo"])));
|
||||
let res = resolve(pkg_id("root"), vec![dep("bar")], &mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names(["root", "foo", "bar"])));
|
||||
assert_that(&res, contains(names(&["root", "foo", "bar"])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -167,7 +167,7 @@ fn test_resolving_common_transitive_deps() {
|
|||
let res = resolve(pkg_id("root"), vec![dep("foo"), dep("bar")],
|
||||
&mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names(["root", "foo", "bar"])));
|
||||
assert_that(&res, contains(names(&["root", "foo", "bar"])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -181,8 +181,8 @@ fn test_resolving_with_same_name() {
|
|||
dep_loc("bar", "http://second.example.com")],
|
||||
&mut reg);
|
||||
|
||||
let mut names = loc_names([("foo", "http://first.example.com"),
|
||||
("bar", "http://second.example.com")]);
|
||||
let mut names = loc_names(&[("foo", "http://first.example.com"),
|
||||
("bar", "http://second.example.com")]);
|
||||
|
||||
names.push(pkg_id("root"));
|
||||
|
||||
|
@ -202,7 +202,7 @@ fn test_resolving_with_dev_deps() {
|
|||
vec![dep("foo"), dep("baz").kind(Development)],
|
||||
&mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names(["root", "foo", "bar", "baz"])));
|
||||
assert_that(&res, contains(names(&["root", "foo", "bar", "baz"])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -214,8 +214,8 @@ fn resolving_with_many_versions() {
|
|||
|
||||
let res = resolve(pkg_id("root"), vec![dep("foo")], &mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names([("root", "1.0.0"),
|
||||
("foo", "1.0.2")])));
|
||||
assert_that(&res, contains(names(&[("root", "1.0.0"),
|
||||
("foo", "1.0.2")])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -228,8 +228,8 @@ fn resolving_with_specific_version() {
|
|||
let res = resolve(pkg_id("root"), vec![dep_req("foo", "=1.0.1")],
|
||||
&mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names([("root", "1.0.0"),
|
||||
("foo", "1.0.1")])));
|
||||
assert_that(&res, contains(names(&[("root", "1.0.0"),
|
||||
("foo", "1.0.1")])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -259,9 +259,9 @@ fn resolving_backtrack() {
|
|||
dep_req("foo", "^1"),
|
||||
], &mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names([("root", "1.0.0"),
|
||||
("foo", "1.0.1"),
|
||||
("baz", "1.0.0")])));
|
||||
assert_that(&res, contains(names(&[("root", "1.0.0"),
|
||||
("foo", "1.0.1"),
|
||||
("baz", "1.0.0")])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -283,16 +283,16 @@ fn resolving_allows_multiple_compatible_versions() {
|
|||
dep("bar"),
|
||||
], &mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names([("root", "1.0.0"),
|
||||
("foo", "1.0.0"),
|
||||
("foo", "2.0.0"),
|
||||
("foo", "0.1.0"),
|
||||
("foo", "0.2.0"),
|
||||
("d1", "1.0.0"),
|
||||
("d2", "1.0.0"),
|
||||
("d3", "1.0.0"),
|
||||
("d4", "1.0.0"),
|
||||
("bar", "1.0.0")])));
|
||||
assert_that(&res, contains(names(&[("root", "1.0.0"),
|
||||
("foo", "1.0.0"),
|
||||
("foo", "2.0.0"),
|
||||
("foo", "0.1.0"),
|
||||
("foo", "0.2.0"),
|
||||
("d1", "1.0.0"),
|
||||
("d2", "1.0.0"),
|
||||
("d3", "1.0.0"),
|
||||
("d4", "1.0.0"),
|
||||
("bar", "1.0.0")])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -316,10 +316,10 @@ fn resolving_with_deep_backtracking() {
|
|||
dep_req("foo", "1"),
|
||||
], &mut reg).unwrap();
|
||||
|
||||
assert_that(&res, contains(names([("root", "1.0.0"),
|
||||
("foo", "1.0.0"),
|
||||
("bar", "2.0.0"),
|
||||
("baz", "1.0.1")])));
|
||||
assert_that(&res, contains(names(&[("root", "1.0.0"),
|
||||
("foo", "1.0.0"),
|
||||
("bar", "2.0.0"),
|
||||
("baz", "1.0.1")])));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -45,6 +45,6 @@ impl RepoBuilder {
|
|||
let tree = self.repo.find_tree(id).unwrap();
|
||||
let sig = self.repo.signature().unwrap();
|
||||
self.repo.commit(Some("HEAD"), &sig, &sig,
|
||||
"Initial commit", &tree, []).unwrap();
|
||||
"Initial commit", &tree, &[]).unwrap();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::io::process::{ProcessOutput};
|
|||
use std::io;
|
||||
use std::os;
|
||||
use std::path::{Path,BytesContainer};
|
||||
use std::str;
|
||||
use std::str::{mod, Str};
|
||||
use std::vec::Vec;
|
||||
use url::Url;
|
||||
use hamcrest as ham;
|
||||
|
@ -119,6 +119,7 @@ impl ProjectBuilder {
|
|||
|
||||
pub fn process<T: ToCStr>(&self, program: T) -> ProcessBuilder {
|
||||
process(program)
|
||||
.unwrap()
|
||||
.cwd(self.root())
|
||||
.env("HOME", Some(paths::home().display().to_string().as_slice()))
|
||||
}
|
||||
|
@ -296,7 +297,7 @@ impl Execs {
|
|||
|
||||
fn match_std(&self, expected: Option<&String>, actual: &[u8],
|
||||
description: &str, extra: &[u8]) -> ham::MatchResult {
|
||||
match expected.as_ref().map(|s| s.as_slice()) {
|
||||
match expected.map(|s| Str::as_slice(s)) {
|
||||
None => ham::success(),
|
||||
Some(out) => {
|
||||
let actual = match str::from_utf8(actual) {
|
||||
|
@ -516,4 +517,5 @@ pub static PACKAGING: &'static str = " Packaging";
|
|||
pub static DOWNLOADING: &'static str = " Downloading";
|
||||
pub static UPLOADING: &'static str = " Uploading";
|
||||
pub static VERIFYING: &'static str = " Verifying";
|
||||
#[allow(dead_code)]
|
||||
pub static WARNING: &'static str = " Warning";
|
||||
|
|
|
@ -104,7 +104,7 @@ pub fn publish(file: &str, line: &str) {
|
|||
let parent = repo.find_commit(parent).unwrap();
|
||||
repo.commit(Some("HEAD"), &sig, &sig,
|
||||
"Another commit", &tree,
|
||||
[&parent]).unwrap();
|
||||
&[&parent]).unwrap();
|
||||
}
|
||||
|
||||
pub fn pkg(name: &str, vers: &str, deps: &[(&str, &str)], cksum: &str,
|
||||
|
|
|
@ -34,8 +34,10 @@ fn new_path() -> Vec<Path> {
|
|||
test!(list_commands_looks_at_path {
|
||||
let proj = project("list-non-overlapping");
|
||||
let proj = fake_executable(proj, &Path::new("path-test"), "cargo-1");
|
||||
let pr = process(cargo_dir().join("cargo")).cwd(proj.root())
|
||||
.env("HOME", Some(paths::home()));
|
||||
let pr = process(cargo_dir().join("cargo"))
|
||||
.unwrap()
|
||||
.cwd(proj.root())
|
||||
.env("HOME", Some(paths::home()));
|
||||
|
||||
let mut path = new_path();
|
||||
path.push(proj.root().join("path-test"));
|
||||
|
@ -47,7 +49,7 @@ test!(list_commands_looks_at_path {
|
|||
})
|
||||
|
||||
test!(find_closest_biuld_to_build {
|
||||
let pr = process(cargo_dir().join("cargo"))
|
||||
let pr = process(cargo_dir().join("cargo")).unwrap()
|
||||
.arg("biuld").cwd(paths::root())
|
||||
.env("HOME", Some(paths::home()));
|
||||
|
||||
|
@ -62,7 +64,7 @@ Did you mean `build`?
|
|||
|
||||
// if a subcommand is more than 3 edit distance away, we don't make a suggestion
|
||||
test!(find_closest_dont_correct_nonsense {
|
||||
let pr = process(cargo_dir().join("cargo"))
|
||||
let pr = process(cargo_dir().join("cargo")).unwrap()
|
||||
.arg("asdf").cwd(paths::root())
|
||||
.env("HOME", Some(paths::home()));
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ test!(cargo_bench_simple {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("hello\n"));
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
|
||||
|
@ -169,7 +169,7 @@ test!(cargo_bench_failing_test {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("hello\n"));
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
|
||||
|
|
|
@ -7,7 +7,7 @@ fn setup() {
|
|||
test!(cargo_clean_simple {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice());
|
||||
|
||||
assert_that(p.cargo_process("build"), execs().with_status(0));
|
||||
assert_that(&p.build_dir(), existing_dir());
|
||||
|
@ -20,7 +20,7 @@ test!(cargo_clean_simple {
|
|||
test!(different_dir {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice())
|
||||
.file("src/bar/a.rs", "");
|
||||
|
||||
assert_that(p.cargo_process("build"), execs().with_status(0));
|
||||
|
|
|
@ -6,7 +6,6 @@ use support::{ResultTest, project, execs, main_file, basic_bin_manifest};
|
|||
use support::{COMPILING, RUNNING, cargo_dir, ProjectBuilder};
|
||||
use hamcrest::{assert_that, existing_file};
|
||||
use support::paths::PathExt;
|
||||
use cargo;
|
||||
use cargo::util::process;
|
||||
|
||||
fn setup() {
|
||||
|
@ -15,20 +14,20 @@ fn setup() {
|
|||
test!(cargo_compile_simple {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice());
|
||||
|
||||
assert_that(p.cargo_process("build"), execs());
|
||||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("i am foo\n"));
|
||||
})
|
||||
|
||||
test!(cargo_compile_manifest_path {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice());
|
||||
|
||||
assert_that(p.cargo_process("build")
|
||||
.arg("--manifest-path").arg("foo/Cargo.toml")
|
||||
|
@ -187,7 +186,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -222,7 +221,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("test passed\n"));
|
||||
})
|
||||
|
||||
|
@ -242,7 +241,7 @@ test!(cargo_compile_with_nested_deps_inferred {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -280,7 +279,7 @@ test!(cargo_compile_with_nested_deps_inferred {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("test passed\n"));
|
||||
})
|
||||
|
||||
|
@ -300,7 +299,7 @@ test!(cargo_compile_with_nested_deps_correct_bin {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/main.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -338,7 +337,7 @@ test!(cargo_compile_with_nested_deps_correct_bin {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("test passed\n"));
|
||||
})
|
||||
|
||||
|
@ -359,7 +358,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -405,7 +404,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("test passed\n"));
|
||||
})
|
||||
|
||||
|
@ -427,7 +426,7 @@ test!(cargo_compile_with_nested_deps_longhand {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -472,7 +471,7 @@ test!(cargo_compile_with_nested_deps_longhand {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("test passed\n"));
|
||||
})
|
||||
|
||||
|
@ -495,9 +494,9 @@ test!(cargo_compile_with_dep_name_mismatch {
|
|||
|
||||
path = "bar"
|
||||
"#)
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, ["bar"]).as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", basic_bin_manifest("bar").as_slice())
|
||||
.file("bar/src/bar.rs", main_file(r#""i am bar""#, []).as_slice());
|
||||
.file("bar/src/bar.rs", main_file(r#""i am bar""#, &[]).as_slice());
|
||||
|
||||
assert_that(p.cargo_process("build"),
|
||||
execs().with_status(101).with_stderr(format!(
|
||||
|
@ -548,7 +547,7 @@ test!(crate_version_env_vars {
|
|||
assert_that(p.cargo_process("build"), execs().with_status(0));
|
||||
|
||||
assert_that(
|
||||
process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout(format!("0-5-1 @ alpha.1 in {}\n",
|
||||
p.root().display()).as_slice()));
|
||||
|
||||
|
@ -704,14 +703,14 @@ test!(self_dependency {
|
|||
test!(ignore_broken_symlinks {
|
||||
let p = project("foo")
|
||||
.file("Cargo.toml", basic_bin_manifest("foo").as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice())
|
||||
.file("src/foo.rs", main_file(r#""i am foo""#, &[]).as_slice())
|
||||
.symlink("Notafile", "bar");
|
||||
|
||||
assert_that(p.cargo_process("build"), execs());
|
||||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("i am foo\n"));
|
||||
})
|
||||
|
||||
|
@ -918,9 +917,9 @@ test!(explicit_examples {
|
|||
"#);
|
||||
|
||||
assert_that(p.cargo_process("test"), execs());
|
||||
assert_that(process(p.bin("examples/hello")),
|
||||
assert_that(process(p.bin("examples/hello")).unwrap(),
|
||||
execs().with_stdout("Hello, World!\n"));
|
||||
assert_that(process(p.bin("examples/goodbye")),
|
||||
assert_that(process(p.bin("examples/goodbye")).unwrap(),
|
||||
execs().with_stdout("Goodbye, World!\n"));
|
||||
})
|
||||
|
||||
|
@ -947,9 +946,9 @@ test!(implicit_examples {
|
|||
"#);
|
||||
|
||||
assert_that(p.cargo_process("test"), execs().with_status(0));
|
||||
assert_that(process(p.bin("examples/hello")),
|
||||
assert_that(process(p.bin("examples/hello")).unwrap(),
|
||||
execs().with_stdout("Hello, World!\n"));
|
||||
assert_that(process(p.bin("examples/goodbye")),
|
||||
assert_that(process(p.bin("examples/goodbye")).unwrap(),
|
||||
execs().with_stdout("Goodbye, World!\n"));
|
||||
})
|
||||
|
||||
|
@ -967,7 +966,7 @@ test!(standard_build_no_ndebug {
|
|||
"#);
|
||||
|
||||
assert_that(p.cargo_process("build"), execs().with_status(0));
|
||||
assert_that(process(p.bin("foo")), execs().with_stdout("slow\n"));
|
||||
assert_that(process(p.bin("foo")).unwrap(), execs().with_stdout("slow\n"));
|
||||
})
|
||||
|
||||
test!(release_build_ndebug {
|
||||
|
@ -985,7 +984,7 @@ test!(release_build_ndebug {
|
|||
|
||||
assert_that(p.cargo_process("build").arg("--release"),
|
||||
execs().with_status(0));
|
||||
assert_that(process(p.bin("release/foo")), execs().with_stdout("fast\n"));
|
||||
assert_that(process(p.bin("release/foo")).unwrap(), execs().with_stdout("fast\n"));
|
||||
})
|
||||
|
||||
test!(inferred_main_bin {
|
||||
|
@ -1001,7 +1000,7 @@ test!(inferred_main_bin {
|
|||
"#);
|
||||
|
||||
assert_that(p.cargo_process("build"), execs().with_status(0));
|
||||
assert_that(process(p.bin("foo")), execs().with_status(0));
|
||||
assert_that(process(p.bin("foo")).unwrap(), execs().with_status(0));
|
||||
})
|
||||
|
||||
test!(deletion_causes_failure {
|
||||
|
@ -1051,7 +1050,7 @@ test!(bad_cargo_toml_in_target_dir {
|
|||
.file("target/Cargo.toml", "bad-toml");
|
||||
|
||||
assert_that(p.cargo_process("build"), execs().with_status(0));
|
||||
assert_that(process(p.bin("foo")), execs().with_status(0));
|
||||
assert_that(process(p.bin("foo")).unwrap(), execs().with_status(0));
|
||||
})
|
||||
|
||||
test!(lib_with_standard_name {
|
||||
|
@ -1370,7 +1369,7 @@ test!(cargo_platform_specific_dependency {
|
|||
path = "bar"
|
||||
"#)
|
||||
.file("src/main.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -1391,7 +1390,7 @@ test!(cargo_platform_specific_dependency {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("test passed\n"));
|
||||
})
|
||||
|
||||
|
@ -1411,7 +1410,7 @@ test!(cargo_platform_specific_dependency {
|
|||
path = "bar"
|
||||
"#)
|
||||
.file("src/main.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -1464,7 +1463,7 @@ test!(cargo_platform_specific_dependency_wrong_platform {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs());
|
||||
|
||||
let lockfile = p.root().join("Cargo.lock");
|
||||
|
|
|
@ -83,7 +83,7 @@ test!(custom_build_env_vars {
|
|||
|
||||
let out = os::getenv("CARGO_MANIFEST_DIR").unwrap();
|
||||
let p1 = Path::new(out);
|
||||
let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path());
|
||||
let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path()).unwrap();
|
||||
assert!(p1 == p2, "{{}} != {{}}", p1.display(), p2.display());
|
||||
|
||||
let opt = os::getenv("OPT_LEVEL").unwrap();
|
||||
|
|
|
@ -112,7 +112,7 @@ test!(cargo_compile_simple_git_dep {
|
|||
|
||||
name = "foo"
|
||||
"#, git_project.url()))
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
|
||||
|
||||
let root = project.root();
|
||||
let git_root = git_project.root();
|
||||
|
@ -130,7 +130,7 @@ test!(cargo_compile_simple_git_dep {
|
|||
assert_that(&project.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(project.bin("foo")),
|
||||
cargo::util::process(project.bin("foo")).unwrap(),
|
||||
execs().with_stdout("hello world\n"));
|
||||
})
|
||||
|
||||
|
@ -179,7 +179,7 @@ test!(cargo_compile_git_dep_branch {
|
|||
|
||||
name = "foo"
|
||||
"#, git_project.url()))
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
|
||||
|
||||
let root = project.root();
|
||||
let git_root = git_project.root();
|
||||
|
@ -197,7 +197,7 @@ test!(cargo_compile_git_dep_branch {
|
|||
assert_that(&project.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(project.bin("foo")),
|
||||
cargo::util::process(project.bin("foo")).unwrap(),
|
||||
execs().with_stdout("hello world\n"));
|
||||
})
|
||||
|
||||
|
@ -249,7 +249,7 @@ test!(cargo_compile_git_dep_tag {
|
|||
|
||||
name = "foo"
|
||||
"#, git_project.url()))
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
|
||||
|
||||
let root = project.root();
|
||||
let git_root = git_project.root();
|
||||
|
@ -267,7 +267,7 @@ test!(cargo_compile_git_dep_tag {
|
|||
assert_that(&project.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(project.bin("foo")),
|
||||
cargo::util::process(project.bin("foo")).unwrap(),
|
||||
execs().with_stdout("hello world\n"));
|
||||
})
|
||||
|
||||
|
@ -333,7 +333,7 @@ test!(cargo_compile_with_nested_paths {
|
|||
name = "parent"
|
||||
"#, git_project.url()))
|
||||
.file("src/parent.rs",
|
||||
main_file(r#""{}", dep1::hello()"#, ["dep1"]).as_slice());
|
||||
main_file(r#""{}", dep1::hello()"#, &["dep1"]).as_slice());
|
||||
|
||||
p.cargo_process("build")
|
||||
.exec_with_output()
|
||||
|
@ -342,7 +342,7 @@ test!(cargo_compile_with_nested_paths {
|
|||
assert_that(&p.bin("parent"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("parent")),
|
||||
cargo::util::process(p.bin("parent")).unwrap(),
|
||||
execs().with_stdout("hello world\n"));
|
||||
})
|
||||
|
||||
|
@ -406,7 +406,7 @@ test!(cargo_compile_with_meta_package {
|
|||
name = "parent"
|
||||
"#, git_project.url(), git_project.url()))
|
||||
.file("src/parent.rs",
|
||||
main_file(r#""{} {}", dep1::hello(), dep2::hello()"#, ["dep1", "dep2"]).as_slice());
|
||||
main_file(r#""{} {}", dep1::hello(), dep2::hello()"#, &["dep1", "dep2"]).as_slice());
|
||||
|
||||
p.cargo_process("build")
|
||||
.exec_with_output()
|
||||
|
@ -415,7 +415,7 @@ test!(cargo_compile_with_meta_package {
|
|||
assert_that(&p.bin("parent"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("parent")),
|
||||
cargo::util::process(p.bin("parent")).unwrap(),
|
||||
execs().with_stdout("this is dep1 this is dep2\n"));
|
||||
})
|
||||
|
||||
|
@ -438,13 +438,13 @@ test!(cargo_compile_with_short_ssh_git {
|
|||
|
||||
name = "foo"
|
||||
"#, url))
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
|
||||
.file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, &["dep1"]));
|
||||
|
||||
assert_that(project.cargo_process("build"),
|
||||
execs()
|
||||
.with_stdout("")
|
||||
.with_stderr(format!("Cargo.toml is not a valid manifest\n\n\
|
||||
invalid url `{}`: Relative URL without a base\n", url)));
|
||||
invalid url `{}`: relative URL without a base\n", url)));
|
||||
})
|
||||
|
||||
test!(two_revs_same_deps {
|
||||
|
@ -552,7 +552,7 @@ test!(recompilation {
|
|||
name = "foo"
|
||||
"#, git_project.url()))
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::bar()"#, ["bar"]).as_slice());
|
||||
main_file(r#""{}", bar::bar()"#, &["bar"]).as_slice());
|
||||
|
||||
// First time around we should compile both foo and bar
|
||||
assert_that(p.cargo_process("build"),
|
||||
|
@ -1230,7 +1230,7 @@ test!(git_dep_build_cmd {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -1254,7 +1254,7 @@ test!(git_dep_build_cmd {
|
|||
execs().with_status(0));
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
cargo::util::process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("0\n"));
|
||||
|
||||
// Touching bar.rs.in should cause the `build` command to run again.
|
||||
|
@ -1266,7 +1266,7 @@ test!(git_dep_build_cmd {
|
|||
execs().with_status(0));
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
cargo::util::process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("1\n"));
|
||||
})
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ test!(old_custom_build_env_vars {
|
|||
|
||||
let out = os::getenv("CARGO_MANIFEST_DIR").unwrap();
|
||||
let p1 = Path::new(out);
|
||||
let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path());
|
||||
let p2 = os::make_absolute(&Path::new(file!()).dir_path().dir_path()).unwrap();
|
||||
assert!(p1 == p2, "{{}} != {{}}", p1.display(), p2.display());
|
||||
}}
|
||||
"#,
|
||||
|
|
|
@ -29,7 +29,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -81,7 +81,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
cargo::util::process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("test passed\n"));
|
||||
|
||||
println!("cleaning");
|
||||
|
@ -119,7 +119,7 @@ test!(cargo_compile_with_root_dev_deps {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/main.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice());
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice());
|
||||
let p2 = project("bar")
|
||||
.file("Cargo.toml", r#"
|
||||
[package]
|
||||
|
@ -157,7 +157,7 @@ test!(cargo_compile_with_root_dev_deps_with_testing {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/main.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice());
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice());
|
||||
let p2 = project("bar")
|
||||
.file("Cargo.toml", r#"
|
||||
[package]
|
||||
|
@ -205,7 +205,7 @@ test!(cargo_compile_with_transitive_dev_deps {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -236,7 +236,7 @@ test!(cargo_compile_with_transitive_dev_deps {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
cargo::util::process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("zoidberg\n"));
|
||||
})
|
||||
|
||||
|
@ -457,7 +457,7 @@ test!(nested_deps_recompile {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("src/bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -648,7 +648,7 @@ test!(path_dep_build_cmd {
|
|||
name = "foo"
|
||||
"#)
|
||||
.file("src/foo.rs",
|
||||
main_file(r#""{}", bar::gimme()"#, ["bar"]).as_slice())
|
||||
main_file(r#""{}", bar::gimme()"#, &["bar"]).as_slice())
|
||||
.file("bar/Cargo.toml", r#"
|
||||
[project]
|
||||
|
||||
|
@ -677,7 +677,7 @@ test!(path_dep_build_cmd {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
cargo::util::process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("0\n"));
|
||||
|
||||
// Touching bar.rs.in should cause the `build` command to run again.
|
||||
|
@ -693,7 +693,7 @@ test!(path_dep_build_cmd {
|
|||
COMPILING, p.url())));
|
||||
|
||||
assert_that(
|
||||
cargo::util::process(p.bin("foo")),
|
||||
cargo::util::process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("1\n"));
|
||||
})
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ test!(simple_cross {
|
|||
assert_that(&p.target_bin(target, "foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.target_bin(target, "foo")),
|
||||
process(p.target_bin(target, "foo")).unwrap(),
|
||||
execs().with_status(0));
|
||||
})
|
||||
|
||||
|
@ -106,7 +106,7 @@ test!(simple_deps {
|
|||
assert_that(&p.target_bin(target, "foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.target_bin(target, "foo")),
|
||||
process(p.target_bin(target, "foo")).unwrap(),
|
||||
execs().with_status(0));
|
||||
})
|
||||
|
||||
|
@ -184,7 +184,7 @@ test!(plugin_deps {
|
|||
assert_that(&foo.target_bin(target, "foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(foo.target_bin(target, "foo")),
|
||||
process(foo.target_bin(target, "foo")).unwrap(),
|
||||
execs().with_status(0));
|
||||
})
|
||||
|
||||
|
@ -269,7 +269,7 @@ test!(plugin_to_the_max {
|
|||
assert_that(&foo.target_bin(target, "foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(foo.target_bin(target, "foo")),
|
||||
process(foo.target_bin(target, "foo")).unwrap(),
|
||||
execs().with_status(0));
|
||||
})
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ fn setup() {
|
|||
}
|
||||
|
||||
fn my_process(s: &str) -> ProcessBuilder {
|
||||
process(s)
|
||||
process(s).unwrap()
|
||||
.cwd(paths::root())
|
||||
.env("HOME", Some(paths::home()))
|
||||
}
|
||||
|
||||
fn cargo_process(s: &str) -> ProcessBuilder {
|
||||
process(cargo_dir().join("cargo")).arg(s)
|
||||
process(cargo_dir().join("cargo")).unwrap().arg(s)
|
||||
.cwd(paths::root())
|
||||
.env("HOME", Some(paths::home()))
|
||||
}
|
||||
|
@ -136,9 +136,9 @@ test!(finds_author_username {
|
|||
})
|
||||
|
||||
test!(finds_author_git {
|
||||
my_process("git").args(["config", "--global", "user.name", "bar"])
|
||||
my_process("git").args(&["config", "--global", "user.name", "bar"])
|
||||
.exec().assert();
|
||||
my_process("git").args(["config", "--global", "user.email", "baz"])
|
||||
my_process("git").args(&["config", "--global", "user.email", "baz"])
|
||||
.exec().assert();
|
||||
assert_that(cargo_process("new").arg("foo").env("USER", Some("foo")),
|
||||
execs().with_status(0));
|
||||
|
@ -149,9 +149,9 @@ test!(finds_author_git {
|
|||
})
|
||||
|
||||
test!(author_prefers_cargo {
|
||||
my_process("git").args(["config", "--global", "user.name", "bar"])
|
||||
my_process("git").args(&["config", "--global", "user.name", "bar"])
|
||||
.exec().assert();
|
||||
my_process("git").args(["config", "--global", "user.email", "baz"])
|
||||
my_process("git").args(&["config", "--global", "user.email", "baz"])
|
||||
.exec().assert();
|
||||
let root = paths::root();
|
||||
fs::mkdir(&root.join(".cargo"), USER_RWX).assert();
|
||||
|
|
|
@ -4,7 +4,7 @@ use tar::Archive;
|
|||
use flate2::reader::GzDecoder;
|
||||
|
||||
use support::{project, execs, cargo_dir, ResultTest};
|
||||
use support::{PACKAGING, WARNING, VERIFYING, COMPILING};
|
||||
use support::{PACKAGING, VERIFYING, COMPILING};
|
||||
use hamcrest::{assert_that, existing_file};
|
||||
|
||||
fn setup() {
|
||||
|
|
|
@ -24,7 +24,7 @@ test!(simple {
|
|||
"#)
|
||||
.file("src/main.rs", "fn main() {}");
|
||||
|
||||
r::mock_pkg("bar", "0.0.1", []);
|
||||
r::mock_pkg("bar", "0.0.1", &[]);
|
||||
|
||||
assert_that(p.cargo_process("build"),
|
||||
execs().with_status(0).with_stdout(format!("\
|
||||
|
@ -64,8 +64,8 @@ test!(deps {
|
|||
"#)
|
||||
.file("src/main.rs", "fn main() {}");
|
||||
|
||||
r::mock_pkg("baz", "0.0.1", []);
|
||||
r::mock_pkg("bar", "0.0.1", [("baz", "*")]);
|
||||
r::mock_pkg("baz", "0.0.1", &[]);
|
||||
r::mock_pkg("bar", "0.0.1", &[("baz", "*")]);
|
||||
|
||||
assert_that(p.cargo_process("build"),
|
||||
execs().with_status(0).with_stdout(format!("\
|
||||
|
@ -117,7 +117,7 @@ test!(bad_cksum {
|
|||
"#)
|
||||
.file("src/main.rs", "fn main() {}");
|
||||
|
||||
r::mock_pkg("bad-cksum", "0.0.1", []);
|
||||
r::mock_pkg("bad-cksum", "0.0.1", &[]);
|
||||
File::create(&r::mock_archive_dst("bad-cksum", "0.0.1")).unwrap();
|
||||
|
||||
assert_that(p.cargo_process("build").arg("-v"),
|
||||
|
@ -152,7 +152,7 @@ location searched: registry file://[..]
|
|||
version required: >= 0.0.0
|
||||
"));
|
||||
|
||||
r::mock_pkg("notyet", "0.0.1", []);
|
||||
r::mock_pkg("notyet", "0.0.1", &[]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0).with_stdout(format!("\
|
||||
|
@ -202,7 +202,7 @@ location searched: registry file://[..]
|
|||
version required: ^0.0.1
|
||||
"));
|
||||
|
||||
r::mock_pkg("notyet", "0.0.1", []);
|
||||
r::mock_pkg("notyet", "0.0.1", &[]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("package"),
|
||||
execs().with_status(0).with_stdout(format!("\
|
||||
|
@ -236,7 +236,7 @@ test!(lockfile_locks {
|
|||
.file("src/main.rs", "fn main() {}");
|
||||
p.build();
|
||||
|
||||
r::mock_pkg("bar", "0.0.1", []);
|
||||
r::mock_pkg("bar", "0.0.1", &[]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0).with_stdout(format!("\
|
||||
|
@ -248,7 +248,7 @@ test!(lockfile_locks {
|
|||
dir = p.url()).as_slice()));
|
||||
|
||||
p.root().move_into_the_past().unwrap();
|
||||
r::mock_pkg("bar", "0.0.2", []);
|
||||
r::mock_pkg("bar", "0.0.2", &[]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0).with_stdout(""));
|
||||
|
@ -268,8 +268,8 @@ test!(lockfile_locks_transitively {
|
|||
.file("src/main.rs", "fn main() {}");
|
||||
p.build();
|
||||
|
||||
r::mock_pkg("baz", "0.0.1", []);
|
||||
r::mock_pkg("bar", "0.0.1", [("baz", "*")]);
|
||||
r::mock_pkg("baz", "0.0.1", &[]);
|
||||
r::mock_pkg("bar", "0.0.1", &[("baz", "*")]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0).with_stdout(format!("\
|
||||
|
@ -283,8 +283,8 @@ test!(lockfile_locks_transitively {
|
|||
dir = p.url()).as_slice()));
|
||||
|
||||
p.root().move_into_the_past().unwrap();
|
||||
r::mock_pkg("baz", "0.0.2", []);
|
||||
r::mock_pkg("bar", "0.0.2", [("baz", "*")]);
|
||||
r::mock_pkg("baz", "0.0.2", &[]);
|
||||
r::mock_pkg("bar", "0.0.2", &[("baz", "*")]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0).with_stdout(""));
|
||||
|
@ -304,10 +304,10 @@ test!(yanks_are_not_used {
|
|||
.file("src/main.rs", "fn main() {}");
|
||||
p.build();
|
||||
|
||||
r::mock_pkg("baz", "0.0.1", []);
|
||||
r::mock_pkg_yank("baz", "0.0.2", [], true);
|
||||
r::mock_pkg("bar", "0.0.1", [("baz", "*")]);
|
||||
r::mock_pkg_yank("bar", "0.0.2", [("baz", "*")], true);
|
||||
r::mock_pkg("baz", "0.0.1", &[]);
|
||||
r::mock_pkg_yank("baz", "0.0.2", &[], true);
|
||||
r::mock_pkg("bar", "0.0.1", &[("baz", "*")]);
|
||||
r::mock_pkg_yank("bar", "0.0.2", &[("baz", "*")], true);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0).with_stdout(format!("\
|
||||
|
@ -335,9 +335,9 @@ test!(relying_on_a_yank_is_bad {
|
|||
.file("src/main.rs", "fn main() {}");
|
||||
p.build();
|
||||
|
||||
r::mock_pkg("baz", "0.0.1", []);
|
||||
r::mock_pkg_yank("baz", "0.0.2", [], true);
|
||||
r::mock_pkg("bar", "0.0.1", [("baz", "=0.0.2")]);
|
||||
r::mock_pkg("baz", "0.0.1", &[]);
|
||||
r::mock_pkg_yank("baz", "0.0.2", &[], true);
|
||||
r::mock_pkg("bar", "0.0.1", &[("baz", "=0.0.2")]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(101).with_stderr("\
|
||||
|
@ -361,14 +361,14 @@ test!(yanks_in_lockfiles_are_ok {
|
|||
.file("src/main.rs", "fn main() {}");
|
||||
p.build();
|
||||
|
||||
r::mock_pkg("bar", "0.0.1", []);
|
||||
r::mock_pkg("bar", "0.0.1", &[]);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0));
|
||||
|
||||
fs::rmdir_recursive(&r::registry_path().join("3")).unwrap();
|
||||
|
||||
r::mock_pkg_yank("bar", "0.0.1", [], true);
|
||||
r::mock_pkg_yank("bar", "0.0.1", &[], true);
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0).with_stdout(""));
|
||||
|
@ -395,7 +395,7 @@ test!(update_with_lockfile_if_packages_missing {
|
|||
.file("src/main.rs", "fn main() {}");
|
||||
p.build();
|
||||
|
||||
r::mock_pkg("bar", "0.0.1", []);
|
||||
r::mock_pkg("bar", "0.0.1", &[]);
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0));
|
||||
p.root().move_into_the_past().unwrap();
|
||||
|
@ -422,11 +422,11 @@ test!(update_lockfile {
|
|||
.file("src/main.rs", "fn main() {}");
|
||||
p.build();
|
||||
|
||||
r::mock_pkg("bar", "0.0.1", []);
|
||||
r::mock_pkg("bar", "0.0.1", &[]);
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
|
||||
execs().with_status(0));
|
||||
|
||||
r::mock_pkg("bar", "0.0.2", []);
|
||||
r::mock_pkg("bar", "0.0.2", &[]);
|
||||
fs::rmdir_recursive(&paths::home().join(".cargo/registry")).unwrap();
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("update")
|
||||
.arg("-p").arg("bar"),
|
||||
|
|
|
@ -30,7 +30,7 @@ test!(cargo_test_simple {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("hello\n"));
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
|
||||
|
@ -121,7 +121,7 @@ test!(cargo_test_failing_test {
|
|||
assert_that(&p.bin("foo"), existing_file());
|
||||
|
||||
assert_that(
|
||||
process(p.bin("foo")),
|
||||
process(p.bin("foo")).unwrap(),
|
||||
execs().with_stdout("hello\n"));
|
||||
|
||||
assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
|
||||
|
|
Loading…
Reference in a new issue