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

Added optional depends and optdepends keys #11

Closed
wants to merge 2 commits into from
Closed

Added optional depends and optdepends keys #11

wants to merge 2 commits into from

Conversation

margual56
Copy link
Contributor

asciicast

Why?

depends and optdepends are often needed when creating an AUR package. Not "cargo" dependencies, but other programs such as mpv to play videos.

How?

This pull request adds two optional manifest keys: depends and optdepends, which are arrays of strings containing the name of the program's dependencies.

Since they are optional, this version will remain backwards-compatible. Empty arrays will be generated if not present in the Cargo.toml

Possible improvements

  • When compiling, cargo warns about "unused manifest keys" (because depends and optdepends are not valid cargo package keys).

@fosskers
Copy link
Owner

fosskers commented Apr 18, 2022

Thanks for this, this would be a good addition!

I had thought that https://lib.rs/crates/cargo-readme did something similar, where it would look for a badges key. Is there not a way to tell Cargo "Hey this is a custom key that I'm using elsewhere, don't worry about it"?

@margual56
Copy link
Contributor Author

Is there not a way to tell Cargo "Hey this is a custom key that I'm using elsewhere, don't worry about it"?

After some digging, I found that there exists the [package.metadata] table, and indeed with the keys inside that table, no warning is displayed.

I will try to shuffle a couple things and see if I can get stuff parsed from the package.metadata, that should solve the issue :)

@margual56
Copy link
Contributor Author

margual56 commented Apr 18, 2022

That works! I tried to tidy it up somewhat, I hope the formatting and comments are okay.

Open to suggestions 😃

@fosskers
Copy link
Owner

Fantastic, I'll take a look.

@fosskers
Copy link
Owner

Github will show the merge status incorrectly, but this was indeed merged! Check the master branch. Once you've signed off, I'll close this PR.

@fosskers
Copy link
Owner

I've released 1.5.0 with this included.

@margual56
Copy link
Contributor Author

Nice! Thank you 😊

@fosskers fosskers closed this Apr 21, 2022
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 this pull request may close these issues.

None yet

2 participants