Skip to content

Commit d3dc9e5

Browse files
authored
Merge pull request #149 from madsmtm/feature-cleanup
Cargo features cleanup
2 parents c75691e + 08a13d3 commit d3dc9e5

File tree

16 files changed

+62
-50
lines changed

16 files changed

+62
-50
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ env:
1414
RUSTFLAGS: "-C debuginfo=0 -D warnings"
1515
RUSTDOCFLAGS: "-D warnings"
1616
CARGO_TERM_VERBOSE: true
17-
FEATURES: malloc,block,exception,catch_all,verify_message
18-
UNSTABLE_FEATURES: unstable_autoreleasesafe
1917
MACOSX_DEPLOYMENT_TARGET: 10.7
2018
IPHONEOS_DEPLOYMENT_TARGET: 7.0
2119
# We only support compiling Objective-C code with clang
@@ -125,6 +123,13 @@ jobs:
125123
components: rust-src
126124
args: -Zbuild-std -Zdoctest-xcompile
127125
test-args: --no-run
126+
- name: Test Compiler-RT
127+
os: ubuntu-latest
128+
target: x86_64-unknown-linux-gnu
129+
runtime: compiler-rt
130+
args: -p block-sys -p block2
131+
features: ' '
132+
unstable-features: ' '
128133

129134
env:
130135
CARGO_BUILD_TARGET: ${{ matrix.target }}
@@ -136,6 +141,8 @@ jobs:
136141
ARGS: --no-default-features --features ${{ matrix.runtime || 'apple' }} ${{ matrix.args }}
137142
# Use --no-fail-fast, except with dinghy
138143
TESTARGS: ${{ matrix.dinghy && ' ' || '--no-fail-fast' }} ${{ matrix.test-args }}
144+
FEATURES: ${{ matrix.features || 'malloc,block,exception,catch_all,verify_message' }}
145+
UNSTABLE_FEATURES: ${{ matrix.unstable-features || 'unstable-autoreleasesafe' }}
139146

140147
runs-on: ${{ matrix.os }}
141148

@@ -195,6 +202,10 @@ jobs:
195202
sudo apt-get update
196203
sudo apt-get -y install clang valgrind
197204
205+
- name: Install libBlocksRuntime
206+
if: contains(matrix.runtime, 'compiler-rt')
207+
run: sudo apt-get -y install libblocksruntime-dev
208+
198209
- name: Install cross compilation tools
199210
if: matrix.target == 'i686-unknown-linux-gnu'
200211
run: |
@@ -220,11 +231,11 @@ jobs:
220231
mv MacOSX${{ matrix.sdk }}.sdk $HOME/extern/sdk
221232
222233
- name: Install Make and Cmake
223-
if: contains(matrix.os, 'ubuntu') && steps.extern-cache.outputs.cache-hit != 'true'
234+
if: contains(matrix.runtime, 'gnustep') && steps.extern-cache.outputs.cache-hit != 'true'
224235
run: sudo apt-get -y install make cmake
225236

226237
- name: Install GNUStep libobjc2 v1.9
227-
if: contains(matrix.os, 'ubuntu') && steps.extern-cache.outputs.cache-hit != 'true'
238+
if: contains(matrix.runtime, 'gnustep') && steps.extern-cache.outputs.cache-hit != 'true'
228239
run: |
229240
wget https://github.com/gnustep/libobjc2/archive/refs/tags/v1.9.tar.gz
230241
tar -xzf v1.9.tar.gz
@@ -234,7 +245,7 @@ jobs:
234245
make install
235246
236247
- name: Install GNUStep make
237-
if: contains(matrix.os, 'ubuntu') && steps.extern-cache.outputs.cache-hit != 'true'
248+
if: contains(matrix.runtime, 'gnustep') && steps.extern-cache.outputs.cache-hit != 'true'
238249
run: |
239250
wget https://github.com/gnustep/tools-make/archive/refs/tags/make-2_9_0.tar.gz
240251
tar -xzf make-2_9_0.tar.gz
@@ -244,7 +255,7 @@ jobs:
244255
make install
245256
246257
- name: Install GNUStep-Base
247-
if: contains(matrix.os, 'ubuntu') && steps.extern-cache.outputs.cache-hit != 'true'
258+
if: contains(matrix.runtime, 'gnustep') && steps.extern-cache.outputs.cache-hit != 'true'
248259
run: |
249260
wget https://github.com/gnustep/libs-base/archive/refs/tags/base-1_28_0.tar.gz
250261
tar -xzf base-1_28_0.tar.gz
@@ -326,7 +337,7 @@ jobs:
326337
uses: actions-rs/cargo@v1
327338
with:
328339
command: bench
329-
args: ${{ env.ARGS }} ${{ env.TESTARGS }} --bench autorelease
340+
args: ${{ env.ARGS }} ${{ env.TESTARGS }}
330341

331342
- name: Test with unstable features
332343
if: ${{ !matrix.dinghy && matrix.rust.toolchain == 'nightly' }}

block-sys/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ gnustep-2-0 = ["objc-sys/gnustep-2-0", "gnustep-1-9"]
4141
gnustep-2-1 = ["objc-sys/gnustep-2-1", "gnustep-2-0"]
4242

4343
# Link to Microsoft's libobjc2
44-
winobjc = ["objc-sys/winobjc", "gnustep-1-8"]
44+
unstable-winobjc = ["objc-sys/unstable-winobjc", "gnustep-1-8"]
4545

46-
# TODO
47-
objfw = []
46+
# Link to ObjFW
47+
unstable-objfw = []
4848

4949
[dependencies]
5050
objc-sys = { path = "../objc-sys", version = "=0.2.0-alpha.1", default-features = false, optional = true }

block-sys/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,19 @@ Sources:
7373

7474
### Microsoft's [`WinObjC`](https://github.com/microsoft/WinObjC)
7575

76-
- Feature flag: `winobjc`.
76+
- Feature flag: `unstable-winobjc`.
77+
78+
**Unstable: Hasn't been tested on Windows yet!**
7779

7880
Essentially just [a fork](https://github.com/microsoft/libobjc2) based on
7981
GNUStep's `libobjc2` version 1.8.
8082

8183

82-
### [`ObjFW`](https://github.com/ObjFW/ObjFW) (WIP)
84+
### [`ObjFW`](https://github.com/ObjFW/ObjFW)
85+
86+
- Feature flag: `unstable-objfw`.
8387

84-
- Feature flag: `objfw`.
88+
**Unstable: Doesn't work yet!**
8589

8690
TODO.
8791

block-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() {
1010
let mut apple = env::var_os("CARGO_FEATURE_APPLE").is_some();
1111
let compiler_rt = env::var_os("CARGO_FEATURE_COMPILER_RT").is_some();
1212
let mut gnustep = env::var_os("CARGO_FEATURE_GNUSTEP_1_7").is_some();
13-
let objfw = env::var_os("CARGO_FEATURE_OBJFW").is_some();
13+
let objfw = env::var_os("CARGO_FEATURE_UNSTABLE_OBJFW").is_some();
1414

1515
if std::env::var("DOCS_RS").is_ok() {
1616
if let "macos" | "ios" | "tvos" | "watchos" = &*target_os {

block2/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ gnustep-1-8 = ["gnustep-1-7", "block-sys/gnustep-1-8"]
2828
gnustep-1-9 = ["gnustep-1-8", "block-sys/gnustep-1-9"]
2929
gnustep-2-0 = ["gnustep-1-9", "block-sys/gnustep-2-0"]
3030
gnustep-2-1 = ["gnustep-2-0", "block-sys/gnustep-2-1"]
31-
winobjc = ["gnustep-1-8", "block-sys/winobjc"]
3231

3332
[dependencies]
3433
objc2-encode = { path = "../objc2-encode", version = "=2.0.0-beta.2", default-features = false }

objc-sys/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ gnustep-2-0 = ["gnustep-1-9"]
4040
gnustep-2-1 = ["gnustep-2-0"]
4141

4242
# Link to Microsoft's libobjc2
43-
winobjc = ["gnustep-1-8"]
43+
unstable-winobjc = ["gnustep-1-8"]
4444

45-
# TODO
46-
objfw = []
45+
# Link to ObjFW
46+
unstable-objfw = []
4747

48-
# Private/unstable features - must not be relied on!
48+
# Private
4949
unstable-exception = ["cc"]
5050

5151
[build-dependencies]

objc-sys/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,21 @@ chosen using the standard `X_DEPLOYMENT_TARGET` environment variables:
5656
`gnustep-1-8`.
5757

5858

59-
### Window's [`WinObjC`](https://github.com/microsoft/WinObjC)
59+
### Microsoft's [`WinObjC`](https://github.com/microsoft/WinObjC)
6060

61-
- Feature flag: `winobjc`.
61+
- Feature flag: `unstable-winobjc`.
62+
63+
**Unstable: Hasn't been tested on Windows yet!**
6264

6365
This is essentially just [a fork](https://github.com/microsoft/libobjc2) based
6466
on GNUStep's `libobjc2` version 1.8, with very few user-facing changes.
6567

6668

67-
### [`ObjFW`](https://github.com/ObjFW/ObjFW) (WIP)
69+
### [`ObjFW`](https://github.com/ObjFW/ObjFW)
70+
71+
- Feature flag: `unstable-objfw`.
6872

69-
- Feature flag: `objfw`.
73+
**Unstable: Doesn't work yet!**
7074

7175
TODO.
7276

@@ -79,7 +83,7 @@ and `objc_autoreleasePoolPop` is a vital requirement for most applications.
7983

8084
Just so we're being clear, this rules out the GCC [`libobjc`][gcc-libobjc]
8185
runtime (see [this][gcc-objc-support]), the [`mulle-objc`] runtime and
82-
[cocotron]. (But support for [`ObjFW`] and [`darling`] may be added).
86+
[cocotron]. (But support for [`darling`] may be added).
8387
More information on different runtimes can be found in GNUStep's
8488
[Objective-C Compiler and Runtime FAQ][gnustep-faq].
8589

@@ -88,7 +92,6 @@ More information on different runtimes can be found in GNUStep's
8892
[gcc-objc-support]: https://gcc.gnu.org/onlinedocs/gcc/Standards.html#Objective-C-and-Objective-C_002b_002b-Languages
8993
[`mulle-objc`]: https://github.com/mulle-objc/mulle-objc-runtime
9094
[cocotron]: https://cocotron.org/
91-
[`ObjFW`]: https://github.com/ObjFW/ObjFW
9295
[`darling`]: https://github.com/darlinghq/darling-objc4
9396
[gnustep-faq]: http://wiki.gnustep.org/index.php/Objective-C_Compiler_and_Runtime_FAQ
9497

objc-sys/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn main() {
7171

7272
let mut apple = env::var_os("CARGO_FEATURE_APPLE").is_some();
7373
let mut gnustep = env::var_os("CARGO_FEATURE_GNUSTEP_1_7").is_some();
74-
let objfw = env::var_os("CARGO_FEATURE_OBJFW").is_some();
74+
let objfw = env::var_os("CARGO_FEATURE_UNSTABLE_OBJFW").is_some();
7575

7676
// Choose defaults when generating docs
7777
if std::env::var("DOCS_RS").is_ok() {
@@ -106,7 +106,7 @@ fn main() {
106106
} else {
107107
GNUStep(1, 7)
108108
}
109-
} else if env::var_os("CARGO_FEATURE_WINOBJC").is_some() {
109+
} else if env::var_os("CARGO_FEATURE_UNSTABLE_WINOBJC").is_some() {
110110
WinObjC
111111
} else if env::var_os("CARGO_FEATURE_GNUSTEP_2_1").is_some() {
112112
GNUStep(2, 1)

objc-sys/src/exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ extern_c! {
6161
// objc_exception_get_functions
6262
// objc_exception_set_functions
6363

64-
#[cfg(any(gnustep, winobjc))]
64+
#[cfg(gnustep)]
6565
pub fn objc_exception_rethrow(exc_buf: *mut c_void) -> !;
6666

6767
#[cfg(apple_new)]

objc2-foundation/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "block2?/gnustep-1-8"]
2828
gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "block2?/gnustep-1-9"]
2929
gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "block2?/gnustep-2-0"]
3030
gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1"]
31-
winobjc = ["gnustep-1-8", "objc2/winobjc", "block2?/winobjc"]
3231

3332
[dependencies]
3433
block2 = { path = "../block2", version = "=0.2.0-alpha.3", default-features = false, optional = true }

0 commit comments

Comments
 (0)