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

Even more manifest path consistency #1955

Merged

Conversation

Projects
None yet
5 participants
@carols10cents
Copy link
Member

carols10cents commented Aug 30, 2015

Hiii :) This builds on #1953, so if yinz like this better, I'll close that one.

This PR makes all commands that take --manifest-path (except locate-project, see below) behave in a consistent way with regards to invalid paths, and hopefully gives better error messages.

This DOES break some instances where commands were "working", ie, completing their command successfully, with some path that they decided was right, not necessarily exactly the path that was passed in though. I'm not sure how this impacts whatever backwards compatibility guarantees cargo has. Given that those cases weren't using a valid path to an existing Cargo.toml, hopefully no one is relying on that behavior?

So locate-project... I'm not sure what to do about that one, exactly... If we define --manifest-path as a path to a Cargo.toml, then uhhhh we've located the project, it's right where you told us it is ;) So I think we should change it to be --search-path or similar? I'm too sleepy to take care of that tonight, so I just left it out of the manifest path tests.

@rust-highfive

This comment has been minimized.

Copy link

rust-highfive commented Aug 30, 2015

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

}
if !fs::metadata(&filename).is_ok() {
fail("invalid", &format!("manifest path `{}` does not exist", filename))
}

This comment has been minimized.

@alexcrichton

alexcrichton Aug 31, 2015

Member

Could this punt over to find_root_manifest_for_cwd?

This comment has been minimized.

@carols10cents

carols10cents Sep 1, 2015

Author Member

Oh! Totally!

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Aug 31, 2015

Looks great to me, thanks @carols10cents! Commands like this (and especially verify-project etc) don't get nearly as much love as they should.

carols10cents added some commits Aug 29, 2015

Add tests for different arguments given to read-manifest
Right now, only passing --manifest-path an absolute path to the
parent directory of a Cargo.toml file works, but I think the other
tests should work as well for consistency with other commands that
optionally take --manifest-path.
Make read-manifest accept consistent manifest-path arguments
And also preserve the existing behavior of accepting an absolute path to
a directory containing a Cargo.toml for backwards compatibility.
Add tests for different arguments given to verify-project
Right now, only passing --manifest-path a path to a Cargo.toml file
works, but I think not specifying a path and verifying the current
working directory, if it has a Cargo.toml, should work as well for
consistency with all the other commands that optionally take
--manifest-path.
Make verify-project able to verify the current working dir project
All other commands use the Cargo.toml in the current directory if
--manifest-path is not specified; this makes verify-project consistent.

@carols10cents carols10cents force-pushed the carols10cents:even-more-manifest-path-consistency branch from 4c12d39 to ead966b Sep 1, 2015

@carols10cents

This comment has been minimized.

Copy link
Member Author

carols10cents commented Sep 1, 2015

@alexcrichton fixed!! Thank you!! ❤️

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Sep 1, 2015

bors added a commit that referenced this pull request Sep 1, 2015

Auto merge of #1955 - carols10cents:even-more-manifest-path-consisten…
…cy, r=alexcrichton

Hiii :) This builds on #1953, so if yinz like this better, I'll close that one.

This PR makes all commands that take `--manifest-path` (except locate-project, see below) behave in a consistent way with regards to invalid paths, and hopefully gives better error messages.

This DOES break some instances where commands were "working", ie, completing their command successfully, with some path that they decided was right, not necessarily exactly the path that was passed in though. I'm not sure how this impacts whatever backwards compatibility guarantees cargo has. Given that those cases weren't using a valid path to an existing Cargo.toml, hopefully no one is relying on that behavior?

So locate-project... I'm not sure what to do about that one, exactly... If we define `--manifest-path` as a path to a Cargo.toml, then uhhhh we've located the project, it's right where you told us it is ;) So I think we should change it to be `--search-path` or similar? I'm too sleepy to take care of that tonight, so I just left it out of the manifest path tests.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Sep 1, 2015

⌛️ Testing commit ead966b with merge 6097937...

@bors

This comment has been minimized.

@bors bors merged commit ead966b into rust-lang:master Sep 1, 2015

3 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@carols10cents carols10cents deleted the carols10cents:even-more-manifest-path-consistency branch Sep 1, 2015

huonw added a commit to huonw/travis-cargo that referenced this pull request Sep 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.