Skip to content

Commit b18004b

Browse files
bors[bot]codyps
andauthored
Merge #236
236: fix build on docs.rs r=jmesmon a=jmesmon Fixes #211 Co-authored-by: Cody P Schafer <[email protected]>
2 parents 3ef6a64 + 4dfd33a commit b18004b

File tree

5 files changed

+37
-31
lines changed

5 files changed

+37
-31
lines changed

.github/workflows/build.yml

+32-27
Original file line numberDiff line numberDiff line change
@@ -59,35 +59,18 @@ jobs:
5959
- name: Install libsystemd-dev
6060
run: sudo apt-get -o Acquire::Retries=3 install libsystemd-dev
6161

62-
- name: Check with no-default-features
62+
- name: Install cargo-hack
6363
uses: actions-rs/cargo@v1
6464
with:
65-
command: check
66-
args: --all --no-default-features
65+
command: install
66+
args: cargo-hack
6767

68-
- name: Check with only bus
68+
- name: Check with all variants
6969
uses: actions-rs/cargo@v1
7070
with:
71-
command: check
72-
args: --all --no-default-features --features bus
71+
command: hack
72+
args: --feature-powerset --skip unstable-doc-cfg check --workspace --all-targets
7373

74-
- name: Check with only journal
75-
uses: actions-rs/cargo@v1
76-
with:
77-
command: check
78-
args: --all --no-default-features --features journal
79-
80-
- name: Check with only systemd_v245
81-
uses: actions-rs/cargo@v1
82-
with:
83-
command: check
84-
args: --all --no-default-features --features systemd_v245
85-
86-
- name: Check with all features
87-
uses: actions-rs/cargo@v1
88-
with:
89-
command: check
90-
args: --all --all-features
9174
test:
9275
runs-on: ubuntu-20.04
9376
strategy:
@@ -115,14 +98,36 @@ jobs:
11598
- name: Install libsystemd-dev
11699
run: sudo apt-get -o Acquire::Retries=3 install libsystemd-dev
117100

101+
- name: Install cargo-hack
102+
uses: actions-rs/cargo@v1
103+
with:
104+
command: install
105+
args: cargo-hack
106+
107+
- name: Build everything
108+
uses: actions-rs/cargo@v1
109+
if: ${{matrix.rust != 'nightly' }}
110+
with:
111+
command: hack
112+
args: --feature-powerset --skip unstable-doc-cfg build --all --all-targets
113+
114+
- name: Run all tests
115+
uses: actions-rs/cargo@v1
116+
if: ${{matrix.rust != 'nightly' }}
117+
with:
118+
command: hack
119+
args: --feature-powerset --skip unstable-doc-cfg test --all
120+
118121
- name: Build everything
119122
uses: actions-rs/cargo@v1
123+
if: ${{matrix.rust == 'nightly' }}
120124
with:
121-
command: build
122-
args: --all --all-targets
125+
command: hack
126+
args: --feature-powerset build --all --all-targets
123127

124128
- name: Run all tests
125129
uses: actions-rs/cargo@v1
130+
if: ${{matrix.rust == 'nightly' }}
126131
with:
127-
command: test
128-
args: --all
132+
command: hack
133+
args: --feature-powerset test --all

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ default = ["bus", "journal"]
1616
bus = ["libsystemd-sys/bus"]
1717
journal = ["libsystemd-sys/journal"]
1818
systemd_v245 = ["libsystemd-sys/systemd_v245"]
19+
unstable-doc-cfg = []
1920

2021
[dependencies]
2122
log = "~0.4"
@@ -41,7 +42,6 @@ debug = true
4142

4243
[package.metadata.docs.rs]
4344
all-features = true
44-
rustdoc-args = ["--cfg", "docsrs"]
4545

4646
[workspace]
4747
members = ["libsystemd-sys"]

libsystemd-sys/tests/journal-send.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use libsystemd_sys as sd;
2-
1+
#[cfg(feature = "journal")]
32
#[test]
43
fn raw_send() {
4+
use libsystemd_sys as sd;
55
let a = ["MESSAGE=raw rust-systemd send"];
66
let v = [sd::const_iovec {
77
iov_base: a[0].as_ptr() as *const _,

src/journal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ impl OpenOptions {
423423
///
424424
/// `sd_journal_open_namespace()`: https://www.freedesktop.org/software/systemd/man/sd_journal_open.html
425425
#[cfg(feature = "systemd_v245")]
426-
#[cfg_attr(docsrs, doc(cfg(feature = "systemd_v245")))]
426+
#[cfg_attr(feature = "unstable-doc-cfg", doc(cfg(feature = "systemd_v245")))]
427427
pub fn open_namespace<A: CStrArgument>(&self, namespace: A) -> Result<Journal> {
428428
Journal::open_with_opts_ns(Some(namespace), self)
429429
}

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![cfg_attr(feature = "unstable-doc-cfg", feature(doc_cfg))]
12
#![warn(rust_2018_idioms)]
23

34
extern crate libsystemd_sys as ffi;

0 commit comments

Comments
 (0)