Skip to content

Commit

Permalink
Merge pull request #536 from madsmtm/new-versions
Browse files Browse the repository at this point in the history
New versions
  • Loading branch information
madsmtm authored Dec 3, 2023
2 parents 1af01ab + a7ca37c commit 8b04944
Show file tree
Hide file tree
Showing 43 changed files with 364 additions and 167 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ jobs:
- fmt
- lint

env:
TRYBUILD: overwrite

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -213,6 +216,10 @@ jobs:
- name: Run UI tests
run: cargo run --features=run --bin=test-ui

- name: Check diff
if: ${{ always() }}
run: git diff --exit-code

assembly:
name: Assembly tests
runs-on: ubuntu-latest
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
[![License](https://badgen.net/badge/license/MIT/blue)](./LICENSE.txt)
[![CI](https://github.com/madsmtm/objc2/actions/workflows/ci.yml/badge.svg)](https://github.com/madsmtm/objc2/actions/workflows/ci.yml)

# DISCLAIMER! These crates are work in progress, and should not be used in production environments. Use the battle-tested `objc` family instead!

Anyway, thanks for being here, any help testing things out is highly
appreciated!

The two crates you're interested in is probably [`icrate`], which provide a
mostly autogenerated interface for Apple's Objective-C frameworks (`AppKit`,
`Foundation`, `Metal`, `WebKit`, you name it), and [`objc2`], which contains
Expand Down
2 changes: 1 addition & 1 deletion crates/block-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ unstable-objfw = []
unstable-docsrs = ["objc-sys", "objc-sys/unstable-docsrs"]

[dependencies]
objc-sys = { path = "../objc-sys", version = "0.3.1", default-features = false, optional = true }
objc-sys = { path = "../objc-sys", version = "0.3.2", default-features = false, optional = true }

[package.metadata.docs.rs]
default-target = "x86_64-apple-darwin"
Expand Down
6 changes: 6 additions & 0 deletions crates/block2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased - YYYY-MM-DD


## 0.4.0 - 2023-12-03

### Changed
* **BREAKING**: Updated `objc2` dependency to `v0.5.0`.


## 0.3.0 - 2023-07-31

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions crates/block2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "block2"
# Remember to update html_root_url in lib.rs and README.md
version = "0.3.0"
version = "0.4.0"
authors = ["Steven Sheldon", "Mads Marquart <mads@marquart.dk>"]
edition = "2021"
rust-version = "1.60"
Expand Down Expand Up @@ -35,7 +35,7 @@ gnustep-2-0 = ["gnustep-1-9", "block-sys/gnustep-2-0", "objc2/gnustep-2-0"]
gnustep-2-1 = ["gnustep-2-0", "block-sys/gnustep-2-1", "objc2/gnustep-2-1"]

[dependencies]
objc2 = { path = "../objc2", version = "0.4.1", default-features = false }
objc2 = { path = "../objc2", version = "0.5.0", default-features = false }
block-sys = { path = "../block-sys", version = "0.2.0", default-features = false }

[package.metadata.docs.rs]
Expand Down
2 changes: 1 addition & 1 deletion crates/block2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
#![warn(clippy::missing_errors_doc)]
#![warn(clippy::missing_panics_doc)]
// Update in Cargo.toml as well.
#![doc(html_root_url = "https://docs.rs/block2/0.3.0")]
#![doc(html_root_url = "https://docs.rs/block2/0.4.0")]

extern crate alloc;
extern crate std;
Expand Down
11 changes: 8 additions & 3 deletions crates/icrate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## icrate Unreleased - YYYY-MM-DD


## icrate 0.1.0 - 2023-12-03

### Added
* Added `MainThreadMarker` `From` implementation for `MainThreadOnly` types.
* Added `Send` and `Sync` implementations for a bunch more types (same as the
Expand Down Expand Up @@ -62,7 +65,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
`NS[Mutable]Dictionary::from_vec`.
* **BREAKING**: Renamed `NSMutableDictionary::insert` and
`NSMutableSet::insert` to `insert_id`.
- **BREAKING**: `CWWiFiClient::interfaceNames` has been renamed to `CWWiFiClient::interfaceNames_class`.
* **BREAKING**: `CWWiFiClient::interfaceNames` has been renamed to `CWWiFiClient::interfaceNames_class`.
* **BREAKING**: Updated `objc2` to `v0.5.0`.
* **BREAKING**: Updated `block2` to `v0.4.0`.

### Removed
* **BREAKING**: Removed the `MainThreadMarker` argument from the closure
Expand Down Expand Up @@ -92,8 +97,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
`AnyObject` instead of the correct `ProtocolObject<dyn NSCopying>`).
* Update the minimum deployment target, which adds a few missing protocol
implementations and methods for `NSPopover` and `NSLayoutAnchor`.
- **BREAKING**: `CKSystemSharingUIObserver` and `CKLocationSortDescriptor` are no longer marked thread safe.
- **BREAKING**: `NSColor::ignoresAlpha` now requires a main thread marker.
* **BREAKING**: `CKSystemSharingUIObserver` and `CKLocationSortDescriptor` are no longer marked thread safe.
* **BREAKING**: `NSColor::ignoresAlpha` now requires a main thread marker.


## icrate 0.0.4 - 2023-07-31
Expand Down
6 changes: 3 additions & 3 deletions crates/icrate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "icrate"
version = "0.0.4" # Remember to update html_root_url in lib.rs
version = "0.1.0" # Remember to update html_root_url in lib.rs
authors = ["Mads Marquart <mads@marquart.dk>"]
edition = "2021"
rust-version = "1.60"
Expand All @@ -20,8 +20,8 @@ documentation = "https://docs.rs/icrate/"
license = "MIT"

[dependencies]
objc2 = { path = "../objc2", version = "0.4.1", default-features = false, optional = true }
block2 = { path = "../block2", version = "0.3.0", default-features = false, optional = true }
objc2 = { path = "../objc2", version = "0.5.0", default-features = false, optional = true }
block2 = { path = "../block2", version = "0.4.0", default-features = false, optional = true }
dispatch = { version = "0.2.0", optional = true }

[dev-dependencies]
Expand Down
6 changes: 5 additions & 1 deletion crates/icrate/src/additions/Foundation/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,11 @@ impl<K: Message, V: Message> NSDictionary<K, V> {
///
/// # Examples
///
/// ```
#[cfg_attr(all(feature = "Foundation_NSMutableDictionary"), doc = "```")]
#[cfg_attr(
not(all(feature = "Foundation_NSMutableDictionary")),
doc = "```ignore"
)]
/// use icrate::Foundation::{ns_string, NSMutableDictionary, NSObject, NSString};
///
/// let mut dict = NSMutableDictionary::new();
Expand Down
2 changes: 1 addition & 1 deletion crates/icrate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
#![allow(clippy::identity_op)]
#![allow(clippy::missing_safety_doc)]
// Update in Cargo.toml as well.
#![doc(html_root_url = "https://docs.rs/icrate/0.0.4")]
#![doc(html_root_url = "https://docs.rs/icrate/0.1.0")]
#![recursion_limit = "512"]

#[cfg(feature = "alloc")]
Expand Down
3 changes: 3 additions & 0 deletions crates/objc-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased - YYYY-MM-DD


## 0.3.2 - 2023-12-03

### Added
* Added `objc_terminate`, `object_isClass`, `objc_alloc` and
`objc_allocWithZone` now that Rust's macOS deployment target is 10.12.
Expand Down
2 changes: 1 addition & 1 deletion crates/objc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "objc-sys"
#
# Also, beware of using pre-release versions here, since because of the
# `links` key, two pre-releases requested with `=...` are incompatible.
version = "0.3.1"
version = "0.3.2"
authors = ["Mads Marquart <mads@marquart.dk>"]
edition = "2021"
rust-version = "1.60"
Expand Down
2 changes: 1 addition & 1 deletion crates/objc-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![doc(html_root_url = "https://docs.rs/objc-sys/0.3.1")]
#![doc(html_root_url = "https://docs.rs/objc-sys/0.3.2")]
#![cfg_attr(feature = "unstable-c-unwind", feature(c_unwind))]
#![cfg_attr(feature = "unstable-docsrs", feature(doc_auto_cfg, doc_cfg_hide))]
#![cfg_attr(feature = "unstable-docsrs", doc(cfg_hide(doc)))]
Expand Down
3 changes: 3 additions & 0 deletions crates/objc2-encode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased - YYYY-MM-DD


## 4.0.0 - 2023-12-03

### Changed
* **BREAKING**: Changed the type of `EncodingBox::Struct` and
`EncodingBox::Union` to no longer contain an `Option`.
Expand Down
2 changes: 1 addition & 1 deletion crates/objc2-encode/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "objc2-encode"
# Remember to update html_root_url in lib.rs
version = "3.0.0"
version = "4.0.0"
authors = ["Steven Sheldon", "Mads Marquart <mads@marquart.dk>"]
edition = "2021"
rust-version = "1.60"
Expand Down
2 changes: 1 addition & 1 deletion crates/objc2-encode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#![warn(clippy::missing_errors_doc)]
#![warn(clippy::missing_panics_doc)]
// Update in Cargo.toml as well.
#![doc(html_root_url = "https://docs.rs/objc2-encode/3.0.0")]
#![doc(html_root_url = "https://docs.rs/objc2-encode/4.0.0")]
#![cfg_attr(feature = "unstable-c-unwind", feature(c_unwind))]

#[cfg(doctest)]
Expand Down
4 changes: 4 additions & 0 deletions crates/objc2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased - YYYY-MM-DD


## 0.5.0 - 2023-12-03

### Added
* Added the following traits to the `mutability` module (see the documentation
for motivation and usage info):
Expand Down Expand Up @@ -154,6 +157,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
that uses of `Option<Allocated<T>>` is now simply `Allocated<T>`.
* `AnyObject::class` now returns a `'static` reference to the class.
* Relaxed `ProtocolType` requirement on `ProtocolObject`.
* **BREAKING**: Updated `encode` types to those from `objc2-encode v4.0.0`.

### Deprecated
* Soft deprecated using `msg_send!` without a comma between arguments (i.e.
Expand Down
6 changes: 3 additions & 3 deletions crates/objc2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "objc2"
version = "0.4.1" # Remember to update html_root_url in lib.rs
version = "0.5.0" # Remember to update html_root_url in lib.rs
authors = ["Steven Sheldon", "Mads Marquart <mads@marquart.dk>"]
edition = "2021"
rust-version = "1.60"
Expand Down Expand Up @@ -101,8 +101,8 @@ unstable-compiler-rt = ["apple"]

[dependencies]
malloc_buf = { version = "1.0", optional = true }
objc-sys = { path = "../objc-sys", version = "0.3.1", default-features = false }
objc2-encode = { path = "../objc2-encode", version = "3.0.0", default-features = false }
objc-sys = { path = "../objc-sys", version = "0.3.2", default-features = false }
objc2-encode = { path = "../objc2-encode", version = "4.0.0", default-features = false }
objc2-proc-macros = { path = "../objc2-proc-macros", version = "0.1.1", optional = true }

[dev-dependencies]
Expand Down
8 changes: 8 additions & 0 deletions crates/objc2/src/__macro_helpers/declared_ivars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,10 @@ mod tests {

#[test]
#[should_panic = "panic in drop"]
#[cfg_attr(
any(feature = "unstable-c-unwind", target_arch = "x86"),
ignore = "panicking in Drop requires that we actually implement `dealloc` as `C-unwind`"
)]
fn test_panic_in_drop() {
declare_class!(
struct DropPanics;
Expand All @@ -901,6 +905,10 @@ mod tests {

#[test]
#[should_panic = "panic in ivar drop"]
#[cfg_attr(
any(feature = "unstable-c-unwind", target_arch = "x86"),
ignore = "panicking in Drop requires that we actually implement `dealloc` as `C-unwind`"
)]
fn test_panic_in_ivar_drop() {
struct DropPanics;

Expand Down
7 changes: 7 additions & 0 deletions crates/objc2/src/__macro_helpers/msg_send_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,13 @@ mod tests {
#[test]
#[should_panic = "tried to initialize ivars after they were already initialized"]
#[cfg_attr(not(debug_assertions), ignore = "only checked with debug assertions")]
#[cfg_attr(
all(
debug_assertions,
any(feature = "unstable-c-unwind", target_arch = "x86")
),
ignore = "panicking in `init` requires that we emit the function as `C-unwind`"
)]
fn test_super_init_not_initialized() {
let obj = __RcTestObject::alloc().set_ivars(());
let _: Id<__RcTestObject> =
Expand Down
2 changes: 1 addition & 1 deletion crates/objc2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
#![warn(clippy::missing_errors_doc)]
#![warn(clippy::missing_panics_doc)]
// Update in Cargo.toml as well.
#![doc(html_root_url = "https://docs.rs/objc2/0.4.1")]
#![doc(html_root_url = "https://docs.rs/objc2/0.5.0")]

#[cfg(not(feature = "alloc"))]
compile_error!("The `alloc` feature currently must be enabled.");
Expand Down
9 changes: 8 additions & 1 deletion crates/objc2/src/rc/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,13 @@ impl<T: Message> Id<T> {
// swiftc: https://github.com/apple/swift/blob/swift-5.5.3-RELEASE/lib/IRGen/GenObjC.cpp#L148-L173
// Clang: https://github.com/llvm/llvm-project/blob/889317d47b7f046cf0e68746da8f7f264582fb5b/clang/lib/CodeGen/CGObjC.cpp#L2339-L2373
//
// Note that LLVM may sometimes insert extra instructions between the
// assembly and the `objc_retainAutoreleasedReturnValue` call,
// especially when doing tail calls and it needs to clean up the
// function frame. Unsure how to avoid this in a performant manner?
// Maybe force not doing tail calls by inserting assembly to do the
// call manually?
//
// Resources:
// - https://www.mikeash.com/pyblog/friday-qa-2011-09-30-automatic-reference-counting.html
// - https://www.galloway.me.uk/2012/02/how-does-objc_retainautoreleasedreturnvalue-work/
Expand Down Expand Up @@ -423,7 +430,7 @@ impl<T: Message> Id<T> {
// https://developer.apple.com/videos/play/wwdc2022/110363/
#[cfg(all(target_arch = "aarch64", not(feature = "unstable-apple-new")))]
unsafe {
// Same as `mov x29, x29`
// Same as `mov x29, x29`.
core::arch::asm!("mov fp, fp", options(nomem, preserves_flags, nostack))
};

Expand Down
5 changes: 4 additions & 1 deletion crates/objc2/src/rc/test_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,10 @@ mod tests {
// x86 autorelease_return is not currently tail-called, so the
// optimization doesn't work on declare_class! functions.
2
} else if cfg!(any(debug_assertions, feature = "exception")) {
} else if cfg!(target_arch = "aarch64") {
// Currently doesn't work
2
} else if cfg!(any(debug_assertions, feature = "catch-all")) {
2
} else {
1
Expand Down
2 changes: 1 addition & 1 deletion crates/objc2/tests/id_retain_autoreleased.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn test_retain_autoreleased() {
} else if cfg!(all(target_arch = "arm", panic = "unwind")) {
// 32-bit ARM unwinding interferes with the optimization
2
} else if cfg!(any(debug_assertions, feature = "exception")) {
} else if cfg!(any(debug_assertions, feature = "catch-all")) {
2
} else {
1
Expand Down
Loading

0 comments on commit 8b04944

Please sign in to comment.