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

Why isn't manifest_path made available? #187

Closed
ilyvion opened this issue Jul 1, 2022 · 2 comments · Fixed by #195
Closed

Why isn't manifest_path made available? #187

ilyvion opened this issue Jul 1, 2022 · 2 comments · Fixed by #195

Comments

@ilyvion
Copy link

ilyvion commented Jul 1, 2022

I'm writing some code to parse cargo test output, and among the data given I want to grab the manifest_path from a "reason":"compiler-artifact" (i.e. Message::CompilerArtifact(Artifact)), but it's not there. The Artifact type has no manifest_path. It's there in the underlying JSON, so... how do I get to it? Here's an example output line:

{"reason":"compiler-artifact","package_id":"bar 1.2.3 (path+file:///C:/Users/alexs/Documents/Projects/foo/bar)","manifest_path":"C:\\Users\\alexs\\Documents\\Projects\\foo\\bar\\Cargo.toml","target":{"kind":["lib"],"crate_types":["lib"],"name":"bar","src_path":"C:\\Users\\alexs\\Documents\\Projects\\foo\\bar\\lib.rs","edition":"2021","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"1","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":true},"features":[],"filenames":["C:\\Users\\alexs\\Documents\\Projects\\foo\\target\\debug\\deps\\bar-812df0f62c7b9322.exe","C:\\Users\\alexs\\Documents\\Projects\\foo\\target\\debug\\deps\\bar-812df0f62c7b9322.pdb"],"executable":"C:\\Users\\alexs\\Documents\\Projects\\foo\\target\\debug\\deps\\bar-812df0f62c7b9322.exe","fresh":true}

and output in Message::parse_stream:

Artifact {
    package_id: PackageId {
        repr: "bar 1.2.3 (path+file:///C:/Users/alexs/Documents/Projects/foo/bar)",
    },
    target: Target {
        name: "bar",
        kind: [
            "lib",
        ],
        crate_types: [
            "lib",
        ],
        required_features: [],
        src_path: "C:\\Users\\alexs\\Documents\\Projects\\foo\\bar\\lib.rs",
        edition: E2021,
        doctest: true,
        test: true,
        doc: true,
    },
    profile: ArtifactProfile {
        opt_level: "1",
        debuginfo: Some(
            2,
        ),
        debug_assertions: true,
        overflow_checks: true,
        test: true,
    },
    features: [],
    filenames: [
        "C:\\Users\\alexs\\Documents\\Projects\\foo\\target\\debug\\deps\\bar-812df0f62c7b9322.exe",
        "C:\\Users\\alexs\\Documents\\Projects\\foo\\target\\debug\\deps\\bar-812df0f62c7b9322.pdb",
    ],
    executable: Some(
        "C:\\Users\\alexs\\Documents\\Projects\\foo\\target\\debug\\deps\\bar-812df0f62c7b9322.exe",
    ),
    fresh: true,
}

Unless I'm missing something, it's the only field not present, too. Just my luck!

@oli-obk
Copy link
Owner

oli-obk commented Jul 1, 2022

We probably just forgot to add it. I'll see if I can add a cronjob that will fail if fields are in the json and not the datastructure

@morr0ne
Copy link
Contributor

morr0ne commented Jul 1, 2022

Assuming that this is the most up to date format it might be a good idea to add a ci check that test against that json to see if any field doesn't get parsed.

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

Successfully merging a pull request may close this issue.

3 participants