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

Crate type of examples is not included in read-manifest output #3572

Closed
jethrogb opened this issue Jan 20, 2017 · 3 comments
Closed

Crate type of examples is not included in read-manifest output #3572

jethrogb opened this issue Jan 20, 2017 · 3 comments

Comments

@jethrogb
Copy link
Contributor

I have this crate:

[lib]
crate-type = ["staticlib"]

[[example]]
name = "l"
crate-type = ["staticlib"]

This succesfully builds my example into a static library.

However, I this information is not exposed through cargo read-manifest:

$ cargo read-manifest|json_pp
{
   "dependencies" : [],
   "targets" : [
      {
         "name" : "cttest",
         "src_path" : "src/lib.rs",
         "kind" : [
            "staticlib"
         ]
      },
      {
         "kind" : [
            "example"
         ],
         "src_path" : "examples/l.rs",
         "name" : "l"
      }
   ],
...
@matklad
Copy link
Member

matklad commented Jan 23, 2017

Unrelated note: read-manifest is deprecated, it's better to use cargo metadata or cargo metadata --no-deps.

I think we perhaps don't need TargetKind::Example at all? Instead, we can add an is_example field to Target.

@alexcrichton
Copy link
Member

@matklad yeah I think you're right, its own kind is likely unwarranted now

@carols10cents
Copy link
Member

When I have a project with a Cargo.toml like this:

[package]
name = "dev-dep-test"
version = "0.1.0"
authors = ["Carol (Nichols || Goulding) <[email protected]>"]

[lib]
crate-type = ["staticlib"]

[[example]]
name = "simple"
crate-type = ["staticlib"]

And this example/simple.rs:

pub fn foo() {}

If I run $ cargo build -q --message-format json --examples, I see in the output "kind": ["example"]:

  "target": {
    "crate_types": [
      "staticlib"
    ],
    "kind": [
      "example"
    ],
    "name": "simple",
    "src_path": "/Users/carolnichols/rust/dev-dep-test/examples/simple.rs"
  }

So I think this can be closed. Please reopen if I'm mistaken! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants