Skip to content

Commit

Permalink
Fix docs.rs and test building docs in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Schwender <[email protected]>
  • Loading branch information
jschwe committed Jul 18, 2024
1 parent 82575a9 commit 7ed7915
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --features ${{ matrix.api_level }} --features ${{ matrix.component }}
name: Build minimal features
name: Build minimal features

rustdoc:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Build docs
run: cargo doc --all-features --workspace --no-deps
env:
RUSTDOCFLAGS: "--cfg=docsrs"
18 changes: 18 additions & 0 deletions components/drawing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
//! FFI Bindings for `native_drawing` on OpenHarmony
//!
//! The native drawing module provides APIs for drawing 2D graphics and text.
//! The graphics and text drawn by using the APIs cannot be directly displayed on the screen.
//! To display the drawn graphics and text, you'll need the capabilities provided by the <XComponent> and native window module.
//!
//! Please consult the official documentation for more details: [English docs], [Chinese docs]
//!
//! [English docs]: https://docs.openharmony.cn/pages/v5.0/en/application-dev/graphics/drawing-guidelines.md
//! [Chinese docs]: https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/graphics/drawing-guidelines.md
//!
//! ## Feature flags
#![cfg_attr(
feature = "document-features",
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[link(name = "native_drawing")]
extern "C" {}

Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
feature = "document-features",
cfg_attr(doc, doc = ::document_features::document_features!())
)]
#[cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[cfg(feature = "drawing")]
#[cfg_attr(docsrs, doc(cfg(feature = "drawing")))]
pub mod drawing {
Expand Down

0 comments on commit 7ed7915

Please sign in to comment.