Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Simplify install #5350

Merged
merged 2 commits into from
Apr 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 12 additions & 20 deletions src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,30 +224,22 @@ fn install_one(
Some(Filesystem::new(config.cwd().join("target-install")))
};

let ws = match overidden_target_dir {
Some(dir) => Workspace::ephemeral(pkg, config, Some(dir), false)?,
None => {
let mut ws = Workspace::new(pkg.manifest_path(), config)?;
ws.set_require_optional_deps(false);
ws
}
};
let ws = Workspace::ephemeral(pkg, config, overidden_target_dir, false)?;
let pkg = ws.current()?;

if from_cwd {
match pkg.manifest().edition() {
Edition::Edition2015 =>
config.shell().warn("To build the current package use `cargo build`, to install the current package run `cargo install --path .`")?
,
Edition::Edition2018 =>
bail!(
"To build the current package use `cargo build`, \
to install the current package run `cargo install --path .`, \
otherwise specify a crate to install from \
crates.io, or use --path or --git to \
specify alternate source"
)
,
Edition::Edition2015 => config.shell().warn(
"To build the current package use `cargo build`, \
to install the current package run `cargo install --path .`",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks!

)?,
Edition::Edition2018 => bail!(
"To build the current package use `cargo build`, \
to install the current package run `cargo install --path .`, \
otherwise specify a crate to install from \
crates.io, or use --path or --git to \
specify alternate source"
),
}
};

Expand Down