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 with custom bin target causes cargo-semver-check to not find the rustdoc JSON output #162

Closed
liquidev opened this issue Oct 27, 2022 · 2 comments · Fixed by #164
Closed
Labels
C-bug Category: doesn't meet expectations

Comments

@liquidev
Copy link

Steps to reproduce the bug with the above code

To reproduce this setup:

$ cargo new testing --lib
$ cd testing
$ cargo new test2 --bin

To testing/Cargo.toml, append:

[workspace]
members = ["test2"]

To test2/Cargo.toml, append:

[[bin]]
name = "test3-actually"
path = "src/main.rs"

As far as I know cargo-semver-checks requires the crate to be published to crates.io with no way to disable looking for the crate in the index, so this won't be reproducible with a minimal setup like this; however I have run across this issue in Mica - feel free to test based on this commit.

Actual Behaviour

What will happen is cargo semver-checks check-release --workspace will fail, saying it could not find the expected rustdoc output. I haven't published the minimal setup above for obvious reasons, but on mica this can be easily reproduced with the following output:

    Updating index
     Parsing mica v0.5.0 (current)
     Parsing mica v0.5.0 (baseline)
     Parsing mica-cli v0.5.0 (current)
Error: Could not find expected rustdoc output for `mica-cli`: /home/daknus/Coding/Rust/mica/target/semver-checks/target/doc/mica_cli.json

because mica-cli renames its bin target to mica.

Expected Behaviour

cargo-semver-check should not fail and instead find the rustdoc JSON successfully.

Additional Context

What happens is that the custom named bin target causes rustdoc to use that target's name when outputting the JSON file. I have not tested what happens with multiple bin targets.

Debug Output

No response

@liquidev liquidev added the C-bug Category: doesn't meet expectations label Oct 27, 2022
@obi1kenobi
Copy link
Owner

Thanks for the detailed report!

As far as I know cargo-semver-checks requires the crate to be published to crates.io with no way to disable looking for the crate in the index

There are actually multiple ways to load the baseline, only one of which (the default one) requires the crate to be on crates.io:

Baseline:
      --baseline-version <X.Y.Z>
          Version from registry to lookup for a baseline

      --baseline-rev <REV>
          Git revision to lookup for a baseline

      --baseline-root <MANIFEST_ROOT>
          Directory containing baseline crate source

      --baseline-rustdoc <JSON_PATH>
          The rustdoc json file to use as a semver baseline

The above is an excerpt from cargo semver-checks check-release --help.

We should probably do a better job of documenting this in the README as well.

@obi1kenobi
Copy link
Owner

I'm adding a section to the FAQ on this in #165. Thanks for helping point out that this needed to be more obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: doesn't meet expectations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants