Skip to content

Commit

Permalink
replace use of dox feature for bypassing build script pkg-config ch…
Browse files Browse the repository at this point in the history
…ecks

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.
  • Loading branch information
jnqnfe committed Dec 11, 2020
1 parent 83f8b6f commit 7147efa
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 51 deletions.
1 change: 1 addition & 0 deletions pulse-binding-mainloop-glib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 1 addition & 4 deletions pulse-binding-mainloop-glib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 1 addition & 0 deletions pulse-binding-simple/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 1 addition & 4 deletions pulse-binding-simple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 1 addition & 0 deletions pulse-binding/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 1 addition & 4 deletions pulse-binding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
5 changes: 1 addition & 4 deletions pulse-sys-mainloop-glib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 1 addition & 4 deletions pulse-sys-mainloop-glib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 5 additions & 5 deletions pulse-sys-mainloop-glib/build.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
5 changes: 1 addition & 4 deletions pulse-sys-simple/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 1 addition & 4 deletions pulse-sys-simple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 5 additions & 5 deletions pulse-sys-simple/build.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down
5 changes: 1 addition & 4 deletions pulse-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 1 addition & 4 deletions pulse-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 5 additions & 5 deletions pulse-sys/build.rs
Original file line number Diff line number Diff line change
@@ -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")]
Expand Down

0 comments on commit 7147efa

Please sign in to comment.