Skip to content

Commit

Permalink
Remove cargo xtask doc, only use cargo doc subcommand for book
Browse files Browse the repository at this point in the history
Add features so everything is actually documented
  • Loading branch information
datdenkikniet committed Jul 6, 2023
1 parent 3c44bd8 commit d47d24a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 49 deletions.
12 changes: 9 additions & 3 deletions rtic-monotonics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
//! To enable the implementations, you must enable a feature for the specific MCU you're targeting.
//!
//! # Cortex-M Systick
//! The [`systick`] monotonic works on all cortex-M parts, and requires that the feature `cortex-m-systick` is enabled.
//! The
#![cfg_attr(feature = "cortex-m-systick", doc = "[`systick`]")]
#![cfg_attr(not(feature = "cortex-m-systick"), doc = "`systick`")]
//! monotonic works on all cortex-M parts, and requires that the feature `cortex-m-systick` is enabled.
//!
//! # RP2040
//! The RP2040 monotonics require that the `rp2040` feature is enabled.
//! The
#![cfg_attr(feature = "rp2040", doc = "[`rp2040`]")]
#![cfg_attr(not(feature = "rp2040"), doc = "`rp2040`")]
//! monotonics require that the `rp2040` feature is enabled.
//!
//! # nRF
//! nRF monotonics require that one of the available `nrf52*` features is enabled.
//! The nRF monotonics require that one of the available `nrf52*` features is enabled.
//!
//! All implementations of timers for the nRF52 family are documented here. Monotonics that
//! are not available on all parts in this family will have an `Available on crate features X only`
Expand Down
8 changes: 0 additions & 8 deletions xtask/src/argument_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,6 @@ pub enum Commands {
/// Requires that an ARM target is selected
Run(QemuAndRun),

/// Build docs
///
/// To pass options to `cargo doc`, add `--` and then the following
/// arguments will be passed on
///
/// Example: `cargo xtask doc -- --open`
Doc(DocArgs),

/// Run tests
Test(PackageOpt),

Expand Down
4 changes: 0 additions & 4 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ fn main() -> anyhow::Result<()> {
let ex = args.examples.example_list()?;
qemu_run_examples(globals, &cargologlevel, ex, args.overwrite_expected)
}
Commands::Doc(args) => {
let links = !args.skip_link_check;
cargo_doc(globals, &cargologlevel, &args.arguments, links)
}
Commands::Test(args) => cargo_test(globals, &args),
Commands::Book(args) => {
let links = !args.skip_link_check;
Expand Down
38 changes: 4 additions & 34 deletions xtask/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,39 +344,6 @@ pub fn cargo_format<'c>(
runner.run_and_coalesce()
}

/// Run cargo doc
pub fn cargo_doc<'c>(
globals: &'c Globals,
cargoarg: &'c Option<&'c str>,
arguments: &'c Option<ExtraArguments>,
check_links: bool,
) -> Vec<FinalRunResult<'c>> {
let backend = globals.backend();
info!("Running cargo doc for backend {backend:?}");

let features = Some(backend.to_target().and_features(backend.to_rtic_feature()));

let command = CargoCommand::Doc {
cargoarg,
features,
arguments: arguments.clone(),
deny_warnings: true,
};

let mut results = Vec::new();
let doc = run_and_convert((globals, command, false));
results.push(doc);
if results.iter().any(|r| !r.is_success()) {
return results;
}

if check_links {
let mut links = check_all_api_links(globals);
results.append(&mut links);
}
results
}

/// Run cargo test on the selected package or all packages
///
/// If no package is specified, loop through all packages
Expand Down Expand Up @@ -585,9 +552,12 @@ pub fn cargo_book<'c>(
}
api
} else {
let features = globals.backend().to_rtic_feature().to_string();
let features = format!("rp2040,cortex-m-systick,nrf52840,{features}");

let doc_command = CargoCommand::Doc {
cargoarg: &None,
features: Some(globals.backend().to_rtic_feature().to_string()),
features: Some(features),
arguments: None,
deny_warnings: true,
};
Expand Down

0 comments on commit d47d24a

Please sign in to comment.