Skip to content

"cargo metadata" no longer displays "example" kind if example specifies crate-type #3654

Closed
@ehuss

Description

@ehuss

As of /pull/3556, the cargo metadata command does not output the "kind" as "example" if the example specifies a crate-type. Sample Cargo.toml:

[package]
name = "scratch"
version = "0.0.0"

[[example]]
name = "elib1"
path = "examples/elib1.rs"
crate-type=["staticlib"]

I am working on a tool that uses the metadata output to determine which command-line arguments to pass to Cargo in order to build a target. Without knowing this is an example, it is impossible to know to pass --example.

I am unsure of what the correct solution is. Some ideas:

  • "kind" can display "example" even if it is an ExampleLib.
  • Include an "is_example" field.
  • Include an "args" field that indicates how to build this target.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions