Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(cli): Generate rustdoc automatically #80

Merged
merged 9 commits into from
Aug 18, 2022
Merged

Conversation

epage
Copy link
Collaborator

@epage epage commented Aug 17, 2022

The original command-line will work as usual but now

  • If you don't specify --current, it will infer the packages like any other cargo command
  • Instead of --baseline, you can specify --baseline-root and it will search it for relevant manifests for what is in current

clap is enforcing the relationships to make this all work.

I've played with integration tests for this but we'll have to decide how well we want to handle that going forward. I was originally going to do integration tests against all of cargo-semverver's test cases but it was pretty slow :). I did hand test by having two clap directories set to different commits.

--baseline-git will build on this, we'll just clone first. --baseline-version will require a bit more work.

This is best review per-commit to see how it all builds up

Fixes #52

@epage epage requested a review from obi1kenobi August 17, 2022 21:41
Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of good stuff here! Excited to get it merged. Left a few minor suggestions here and there.

src/main.rs Outdated
Comment on lines 71 to 78
let rustdoc = dump::RustDoc::new().deps(false).silence(false);

let rustdoc_paths =
if let Some(current_rustdoc_path) = args.current_rustdoc_path.as_deref() {
vec![(
loader.load_rustdoc("<unknown>")?,
loader.load_rustdoc(&rustdoc, "<unknown>")?,
current_rustdoc_path.to_owned(),
)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this correctly, it seems like this is always generating new rustdoc JSON since new line 71 is always hit, even if there's a current_rustdoc_path set. That doesn't seem right to me?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 71 just creates the rustdoc wrapper. The active loader is what determines whether rustdoc is generated or not.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing RustDoc to RustDocCommand helps a lot here, thanks! To simplify the thought process of the next person to come across this, consider leaving a comment next to let rustdoc mentioning that the command is prepared but not executed, and that the loader gets to choose whether to run it or not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the variable to clarify this is the command. This should clarify that it still needs a call done on it to actually execute.

@obi1kenobi
Copy link
Owner

All this looks good, my remaining comments are nits that I feel like are pretty straightforward and don't need an in-depth review.

If you'd like to merge this, go for it 👍 If you'd prefer to keep polishing (docs, CLI help text, etc.) on this branch before merging, that's fine by me too.

@epage epage merged commit 106a746 into obi1kenobi:main Aug 18, 2022
@epage epage deleted the manifest branch August 18, 2022 01:20
@epage
Copy link
Collaborator Author

epage commented Aug 18, 2022

If you'd like to merge this, go for it 👍 If you'd prefer to keep polishing (docs, CLI help text, etc.) on this branch before merging, that's fine by me too.

I lean towards smaller, independent iterations rather than upfront perfection. Feel free to fix or open issues in anything you see. Otherwise, I'll probably move on to git support and then registry support

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

Successfully merging this pull request may close these issues.

Add --base-manifest-path <path> argument
2 participants