diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f695fea5c..3d7961d97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,8 +51,8 @@ env: FRAMEWORKS_MACOS_12: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-business-chat --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit FRAMEWORKS_MACOS_13: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit FRAMEWORKS_MACOS_14: --package=objc2-accessibility --package=objc2-accounts --package=objc2-ad-services --package=objc2-ad-support --package=objc2-app-kit --package=objc2-app-tracking-transparency --package=objc2-authentication-services --package=objc2-automatic-assessment-configuration --package=objc2-automator --package=objc2-av-kit --package=objc2-background-assets --package=objc2-business-chat --package=objc2-call-kit --package=objc2-class-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-image --package=objc2-core-location --package=objc2-core-ml --package=objc2-core-motion --package=objc2-core-wlan --package=objc2-data-detection --package=objc2-device-check --package=objc2-event-kit --package=objc2-exception-handling --package=objc2-extension-kit --package=objc2-external-accessory --package=objc2-file-provider --package=objc2-file-provider-ui --package=objc2-finder-sync --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-identity-lookup --package=objc2-input-method-kit --package=objc2-link-presentation --package=objc2-local-authentication --package=objc2-local-authentication-embedded-ui --package=objc2-mail-kit --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-fx --package=objc2-metal-kit --package=objc2-metric-kit --package=objc2-ml-compute --package=objc2-multipeer-connectivity --package=objc2-natural-language --package=objc2-nearby-interaction --package=objc2-network-extension --package=objc2-osa-kit --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-screen-capture-kit --package=objc2-sensitive-content-analysis --package=objc2-service-management --package=objc2-social --package=objc2-sound-analysis --package=objc2-speech --package=objc2-store-kit --package=objc2-symbols --package=objc2-uniform-type-identifiers --package=objc2-user-notifications --package=objc2-virtualization --package=objc2-vision --package=objc2-web-kit - FRAMEWORKS_IOS_10: --package=objc2-foundation --package=objc2-metal --package=objc2-ui-kit - FRAMEWORKS_GNUSTEP: --package=objc2-app-kit --package=objc2-core-data --package=objc2-foundation + FRAMEWORKS_IOS_10: --package=objc2-accounts --package=objc2-ad-support --package=objc2-av-kit --package=objc2-call-kit --package=objc2-cloud-kit --package=objc2-contacts --package=objc2-contacts-ui --package=objc2-core-bluetooth --package=objc2-core-data --package=objc2-core-image --package=objc2-core-location --package=objc2-core-motion --package=objc2-event-kit --package=objc2-external-accessory --package=objc2-foundation --package=objc2-game-controller --package=objc2-game-kit --package=objc2-health-kit --package=objc2-local-authentication --package=objc2-map-kit --package=objc2-media-player --package=objc2-metal --package=objc2-metal-kit --package=objc2-multipeer-connectivity --package=objc2-network-extension --package=objc2-photos --package=objc2-photos-ui --package=objc2-quartz-core --package=objc2-social --package=objc2-speech --package=objc2-store-kit --package=objc2-ui-kit --package=objc2-user-notifications + FRAMEWORKS_GNUSTEP: --package=objc2-app-kit --package=objc2-foundation # END AUTOMATICALLY GENERATED # The current nightly Rust version. Keep this synced with `rust-toolchain.toml` diff --git a/crates/header-translator/src/availability.rs b/crates/header-translator/src/availability.rs index 0a2ec1a80..538ea9291 100644 --- a/crates/header-translator/src/availability.rs +++ b/crates/header-translator/src/availability.rs @@ -1,4 +1,3 @@ -//! use std::fmt; use clang::{Entity, PlatformAvailability, Version}; @@ -8,9 +7,7 @@ use crate::context::Context; #[derive(Debug, Clone, PartialEq, Default)] struct Unavailable { ios: bool, - ios_app_extension: bool, macos: bool, - macos_app_extension: bool, maccatalyst: bool, watchos: bool, tvos: bool, @@ -18,17 +15,16 @@ struct Unavailable { } #[derive(Debug, Clone, PartialEq, Default)] -struct Versions { - ios: Option, - ios_app_extension: Option, - macos: Option, - macos_app_extension: Option, - maccatalyst: Option, - watchos: Option, - tvos: Option, - visionos: Option, +pub struct Versions { + pub(crate) macos: Option, + pub(crate) maccatalyst: Option, + pub(crate) ios: Option, + pub(crate) tvos: Option, + pub(crate) watchos: Option, + pub(crate) visionos: Option, } +/// #[derive(Debug, Clone, PartialEq)] pub struct Availability { unavailable: Unavailable, @@ -76,41 +72,23 @@ impl Availability { // TODO: Ensure that a specific platform only appears once match &*availability.platform { - "ios" => set( - availability, - &mut unavailable.ios, - &mut introduced.ios, - &mut deprecated.ios, - ), - "ios_app_extension" => set( - availability, - &mut unavailable.ios_app_extension, - &mut introduced.ios_app_extension, - &mut deprecated.ios_app_extension, - ), "macos" => set( availability, &mut unavailable.macos, &mut introduced.macos, &mut deprecated.macos, ), - "macos_app_extension" => set( - availability, - &mut unavailable.macos_app_extension, - &mut introduced.macos_app_extension, - &mut deprecated.macos_app_extension, - ), "maccatalyst" => set( availability, &mut unavailable.maccatalyst, &mut introduced.maccatalyst, &mut deprecated.maccatalyst, ), - "watchos" => set( + "ios" => set( availability, - &mut unavailable.watchos, - &mut introduced.watchos, - &mut deprecated.watchos, + &mut unavailable.ios, + &mut introduced.ios, + &mut deprecated.ios, ), "tvos" => set( availability, @@ -118,6 +96,12 @@ impl Availability { &mut introduced.tvos, &mut deprecated.tvos, ), + "watchos" => set( + availability, + &mut unavailable.watchos, + &mut introduced.watchos, + &mut deprecated.watchos, + ), "xros" => set( availability, &mut unavailable.visionos, @@ -127,6 +111,9 @@ impl Availability { "swift" => { _swift = Some(availability); } + platform if platform.ends_with("_app_extension") => { + // Ignore availability attributes for app extensions + } platform => error!(?platform, "unknown availability platform"), } } @@ -145,9 +132,7 @@ impl Availability { self.deprecated, Versions { ios: None, - ios_app_extension: None, macos: None, - macos_app_extension: None, maccatalyst: None, watchos: None, tvos: None, diff --git a/crates/header-translator/src/cfgs.rs b/crates/header-translator/src/cfgs.rs new file mode 100644 index 000000000..e90e3adfb --- /dev/null +++ b/crates/header-translator/src/cfgs.rs @@ -0,0 +1,301 @@ +use std::fmt::Display; + +use crate::config::LibraryConfig; +use crate::display_helper::FormatterFn; + +#[derive(Debug, Copy, Clone, Default, PartialEq)] +enum CfgState { + ShouldGate, + /// Whether we emit a `cfg` or not is irrelevant, because it is already + /// gated at a higher level. + #[default] + AlreadyGated, + Omit, +} + +impl CfgState { + fn new(enabled: bool) -> Self { + if enabled { + Self::ShouldGate + } else { + Self::AlreadyGated + } + } + + fn dependency(&mut self, dependency: bool) { + *self = match (*self, dependency) { + (Self::ShouldGate, true) => Self::ShouldGate, + (Self::ShouldGate, false) => Self::Omit, + (Self::AlreadyGated, _) => Self::AlreadyGated, + (Self::Omit, _) => Self::Omit, + }; + } + + fn implied(&mut self, implied: bool) { + *self = match (*self, implied) { + (Self::ShouldGate, false) => Self::ShouldGate, + (_, false) => Self::AlreadyGated, + (state, true) => state, + }; + } + + fn active(&self) -> bool { + matches!(self, Self::ShouldGate) + } + + fn allowed_active(&self) -> bool { + matches!(self, Self::ShouldGate | Self::AlreadyGated) + } +} + +#[derive(Debug, Clone, Default, PartialEq)] +pub struct PlatformCfg { + macos: CfgState, + maccatalyst: CfgState, + ios: CfgState, + tvos: CfgState, + watchos: CfgState, + visionos: CfgState, + gnustep: CfgState, +} + +impl PlatformCfg { + pub fn from_config(lib: &LibraryConfig) -> Self { + Self { + macos: CfgState::new(lib.macos.is_some()), + // FIXME: Temporarily disable any form of Mac Catalyst handling, + // as `cfg(target_abi = ...)` is only stable since Rust 1.78, and + // that is higher than our MSRV. + maccatalyst: CfgState::AlreadyGated, + ios: CfgState::new(lib.ios.is_some()), + tvos: CfgState::new(lib.tvos.is_some()), + watchos: CfgState::new(lib.watchos.is_some()), + visionos: CfgState::new(lib.visionos.is_some()), + gnustep: CfgState::new(lib.gnustep), + } + } + + pub fn dependency(&mut self, dependency: &LibraryConfig) { + self.macos.dependency(dependency.macos.is_some()); + // FIXME: Temporarily disable Mac Catalyst, see above + // self.maccatalyst.dependency(dependency.maccatalyst.is_some()); + self.ios.dependency(dependency.ios.is_some()); + self.tvos.dependency(dependency.tvos.is_some()); + self.watchos.dependency(dependency.watchos.is_some()); + self.visionos.dependency(dependency.visionos.is_some()); + self.gnustep.dependency(dependency.gnustep); + } + + pub fn implied(&mut self, implied: &LibraryConfig) { + self.macos.implied(implied.macos.is_some()); + // FIXME: Temporarily disable Mac Catalyst, see above + // self.maccatalyst.implied(implied.maccatalyst.is_some()); + self.ios.implied(implied.ios.is_some()); + self.tvos.implied(implied.tvos.is_some()); + self.watchos.implied(implied.watchos.is_some()); + self.visionos.implied(implied.visionos.is_some()); + self.gnustep.implied(implied.gnustep); + } + + pub fn cfgs(&self) -> Option { + // Don't emit a cfg if we can avoid it + if self.macos.allowed_active() + && self.maccatalyst.allowed_active() + && self.ios.allowed_active() + && self.tvos.allowed_active() + && self.watchos.allowed_active() + && self.visionos.allowed_active() + && self.gnustep.allowed_active() + { + return None; + } + + Some(FormatterFn(|f| { + match ( + self.macos.allowed_active(), + self.maccatalyst.allowed_active(), + self.ios.allowed_active(), + self.tvos.allowed_active(), + self.watchos.allowed_active(), + self.visionos.allowed_active(), + self.gnustep.allowed_active(), + ) { + // Emit `target_vendor = "apple"` if at all possible, since + // it's more general. + (true, true, true, true, true, true, false) => { + return write!(f, "target_vendor = \"apple\""); + } + // Emit negative `cfg`s when only a niche platform is + // excluded, since it's more likely to be the "true" config + // for this item (e.g. if something is excluded on iOS and + // macOS, it'll likely be on other targets in the future. But + // if something is excluded just for tvOS, that exclusion + // probably only applies to tvOS). + (true, false, true, true, true, true, true) => { + return write!(f, "not(target_abi = \"macabi\")"); + } + (true, true, true, false, true, true, true) => { + return write!(f, "not(target_os = \"tvos\")"); + } + (true, true, true, true, false, true, true) => { + return write!(f, "not(target_os = \"watchos\")"); + } + (true, true, true, false, false, true, true) => { + // tvOS and watchOS are more bare-bones that the others + return write!(f, "not(any(target_os = \"tvos\", target_os = \"watchos\"))"); + } + (true, true, true, true, true, false, true) => { + return write!(f, "not(target_os = \"visionos\")"); + } + _ => {} + } + + let mut cfgs: Vec<&str> = Vec::new(); + + if self.macos.active() { + cfgs.push("target_os = \"macos\""); + } + match (self.ios, self.maccatalyst) { + (CfgState::ShouldGate, CfgState::ShouldGate | CfgState::AlreadyGated) => { + cfgs.push("target_os = \"ios\"") + } + (CfgState::ShouldGate, CfgState::Omit) => { + cfgs.push("all(target_os = \"ios\", not(target_abi = \"macabi\"))") + } + (CfgState::AlreadyGated, CfgState::ShouldGate) => cfgs.push("target_os = \"ios\""), + (CfgState::AlreadyGated, _) => {} + (CfgState::Omit, CfgState::ShouldGate) => cfgs.push("target_abi = \"macabi\""), + (CfgState::Omit, _) => {} + } + if self.tvos.active() { + cfgs.push("target_os = \"tvos\""); + } + if self.watchos.active() { + cfgs.push("target_os = \"watchos\""); + } + if self.visionos.active() { + cfgs.push("target_os = \"visionos\""); + } + if self.gnustep.active() { + // FIXME: This will fail if it got emitted in `Cargo.toml` + cfgs.push("feature = \"gnustep-1-7\""); + } + + match &*cfgs { + [] => write!(f, "any()"), // Should be unreachable in reality + [cfg] => write!(f, "{cfg}"), + cfgs => write!(f, "any({})", cfgs.join(", ")), + } + })) + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[track_caller] + fn assert_cfgs(platform: &PlatformCfg, expected: &str) { + let actual = platform + .cfgs() + .map(|cfg| cfg.to_string()) + .unwrap_or("all()".to_string()); + assert_eq!(expected, actual, "platform: {platform:?}"); + } + + #[test] + fn basic() { + let mut platform = PlatformCfg::default(); + assert_cfgs(&platform, r#"all()"#); + + platform.gnustep = CfgState::Omit; + assert_cfgs(&platform, r#"target_vendor = "apple""#); + + platform.tvos = CfgState::Omit; + assert_cfgs(&platform, r#"any()"#); + + platform.visionos = CfgState::ShouldGate; + assert_cfgs(&platform, r#"target_os = "visionos""#); + + platform.watchos = CfgState::ShouldGate; + assert_cfgs( + &platform, + r#"any(target_os = "watchos", target_os = "visionos")"#, + ); + + platform.watchos = CfgState::AlreadyGated; + } + + #[test] + #[allow(clippy::field_reassign_with_default)] + fn maccatalyst() { + let mut platform = PlatformCfg::default(); + platform.macos = CfgState::Omit; + platform.tvos = CfgState::Omit; + + // iOS Gated + platform.ios = CfgState::ShouldGate; + platform.maccatalyst = CfgState::ShouldGate; + assert_cfgs(&platform, r#"target_os = "ios""#); + platform.maccatalyst = CfgState::AlreadyGated; + assert_cfgs(&platform, r#"target_os = "ios""#); + platform.maccatalyst = CfgState::Omit; + assert_cfgs( + &platform, + r#"all(target_os = "ios", not(target_abi = "macabi"))"#, + ); + + // iOS Irrelevant + platform.ios = CfgState::AlreadyGated; + platform.maccatalyst = CfgState::ShouldGate; + assert_cfgs(&platform, r#"target_os = "ios""#); + platform.maccatalyst = CfgState::AlreadyGated; + assert_cfgs(&platform, r#"any()"#); + platform.maccatalyst = CfgState::Omit; + assert_cfgs(&platform, r#"any()"#); + + // iOS Omit + platform.ios = CfgState::Omit; + platform.maccatalyst = CfgState::ShouldGate; + assert_cfgs(&platform, r#"target_abi = "macabi""#); + platform.maccatalyst = CfgState::AlreadyGated; + assert_cfgs(&platform, r#"any()"#); + platform.maccatalyst = CfgState::Omit; + assert_cfgs(&platform, r#"any()"#); + } + + #[test] + #[allow(clippy::field_reassign_with_default)] + fn systematic() { + #[rustfmt::skip] + let tests = &[ + ((true, true), (true, true), "all()"), // any(macos, ios) + ((true, false), (true, true), "target_os = \"ios\""), // ios + ((false, true), (true, true), "all()"), // any(macos, ios) | ios + ((false, false), (true, true), "all()"), // any(macos, ios) | ios + ((true, true), (true, false), "target_os = \"macos\""), // macos + ((true, false), (true, false), "any()"), // any() + ((false, true), (true, false), "any()"), // macos | any() + ((false, false), (true, false), "any()"), // macos | any() + ((true, true), (false, true), "all()"), // any(macos, ios) | macos + ((true, false), (false, true), "any()"), // ios | any() + ((false, true), (false, true), "all()"), // any(macos, ios) | macos | ios | any() + ((false, false), (false, true), "all()"), // any(macos, ios) | macos | ios | any() + ((true, true), (false, false), "all()"), // any(macos, ios) | macos + ((true, false), (false, false), "any()"), // ios | any() + ((false, true), (false, false), "all()"), // any(macos, ios) | macos | ios | any() + ((false, false), (false, false), "all()"), // any(macos, ios) | macos | ios | any() + ]; + + for ((macos_used, macos_avail), (ios_used, ios_avail), expected) in tests { + let mut platform = PlatformCfg::default(); + platform.macos = CfgState::new(*macos_used); + platform.macos.dependency(*macos_avail); + platform.ios = CfgState::new(*ios_used); + platform.ios.dependency(*ios_avail); + platform.maccatalyst = platform.ios; + + assert_cfgs(&platform, expected); + } + } +} diff --git a/crates/header-translator/src/config.rs b/crates/header-translator/src/config.rs index 6eef29351..7a2469b1f 100644 --- a/crates/header-translator/src/config.rs +++ b/crates/header-translator/src/config.rs @@ -8,7 +8,6 @@ use heck::ToTrainCase; use semver::Version; use serde::{de, Deserialize, Deserializer}; -use crate::id::Location; use crate::stmt::{Derives, Mutability}; use crate::ItemIdentifier; @@ -18,22 +17,43 @@ pub struct Config { pub system: LibraryConfig, } +fn uses_system_config(library_name: &str) -> bool { + match library_name { + "System" | "bitflags" | "block2" | "libc" | "objc2" => true, + // Temporary + "CoreFoundation" => true, + _ => false, + } +} + impl Config { - pub fn library(&self, location: impl AsRef) -> &LibraryConfig { - let location = location.as_ref(); - let library_name = location.library_name(); - if library_name == "System" || library_name == "objc2" { + pub fn library(&self, library_name: &str) -> &LibraryConfig { + if uses_system_config(library_name) { &self.system } else { self.libraries.get(library_name).unwrap_or_else(|| { - error!("tried to get library config from {location:?}"); + error!("tried to get library config from {library_name:?}"); &self.system }) } } + pub fn library_from_crate(&self, krate: &str) -> &LibraryConfig { + if uses_system_config(krate) { + &self.system + } else { + self.libraries + .values() + .find(|lib| lib.krate == krate) + .unwrap_or_else(|| { + error!("tried to get library config from krate {krate:?}"); + &self.system + }) + } + } + pub fn replace_protocol_name(&self, id: ItemIdentifier) -> ItemIdentifier { - let library_config = self.library(&id); + let library_config = self.library(id.library_name()); id.map_name(|name| { library_config .protocol_data diff --git a/crates/header-translator/src/id.rs b/crates/header-translator/src/id.rs index 0cb3f328d..f1a72fbbd 100644 --- a/crates/header-translator/src/id.rs +++ b/crates/header-translator/src/id.rs @@ -6,6 +6,7 @@ use std::collections::BTreeSet; use clang::Entity; +use crate::cfgs::PlatformCfg; use crate::context::Context; use crate::display_helper::FormatterFn; use crate::module::clean_name; @@ -154,6 +155,8 @@ impl Location { "block2" => LocationLibrary::Block2, "libc" => LocationLibrary::Libc, "objc2" => LocationLibrary::Objc2, + // Temporary + "CoreFoundation" => LocationLibrary::System, library => { if let Some(krate) = config.libraries.get(library).map(|lib| &*lib.krate) { if library == emission_library { @@ -175,7 +178,7 @@ impl Location { } } } else { - debug!(location = ?self, "failed getting crate name"); + error!(location = ?self, "failed getting crate name"); LocationLibrary::System } } @@ -407,53 +410,62 @@ impl AsRef for ItemIdentifier { /// items and the implied features. /// /// Only the library of the emmision location matters. -pub fn cfg_gate_ln, I: AsRef>( - required_features: impl IntoIterator, - implied_features: impl IntoIterator, - config: &Config, - emission_location: &Location, -) -> impl fmt::Display { +pub fn cfg_gate_ln<'a, R: AsRef + 'a, I: AsRef + 'a>( + required_features: impl IntoIterator + 'a, + implied_features: impl IntoIterator + 'a, + config: &'a Config, + emission_location: &'a Location, +) -> impl fmt::Display + 'a { + let emission_library = emission_location.library_name(); // Use a set to deduplicate features, and to have them in // a consistent order. - let mut feature_names: BTreeSet = required_features - .into_iter() - .filter_map(|id| { - id.as_ref() - .library(config, emission_location.library_name()) - .feature() - }) - .collect(); + let mut feature_names = BTreeSet::new(); + let mut platform_cfg = PlatformCfg::from_config(config.library(emission_library)); + + for location in required_features { + let location: &Location = location.as_ref(); + if let Some(feature_name) = location.library(config, emission_library).feature() { + feature_names.insert(feature_name); + } + + platform_cfg.dependency(config.library(location.library_name())); + } for location in implied_features { - if let Some(feature_name) = location - .as_ref() - .library(config, emission_location.library_name()) - .feature() - { + let location: &Location = location.as_ref(); + if let Some(feature_name) = location.library(config, emission_library).feature() { feature_names.remove(&feature_name); } + + platform_cfg.implied(config.library(location.library_name())); } - FormatterFn(move |f| match feature_names.len() { - 0 => Ok(()), - 1 => { - let feature = feature_names.first().unwrap(); - writeln!(f, "#[cfg(feature = \"{feature}\")]") - } - _ => { - write!(f, "#[cfg(all(")?; + FormatterFn(move |f| { + match feature_names.len() { + 0 => {} + 1 => { + let feature = feature_names.first().unwrap(); + writeln!(f, "#[cfg(feature = \"{feature}\")]")?; + } + _ => { + write!(f, "#[cfg(all(")?; - for (i, feature) in feature_names.iter().enumerate() { - if i != 0 { - write!(f, ", ")?; + for (i, feature) in feature_names.iter().enumerate() { + if i != 0 { + write!(f, ", ")?; + } + write!(f, "feature = \"{feature}\"")?; } - write!(f, "feature = \"{feature}\"")?; - } - write!(f, "))]")?; - writeln!(f)?; + write!(f, "))]")?; + writeln!(f)?; + } + } - Ok(()) + if let Some(cfg) = platform_cfg.cfgs() { + writeln!(f, "#[cfg({cfg})]")?; } + + Ok(()) }) } diff --git a/crates/header-translator/src/lib.rs b/crates/header-translator/src/lib.rs index fc880b55f..2a72e99ce 100644 --- a/crates/header-translator/src/lib.rs +++ b/crates/header-translator/src/lib.rs @@ -11,6 +11,7 @@ use clang::{Entity, EntityVisitResult}; use tracing::span::EnteredSpan; mod availability; +mod cfgs; mod config; mod context; mod display_helper; diff --git a/crates/header-translator/src/library.rs b/crates/header-translator/src/library.rs index 164b70067..2ebaa38f8 100644 --- a/crates/header-translator/src/library.rs +++ b/crates/header-translator/src/library.rs @@ -10,6 +10,7 @@ use std::path::Path; use toml_edit::InlineTable; use toml_edit::{value, Array, DocumentMut, Formatted, Item, Table, Value}; +use crate::cfgs::PlatformCfg; use crate::config::LibraryConfig; use crate::display_helper::FormatterFn; use crate::module::Module; @@ -250,7 +251,7 @@ see that for related crates.", self.data.krate, self.link_name)?; cargo_toml["package"]["metadata"]["docs"]["rs"]["default-target"] = value(default_target.unwrap()); - for (krate, (required, _, features)) in &dependency_map[&*self.link_name] { + for (krate, (required, _, required_features)) in &dependency_map[&*self.link_name] { let mut table = match *krate { "objc2" => InlineTable::from_iter([ ("path", Value::from("../../crates/objc2".to_string())), @@ -273,15 +274,57 @@ see that for related crates.", self.data.krate, self.link_name)?; if !required { table.insert("optional", Value::from(true)); } - if !features.is_empty() { - let array: Array = features.iter().collect(); + if !required_features.is_empty() { + let array: Array = required_features.iter().collect(); table.insert("features", Value::from(array)); } + let mut platform_cfg = PlatformCfg::from_config(&self.data); + platform_cfg.dependency(config.library_from_crate(krate)); + let dependency_table = if let Some(cfgs) = platform_cfg.cfgs() { + let dep_position = cargo_toml["dependencies"] + .as_table() + .unwrap() + .position() + .unwrap(); + + let target = cargo_toml + .entry("target") + .or_insert({ + let mut table = Table::new(); + table.set_implicit(true); + Item::Table(table) + }) + .as_table_mut() + .unwrap(); + + target.set_position(dep_position); + + let key = format!("'cfg({cfgs})'").parse().unwrap(); + let cfg = target + .entry_format(&key) + .or_insert({ + let mut table = Table::new(); + table.set_implicit(true); + Item::Table(table) + }) + .as_table_mut() + .unwrap(); + + cfg.entry("dependencies") + .or_insert({ + let mut table = Table::new(); + table.set_implicit(true); + Item::Table(table) + }) + .as_table_mut() + .unwrap() + } else { + cargo_toml["dependencies"].as_table_mut().unwrap() + }; + // Don't override if set by Cargo.modified.toml - cargo_toml["dependencies"] - .as_table_mut() - .unwrap() + dependency_table .entry(krate) .or_insert(Item::Value(Value::InlineTable(table))); diff --git a/crates/header-translator/src/main.rs b/crates/header-translator/src/main.rs index 46247992e..97581122d 100644 --- a/crates/header-translator/src/main.rs +++ b/crates/header-translator/src/main.rs @@ -515,17 +515,11 @@ fn update_ci(workspace_dir: &Path, config: &Config) -> io::Result<()> { .is_some_and(|v| VersionReq::parse("<=14.0").unwrap().matches(v)) })?; writer(&mut ci, config, "FRAMEWORKS_IOS_10", |lib| { - // HACK: We can't test iOS frameworks with the `"all"` feature, as - // that enables `objc2-app-kit` as well. - matches!( - &*lib.krate, - "objc2-foundation" | "objc2-metal" | "objc2-ui-kit" - ) - })?; - writer(&mut ci, config, "FRAMEWORKS_GNUSTEP", |lib| { - lib.gnustep - && ["objc2-app-kit", "objc2-foundation", "objc2-core-data"].contains(&&*lib.krate) + lib.ios + .as_ref() + .is_some_and(|v| VersionReq::parse("<=10.0").unwrap().matches(v)) })?; + writer(&mut ci, config, "FRAMEWORKS_GNUSTEP", |lib| lib.gnustep)?; write!(&mut ci, " # END AUTOMATICALLY GENERATED{after}")?; diff --git a/crates/header-translator/src/module.rs b/crates/header-translator/src/module.rs index f1f8b5393..224c26caa 100644 --- a/crates/header-translator/src/module.rs +++ b/crates/header-translator/src/module.rs @@ -3,6 +3,7 @@ use std::ffi::OsString; use std::path::Path; use std::{fmt, fs}; +use crate::cfgs::PlatformCfg; use crate::display_helper::FormatterFn; use crate::id::{cfg_gate_ln, Location}; use crate::stmt::Stmt; @@ -82,13 +83,24 @@ impl Module { .stmts .iter() .flat_map(|stmt| stmt.required_items_inner()) - .filter_map(|item| item.location().library(config, emission_library).import()) + .filter_map(|item| { + item.location() + .library(config, emission_library) + .import() + .map(|import_data| (item.library_name().to_string(), import_data)) + }) .collect(); - for (krate, required) in imports { + let emission_config = &config.library(emission_library); + for (library_name, (krate, required)) in imports { if !required { writeln!(f, "#[cfg(feature = {:?})]", krate)?; } + let mut platform_cfg = PlatformCfg::from_config(emission_config); + platform_cfg.dependency(config.library(&library_name)); + if let Some(cfg) = platform_cfg.cfgs() { + writeln!(f, "#[cfg({cfg})]")?; + } writeln!(f, "use {}::*;", krate.replace('-', "_"))?; } writeln!(f)?; @@ -130,7 +142,7 @@ impl Module { write!( f, "{}", - cfg_gate_ln::<_, Location>(items, [], config, item.location()) + cfg_gate_ln(items, &[] as &[Location], config, item.location()) )?; let visibility = if item.name.starts_with('_') { diff --git a/crates/header-translator/src/stmt.rs b/crates/header-translator/src/stmt.rs index 89dfb4bf4..697986ab2 100644 --- a/crates/header-translator/src/stmt.rs +++ b/crates/header-translator/src/stmt.rs @@ -292,7 +292,7 @@ pub(crate) fn items_required_by_decl( match entity.get_kind() { EntityKind::ObjCInterfaceDecl => { - let data = context.library(&id).class_data.get(&id.name); + let data = context.library(id.library_name()).class_data.get(&id.name); for (superclass, _, _) in parse_superclasses(entity, context) { items.push(superclass); @@ -634,7 +634,7 @@ impl Stmt { EntityKind::ObjCInterfaceDecl => { // entity.get_mangled_objc_names() let id = ItemIdentifier::new(entity, context); - let data = context.library(&id).class_data.get(&id.name); + let data = context.library(id.library_name()).class_data.get(&id.name); if data.map(|data| data.skipped).unwrap_or_default() { return vec![]; @@ -680,7 +680,7 @@ impl Stmt { .iter() .filter_map(|(superclass_id, _, entity)| { let superclass_data = context - .library(superclass_id) + .library(superclass_id.library_name()) .class_data .get(&superclass_id.name); @@ -787,7 +787,10 @@ impl Stmt { let cls_entity = cls_entity.expect("could not find category class"); let cls = ItemIdentifier::new(&cls_entity, context); - let data = context.library(&category).class_data.get(&cls.name); + let data = context + .library(category.library_name()) + .class_data + .get(&cls.name); if data.map(|data| data.skipped).unwrap_or_default() { return vec![]; @@ -855,8 +858,10 @@ impl Stmt { let extra_methods = if let Mutability::ImmutableWithMutableSubclass(subclass) = data.map(|data| data.mutability.clone()).unwrap_or_default() { - let subclass_data = - context.library(&subclass).class_data.get(&subclass.name); + let subclass_data = context + .library(subclass.library_name()) + .class_data + .get(&subclass.name); assert!(!subclass_data.map(|data| data.skipped).unwrap_or_default()); let (mut methods, _) = parse_methods( @@ -981,7 +986,7 @@ impl Stmt { EntityKind::ObjCProtocolDecl => { let actual_id = ItemIdentifier::new(entity, context); let data = context - .library(&actual_id) + .library(actual_id.library_name()) .protocol_data .get(&actual_id.name); let actual_name = data @@ -1064,7 +1069,7 @@ impl Stmt { }); if context - .library(&id) + .library(id.library_name()) .typedef_data .get(&id.name) .map(|data| data.skipped) @@ -1093,7 +1098,7 @@ impl Stmt { let availability = Availability::parse(entity, context); if context - .library(&id) + .library(id.library_name()) .struct_data .get(&id.name) .map(|data| data.skipped) @@ -1170,7 +1175,7 @@ impl Stmt { let id = new_enum_id(entity, context); let data = context - .library(&id) + .library(id.library_name()) .enum_data .get(id.name.as_deref().unwrap_or("anonymous")) .cloned() @@ -1303,7 +1308,7 @@ impl Stmt { let id = ItemIdentifier::new(entity, context); if context - .library(&id) + .library(id.library_name()) .statics .get(&id.name) .map(|data| data.skipped) @@ -1347,7 +1352,7 @@ impl Stmt { let id = ItemIdentifier::new(entity, context); let data = context - .library(&id) + .library(id.library_name()) .fns .get(&id.name) .cloned() diff --git a/crates/header-translator/src/thread_safety.rs b/crates/header-translator/src/thread_safety.rs index 155bfc466..2cc7edc35 100644 --- a/crates/header-translator/src/thread_safety.rs +++ b/crates/header-translator/src/thread_safety.rs @@ -77,7 +77,7 @@ impl ThreadSafetyAttr { match entity.get_kind() { EntityKind::ObjCInterfaceDecl => { let id = ItemIdentifier::new(entity, context); - let data = context.library(&id).class_data.get(&id.name); + let data = context.library(id.library_name()).class_data.get(&id.name); if data.map(|data| data.mutability.clone()).unwrap_or_default() == Mutability::MainThreadOnly @@ -87,7 +87,10 @@ impl ThreadSafetyAttr { } EntityKind::ObjCProtocolDecl => { let id = ItemIdentifier::new(entity, context); - let data = context.library(&id).protocol_data.get(&id.name); + let data = context + .library(id.library_name()) + .protocol_data + .get(&id.name); // Set the protocol as main thread only if all methods are // explicitly _marked_ (not inferred, since then we'd have to diff --git a/crates/header-translator/system-config.toml b/crates/header-translator/system-config.toml index 3cf872541..f3612e183 100644 --- a/crates/header-translator/system-config.toml +++ b/crates/header-translator/system-config.toml @@ -2,6 +2,13 @@ framework = "System" crate = "objc2-system" required-dependencies = [] +macos = "10.0" +maccatalyst = "13.0" +ios = "2.0" +tvos = "9.0" +watchos = "2.0" +visionos = "1.0" +gnustep = true # Both a protocol and a class, so we use Swift's naming scheme protocol.NSObject.renamed = "NSObjectProtocol" diff --git a/crates/objc2/src/topics/about_generated/CHANGELOG.md b/crates/objc2/src/topics/about_generated/CHANGELOG.md index f487df374..16976bb37 100644 --- a/crates/objc2/src/topics/about_generated/CHANGELOG.md +++ b/crates/objc2/src/topics/about_generated/CHANGELOG.md @@ -59,9 +59,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). implements the protocol, but was marked with `Mutability = Mutable`, but Metal protocols are assumed retainable by Objective-C code, so that'd have been unsound anyway. +* Add `#[cfg(target_os = "...")]` when a platform-specific dependency is used. + + This improves iOS support, as crates like `objc2-app-kit` are no longer + enabled on this platform. ### Removed * `objc2-metal`: Removed internal `__MTLPackedFloat3` and made `MTLPackedFloat3` public. +* `objc2-core-data`: Removed broken GNUStep support. +* `objc2-quartz-core`: Removed broken GNUStep support. ## 0.2.0 - 2024-04-17 diff --git a/framework-crates/objc2-app-kit/Cargo.toml b/framework-crates/objc2-app-kit/Cargo.toml index ef80dbefc..ec4b07335 100644 --- a/framework-crates/objc2-app-kit/Cargo.toml +++ b/framework-crates/objc2-app-kit/Cargo.toml @@ -25,9 +25,11 @@ bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } libc = { version = "0.2.80", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } +objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } + +[target.'cfg(target_vendor = "apple")'.dependencies] objc2-core-data = { path = "../objc2-core-data", version = "0.2.0", default-features = false, optional = true } objc2-core-image = { path = "../objc2-core-image", version = "0.2.0", default-features = false, optional = true } -objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } objc2-quartz-core = { path = "../objc2-quartz-core", version = "0.2.0", default-features = false, optional = true } [package.metadata.docs.rs] diff --git a/framework-crates/objc2-authentication-services/Cargo.toml b/framework-crates/objc2-authentication-services/Cargo.toml index 432ca233c..cd7f42ac3 100644 --- a/framework-crates/objc2-authentication-services/Cargo.toml +++ b/framework-crates/objc2-authentication-services/Cargo.toml @@ -24,9 +24,11 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-av-kit/Cargo.toml b/framework-crates/objc2-av-kit/Cargo.toml index 9b5599853..a3e8bf75b 100644 --- a/framework-crates/objc2-av-kit/Cargo.toml +++ b/framework-crates/objc2-av-kit/Cargo.toml @@ -24,9 +24,11 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-business-chat/Cargo.toml b/framework-crates/objc2-business-chat/Cargo.toml index 5d0ab2a5d..61642bbed 100644 --- a/framework-crates/objc2-business-chat/Cargo.toml +++ b/framework-crates/objc2-business-chat/Cargo.toml @@ -22,9 +22,11 @@ workspace = true [dependencies] objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-contacts-ui/Cargo.toml b/framework-crates/objc2-contacts-ui/Cargo.toml index 8e32c61b7..2adb02d17 100644 --- a/framework-crates/objc2-contacts-ui/Cargo.toml +++ b/framework-crates/objc2-contacts-ui/Cargo.toml @@ -22,10 +22,12 @@ workspace = true [dependencies] objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-contacts = { path = "../objc2-contacts", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-core-data/Cargo.modified.toml b/framework-crates/objc2-core-data/Cargo.modified.toml index 426b1e1a1..9da33a0da 100644 --- a/framework-crates/objc2-core-data/Cargo.modified.toml +++ b/framework-crates/objc2-core-data/Cargo.modified.toml @@ -1,10 +1,8 @@ [features] -# Deprecated; this is the default on Apple platforms, and not applicable on other platforms. +# No-op, deprecated apple = [] - -# Runtime selection. See `objc-sys` for details. -gnustep-1-7 = ["objc2/gnustep-1-7", "block2?/gnustep-1-7", "objc2-foundation/gnustep-1-7"] -gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "block2?/gnustep-1-8", "objc2-foundation/gnustep-1-8"] -gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "block2?/gnustep-1-9", "objc2-foundation/gnustep-1-9"] -gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "block2?/gnustep-2-0", "objc2-foundation/gnustep-2-0"] -gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1", "objc2-foundation/gnustep-2-1"] +gnustep-1-7 = [] +gnustep-1-8 = [] +gnustep-1-9 = [] +gnustep-2-0 = [] +gnustep-2-1 = [] diff --git a/framework-crates/objc2-core-data/Cargo.toml b/framework-crates/objc2-core-data/Cargo.toml index dacdc71e1..61862d04d 100644 --- a/framework-crates/objc2-core-data/Cargo.toml +++ b/framework-crates/objc2-core-data/Cargo.toml @@ -36,8 +36,6 @@ targets = [ "aarch64-apple-tvos", "aarch64-apple-watchos", "aarch64-apple-ios-macabi", - "x86_64-unknown-linux-gnu", - "i686-unknown-linux-gnu", ] [features] @@ -47,11 +45,11 @@ default = ["std"] std = ["alloc", "bitflags?/std", "block2?/std", "objc2/std", "objc2-foundation/std"] alloc = ["block2?/alloc", "objc2/alloc", "objc2-foundation/alloc"] apple = [] -gnustep-1-7 = ["objc2/gnustep-1-7", "block2?/gnustep-1-7", "objc2-foundation/gnustep-1-7"] -gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "block2?/gnustep-1-8", "objc2-foundation/gnustep-1-8"] -gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "block2?/gnustep-1-9", "objc2-foundation/gnustep-1-9"] -gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "block2?/gnustep-2-0", "objc2-foundation/gnustep-2-0"] -gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1", "objc2-foundation/gnustep-2-1"] +gnustep-1-7 = [] +gnustep-1-8 = [] +gnustep-1-9 = [] +gnustep-2-0 = [] +gnustep-2-1 = [] bitflags = ["dep:bitflags", "objc2-foundation/bitflags"] block2 = ["dep:block2", "objc2-foundation/block2"] diff --git a/framework-crates/objc2-core-data/translation-config.toml b/framework-crates/objc2-core-data/translation-config.toml index d925ff290..90b9096a1 100644 --- a/framework-crates/objc2-core-data/translation-config.toml +++ b/framework-crates/objc2-core-data/translation-config.toml @@ -7,7 +7,6 @@ ios = "3.0" tvos = "9.0" watchos = "2.0" visionos = "1.0" -gnustep = true # Has `error:` parameter, but returns NSInteger (where 0 means error) class.NSManagedObjectContext.methods."countForFetchRequest:error:".skipped = true diff --git a/framework-crates/objc2-core-image/Cargo.toml b/framework-crates/objc2-core-image/Cargo.toml index eeffac15a..ba7c51f30 100644 --- a/framework-crates/objc2-core-image/Cargo.toml +++ b/framework-crates/objc2-core-image/Cargo.toml @@ -35,8 +35,6 @@ targets = [ "aarch64-apple-ios", "aarch64-apple-tvos", "aarch64-apple-ios-macabi", - "x86_64-unknown-linux-gnu", - "i686-unknown-linux-gnu", ] [features] diff --git a/framework-crates/objc2-core-image/translation-config.toml b/framework-crates/objc2-core-image/translation-config.toml index 3aa09932a..57c610fa8 100644 --- a/framework-crates/objc2-core-image/translation-config.toml +++ b/framework-crates/objc2-core-image/translation-config.toml @@ -6,7 +6,6 @@ maccatalyst = "13.0" ios = "5.0" tvos = "9.0" visionos = "1.0" -gnustep = true # CF_RETURNS_NOT_RETAINED class.CIColor.methods.colorSpace.skipped = true diff --git a/framework-crates/objc2-core-location/Cargo.toml b/framework-crates/objc2-core-location/Cargo.toml index d6b0df2ef..cee3ff34d 100644 --- a/framework-crates/objc2-core-location/Cargo.toml +++ b/framework-crates/objc2-core-location/Cargo.toml @@ -23,9 +23,11 @@ workspace = true [dependencies] block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-contacts = { path = "../objc2-contacts", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(not(target_os = "tvos"))'.dependencies] +objc2-contacts = { path = "../objc2-contacts", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-core-ml/Cargo.toml b/framework-crates/objc2-core-ml/Cargo.toml index fde548646..aa4a1161e 100644 --- a/framework-crates/objc2-core-ml/Cargo.toml +++ b/framework-crates/objc2-core-ml/Cargo.toml @@ -25,6 +25,8 @@ bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } + +[target.'cfg(not(target_os = "watchos"))'.dependencies] objc2-metal = { path = "../objc2-metal", version = "0.2.0", default-features = false, optional = true } [package.metadata.docs.rs] diff --git a/framework-crates/objc2-event-kit/Cargo.toml b/framework-crates/objc2-event-kit/Cargo.toml index af73dc0f3..67269c845 100644 --- a/framework-crates/objc2-event-kit/Cargo.toml +++ b/framework-crates/objc2-event-kit/Cargo.toml @@ -24,11 +24,13 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-core-location = { path = "../objc2-core-location", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } objc2-map-kit = { path = "../objc2-map-kit", version = "0.2.0", default-features = false, optional = true } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-extension-kit/Cargo.toml b/framework-crates/objc2-extension-kit/Cargo.toml index dd53ddb01..0ee1bf90f 100644 --- a/framework-crates/objc2-extension-kit/Cargo.toml +++ b/framework-crates/objc2-extension-kit/Cargo.toml @@ -22,9 +22,11 @@ workspace = true [dependencies] objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-file-provider-ui/Cargo.toml b/framework-crates/objc2-file-provider-ui/Cargo.toml index e4ea04404..61eccec6c 100644 --- a/framework-crates/objc2-file-provider-ui/Cargo.toml +++ b/framework-crates/objc2-file-provider-ui/Cargo.toml @@ -23,10 +23,12 @@ workspace = true [dependencies] block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-file-provider = { path = "../objc2-file-provider", version = "0.2.0", default-features = false } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-game-controller/Cargo.toml b/framework-crates/objc2-game-controller/Cargo.toml index 4e8012913..5562f0a62 100644 --- a/framework-crates/objc2-game-controller/Cargo.toml +++ b/framework-crates/objc2-game-controller/Cargo.toml @@ -24,9 +24,11 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-game-kit/Cargo.toml b/framework-crates/objc2-game-kit/Cargo.toml index cf8a6cd84..54e881a97 100644 --- a/framework-crates/objc2-game-kit/Cargo.toml +++ b/framework-crates/objc2-game-kit/Cargo.toml @@ -23,9 +23,11 @@ workspace = true [dependencies] block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-input-method-kit/Cargo.toml b/framework-crates/objc2-input-method-kit/Cargo.toml index 1b0f43676..d9acb9c4c 100644 --- a/framework-crates/objc2-input-method-kit/Cargo.toml +++ b/framework-crates/objc2-input-method-kit/Cargo.toml @@ -31,7 +31,6 @@ features = ["all"] targets = [ "aarch64-apple-darwin", "x86_64-apple-darwin", - "aarch64-apple-ios-macabi", ] [features] diff --git a/framework-crates/objc2-input-method-kit/translation-config.toml b/framework-crates/objc2-input-method-kit/translation-config.toml index 25abfc2d8..baebb3d01 100644 --- a/framework-crates/objc2-input-method-kit/translation-config.toml +++ b/framework-crates/objc2-input-method-kit/translation-config.toml @@ -3,7 +3,6 @@ crate = "objc2-input-method-kit" required-dependencies = ["objc2-foundation"] custom-lib-rs = true macos = "10.5" -maccatalyst = "13.0" # Unsure # Needs `TISInputSourceRef` from Carbon (HIToolbox) class.IMKCandidates.methods."setSelectionKeysKeylayout:".skipped = true diff --git a/framework-crates/objc2-link-presentation/Cargo.toml b/framework-crates/objc2-link-presentation/Cargo.toml index 938028ecf..88efa05e4 100644 --- a/framework-crates/objc2-link-presentation/Cargo.toml +++ b/framework-crates/objc2-link-presentation/Cargo.toml @@ -23,9 +23,11 @@ workspace = true [dependencies] block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-local-authentication-embedded-ui/Cargo.toml b/framework-crates/objc2-local-authentication-embedded-ui/Cargo.toml index c921568bb..5892904ad 100644 --- a/framework-crates/objc2-local-authentication-embedded-ui/Cargo.toml +++ b/framework-crates/objc2-local-authentication-embedded-ui/Cargo.toml @@ -23,10 +23,12 @@ workspace = true [dependencies] block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } objc2-local-authentication = { path = "../objc2-local-authentication", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-map-kit/Cargo.toml b/framework-crates/objc2-map-kit/Cargo.toml index 416086736..d7ed2d760 100644 --- a/framework-crates/objc2-map-kit/Cargo.toml +++ b/framework-crates/objc2-map-kit/Cargo.toml @@ -24,11 +24,15 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } -objc2-contacts = { path = "../objc2-contacts", version = "0.2.0", default-features = false, optional = true } objc2-core-location = { path = "../objc2-core-location", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + +[target.'cfg(not(target_os = "tvos"))'.dependencies] +objc2-contacts = { path = "../objc2-contacts", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-media-player/Cargo.toml b/framework-crates/objc2-media-player/Cargo.toml index 0204881a5..1f0b8e1bd 100644 --- a/framework-crates/objc2-media-player/Cargo.toml +++ b/framework-crates/objc2-media-player/Cargo.toml @@ -24,9 +24,11 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-metal-kit/Cargo.toml b/framework-crates/objc2-metal-kit/Cargo.toml index 040b4ccdd..7a8ed56c8 100644 --- a/framework-crates/objc2-metal-kit/Cargo.toml +++ b/framework-crates/objc2-metal-kit/Cargo.toml @@ -23,11 +23,13 @@ workspace = true [dependencies] block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } objc2-metal = { path = "../objc2-metal", version = "0.2.0", default-features = false } objc2-quartz-core = { path = "../objc2-quartz-core", version = "0.2.0", default-features = false, optional = true } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-multipeer-connectivity/Cargo.toml b/framework-crates/objc2-multipeer-connectivity/Cargo.toml index b77eaa78f..bfc317445 100644 --- a/framework-crates/objc2-multipeer-connectivity/Cargo.toml +++ b/framework-crates/objc2-multipeer-connectivity/Cargo.toml @@ -23,9 +23,11 @@ workspace = true [dependencies] block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-photos-ui/Cargo.toml b/framework-crates/objc2-photos-ui/Cargo.toml index 1ef3ae132..6672ec4fd 100644 --- a/framework-crates/objc2-photos-ui/Cargo.toml +++ b/framework-crates/objc2-photos-ui/Cargo.toml @@ -24,12 +24,14 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-core-location = { path = "../objc2-core-location", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } objc2-map-kit = { path = "../objc2-map-kit", version = "0.2.0", default-features = false, optional = true } objc2-photos = { path = "../objc2-photos", version = "0.2.0", default-features = false, optional = true } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-photos/Cargo.toml b/framework-crates/objc2-photos/Cargo.toml index d63078bff..7e87a82f4 100644 --- a/framework-crates/objc2-photos/Cargo.toml +++ b/framework-crates/objc2-photos/Cargo.toml @@ -24,12 +24,16 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } -objc2-core-image = { path = "../objc2-core-image", version = "0.2.0", default-features = false, optional = true } objc2-core-location = { path = "../objc2-core-location", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } objc2-uniform-type-identifiers = { path = "../objc2-uniform-type-identifiers", version = "0.2.0", default-features = false, optional = true } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + +[target.'cfg(not(target_os = "watchos"))'.dependencies] +objc2-core-image = { path = "../objc2-core-image", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-quartz-core/Cargo.modified.toml b/framework-crates/objc2-quartz-core/Cargo.modified.toml index 2b7901538..01aa409c7 100644 --- a/framework-crates/objc2-quartz-core/Cargo.modified.toml +++ b/framework-crates/objc2-quartz-core/Cargo.modified.toml @@ -2,12 +2,10 @@ description = "Bindings to the QuartzCore/CoreAnimation framework" [features] -# Deprecated; this is the default on Apple platforms, and not applicable on other platforms. +# No-op, deprecated apple = [] - -# Runtime selection. See `objc-sys` for details. -gnustep-1-7 = ["objc2/gnustep-1-7", "block2?/gnustep-1-7", "objc2-foundation/gnustep-1-7"] -gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "block2?/gnustep-1-8", "objc2-foundation/gnustep-1-8"] -gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "block2?/gnustep-1-9", "objc2-foundation/gnustep-1-9"] -gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "block2?/gnustep-2-0", "objc2-foundation/gnustep-2-0"] -gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1", "objc2-foundation/gnustep-2-1"] +gnustep-1-7 = [] +gnustep-1-8 = [] +gnustep-1-9 = [] +gnustep-2-0 = [] +gnustep-2-1 = [] diff --git a/framework-crates/objc2-quartz-core/Cargo.toml b/framework-crates/objc2-quartz-core/Cargo.toml index 6bdffee41..b1fda9409 100644 --- a/framework-crates/objc2-quartz-core/Cargo.toml +++ b/framework-crates/objc2-quartz-core/Cargo.toml @@ -36,8 +36,6 @@ targets = [ "aarch64-apple-ios", "aarch64-apple-tvos", "aarch64-apple-ios-macabi", - "x86_64-unknown-linux-gnu", - "i686-unknown-linux-gnu", ] [features] @@ -47,11 +45,11 @@ default = ["std"] std = ["alloc", "bitflags?/std", "block2?/std", "objc2/std", "objc2-foundation/std", "objc2-metal?/std"] alloc = ["block2?/alloc", "objc2/alloc", "objc2-foundation/alloc", "objc2-metal?/alloc"] apple = [] -gnustep-1-7 = ["objc2/gnustep-1-7", "block2?/gnustep-1-7", "objc2-foundation/gnustep-1-7"] -gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "block2?/gnustep-1-8", "objc2-foundation/gnustep-1-8"] -gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "block2?/gnustep-1-9", "objc2-foundation/gnustep-1-9"] -gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "block2?/gnustep-2-0", "objc2-foundation/gnustep-2-0"] -gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1", "objc2-foundation/gnustep-2-1"] +gnustep-1-7 = [] +gnustep-1-8 = [] +gnustep-1-9 = [] +gnustep-2-0 = [] +gnustep-2-1 = [] bitflags = ["dep:bitflags", "objc2-foundation/bitflags", "objc2-metal?/bitflags"] block2 = ["dep:block2", "objc2-foundation/block2", "objc2-metal?/block2"] objc2-metal = ["dep:objc2-metal"] diff --git a/framework-crates/objc2-quartz-core/translation-config.toml b/framework-crates/objc2-quartz-core/translation-config.toml index 46288af70..ad14b2e2d 100644 --- a/framework-crates/objc2-quartz-core/translation-config.toml +++ b/framework-crates/objc2-quartz-core/translation-config.toml @@ -8,7 +8,6 @@ maccatalyst = "13.0" ios = "2.0" tvos = "9.0" visionos = "1.0" -gnustep = true # Uses stuff from CoreFoundation and CoreGraphics class.CAKeyframeAnimation.methods.path.skipped = true diff --git a/framework-crates/objc2-social/Cargo.toml b/framework-crates/objc2-social/Cargo.toml index 193d9d9ce..17e7be6bf 100644 --- a/framework-crates/objc2-social/Cargo.toml +++ b/framework-crates/objc2-social/Cargo.toml @@ -24,9 +24,11 @@ workspace = true block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } objc2-accounts = { path = "../objc2-accounts", version = "0.2.0", default-features = false, optional = true } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-store-kit/Cargo.toml b/framework-crates/objc2-store-kit/Cargo.toml index b52ea3ee2..410d8dd6f 100644 --- a/framework-crates/objc2-store-kit/Cargo.toml +++ b/framework-crates/objc2-store-kit/Cargo.toml @@ -24,9 +24,11 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/framework-crates/objc2-ui-kit/Cargo.toml b/framework-crates/objc2-ui-kit/Cargo.toml index f7b7c2d03..791e50326 100644 --- a/framework-crates/objc2-ui-kit/Cargo.toml +++ b/framework-crates/objc2-ui-kit/Cargo.toml @@ -26,15 +26,17 @@ block2 = { path = "../../crates/block2", version = "0.5.0", default-features = f objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } objc2-cloud-kit = { path = "../objc2-cloud-kit", version = "0.2.0", default-features = false, optional = true } objc2-core-data = { path = "../objc2-core-data", version = "0.2.0", default-features = false, optional = true } -objc2-core-image = { path = "../objc2-core-image", version = "0.2.0", default-features = false, optional = true } objc2-core-location = { path = "../objc2-core-location", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } -objc2-link-presentation = { path = "../objc2-link-presentation", version = "0.2.0", default-features = false, optional = true } -objc2-quartz-core = { path = "../objc2-quartz-core", version = "0.2.0", default-features = false, optional = true } objc2-symbols = { path = "../objc2-symbols", version = "0.2.0", default-features = false, optional = true } objc2-uniform-type-identifiers = { path = "../objc2-uniform-type-identifiers", version = "0.2.0", default-features = false, optional = true } objc2-user-notifications = { path = "../objc2-user-notifications", version = "0.2.0", default-features = false, optional = true } +[target.'cfg(not(target_os = "watchos"))'.dependencies] +objc2-core-image = { path = "../objc2-core-image", version = "0.2.0", default-features = false, optional = true } +objc2-link-presentation = { path = "../objc2-link-presentation", version = "0.2.0", default-features = false, optional = true } +objc2-quartz-core = { path = "../objc2-quartz-core", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-ios" features = ["all"] diff --git a/framework-crates/objc2-web-kit/Cargo.toml b/framework-crates/objc2-web-kit/Cargo.toml index 8fa01f92f..4949f5d02 100644 --- a/framework-crates/objc2-web-kit/Cargo.toml +++ b/framework-crates/objc2-web-kit/Cargo.toml @@ -24,9 +24,11 @@ workspace = true bitflags = { version = "2.5.0", default-features = false, optional = true } block2 = { path = "../../crates/block2", version = "0.5.0", default-features = false, optional = true } objc2 = { path = "../../crates/objc2", version = "0.5.1", default-features = false } -objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } objc2-foundation = { path = "../objc2-foundation", version = "0.2.0", default-features = false } +[target.'cfg(target_os = "macos")'.dependencies] +objc2-app-kit = { path = "../objc2-app-kit", version = "0.2.0", default-features = false, optional = true } + [package.metadata.docs.rs] default-target = "aarch64-apple-darwin" features = ["all"] diff --git a/generated b/generated index 1536b8291..c58a308ae 160000 --- a/generated +++ b/generated @@ -1 +1 @@ -Subproject commit 1536b8291cdfed54711d5f1d105e3a62111470da +Subproject commit c58a308ae5c9d2ca4e99a4d22e0670cb11249bc1