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 docs feature #2676

Merged
merged 2 commits into from
Oct 4, 2023
Merged

Add docs feature #2676

merged 2 commits into from
Oct 4, 2023

Conversation

kennykerr
Copy link
Collaborator

This avoids documentation generation when undesired.

Fixes: #2665

riverar
riverar previously approved these changes Oct 3, 2023
crates/libs/sys/Cargo.toml Outdated Show resolved Hide resolved
@kennykerr kennykerr changed the title Add doc feature Add docs feature Oct 4, 2023
@kennykerr kennykerr merged commit 41ad38d into master Oct 4, 2023
47 checks passed
@kennykerr kennykerr deleted the doc-feature branch October 4, 2023 12:16
@tim-weis
Copy link
Contributor

tim-weis commented Oct 5, 2023

This took me a moment to comprehend, so I'm leaving a few notes here in case someone else gets confused in the future.

What

This PR gates documentation generation for the windows and windows-sys crates behind a feature named "docs". This feature is disabled by default. Other crates (notably windows-core) are unaffected by this change.

How To

The "docs" feature is intended to be used with cargo doc, exclusively (see feature selection in The Cargo Book). By default, no documentation is generated. To enable documentation generation, e.g., for the windows crate run the following command line:

cargo doc --features windows/docs

Similarly for the windows-sys crate.

How Not To

The "docs" feature is a regular Cargo feature that can be enabled from a Cargo.toml file. Clients of windows and windows-sys, and crate authors in particular, should refrain from doing so, as it would effectively invalidate the ability to generate documentation for windows and windows-sys on client request.

@kennykerr
Copy link
Collaborator Author

Thanks Tim, that's helpful.

@tim-weis
Copy link
Contributor

tim-weis commented Oct 5, 2023

Glad to have you back, Kenny!

@LikeLakers2
Copy link

LikeLakers2 commented Oct 11, 2023

@kennykerr Thanks! :)

@tim-weis Let me add a "why" to your notes.

In most crates, the documentation generated isn't very much - the disk space used is so minimal, and the additional files add very little time to a cargo clean. However, with windows and windows-sys, the opposite is true - they generate so much documentation as to use up quite a bit of disk space, and the amount of files generated cause cargo clean to take forever.

Thus, this feature flag serves to solve that issue, by hiding the documentation unless you ask for it, and thus cut down on the amount of files that the crates generate when you run cargo doc.

Hope that helps. :)


P.S. It appears that my comments at #2665 (the issue this fixes) have restarted the discussion of rust-lang/cargo#4049, a suggestion that allows skipping certain crates from cargo doc. See rust-lang/cargo#4049 (comment).

Maybe windows-sys and windows won't actually need a docs feature for that long?

bors referenced this pull request in rust-lang/cargo Dec 1, 2023
chore(deps): update rust crate windows-sys to 0.52

