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

metadata: add --no-deps option #2359

Merged
merged 1 commit into from Feb 5, 2016

Conversation

Projects
None yet
5 participants
@matklad
Copy link
Member

matklad commented Feb 5, 2016

closes #2356. The output is not exactly the same as with read-manifest, because I wanted to include the version field.

Tests and implementation is a copy-paste from read-manifest except that this line is omited, because root_package does update anyway.

@rust-highfive

This comment has been minimized.

Copy link

rust-highfive commented Feb 5, 2016

r? @huonw

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

@matklad

This comment has been minimized.

Copy link
Member Author

matklad commented Feb 5, 2016

@rust-highfive rust-highfive assigned alexcrichton and unassigned huonw Feb 5, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 5, 2016

Instead of different encodable formats, perhaps we could tweak the existing one to look like:

 pub struct ExportInfo {
     packages: Vec<Package>,
     resolve: Option<MetadataResolve>,
     version: u32,
 } 

That way with --no-deps you'd just have one package in the array and a null resolve?

@matklad matklad force-pushed the matklad:metadata-no-deps branch 2 times, most recently from 46c0eae to f3ba93e Feb 5, 2016

@matklad

This comment has been minimized.

Copy link
Member Author

matklad commented Feb 5, 2016

That way with --no-deps you'd just have one package in the array and a null resolve?

Makes perfect sense, PR updated.

@@ -22,16 +23,34 @@ pub struct OutputMetadataOptions<'a> {
/// used versions - considering overrides - and writes all dependencies in a JSON
/// format to stdout.
pub fn output_metadata(opt: OutputMetadataOptions, config: &Config) -> CargoResult<ExportInfo> {
assert_eq!(opt.version, VERSION);

This comment has been minimized.

@alexcrichton

alexcrichton Feb 5, 2016

Member

Oh actually, while you're at it, can you change this assertion to a nicer error? For example something along the lines of:

if opt.version != VERSION {
    bail!("metadata version {} not supported, only {} is currently supported", opt.version, VERSION);
}

This comment has been minimized.

@alexcrichton

alexcrichton Feb 5, 2016

Member

(and add a test while you're at it)

This comment has been minimized.

@matklad

matklad Feb 5, 2016

Author Member

Huh, I somehow thought that docopt should check the version automatically. Fixed.

metadata: add --no-deps option
The intention is to eventually deprecate `cargo read-manifest`

@matklad matklad force-pushed the matklad:metadata-no-deps branch from f3ba93e to 80e3c05 Feb 5, 2016

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 5, 2016

bors added a commit that referenced this pull request Feb 5, 2016

Auto merge of #2359 - matklad:metadata-no-deps, r=alexcrichton
closes #2356. The output is not exactly the same as with `read-manifest`, because I wanted to include the `version` field.

Tests and implementation is a copy-paste from `read-manifest` except that [this line](https://github.com/rust-lang/cargo/blob/master/src/bin/read_manifest.rs#L36) is omited, because `root_package` [does update anyway](https://github.com/rust-lang/cargo/blob/master/src/cargo/sources/path.rs#L51).
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 5, 2016

⌛️ Testing commit 80e3c05 with merge ff0d51b...

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 5, 2016

💔 Test failed - cargo-win-msvc-64

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 5, 2016

@bors: retry

On Fri, Feb 5, 2016 at 12:50 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - cargo-win-msvc-64
http://buildbot.rust-lang.org/builders/cargo-win-msvc-64/builds/296


Reply to this email directly or view it on GitHub
#2359 (comment).

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 5, 2016

⌛️ Testing commit 80e3c05 with merge b5e0a45...

bors added a commit that referenced this pull request Feb 5, 2016

Auto merge of #2359 - matklad:metadata-no-deps, r=alexcrichton
closes #2356. The output is not exactly the same as with `read-manifest`, because I wanted to include the `version` field.

Tests and implementation is a copy-paste from `read-manifest` except that [this line](https://github.com/rust-lang/cargo/blob/master/src/bin/read_manifest.rs#L36) is omited, because `root_package` [does update anyway](https://github.com/rust-lang/cargo/blob/master/src/cargo/sources/path.rs#L51).
@bors

This comment has been minimized.

@bors bors merged commit 80e3c05 into rust-lang:master Feb 5, 2016

2 of 3 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@matklad matklad deleted the matklad:metadata-no-deps branch Jun 9, 2016

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.