Skip to content

Commit 0e10639

Browse files
authored
Merge pull request #160 from madsmtm/tweak-docs-targets
Set `docs.rs` targets on all crates
2 parents 99d0aa7 + 4041a63 commit 0e10639

File tree

8 files changed

+95
-4
lines changed

8 files changed

+95
-4
lines changed

block-sys/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,30 @@ unstable-winobjc = ["objc-sys/unstable-winobjc", "gnustep-1-8"]
4646
# Link to ObjFW
4747
unstable-objfw = []
4848

49+
# Private
50+
unstable-docsrs = ["objc-sys"] # Need `objc-sys` on certain platforms
51+
4952
[dependencies]
5053
objc-sys = { path = "../objc-sys", version = "=0.2.0-alpha.1", default-features = false, optional = true }
5154

5255
[package.metadata.docs.rs]
5356
default-target = "x86_64-apple-darwin"
5457
no-default-features = true
58+
features = ["unstable-docsrs"]
59+
60+
targets = [
61+
# MacOS
62+
"x86_64-apple-darwin",
63+
"aarch64-apple-darwin",
64+
# "i686-apple-darwin",
65+
# iOS
66+
"aarch64-apple-ios",
67+
"x86_64-apple-ios",
68+
# "armv7-apple-ios",
69+
# "i386-apple-ios",
70+
# GNUStep
71+
"x86_64-unknown-linux-gnu",
72+
"i686-unknown-linux-gnu",
73+
# Windows
74+
"x86_64-pc-windows-msvc",
75+
]

block-sys/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ fn main() {
1212
let mut gnustep = env::var_os("CARGO_FEATURE_GNUSTEP_1_7").is_some();
1313
let objfw = env::var_os("CARGO_FEATURE_UNSTABLE_OBJFW").is_some();
1414

15-
if std::env::var("DOCS_RS").is_ok() {
15+
// Only when the crate is being compiled directly
16+
if cfg!(feature = "unstable-docsrs") {
1617
if let "macos" | "ios" | "tvos" | "watchos" = &*target_os {
1718
apple = true;
1819
// Add cheaty #[cfg(feature = "apple")] directive

block2/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,20 @@ block-sys = { path = "../block-sys", version = "0.0.3", default-features = false
3535

3636
[package.metadata.docs.rs]
3737
default-target = "x86_64-apple-darwin"
38+
39+
targets = [
40+
# MacOS
41+
"x86_64-apple-darwin",
42+
"aarch64-apple-darwin",
43+
# "i686-apple-darwin",
44+
# iOS
45+
"aarch64-apple-ios",
46+
"x86_64-apple-ios",
47+
# "armv7-apple-ios",
48+
# "i386-apple-ios",
49+
# GNUStep
50+
"x86_64-unknown-linux-gnu",
51+
"i686-unknown-linux-gnu",
52+
# Windows
53+
"x86_64-pc-windows-msvc",
54+
]

objc-sys/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,29 @@ unstable-objfw = []
4747

4848
# Private
4949
unstable-exception = ["cc"]
50+
unstable-docsrs = []
5051

5152
[build-dependencies]
5253
cc = { version = "1", optional = true }
5354

5455
[package.metadata.docs.rs]
5556
default-target = "x86_64-apple-darwin"
5657
no-default-features = true
58+
features = ["unstable-docsrs"]
5759

5860
targets = [
5961
# MacOS
6062
"x86_64-apple-darwin",
63+
"aarch64-apple-darwin",
6164
# "i686-apple-darwin",
6265
# iOS
6366
"aarch64-apple-ios",
6467
"x86_64-apple-ios",
68+
# "armv7-apple-ios",
69+
# "i386-apple-ios",
6570
# GNUStep
6671
"x86_64-unknown-linux-gnu",
6772
"i686-unknown-linux-gnu",
73+
# Windows
74+
"x86_64-pc-windows-msvc",
6875
]

objc-sys/build.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ fn main() {
7474
let objfw = env::var_os("CARGO_FEATURE_UNSTABLE_OBJFW").is_some();
7575

7676
// Choose defaults when generating docs
77-
if std::env::var("DOCS_RS").is_ok() {
77+
// Only when the crate is being compiled directly
78+
if cfg!(feature = "unstable-docsrs") {
7879
if let "macos" | "ios" | "tvos" | "watchos" = &*target_os {
7980
apple = true;
8081
} else {
@@ -100,7 +101,7 @@ fn main() {
100101
}
101102
(false, true, false) => {
102103
// Choose defaults when generating docs
103-
if std::env::var("DOCS_RS").is_ok() {
104+
if cfg!(feature = "unstable-docsrs") {
104105
if "windows" == target_os {
105106
WinObjC
106107
} else {
@@ -229,6 +230,11 @@ fn main() {
229230
if std::env::var("DOCS_RS").is_ok() {
230231
// docs.rs doesn't have clang, so skip building this. The
231232
// documentation will still work since it doesn't need to link.
233+
//
234+
// This is independent of the `unstable-docsrs` feature flag; we
235+
// never want to try invoking clang on docs.rs, whether we're the
236+
// crate being documented currently, or a dependency of another
237+
// crate.
232238
return;
233239
}
234240
println!("cargo:rerun-if-changed=extern/exception.m");

objc2-encode/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,20 @@ license = "MIT"
2020

2121
[package.metadata.docs.rs]
2222
default-target = "x86_64-apple-darwin"
23+
24+
targets = [
25+
# MacOS
26+
"x86_64-apple-darwin",
27+
"aarch64-apple-darwin",
28+
# "i686-apple-darwin",
29+
# iOS
30+
"aarch64-apple-ios",
31+
"x86_64-apple-ios",
32+
# "armv7-apple-ios",
33+
# "i386-apple-ios",
34+
# GNUStep
35+
"x86_64-unknown-linux-gnu",
36+
"i686-unknown-linux-gnu",
37+
# Windows
38+
"x86_64-pc-windows-msvc",
39+
]

objc2-foundation/Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,21 @@ objc2 = { path = "../objc2", version = "=0.3.0-alpha.6", default-features = fals
3535

3636
[package.metadata.docs.rs]
3737
default-target = "x86_64-apple-darwin"
38+
features = ["block"]
39+
40+
targets = [
41+
# MacOS
42+
"x86_64-apple-darwin",
43+
"aarch64-apple-darwin",
44+
# "i686-apple-darwin",
45+
# iOS
46+
"aarch64-apple-ios",
47+
"x86_64-apple-ios",
48+
# "armv7-apple-ios",
49+
# "i386-apple-ios",
50+
# GNUStep
51+
"x86_64-unknown-linux-gnu",
52+
"i686-unknown-linux-gnu",
53+
# Windows
54+
"x86_64-pc-windows-msvc",
55+
]

objc2/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,21 @@ harness = false
6262

6363
[package.metadata.docs.rs]
6464
default-target = "x86_64-apple-darwin"
65-
6665
features = ["exception", "malloc"]
6766

6867
targets = [
6968
# MacOS
7069
"x86_64-apple-darwin",
70+
"aarch64-apple-darwin",
7171
# "i686-apple-darwin",
7272
# iOS
7373
"aarch64-apple-ios",
7474
"x86_64-apple-ios",
75+
# "armv7-apple-ios",
76+
# "i386-apple-ios",
7577
# GNUStep
7678
"x86_64-unknown-linux-gnu",
7779
"i686-unknown-linux-gnu",
80+
# Windows
81+
"x86_64-pc-windows-msvc",
7882
]

0 commit comments

Comments
 (0)