[![Mend Renovate logo banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [windows-sys](https://github.com/microsoft/windows-rs) | workspace.dependencies | minor | `0.48` -> `0.52` |

---

### Release Notes

<details>
<summary>microsoft/windows-rs (windows-sys)</summary>

### [`v0.52.0`](https://github.com/microsoft/windows-rs/releases/tag/0.52.0)

[Compare Source](https://github.com/microsoft/windows-rs/compare/0.48.0...0.52.0)

This release includes updates to all crates. This includes the first update to the `windows-sys` crate in 8 months. It also includes the first published version of the [riddle](https://crates.io/crates/riddle) tool and the [windows-version](https://crates.io/crates/windows-version) crate.

#### What's Changed

-   Simplify issue templates by [`@&#8203;riverar](https://github.com/riverar)` in [https://github.com/microsoft/windows-rs/pull/2621](https://github.com/microsoft/windows-rs/pull/2621)
-   Switch all crates to Rust edition 2021 by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2620](https://github.com/microsoft/windows-rs/pull/2620)
-   Correct workflow trigger ignore paths by [`@&#8203;riverar](https://github.com/riverar)` in [https://github.com/microsoft/windows-rs/pull/2622](https://github.com/microsoft/windows-rs/pull/2622)
-   Detect unused `bindgen`/`riddle` filters by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2634](https://github.com/microsoft/windows-rs/pull/2634)
-   Fix `BOOLEAN` parameter binding by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2635](https://github.com/microsoft/windows-rs/pull/2635)
-   Provide individual crate readme files by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2645](https://github.com/microsoft/windows-rs/pull/2645)
-   Tweak Win32 error code conversion to handle `HRESULT` input by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2646](https://github.com/microsoft/windows-rs/pull/2646)
-   Remove support for the defunct `StaticLibrary` attribute by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2647](https://github.com/microsoft/windows-rs/pull/2647)
-   Derive `PartialEq`, `Eq`, `Debug`, `Clone` for interfaces by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2651](https://github.com/microsoft/windows-rs/pull/2651)
-   Internal `bindgen` refactoring by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2654](https://github.com/microsoft/windows-rs/pull/2654)
-   Disable signature transformation for `NTSTATUS` by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2658](https://github.com/microsoft/windows-rs/pull/2658)
-   Unhide `query` method on `ComInterface` trait by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2659](https://github.com/microsoft/windows-rs/pull/2659)
-   Harden `QueryInterface` implementation by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2660](https://github.com/microsoft/windows-rs/pull/2660)
-   Mask non-reproducible linker artifacts in libs by [`@&#8203;riverar](https://github.com/riverar)` in [https://github.com/microsoft/windows-rs/pull/2661](https://github.com/microsoft/windows-rs/pull/2661)
-   Slim doc generation by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2671](https://github.com/microsoft/windows-rs/pull/2671)
-   Update SDK and WDK metadata by [`@&#8203;riverar](https://github.com/riverar)` in [https://github.com/microsoft/windows-rs/pull/2664](https://github.com/microsoft/windows-rs/pull/2664)
-   Add feature documentation quotes by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2675](https://github.com/microsoft/windows-rs/pull/2675)
-   Add `docs` feature by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2676](https://github.com/microsoft/windows-rs/pull/2676)
-   Simplify metadata reader by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2682](https://github.com/microsoft/windows-rs/pull/2682)
-   Add bindgen config option to disable generating inner attributes by [`@&#8203;dpaoliello](https://github.com/dpaoliello)` in [https://github.com/microsoft/windows-rs/pull/2683](https://github.com/microsoft/windows-rs/pull/2683)
-   Simplify metadata filtering by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2684](https://github.com/microsoft/windows-rs/pull/2684)
-   Simplify code generation by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2686](https://github.com/microsoft/windows-rs/pull/2686)
-   Fix link from docs.rs to full API documentation by [`@&#8203;ChrisDenton](https://github.com/ChrisDenton)` in [https://github.com/microsoft/windows-rs/pull/2688](https://github.com/microsoft/windows-rs/pull/2688)
-   Optimize tick trimming by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2689](https://github.com/microsoft/windows-rs/pull/2689)
-   Small bindgen refactor and tools refresh by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2695](https://github.com/microsoft/windows-rs/pull/2695)
-   Document `implement` and `interface` macros by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2696](https://github.com/microsoft/windows-rs/pull/2696)
-   Perform checked integral type conversions for APIs by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2699](https://github.com/microsoft/windows-rs/pull/2699)
-   Add `windows-version` crate by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2702](https://github.com/microsoft/windows-rs/pull/2702)
-   Add crate-specific readme files by [`@&#8203;kennykerr](https://github.com/kennykerr)` in [https://github.com/microsoft/windows-rs/pull/2703](https://github.com/microsoft/windows-rs/pull/2703)

#### New Contributors

-   [`@&#8203;dpaoliello](https://github.com/dpaoliello)` made their first contribution in [https://github.com/microsoft/windows-rs/pull/2683](https://github.com/microsoft/windows-rs/pull/2683)

**Full Changelog**: microsoft/windows-rs@0.48.5...0.52.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 5am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/rust-lang/cargo).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->
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.

Hide windows-sys's documentation behind a feature flag?
4 participants