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

Match CI doc testing with docs.rs. #726

Merged
merged 1 commit into from
Nov 5, 2024
Merged

Match CI doc testing with docs.rs. #726

merged 1 commit into from
Nov 5, 2024

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented Nov 5, 2024

  • Treat doc warnings as errors. Historically we've not done so due to various rustdoc bugs giving false positives but I got it to pass without failure right now, so perhaps better times have arrived.
  • Target only x86_64-unknown-linux-gnu on docs.rs as we don't have any platform specific docs.
  • Properly enable example scraping for xilem, xilem_core, and masonry. Fully disable it for xilem_web which does not have examples as Cargo defines them.
  • Pass --all-features at docs.rs to match our CI and reduce the maintenance burden of manually syncing the features list.
  • Enable the doc_auto_cfg feature for docs.rs which will show a little tip next to feature gated functionality informing of the crate feature flag.
  • Replaced [!TIP] with 💡 Tip that was inside <div class="rustdoc-hidden" />. The GitHub specific tip causes a rustdoc error and didn't even render properly.
  • Updated 01_creating_app.md just enough to get rustdoc to pass, but that file needs a bunch of more work, as it is outdated.

Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -5,7 +5,7 @@

<div class="rustdoc-hidden">

> [!TIP]
> 💡 Tip
Copy link
Member

Choose a reason for hiding this comment

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

:( - this rendering is appreciably less obvious, but I can understand the motivation

Moving the <div class="rustdoc-hidden"> into mod.rs should work, if we use the following:
That does move the title below the tip, but that might be just as fine - we don't expect too many people to view it in-situ.

<!-- Copyright 2024 the Xilem Authors -->
<!-- SPDX-License-Identifier: Apache-2.0 -->

> [!TIP]
>
> This file is intended to be read in rustdoc.
> Use `cargo doc --open --package masonry --no-deps`.

</div>

# Building a "To-Do List" app

Leaving it this way is also fine, to be clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well it's better than status quo.

tip

Moving <div class="rustdoc-hidden"> might work indeed, but I'll leave that exercise to someone else as it's orthogonal to my current focus of CI.

features = ["kurbo"]
[[example]]
name = "user_interface"
# This actually enables scraping for all examples, not just this one.
Copy link
Member

Choose a reason for hiding this comment

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

That's janky...

Copy link
Member Author

Choose a reason for hiding this comment

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

Very much so, but I guess it's not stabilized yet so they're going with it.

# rustdoc-scrape-examples tracking issue https://github.com/rust-lang/rust/issues/88791
cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"]

[[example]]
name = "mason"
# This actually enables scraping for all examples, not just this one.
# However it is possible to set doc-scrape-examples to false for other specific examples.
doc-scrape-examples = true
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to disable this for the _android examples?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thankfully it's smart enough to not duplicate the examples, so no.

@xStrom xStrom added this pull request to the merge queue Nov 5, 2024
Merged via the queue into linebender:main with commit 419f8f1 Nov 5, 2024
17 checks passed
@xStrom xStrom deleted the cidoc branch November 5, 2024 11:32
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.

2 participants