Skip to content

Deprecate cocoa, cocoa-foundation and io-surface and link to objc2 crates instead #731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cocoa-foundation/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deprecated = "use the objc2 crate instead"]

use objc::runtime;

Expand Down
2 changes: 1 addition & 1 deletion cocoa-foundation/src/foundation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deprecated = "use the objc2-foundation crate instead"]
#![allow(non_upper_case_globals)]

use crate::base::{id, nil, BOOL, NO, SEL};
Expand Down
3 changes: 2 additions & 1 deletion cocoa-foundation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(non_snake_case)]
//! This crate has been deprecated in favour of the `objc2-foundation` crate.
#![allow(non_snake_case, deprecated)]

pub mod base;
pub mod foundation;
2 changes: 2 additions & 0 deletions cocoa-foundation/tests/foundation.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(deprecated)]

#[cfg(test)]
mod foundation {
mod nsstring {
Expand Down
4 changes: 3 additions & 1 deletion cocoa/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Cocoa-rs
--------

NOTE: This crate has been deprecated in favour of the `objc2` crates.

This crate provides Rust bindings to Cocoa for macOS. It's dual-licensed MIT /
Apache 2.0. If you'd like to help improve cocoa-rs, check out [the Servo
contributing guide](https://github.com/servo/servo/blob/main/CONTRIBUTING.md)!
contributing guide](https://github.com/servo/servo/blob/main/CONTRIBUTING.md)!
1 change: 1 addition & 0 deletions cocoa/examples/color.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)] // the cocoa crate is deprecated
use cocoa::base::{id, nil, selector, NO};

use cocoa::appkit::{
Expand Down
1 change: 1 addition & 0 deletions cocoa/examples/fullscreen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)] // the cocoa crate is deprecated
use cocoa::appkit::{
NSApp, NSApplication, NSApplicationActivateIgnoringOtherApps,
NSApplicationActivationPolicyRegular, NSApplicationPresentationOptions, NSBackingStoreBuffered,
Expand Down
1 change: 1 addition & 0 deletions cocoa/examples/hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)] // the cocoa crate is deprecated
use cocoa::appkit::{
NSApp, NSApplication, NSApplicationActivateIgnoringOtherApps,
NSApplicationActivationPolicyRegular, NSBackingStoreBuffered, NSMenu, NSMenuItem,
Expand Down
1 change: 1 addition & 0 deletions cocoa/examples/nsvisualeffectview_blur.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)] // the cocoa crate is deprecated
use cocoa::base::{nil, selector, NO};
use objc::*;

Expand Down
1 change: 1 addition & 0 deletions cocoa/examples/tab_view.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(deprecated)] // the cocoa crate is deprecated
use cocoa::base::{id, nil, selector, NO};

use cocoa::appkit::{
Expand Down
1 change: 1 addition & 0 deletions cocoa/src/appkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deprecated = "use the objc2-app-kit crate instead"]
#![allow(non_upper_case_globals)]

use crate::base::{id, BOOL, SEL};
Expand Down
10 changes: 0 additions & 10 deletions cocoa/src/base.rs

This file was deleted.

10 changes: 0 additions & 10 deletions cocoa/src/foundation.rs

This file was deleted.

7 changes: 4 additions & 3 deletions cocoa/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! This crate has been deprecated in favour of the `objc2` crates.
#![crate_name = "cocoa"]
#![crate_type = "rlib"]
#![allow(non_snake_case)]
#![allow(non_snake_case, deprecated)]

#[cfg(target_os = "macos")]
pub mod appkit;
pub mod base;
pub mod foundation;
pub use cocoa_foundation::base;
pub use cocoa_foundation::foundation;
#[cfg(target_os = "macos")]
pub mod quartzcore;
#[macro_use]
Expand Down
1 change: 1 addition & 0 deletions cocoa/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
/// # }
/// ```
#[macro_export]
#[deprecated = "use the objc2::define_class! macro instead"]
macro_rules! delegate {
(
$name:expr, {
Expand Down
1 change: 1 addition & 0 deletions cocoa/src/quartzcore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![deprecated = "use the objc2-quartz-core crate instead"]
#![allow(non_upper_case_globals)]

use bitflags::bitflags;
Expand Down
2 changes: 2 additions & 0 deletions io-surface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! This crate has been deprecated in favour of the `objc2-io-surface` crate.
#![deprecated = "use the objc2-io-surface crate instead"]
#![crate_name = "io_surface"]
#![crate_type = "rlib"]

Expand Down
Loading