pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let ops = ops::TestOptions {
no_run: options.flag_no_run,
no_fail_fast: false,
debug!("executing; cmd=cargo-build; args={:?}",
env::args().collect::<Vec<_>>());
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
*/
fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
config.configure(flags.flag_verbose,
- flags.flag_quiet,
- &flags.flag_color,
- flags.flag_frozen,
- flags.flag_locked)?;
+ flags.flag_quiet,
+ &flags.flag_color,
+ flags.flag_frozen,
+ flags.flag_locked)?;
init_git_transports(config);
let _token = cargo::util::job::setup();
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
debug!("executing; cmd=cargo-clean; args={:?}", env::args().collect::<Vec<_>>());
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let opts = ops::CleanOptions {
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let ws = Workspace::new(&root, config)?;
ops::fetch(&ws)?;
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
debug!("executing; cmd=cargo-generate-lockfile; args={:?}", env::args().collect::<Vec<_>>());
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let ws = Workspace::new(&root, config)?;
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let Options { flag_url: url, flag_reference: reference, .. } = options;
let url = url.to_url()?;
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
debug!("executing; cmd=cargo-init; args={:?}", env::args().collect::<Vec<_>>());
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let Options { flag_bin, flag_lib, arg_path, flag_name, flag_vcs, .. } = options;
ops::init(opts, config)?;
config.shell().status("Created", format!("{} project",
- if opts_lib { "library" }
- else {"binary (application)"}))?;
+ if opts_lib { "library" }
+ else {"binary (application)"}))?;
Ok(None)
}
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let compile_opts = ops::CompileOptions {
config: config,
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let token = match options.arg_token.clone() {
Some(token) => token,
None => {
pub fn execute(options: Options, config: &Config) -> CliResult<Option<ExportInfo>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let manifest = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let options = OutputMetadataOptions {
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
debug!("executing; cmd=cargo-new; args={:?}", env::args().collect::<Vec<_>>());
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let Options { flag_bin, flag_lib, arg_path, flag_name, flag_vcs, .. } = options;
ops::new(opts, config)?;
config.shell().status("Created", format!("{} `{}` project",
- if opts_lib { "library" }
- else {"binary (application)"},
- arg_path))?;
+ if opts_lib { "library" }
+ else {"binary (application)"},
+ arg_path))?;
Ok(None)
}
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let opts = ops::OwnersOptions {
krate: options.arg_crate,
token: options.flag_token,
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let ws = Workspace::new(&root, config)?;
ops::package(&ws, &ops::PackageOpts {
pub fn execute(options: Options,
config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path.clone(), config.cwd())?;
let ws = Workspace::new(&root, config)?;
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let Options {
flag_token: token,
flag_host: host,
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
debug!("executing; cmd=cargo-rustc; args={:?}",
env::args().collect::<Vec<_>>());
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path,
- config.cwd())?;
+ config.cwd())?;
let mode = match options.flag_profile.as_ref().map(|t| &t[..]) {
Some("dev") | None => CompileMode::Build,
Some("test") => CompileMode::Test,
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path,
- config.cwd())?;
+ config.cwd())?;
let doc_opts = ops::DocOptions {
open_result: options.flag_open,
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let Options {
flag_host: host,
flag_limit: limit,
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = options.flag_root.as_ref().map(|s| &s[..]);
ops::uninstall(root, &options.arg_spec, &options.flag_bin, config)?;
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
debug!("executing; cmd=cargo-update; args={:?}", env::args().collect::<Vec<_>>());
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let update_opts = ops::UpdateOptions {
pub fn execute(args: Flags, config: &Config) -> CliResult<Option<Error>> {
config.configure(args.flag_verbose,
- args.flag_quiet,
- &args.flag_color,
- args.flag_frozen,
- args.flag_locked)?;
+ args.flag_quiet,
+ &args.flag_color,
+ args.flag_frozen,
+ args.flag_locked)?;
let mut contents = String::new();
let filename = args.flag_manifest_path.unwrap_or("Cargo.toml".into());
pub fn execute(options: Options, config: &Config) -> CliResult<Option<()>> {
config.configure(options.flag_verbose,
- options.flag_quiet,
- &options.flag_color,
- options.flag_frozen,
- options.flag_locked)?;
+ options.flag_quiet,
+ &options.flag_color,
+ options.flag_frozen,
+ options.flag_locked)?;
ops::yank(config,
- options.arg_crate,
- options.flag_vers,
- options.flag_token,
- options.flag_index,
- options.flag_undo)?;
+ options.arg_crate,
+ options.flag_vers,
+ options.flag_token,
+ options.flag_index,
+ options.flag_undo)?;
Ok(None)
}
let path = manifest_path.parent().unwrap();
let source_id = SourceId::for_path(path)?;
let (pkg, _) = ops::read_package(&manifest_path, &source_id,
- config)?;
+ config)?;
Ok(pkg)
}
let summary = Rc::new(summary.clone());
let candidate = Candidate { summary: summary, replace: None };
remaining_deps.extend(activate(&mut cx, registry, None, candidate,
- method)?);
+ method)?);
}
// Main resolution loop, this is the workhorse of the resolution algorithm.
trace!("{}[{}]>{} trying {}", parent.name(), cur, dep.name(),
candidate.summary.version());
remaining_deps.extend(activate(&mut cx, registry, Some(&parent),
- candidate, &method)?);
+ candidate, &method)?);
}
Ok(cx)
}
for dep in s.dependencies().iter().filter(|d| d.is_optional()) {
add_feature(s, dep.name(), &mut deps, &mut used,
- &mut visited)?;
+ &mut visited)?;
}
}
Method::Required { features: requested_features, .. } => {
Method::Required { uses_default_features: true, .. } => {
if s.features().get("default").is_some() {
add_feature(s, "default", &mut deps, &mut used,
- &mut visited)?;
+ &mut visited)?;
}
}
Method::Required { uses_default_features: false, .. } => {}
for pkg in all_packages {
if !checked.contains(pkg) {
visit(resolve,
- pkg,
- &summaries,
- &mut HashSet::new(),
- &mut checked)?
+ pkg,
+ &summaries,
+ &mut HashSet::new(),
+ &mut checked)?
}
}
return Ok(());
Entry::Vacant(v) => {
let source_id = SourceId::for_path(key)?;
let pair = ops::read_manifest(&manifest_path, &source_id,
- self.config)?;
+ self.config)?;
let (manifest, _nested_paths) = pair;
Ok(v.insert(match manifest {
EitherManifest::Real(manifest) => {
}
(Some(args), _) => {
let targets = generate_targets(to_builds[0], profiles,
- mode, filter, release)?;
+ mode, filter, release)?;
if targets.len() == 1 {
let (target, profile) = targets[0];
let mut profile = profile.clone();
}
(None, Some(args)) => {
let targets = generate_targets(to_builds[0], profiles,
- mode, filter, release)?;
+ mode, filter, release)?;
if targets.len() == 1 {
let (target, profile) = targets[0];
let mut profile = profile.clone();
(None, None) => {
for &to_build in to_builds.iter() {
let targets = generate_targets(to_build, profiles, mode,
- filter, release)?;
+ filter, release)?;
package_targets.push((to_build, targets));
}
}
}
ops::compile_targets(ws,
- &package_targets,
- &packages,
- &resolve_with_overrides,
- config,
- build_config,
- profiles)?
+ &package_targets,
+ &packages,
+ &resolve_with_overrides,
+ config,
+ build_config,
+ profiles)?
};
ret.to_doc_test = to_builds.iter().map(|&p| p.clone()).collect();
pub fn generate_lockfile(ws: &Workspace) -> CargoResult<()> {
let mut registry = PackageRegistry::new(ws.config())?;
let resolve = ops::resolve_with_previous(&mut registry, ws,
- Method::Everything,
- None, None, &[])?;
+ Method::Everything,
+ None, None, &[])?;
ops::write_pkg_lockfile(ws, &resolve)?;
Ok(())
}
let map = SourceConfigMap::new(config)?;
let (pkg, source) = if source_id.is_git() {
select_pkg(GitSource::new(source_id, config), source_id,
- krate, vers, &mut |git| git.read_packages())?
+ krate, vers, &mut |git| git.read_packages())?
} else if source_id.is_path() {
let path = source_id.url().to_file_path().ok()
.expect("path sources must have a valid path");
specify an alternate source", path.display()))
})?;
select_pkg(PathSource::new(&path, source_id, config),
- source_id, krate, vers,
- &mut |path| path.read_packages())?
+ source_id, krate, vers,
+ &mut |path| path.read_packages())?
} else {
select_pkg(map.load(source_id)?,
- source_id, krate, vers,
- &mut |_| Err(human("must specify a crate to install from \
- crates.io, or use --path or --git to \
- specify alternate source")))?
+ source_id, krate, vers,
+ &mut |_| Err(human("must specify a crate to install from \
+ crates.io, or use --path or --git to \
+ specify alternate source")))?
};
PackageIdSpec::from_package_id(pkg.package_id())
}).collect::<Vec<_>>();
let deps = ops::resolve_dependencies(ws,
- None,
- &opt.features,
- opt.all_features,
- opt.no_default_features,
- &specs)?;
+ None,
+ &opt.features,
+ opt.all_features,
+ opt.no_default_features,
+ &specs)?;
let (packages, resolve) = deps;
let packages = try!(packages.package_ids()
// the target triple as a Path and then just use the file stem as the
// component for the directory name.
if let Some(triple) = triple {
- path.push(Path::new(triple).file_stem()
- .ok_or(human(format!("target was empty")))?);
+ path.push(Path::new(triple).file_stem().ok_or(human(format!("target was empty")))?);
}
path.push(dest);
Layout::at(ws.config(), path)
-> CargoResult<Resolve> {
let prev = ops::load_pkg_lockfile(ws)?;
let resolve = resolve_with_previous(registry, ws,
- Method::Everything,
- prev.as_ref(), None, &[])?;
+ Method::Everything,
+ prev.as_ref(), None, &[])?;
// Avoid writing a lockfile if we are `cargo install`ing a non local package.
if ws.current_opt().map(|pkg| pkg.package_id().source_id().is_path()).unwrap_or(true) {
let mut summaries = Vec::new();
for member in ws.members() {
- registry.add_sources(&[member.package_id().source_id()
- .clone()])?;
+ registry.add_sources(&[member.package_id().source_id().clone()])?;
let method_to_resolve = match method {
// When everything for a workspace we want to be sure to resolve all
// members in the workspace, so propagate the `Method::Everything`.
human(format!("could not parse pattern `{}`: {}", p, e))
})
};
- let exclude = pkg.manifest().exclude().iter()
- .map(|p| parse(p)).collect::<Result<Vec<_>, _>>()?;
- let include = pkg.manifest().include().iter()
- .map(|p| parse(p)).collect::<Result<Vec<_>, _>>()?;
+ let exclude = pkg.manifest().exclude().iter().map(|p| parse(p)).collect::<Result<Vec<_>, _>>()?;
+ let include = pkg.manifest().include().iter().map(|p| parse(p)).collect::<Result<Vec<_>, _>>()?;
let mut filter = |p: &Path| {
let relative_path = util::without_prefix(p, &root).unwrap();
-> CargoResult<FileLock> {
let crate_file = format!("{}-{}.crate", pkg.name(), pkg.version());
let mut crate_file = self.root.open_ro(&crate_file,
- self.config,
- "crate file")?;
+ self.config,
+ "crate file")?;
// If we've already got an unpacked version of this crate, then skip the
// checksum below as it is in theory already verified.
fn config(&self) -> CargoResult<Option<RegistryConfig>> {
let lock = self.index_path.open_ro(Path::new(INDEX_LOCK),
- self.config,
- "the registry index")?;
+ self.config,
+ "the registry index")?;
let path = lock.path().parent().unwrap();
let contents = paths::read(&path.join("config.json"))?;
let config = json::decode(&contents)?;
// Then we actually update the index
self.index_path.create_dir()?;
let lock = self.index_path.open_rw(Path::new(INDEX_LOCK),
- self.config,
- "the registry index")?;
+ self.config,
+ "the registry index")?;
let path = lock.path().parent().unwrap();
self.config.shell().status("Updating",
match state {
State::Exclusive => {
acquire(config, msg, &path,
- &|| f.try_lock_exclusive(),
- &|| f.lock_exclusive())?;
+ &|| f.try_lock_exclusive(),
+ &|| f.lock_exclusive())?;
}
State::Shared => {
acquire(config, msg, &path,
- &|| f.try_lock_shared(),
- &|| f.lock_shared())?;
+ &|| f.try_lock_shared(),
+ &|| f.lock_shared())?;
}
State::Unlocked => {}
pub fn append(path: &Path, contents: &[u8]) -> CargoResult<()> {
(|| -> CargoResult<()> {
let mut f = OpenOptions::new()
- .write(true)
- .append(true)
- .create(true)
- .open(path)?;
+ .write(true)
+ .append(true)
+ .create(true)
+ .open(path)?;
f.write_all(contents)?;
Ok(())
}
// Collect the deps
- process_dependencies(&mut cx, self.dependencies.as_ref(),
- None)?;
- process_dependencies(&mut cx, self.dev_dependencies.as_ref(),
- Some(Kind::Development))?;
- process_dependencies(&mut cx, self.build_dependencies.as_ref(),
- Some(Kind::Build))?;
+ process_dependencies(&mut cx, self.dependencies.as_ref(), None)?;
+ process_dependencies(&mut cx, self.dev_dependencies.as_ref(), Some(Kind::Development))?;
+ process_dependencies(&mut cx, self.build_dependencies.as_ref(), Some(Kind::Build))?;
for (name, platform) in self.target.iter().flat_map(|t| t) {
cx.platform = Some(name.parse()?);
- process_dependencies(&mut cx,
- platform.dependencies.as_ref(),
- None)?;
- process_dependencies(&mut cx,
- platform.build_dependencies.as_ref(),
- Some(Kind::Build))?;
- process_dependencies(&mut cx,
- platform.dev_dependencies.as_ref(),
- Some(Kind::Development))?;
+ process_dependencies(&mut cx, platform.dependencies.as_ref(), None)?;
+ process_dependencies(&mut cx, platform.build_dependencies.as_ref(), Some(Kind::Build))?;
+ process_dependencies(&mut cx, platform.dev_dependencies.as_ref(), Some(Kind::Development))?;
}
replace = self.replace(&mut cx)?;
let exclude = project.exclude.clone().unwrap_or(Vec::new());
let include = project.include.clone().unwrap_or(Vec::new());
- let summary = Summary::new(pkgid, deps,
- self.features.clone()
- .unwrap_or(HashMap::new()))?;
+ let summary = Summary::new(pkgid, deps, self.features.clone() .unwrap_or(HashMap::new()))?;
let metadata = ManifestMetadata {
description: project.description.clone(),
homepage: project.homepage.clone(),
fn match_stdout(&self, actual: &Output) -> ham::MatchResult {
self.match_std(self.expect_stdout.as_ref(), &actual.stdout,
- "stdout", &actual.stderr, false)?;
+ "stdout", &actual.stderr, false)?;
for expect in self.expect_stdout_contains.iter() {
self.match_std(Some(expect), &actual.stdout, "stdout",
- &actual.stderr, true)?;
+ &actual.stderr, true)?;
}
for expect in self.expect_stderr_contains.iter() {
self.match_std(Some(expect), &actual.stderr, "stderr",
- &actual.stdout, true)?;
+ &actual.stdout, true)?;
}
if let Some(ref objects) = self.expect_json {
-> CargoResult<Vec<PackageId>> {
let summary = Summary::new(pkg.clone(), deps, HashMap::new()).unwrap();
let method = Method::Everything;
- Ok(resolver::resolve(&[(summary, method)],
- &[],
- registry)?.iter().map(|p| {
+ Ok(resolver::resolve(&[(summary, method)], &[], registry)?.iter().map(|p| {
p.clone()
}).collect())
}