From 7147efa3b8d5d840b8e8291f148fb06eb40b7c96 Mon Sep 17 00:00:00 2001 From: Lyndon Brown Date: Sat, 5 Dec 2020 00:49:37 +0000 Subject: [PATCH] replace use of `dox` feature for bypassing build script pkg-config checks for generation of documentation, the actual system lib is unnecessary. we do not need to do a pkg-config check for it, hence our `dox` feature provided a means of bypass. we already ditched use of that feature for including all feature guarded crate elements within generated documentation in favour of `#[cfg(doc)]` in a previous commit, with that capability having shipped in Rust 1.41. that left the feature only being used in the build scripts. unfortunately cargo does not currently seem to pass along `--cfg doc` or the equivalent environment flag (`CARGO_CFG_DOC`) to build scripts, which is problematic. what has been done here is to use features of the the docs.rs config to have `--cfg doc` passed along to build scripts for documentation generated by the docs.rs service. working around the failure of it getting passed along otherwise. note, the existing config name `doc` was used for this rather than `docsrs` as used for `rustdoc-args` since that's designed for only enabling a nightly only feature for docs.rs, until such time that the feature stablises (using `doc` for that would cause errors building with the stable compiler). there is no such problem using `doc` for other things, mirroring the flag that really should be passed in anyway. this change allows us to ditch the `dox` feature completely, although only generation of docs by docs.rs is affected. users wanting to generate docs locally without having the system lib will now no longer have the `dox` feature flag there to do that. i doubt anyone's going to be affected by that though in reality. --- pulse-binding-mainloop-glib/CHANGELOG.md | 1 + pulse-binding-mainloop-glib/Cargo.toml | 5 +---- pulse-binding-simple/CHANGELOG.md | 1 + pulse-binding-simple/Cargo.toml | 5 +---- pulse-binding/CHANGELOG.md | 1 + pulse-binding/Cargo.toml | 5 +---- pulse-sys-mainloop-glib/CHANGELOG.md | 5 +---- pulse-sys-mainloop-glib/Cargo.toml | 5 +---- pulse-sys-mainloop-glib/build.rs | 10 +++++----- pulse-sys-simple/CHANGELOG.md | 5 +---- pulse-sys-simple/Cargo.toml | 5 +---- pulse-sys-simple/build.rs | 10 +++++----- pulse-sys/CHANGELOG.md | 5 +---- pulse-sys/Cargo.toml | 5 +---- pulse-sys/build.rs | 10 +++++----- 15 files changed, 27 insertions(+), 51 deletions(-) diff --git a/pulse-binding-mainloop-glib/CHANGELOG.md b/pulse-binding-mainloop-glib/CHANGELOG.md index cb157038..2b625029 100644 --- a/pulse-binding-mainloop-glib/CHANGELOG.md +++ b/pulse-binding-mainloop-glib/CHANGELOG.md @@ -1,6 +1,7 @@ # [unreleased] * Made some changes to cargo features: + - Removed the now obsolete `dox` cargo feature. - Removed the `pa_latest` and `pa_latest_common` cargo features. - Changed the default version feature level to `pa_v8`. * MSRV bumped from 1.40 to 1.41. diff --git a/pulse-binding-mainloop-glib/Cargo.toml b/pulse-binding-mainloop-glib/Cargo.toml index dfc04f44..16971176 100644 --- a/pulse-binding-mainloop-glib/Cargo.toml +++ b/pulse-binding-mainloop-glib/Cargo.toml @@ -29,11 +29,8 @@ pa_v8 = ["pa_v6", "libpulse-binding/pa_v8", "libpulse-mainloop-glib-sys/pa_v8 pa_v6 = ["pa_v5", "libpulse-binding/pa_v6", "libpulse-mainloop-glib-sys/pa_v6"] pa_v5 = [ "libpulse-binding/pa_v5", "libpulse-mainloop-glib-sys/pa_v5"] -# This skips the pkg-config check. It is meant for documentation generation purposes only. -dox = ["libpulse-binding/dox", "libpulse-mainloop-glib-sys/dox"] - [package.metadata.docs.rs] -features = ["dox"] all-features = false no-default-features = true +rustc-args = ["--cfg", "doc"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/pulse-binding-simple/CHANGELOG.md b/pulse-binding-simple/CHANGELOG.md index 8fe69bb8..5bf86117 100644 --- a/pulse-binding-simple/CHANGELOG.md +++ b/pulse-binding-simple/CHANGELOG.md @@ -1,6 +1,7 @@ # [unreleased] * Made some changes to cargo features: + - Removed the now obsolete `dox` cargo feature. - Removed the `pa_latest` and `pa_latest_common` cargo features. - Changed the default version feature level to `pa_v8`. * MSRV bumped from 1.40 to 1.41. diff --git a/pulse-binding-simple/Cargo.toml b/pulse-binding-simple/Cargo.toml index 40111e6a..ebf60cf7 100644 --- a/pulse-binding-simple/Cargo.toml +++ b/pulse-binding-simple/Cargo.toml @@ -28,11 +28,8 @@ pa_v8 = ["pa_v6", "libpulse-binding/pa_v8", "libpulse-sys/pa_v8", "libpulse- pa_v6 = ["pa_v5", "libpulse-binding/pa_v6", "libpulse-sys/pa_v6", "libpulse-simple-sys/pa_v6"] pa_v5 = [ "libpulse-binding/pa_v5", "libpulse-sys/pa_v5", "libpulse-simple-sys/pa_v5"] -# This skips the pkg-config check. It is meant for documentation generation purposes only. -dox = ["libpulse-binding/dox", "libpulse-sys/dox", "libpulse-simple-sys/dox"] - [package.metadata.docs.rs] -features = ["dox"] all-features = false no-default-features = true +rustc-args = ["--cfg", "doc"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/pulse-binding/CHANGELOG.md b/pulse-binding/CHANGELOG.md index 9addabb8..7e8aa94f 100644 --- a/pulse-binding/CHANGELOG.md +++ b/pulse-binding/CHANGELOG.md @@ -1,6 +1,7 @@ # [unreleased] * Made some changes to cargo features: + - Removed the now obsolete `dox` cargo feature. - Removed the `pa_latest` and `pa_latest_common` cargo features. - Changed the default version feature level to `pa_v8`. * MSRV bumped from 1.40 to 1.41. diff --git a/pulse-binding/Cargo.toml b/pulse-binding/Cargo.toml index faa032fb..8dece203 100644 --- a/pulse-binding/Cargo.toml +++ b/pulse-binding/Cargo.toml @@ -32,11 +32,8 @@ pa_v8 = ["pa_v6", "libpulse-sys/pa_v8"] pa_v6 = ["pa_v5", "libpulse-sys/pa_v6"] pa_v5 = [ "libpulse-sys/pa_v5"] -# This skips the pkg-config check. It is meant for documentation generation purposes only. -dox = ["libpulse-sys/dox"] - [package.metadata.docs.rs] -features = ["dox"] all-features = false no-default-features = true +rustc-args = ["--cfg", "doc"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/pulse-sys-mainloop-glib/CHANGELOG.md b/pulse-sys-mainloop-glib/CHANGELOG.md index d1fd6013..39845b3e 100644 --- a/pulse-sys-mainloop-glib/CHANGELOG.md +++ b/pulse-sys-mainloop-glib/CHANGELOG.md @@ -1,13 +1,10 @@ # [unreleased] * Made some changes to cargo features: + - Removed the now obsolete `dox` cargo feature. - Removed the `pa_latest` and `pa_latest_common` cargo features. - Changed the default version feature level to `pa_v8`. * MSRV bumped from 1.40 to 1.41. - * Fixed failure to actually bypass the pkg-config check when `dox` feature is used, as had always - been the intention as I recall, and as stated in the documentation. This for instance means that - the docs.rs service will no longer be performing an unintentional pkg-config check when - generating documentation. * Made use of `#[cfg(doc)]` to always include stuff behind PA version feature guards in generated documentation. (Required bump of minimum supported Rust version from 1.40 to 1.41). * Added support for feature tagging in documentation (requires nightly Rust version, so only diff --git a/pulse-sys-mainloop-glib/Cargo.toml b/pulse-sys-mainloop-glib/Cargo.toml index d606a1bf..0dda4f05 100644 --- a/pulse-sys-mainloop-glib/Cargo.toml +++ b/pulse-sys-mainloop-glib/Cargo.toml @@ -32,11 +32,8 @@ pa_v8 = ["pa_v6", "libpulse-sys/pa_v8"] pa_v6 = ["pa_v5", "libpulse-sys/pa_v6"] pa_v5 = [ "libpulse-sys/pa_v5"] -# This skips the pkg-config check. It is meant for documentation generation purposes only. -dox = ["libpulse-sys/dox"] - [package.metadata.docs.rs] -features = ["dox"] all-features = false no-default-features = true +rustc-args = ["--cfg", "doc"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/pulse-sys-mainloop-glib/build.rs b/pulse-sys-mainloop-glib/build.rs index 98828bcd..cc9046ea 100644 --- a/pulse-sys-mainloop-glib/build.rs +++ b/pulse-sys-mainloop-glib/build.rs @@ -1,11 +1,11 @@ -#[cfg(not(feature = "dox"))] extern crate pkg_config; -#[cfg(feature = "dox")] -fn main() {} - -#[cfg(not(feature = "dox"))] fn main() { + // Skip pkg-config check if just generating documentation. + if cfg!(doc) { + return; + } + let lib_name = "libpulse-mainloop-glib"; let fallback_name = { #[cfg(target_os = "linux")] diff --git a/pulse-sys-simple/CHANGELOG.md b/pulse-sys-simple/CHANGELOG.md index 38c928e3..97634509 100644 --- a/pulse-sys-simple/CHANGELOG.md +++ b/pulse-sys-simple/CHANGELOG.md @@ -1,13 +1,10 @@ # [unreleased] * Made some changes to cargo features: + - Removed the now obsolete `dox` cargo feature. - Removed the `pa_latest` and `pa_latest_common` cargo features. - Changed the default version feature level to `pa_v8`. * MSRV bumped from 1.40 to 1.41. - * Fixed failure to actually bypass the pkg-config check when `dox` feature is used, as had always - been the intention as I recall, and as stated in the documentation. This for instance means that - the docs.rs service will no longer be performing an unintentional pkg-config check when - generating documentation. * Made use of `#[cfg(doc)]` to always include stuff behind PA version feature guards in generated documentation. (Required bump of minimum supported Rust version from 1.40 to 1.41). * Added support for feature tagging in documentation (requires nightly Rust version, so only diff --git a/pulse-sys-simple/Cargo.toml b/pulse-sys-simple/Cargo.toml index 2ce721ab..63cb6cc0 100644 --- a/pulse-sys-simple/Cargo.toml +++ b/pulse-sys-simple/Cargo.toml @@ -31,11 +31,8 @@ pa_v8 = ["pa_v6", "libpulse-sys/pa_v8"] pa_v6 = ["pa_v5", "libpulse-sys/pa_v6"] pa_v5 = [ "libpulse-sys/pa_v5"] -# This skips the pkg-config check. It is meant for documentation generation purposes only. -dox = ["libpulse-sys/dox"] - [package.metadata.docs.rs] -features = ["dox"] all-features = false no-default-features = true +rustc-args = ["--cfg", "doc"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/pulse-sys-simple/build.rs b/pulse-sys-simple/build.rs index 153271d7..810bfdb7 100644 --- a/pulse-sys-simple/build.rs +++ b/pulse-sys-simple/build.rs @@ -1,11 +1,11 @@ -#[cfg(not(feature = "dox"))] extern crate pkg_config; -#[cfg(feature = "dox")] -fn main() {} - -#[cfg(not(feature = "dox"))] fn main() { + // Skip pkg-config check if just generating documentation. + if cfg!(doc) { + return; + } + let lib_name = "libpulse-simple"; let fallback_name = { #[cfg(target_os = "linux")] diff --git a/pulse-sys/CHANGELOG.md b/pulse-sys/CHANGELOG.md index edf35ae8..882f25ae 100644 --- a/pulse-sys/CHANGELOG.md +++ b/pulse-sys/CHANGELOG.md @@ -1,14 +1,11 @@ # [unreleased] * Made some changes to cargo features: + - Removed the now obsolete `dox` cargo feature. - Removed the `pa_latest` and `pa_latest_common` cargo features. - Changed the default version feature level to `pa_v8`. * MSRV bumped from 1.40 to 1.41. * Changed `PA_CHANNELS_MAX` from `usize` to `u8`. - * Fixed failure to actually bypass the pkg-config check when `dox` feature is used, as had always - been the intention as I recall, and as stated in the documentation. This for instance means that - the docs.rs service will no longer be performing an unintentional pkg-config check when - generating documentation. * Made use of `#[cfg(doc)]` to always include stuff behind PA version feature guards in generated documentation. (Required bump of minimum supported Rust version from 1.40 to 1.41). * Added support for feature tagging in documentation (requires nightly Rust version, so only diff --git a/pulse-sys/Cargo.toml b/pulse-sys/Cargo.toml index 3f75d71e..4d9fccd9 100644 --- a/pulse-sys/Cargo.toml +++ b/pulse-sys/Cargo.toml @@ -36,11 +36,8 @@ pa_v8 = ["pa_v6"] pa_v6 = ["pa_v5"] pa_v5 = [] -# This skips the pkg-config check. It is meant for documentation generation purposes only. -dox = [] - [package.metadata.docs.rs] -features = ["dox"] all-features = false no-default-features = true +rustc-args = ["--cfg", "doc"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/pulse-sys/build.rs b/pulse-sys/build.rs index d31e2334..8b785ae9 100644 --- a/pulse-sys/build.rs +++ b/pulse-sys/build.rs @@ -1,11 +1,11 @@ -#[cfg(not(feature = "dox"))] extern crate pkg_config; -#[cfg(feature = "dox")] -fn main() {} - -#[cfg(not(feature = "dox"))] fn main() { + // Skip pkg-config check if just generating documentation. + if cfg!(doc) { + return; + } + let lib_name = "libpulse"; let fallback_name = { #[cfg(target_os = "linux")]