Skip to content

Commit 4346f3e

Browse files
authored
Merge pull request #222 from madsmtm/move-foundation
Move `objc2-foundation` to `objc2::foundation`
2 parents 769ea10 + a33c1ba commit 4346f3e

Some content is hidden

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

58 files changed

+172
-236
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: 9 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,13 @@ 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"`.
15+
* Added `declare_class!`, `extern_class!` and `ns_string!` macros from
16+
`objc2-foundation`.
17+
18+
### Changed
19+
* Change selector syntax in `declare_class!` macro to be more Rust-like.
1220

1321

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

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

Lines changed: 19 additions & 14 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

@@ -14,7 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1416
* Add extra `Extend<&u8>` impl for `NSMutableData`.
1517

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

1922
### Fixed
2023
* Made `Debug` impls for all objects print something useful.
@@ -25,22 +28,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
2528
`Debug`.
2629

2730

28-
## 0.2.0-alpha.6 - 2022-07-19
31+
## objc2-foundation 0.2.0-alpha.6 - 2022-07-19
2932

3033
### Added
3134
* Added `MainThreadMarker` to help with designing APIs where a method is only
3235
safe to call on the main thread.
3336
* Added `NSException` object.
3437
* Added `extern_class!` macro to help with defining interfaces to classes.
38+
Further changelog for this can be found in `CHANGELOG.md`.
3539
* Added `declare_class!` macro to help with declaring custom classes.
40+
Further changelog for this can be found in `CHANGELOG.md`.
3641
* Expose the `objc2` version that this uses in the crate root.
3742
* Added `NSZone`.
3843

3944
### Changed
4045
* Changed a few `Debug` impls.
4146

4247

43-
## 0.2.0-alpha.5 - 2022-06-13
48+
## objc2-foundation 0.2.0-alpha.5 - 2022-06-13
4449

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

111116

112-
## 0.2.0-alpha.3 - 2021-12-22
117+
## objc2-foundation 0.2.0-alpha.3 - 2021-12-22
113118

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

137142

138-
## 0.2.0-alpha.2 - 2021-11-22
143+
## objc2-foundation 0.2.0-alpha.2 - 2021-11-22
139144

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

199204

200-
## 0.2.0-alpha.1 - 2021-10-28
205+
## objc2-foundation 0.2.0-alpha.1 - 2021-10-28
201206

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

215220

216-
## 0.2.0-alpha.0 - 2021-08-29
221+
## objc2-foundation 0.2.0-alpha.0 - 2021-08-29
217222

218223
Note: This is the version that is, as of this writing, available on the
219224
`master` branch in the original `objc-foundation` project.
@@ -229,27 +234,27 @@ Note: This is the version that is, as of this writing, available on the
229234
* Fixed types in various calls to `objc::msg_send!` for better verification.
230235

231236

232-
## [0.1.1] - 2016-06-19
237+
## objc-foundation [0.1.1] - 2016-06-19
233238

234239
### Fixed
235240
* An issue with passing functions (instead of function pointers) in
236241
`INSMutableArray::sort_by`.
237242

238243

239-
## [0.1.0] - 2016-03-20
244+
## objc-foundation [0.1.0] - 2016-03-20
240245

241246
### Changed
242247
* Update `objc` to `v0.2`.
243248
* Update `objc_id` to `v0.1`.
244249

245250

246-
## [0.0.4] - 2015-12-09
251+
## objc-foundation [0.0.4] - 2015-12-09
247252

248253
### Removed
249254
* `libc` dependency.
250255

251256

252-
## [0.0.3] - 2015-11-07
257+
## objc-foundation [0.0.3] - 2015-11-07
253258

254259
### Added
255260
* `object_struct!` macro.
@@ -258,13 +263,13 @@ Note: This is the version that is, as of this writing, available on the
258263
* `libc` version can both be `0.1` and `0.2`.
259264

260265

261-
## [0.0.2] - 2015-09-03
266+
## objc-foundation [0.0.2] - 2015-09-03
262267

263268
### Added
264269
* `Any` bound on `INSObject`, because of a change in `objc` `v0.1.6`.
265270

266271

267-
## [0.0.1] - 2015-06-13
272+
## objc-foundation [0.0.1] - 2015-06-13
268273

269274
Initial release.
270275

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 <mads@marquart.dk>"]
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

objc2-foundation/examples/basic_usage.rs renamed to objc2/examples/basic_usage.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
use objc2::foundation::{NSArray, NSDictionary, NSObject};
2+
use objc2::ns_string;
13
use objc2::rc::autoreleasepool;
2-
use objc2_foundation::{ns_string, NSArray, NSDictionary, NSObject};
34

45
fn main() {
56
// Create and compare NSObjects

objc2-foundation/examples/class_with_lifetime.rs renamed to objc2/examples/class_with_lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::marker::PhantomData;
33
use std::sync::Once;
44

55
use objc2::declare::ClassBuilder;
6+
use objc2::foundation::NSObject;
67
use objc2::rc::{Id, Owned, Shared};
78
use objc2::runtime::{Class, Object, Sel};
89
use objc2::{msg_send, msg_send_id, sel};
910
use objc2::{Encoding, Message, RefEncode};
10-
use objc2_foundation::NSObject;
1111

1212
#[repr(C)]
1313
pub struct MyObject<'a> {

objc2-foundation/examples/custom_class.rs renamed to objc2/examples/custom_class.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::sync::Once;
22

33
use objc2::declare::{ClassBuilder, Ivar, IvarType};
4+
use objc2::foundation::NSObject;
45
use objc2::rc::{Id, Owned};
56
use objc2::runtime::{Class, Object, Sel};
67
use objc2::{msg_send, msg_send_id, sel};
78
use objc2::{Encoding, Message, RefEncode};
8-
use objc2_foundation::NSObject;
99

1010
struct NumberIvar;
1111
unsafe impl IvarType for NumberIvar {

0 commit comments

Comments
 (0)