mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-12-24 03:51:15 -05:00
fix docs building and use a better testing mechanism
This commit is contained in:
parent
36ee09ce42
commit
cdfeb0da74
4 changed files with 46 additions and 38 deletions
|
|
@ -1,9 +1,9 @@
|
|||
@echo off
|
||||
setlocal
|
||||
|
||||
SET BUILD_DOCS=1
|
||||
cargo rustdoc -p veilid-core
|
||||
cargo rustdoc -p veilid-tools
|
||||
cargo rustdoc -p veilid-remote-api
|
||||
cargo install cargo-docs-rs
|
||||
cargo +nightly docs-rs -p veilid-core
|
||||
cargo +nightly docs-rs -p veilid-tools
|
||||
cargo +nightly docs-rs -p veilid-remote-api
|
||||
|
||||
endlocal
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
#!/bin/bash
|
||||
export BUILD_DOCS=1
|
||||
cargo rustdoc -p veilid-core
|
||||
cargo rustdoc -p veilid-tools
|
||||
cargo rustdoc -p veilid-remote-api
|
||||
|
||||
cargo install cargo-docs-rs
|
||||
cargo +nightly docs-rs -p veilid-core
|
||||
cargo +nightly docs-rs -p veilid-tools
|
||||
cargo +nightly docs-rs -p veilid-remote-api
|
||||
|
|
@ -235,10 +235,13 @@ fn download_geoip_database_files() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rustc-check-cfg=cfg(build_docs,values(none()))");
|
||||
|
||||
if std::env::var("DOCS_RS").is_ok()
|
||||
|| std::env::var("CARGO_CFG_DOC").is_ok()
|
||||
|| std::env::var("BUILD_DOCS").is_ok()
|
||||
{
|
||||
println!("cargo:rustc-cfg=build_docs");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,36 +99,6 @@ pub(crate) mod veilid_capnp {
|
|||
#[doc(hidden)]
|
||||
pub mod tests;
|
||||
|
||||
/// Return the cargo package version of veilid-core in string format.
|
||||
#[must_use]
|
||||
pub fn veilid_version_string() -> String {
|
||||
env!("CARGO_PKG_VERSION").to_owned()
|
||||
}
|
||||
|
||||
/// Return the cargo package version of veilid-core in tuple format.
|
||||
#[must_use]
|
||||
pub fn veilid_version() -> (u32, u32, u32) {
|
||||
(
|
||||
u32::from_str(env!("CARGO_PKG_VERSION_MAJOR")).unwrap(),
|
||||
u32::from_str(env!("CARGO_PKG_VERSION_MINOR")).unwrap(),
|
||||
u32::from_str(env!("CARGO_PKG_VERSION_PATCH")).unwrap(),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(all(not(docsrs), not(doc)))]
|
||||
include!(env!("BOSION_PATH"));
|
||||
|
||||
/// Return the features that were enabled when veilid-core was built.
|
||||
#[must_use]
|
||||
pub fn veilid_features() -> Vec<String> {
|
||||
if cfg!(docsrs) {
|
||||
vec!["default".to_string()]
|
||||
} else {
|
||||
let features = Bosion::CRATE_FEATURES.to_vec();
|
||||
features.into_iter().map(String::from).collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub use intf::android::veilid_core_setup_android;
|
||||
|
||||
|
|
@ -153,3 +123,37 @@ cfg_if::cfg_if! {
|
|||
pub use tsify::*;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// Return the cargo package version of veilid-core in string format.
|
||||
#[must_use]
|
||||
pub fn veilid_version_string() -> String {
|
||||
env!("CARGO_PKG_VERSION").to_owned()
|
||||
}
|
||||
|
||||
/// Return the cargo package version of veilid-core in tuple format.
|
||||
#[must_use]
|
||||
pub fn veilid_version() -> (u32, u32, u32) {
|
||||
(
|
||||
u32::from_str(env!("CARGO_PKG_VERSION_MAJOR")).unwrap(),
|
||||
u32::from_str(env!("CARGO_PKG_VERSION_MINOR")).unwrap(),
|
||||
u32::from_str(env!("CARGO_PKG_VERSION_PATCH")).unwrap(),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(not(build_docs))]
|
||||
include!(env!("BOSION_PATH"));
|
||||
|
||||
/// Return the features that were enabled when veilid-core was built.
|
||||
#[must_use]
|
||||
pub fn veilid_features() -> Vec<String> {
|
||||
cfg_if! {
|
||||
if #[cfg(build_docs)] {
|
||||
vec!["default".to_string()]
|
||||
} else {
|
||||
let features = Bosion::CRATE_FEATURES.to_vec();
|
||||
features.into_iter().map(String::from).collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue