Skip to content

Commit 89cf04f

Browse files
committed
Move objc2-foundation to objc2::foundation
There really wasn't a good reason that the libraries were separate, they were slowly becoming increasingly linked anyhow, and it really only meant that we were providing a worse user-experience (e.g. docs and examples were scattered, discoverability, versioning)
1 parent f886250 commit 89cf04f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+85
-171
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ members = [
33
"objc2",
44
"objc-sys",
55
"objc2-encode",
6-
"objc2-foundation",
76
"objc2-proc-macros",
87
"block2",
98
"block-sys",

objc2-foundation/Cargo.toml

Lines changed: 0 additions & 65 deletions
This file was deleted.

objc2-foundation/README.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

objc2/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

3-
Notable changes to this crate will be documented in this file.
3+
Notable changes to this crate will be documented in this file. See the
4+
`CHANGELOG_FOUNDATION.md` file for changes to the `objc2::foundation` module!
45

56
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
67

@@ -9,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
910
### Added
1011
* Added the `"unstable-static-class"` and `"unstable-static-class-inlined"`
1112
feature flags to make the `class!` macro zero cost.
13+
* Moved the external crate `objc2_foundation` into `objc2::foundation` under
14+
(default) feature flag `"foundation"`.
1215

1316

1417
## 0.3.0-beta.1 - 2022-07-19

objc2-foundation/CHANGELOG.md renamed to objc2/CHANGELOG_FOUNDATION.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22

3-
Notable changes to this crate will be documented in this file.
3+
Changes to the `objc2::foundation` module will be documented in this file.
4+
This previously existed as a separate crate `objc2_foundation`, hence the
5+
separation.
46

57
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
68

@@ -15,6 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1517

1618
### Changed
1719
* Change selector syntax in `declare_class!` macro to be more Rust-like.
20+
* **BREAKING**: Moved from external crate `objc2_foundation` into
21+
`objc2::foundation`.
1822

1923
### Fixed
2024
* Made `Debug` impls for all objects print something useful.
@@ -25,7 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
2529
`Debug`.
2630

2731

28-
## 0.2.0-alpha.6 - 2022-07-19
32+
## objc2-foundation 0.2.0-alpha.6 - 2022-07-19
2933

3034
### Added
3135
* Added `MainThreadMarker` to help with designing APIs where a method is only
@@ -40,7 +44,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4044
* Changed a few `Debug` impls.
4145

4246

43-
## 0.2.0-alpha.5 - 2022-06-13
47+
## objc2-foundation 0.2.0-alpha.5 - 2022-06-13
4448

4549
### Added
4650
* Objects now `Deref` to their superclasses. E.g. `NSMutableArray` derefs to
@@ -109,7 +113,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
109113
easily lead to hard-to-diagnose performance issues.
110114

111115

112-
## 0.2.0-alpha.3 - 2021-12-22
116+
## objc2-foundation 0.2.0-alpha.3 - 2021-12-22
113117

114118
### Added
115119
* **BREAKING**: Added associated `Ownership` type to `NSCopying`.
@@ -135,7 +139,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
135139
subclasses may not be).
136140

137141

138-
## 0.2.0-alpha.2 - 2021-11-22
142+
## objc2-foundation 0.2.0-alpha.2 - 2021-11-22
139143

140144
### Added
141145
* **BREAKING**: Added associated `Ownership` type to `INSObject` to specify
@@ -197,7 +201,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
197201
* Fixed `NSData::from_vec` on GNUStep.
198202

199203

200-
## 0.2.0-alpha.1 - 2021-10-28
204+
## objc2-foundation 0.2.0-alpha.1 - 2021-10-28
201205

202206
### Added
203207
* Implement new `RefEncode` trait for objects.
@@ -213,7 +217,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
213217
* `INSString::from_str` on GNUStep (`UTF8_ENCODING` was the wrong type).
214218

215219

216-
## 0.2.0-alpha.0 - 2021-08-29
220+
## objc2-foundation 0.2.0-alpha.0 - 2021-08-29
217221

218222
Note: This is the version that is, as of this writing, available on the
219223
`master` branch in the original `objc-foundation` project.
@@ -229,27 +233,27 @@ Note: This is the version that is, as of this writing, available on the
229233
* Fixed types in various calls to `objc::msg_send!` for better verification.
230234

231235

232-
## [0.1.1] - 2016-06-19
236+
## objc-foundation [0.1.1] - 2016-06-19
233237

234238
### Fixed
235239
* An issue with passing functions (instead of function pointers) in
236240
`INSMutableArray::sort_by`.
237241

238242

239-
## [0.1.0] - 2016-03-20
243+
## objc-foundation [0.1.0] - 2016-03-20
240244

241245
### Changed
242246
* Update `objc` to `v0.2`.
243247
* Update `objc_id` to `v0.1`.
244248

245249

246-
## [0.0.4] - 2015-12-09
250+
## objc-foundation [0.0.4] - 2015-12-09
247251

248252
### Removed
249253
* `libc` dependency.
250254

251255

252-
## [0.0.3] - 2015-11-07
256+
## objc-foundation [0.0.3] - 2015-11-07
253257

254258
### Added
255259
* `object_struct!` macro.
@@ -258,13 +262,13 @@ Note: This is the version that is, as of this writing, available on the
258262
* `libc` version can both be `0.1` and `0.2`.
259263

260264

261-
## [0.0.2] - 2015-09-03
265+
## objc-foundation [0.0.2] - 2015-09-03
262266

263267
### Added
264268
* `Any` bound on `INSObject`, because of a change in `objc` `v0.1.6`.
265269

266270

267-
## [0.0.1] - 2015-06-13
271+
## objc-foundation [0.0.1] - 2015-06-13
268272

269273
Initial release.
270274

objc2/Cargo.toml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ version = "0.3.0-beta.1" # Remember to update html_root_url in lib.rs
44
authors = ["Steven Sheldon", "Mads Marquart <[email protected]>"]
55
edition = "2021"
66

7-
description = "Objective-C interface and runtime bindings"
8-
keywords = ["objective-c", "macos", "ios", "objc_msgSend"]
7+
description = "Objective-C interface and bindings to the Cocoa Foundation framework"
8+
keywords = ["objective-c", "macos", "ios", "objc_msgSend", "cocoa"]
99
categories = [
1010
"api-bindings",
1111
"development-tools::ffi",
@@ -19,11 +19,14 @@ license = "MIT"
1919
# NOTE: 'unstable' features are _not_ considered part of the SemVer contract,
2020
# and may be removed in a minor release.
2121
[features]
22-
default = ["std", "apple"]
22+
default = ["std", "apple", "foundation"]
2323

2424
# Currently not possible to turn off, put here for forwards compatibility.
25-
std = ["alloc", "objc2-encode/std", "objc-sys/std"]
26-
alloc = ["objc2-encode/alloc", "objc-sys/alloc"]
25+
std = ["alloc", "objc2-encode/std", "objc-sys/std", "block2?/std"]
26+
alloc = ["objc2-encode/alloc", "objc-sys/alloc", "block2?/alloc"]
27+
28+
# Enable the `objc2::foundation` submodule. It is enabled by default.
29+
foundation = []
2730

2831
# Enables `objc2::exception::throw` and `objc2::exception::catch`
2932
exception = ["objc-sys/unstable-exception"]
@@ -41,6 +44,9 @@ verify_message = ["malloc"] # TODO: Remove malloc feature here
4144
# increases compilation time.
4245
malloc = ["malloc_buf"]
4346

47+
# Expose features that requires creating blocks.
48+
block = ["block2"]
49+
4450
# Make the `sel!` macro look up the selector statically.
4551
#
4652
# The plan is to enable this by default, but right now we are uncertain of
@@ -64,18 +70,22 @@ unstable-c-unwind = ["objc-sys/unstable-c-unwind"]
6470
unstable-docsrs = []
6571

6672
# Runtime selection. See `objc-sys` for details.
67-
apple = ["objc-sys/apple"]
68-
gnustep-1-7 = ["objc-sys/gnustep-1-7"]
69-
gnustep-1-8 = ["gnustep-1-7", "objc-sys/gnustep-1-8"]
70-
gnustep-1-9 = ["gnustep-1-8", "objc-sys/gnustep-1-9"]
71-
gnustep-2-0 = ["gnustep-1-9", "objc-sys/gnustep-2-0"]
72-
gnustep-2-1 = ["gnustep-2-0", "objc-sys/gnustep-2-1"]
73+
apple = ["objc-sys/apple", "block2?/apple"]
74+
gnustep-1-7 = ["objc-sys/gnustep-1-7", "block2?/gnustep-1-7"]
75+
gnustep-1-8 = ["gnustep-1-7", "objc-sys/gnustep-1-8", "block2?/gnustep-1-8"]
76+
gnustep-1-9 = ["gnustep-1-8", "objc-sys/gnustep-1-9", "block2?/gnustep-1-9"]
77+
gnustep-2-0 = ["gnustep-1-9", "objc-sys/gnustep-2-0", "block2?/gnustep-2-0"]
78+
gnustep-2-1 = ["gnustep-2-0", "objc-sys/gnustep-2-1", "block2?/gnustep-2-1"]
7379

7480
[dependencies]
7581
malloc_buf = { version = "1.0", optional = true }
7682
objc-sys = { path = "../objc-sys", version = "=0.2.0-beta.1", default-features = false }
7783
objc2-encode = { path = "../objc2-encode", version = "=2.0.0-pre.1", default-features = false }
7884
objc2-proc-macros = { path = "../objc2-proc-macros", version = "0.1.0", optional = true }
85+
block2 = { path = "../block2", version = "=0.2.0-alpha.5", default-features = false, optional = true }
86+
87+
# Provide methods to convert between `uuid::Uuid` and `objc2::foundation::NSUUID`
88+
uuid = { version = "1.1.2", optional = true, default-features = false }
7989

8090
[dev-dependencies]
8191
iai = { version = "0.1", git = "https://github.com/madsmtm/iai", branch = "callgrind" }
@@ -86,7 +96,7 @@ harness = false
8696

8797
[package.metadata.docs.rs]
8898
default-target = "x86_64-apple-darwin"
89-
features = ["exception", "malloc", "unstable-docsrs"]
99+
features = ["exception", "malloc", "block", "uuid", "unstable-docsrs"]
90100

91101
targets = [
92102
# MacOS

objc2/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
[![Documentation](https://docs.rs/objc2/badge.svg)](https://docs.rs/objc2/)
66
[![CI](https://github.com/madsmtm/objc2/actions/workflows/ci.yml/badge.svg)](https://github.com/madsmtm/objc2/actions/workflows/ci.yml)
77

8-
Objective-C interface and runtime bindings for Rust.
8+
Objective-C interface and bindings to the `Foundation` framework in Rust.
99

1010
Most of the core libraries and frameworks that are in use on Apple systems are
11-
written in Objective-C; this crate enables you to interract with those.
11+
written in Objective-C; this crate enables you to interract with those, and
12+
provides ready-made bindings for the `Foundation` framework in particular.
1213

1314
## Example
1415

0 commit comments

Comments
 (0)