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

Add "all-features = true" to docs.rs metadata for most crates #12366

Merged
merged 3 commits into from
Mar 8, 2024

Conversation

yrns
Copy link
Contributor

@yrns yrns commented Mar 7, 2024

Objective

Fix missing TextBundle (and many others) which are present in the main crate as default features but optional in the sub-crate. See:

There are probably other instances in other crates that I could track down, but maybe "all-features = true" should be used by default in all sub-crates? Not sure. (There were many.) I only noticed this because rust-analyzer's "open docs" features takes me to the sub-crate, not the main one.

Solution

Add "all-features = true" to docs.rs metadata for crates that use features.

Changelog

Changed

  • Unified features documented on docs.rs between main crate and sub-crates

Fixes missing `TextBundle` (and others) which are present in the main
crate as default features but optional in the sub-crate. See:

- https://docs.rs/bevy/0.13.0/bevy/ui/node_bundles/index.html
- https://docs.rs/bevy_ui/0.13.0/bevy_ui/node_bundles/index.html

There are probably other instances in other crates that I could track
down, but maybe "all-features = true" should be used by default in all
sub-crates? Not sure.
@alice-i-cecile alice-i-cecile added C-Docs An addition or correction to our documentation A-UI Graphical user interfaces, styles, layouts, and widgets labels Mar 7, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

Oh clever. Yeah, I think we should actually just turn on all_features in the docs for all of our crates. I've been bitten by that elsewhere too (why doesn't it impl serde?!).

Can you make a PR for that?

@yrns
Copy link
Contributor Author

yrns commented Mar 7, 2024

Can you make a PR for that?

Yep, I'll just push here.

@yrns
Copy link
Contributor Author

yrns commented Mar 7, 2024

I see people using [workspace.metadata.docs.rs] but it apparently doesn't work.

@alice-i-cecile
Copy link
Member

Great :) Can you update your PR description and title?

@yrns yrns changed the title Add bevy_text to bevy_ui docs.rs metadata Add "all-features = true" to docs.rs metadata for most crates Mar 7, 2024
@yrns
Copy link
Contributor Author

yrns commented Mar 7, 2024

Great :) Can you update your PR description and title?

Done.

@mockersf
Copy link
Member

mockersf commented Mar 7, 2024

could you try with doc_auto_cfg to see if that works well to document what is behind features? rust-lang/rust#43781

@yrns
Copy link
Contributor Author

yrns commented Mar 8, 2024

could you try with doc_auto_cfg to see if that works well to document what is behind features? rust-lang/rust#43781

So, add #![cfg_attr(docsrs, feature(doc_auto_cfg))] at the root of every crate? It looks good to me. It requires nightly if you want to build the docs locally with that feature enabled, like: RUSTDOCFLAGS="-Zunstable-options --cfg=docsrs" cargo doc --all-features.

@BD103 BD103 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 8, 2024
@yrns
Copy link
Contributor Author

yrns commented Mar 8, 2024

I added the doc_auto_cfg feature to the same set of crates. It highlights which items are specific to feature or target. It is documented here, and only runs on docs.rs. Might be worth considering using https://github.com/dtolnay/cargo-docs-rs on CI.

@james7132 james7132 added this pull request to the merge queue Mar 8, 2024
Merged via the queue into bevyengine:main with commit 52e3f20 Mar 8, 2024
29 checks passed
spectria-limina pushed a commit to spectria-limina/bevy that referenced this pull request Mar 9, 2024
…gine#12366)

# Objective

Fix missing `TextBundle` (and many others) which are present in the main
crate as default features but optional in the sub-crate. See:

- https://docs.rs/bevy/0.13.0/bevy/ui/node_bundles/index.html
- https://docs.rs/bevy_ui/0.13.0/bevy_ui/node_bundles/index.html

~~There are probably other instances in other crates that I could track
down, but maybe "all-features = true" should be used by default in all
sub-crates? Not sure.~~ (There were many.) I only noticed this because
rust-analyzer's "open docs" features takes me to the sub-crate, not the
main one.

## Solution

Add "all-features = true" to docs.rs metadata for crates that use
features.

## Changelog

### Changed

- Unified features documented on docs.rs between main crate and
sub-crates
@yrns yrns deleted the ui-text-docs branch March 11, 2024 15:23
github-merge-queue bot pushed a commit that referenced this pull request Mar 23, 2024
# Objective

- In #12366 `![cfg_attr(docsrs, feature(doc_auto_cfg))] `was added. But
to apply it it needs `--cfg=docsrs` in rustdoc-args.


## Solution

- Apply `--cfg=docsrs` to all crates and CI.

I also added `[package.metadata.docs.rs]` to all crates to avoid adding
code behind a feature and forget adding the metadata.

Before:

![Screenshot 2024-03-22 at 00 51
57](https://github.com/bevyengine/bevy/assets/104745335/6a9dfdaa-8710-4784-852b-5f9b74e3522c)

After:
![Screenshot 2024-03-22 at 00 51
32](https://github.com/bevyengine/bevy/assets/104745335/c5bd6d8e-8ddb-45b3-b844-5ecf9f88961c)
Shatur added a commit to projectharmonia/bevy_replicon_renet that referenced this pull request Jul 20, 2024
Shatur added a commit to projectharmonia/bevy_replicon_renet that referenced this pull request Jul 20, 2024
Shatur added a commit to projectharmonia/bevy_replicon_renet that referenced this pull request Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Docs An addition or correction to our documentation S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants