Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ jobs:
- lint

env:
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
DEVELOPER_DIR: /Applications/Xcode_26.0_beta_5.app/Contents/Developer

steps:
- uses: actions/checkout@v4
Expand Down
13 changes: 13 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ default.extend-identifiers.IMAGEIO_PNG_FILTER_PAETH = "IMAGEIO_PNG_FILTER_PAETH"
# In framework-crates/objc2-io-bluetooth/translation-config.toml
default.extend-identifiers.kBluetoothHCIEvnetMaskLinkSupervisionTimeoutChangedEvent = "kBluetoothHCIEvnetMaskLinkSupervisionTimeoutChangedEvent"
default.extend-identifiers.kBluetoothHCIEvnetMaskEnhancedFlushCompleteEvent = "kBluetoothHCIEvnetMaskEnhancedFlushCompleteEvent"
# In BackgroundAssets, BA is short of that framework.
default.extend-words.BA = "BA"
# Used in Metal, LOD = level of detail
default.extend-words.lod = "lod"

Expand Down
4 changes: 4 additions & 0 deletions crates/header-translator/configs/libc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ gnustep = true

# HACK: Define `task_port_t` in the using crate (it's a simple alias to `task_t`).
external.task_port_t.module = "__builtin__"

# Redefined by CoreFoundation with a name that makes it hard to see
# that this is `libc::malloc_zone_t`.
struct._malloc_zone_t.renamed = "malloc_zone_t"
25 changes: 23 additions & 2 deletions crates/header-translator/configs/skipped.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ vmnet = "Very C-centric and old"

DriverKit = "Uses C++ classes"

AGL = "OpenGL-specific, use Metal instead"
# AGL = "OpenGL-specific, use Metal instead" # Removed in newer SDKs
GLKit = "OpenGL-specific, use Metal instead"
GLUT = "OpenGL-specific, use Metal instead"
OpenGL = "OpenGL-specific, use Metal instead"
OpenGLES = "OpenGL-specific, use Metal instead"

ActivityKit = "Swift-only"
AdAttributionKit = "Swift-only"
AlarmKit = "Mostly Swift-only"
AppIntents = "Swift-only"
Assignables = "Swift-only"
AutomatedDeviceEnrollment = "Swift-only"
Expand All @@ -43,15 +44,22 @@ CoreTransferable = "Swift-only"
CreateML = "Swift-only"
CreateMLComponents = "Swift-only"
CryptoKit = "Swift-only"
DeclaredAgeRange = "Swift-only"
DeveloperToolsSupport = "Swift-only"
DeviceActivity = "Swift-only"
DockKit = "Swift-only"
EnergyKit = "Swift-only"
ExtensionFoundation = "Swift-only"
FamilyControls = "Swift-only"
FinanceKit = "Swift-only"
FinanceKitUI = "Swift-only"
FoundationModels = "Swift-only"
GeoToolbox = "Swift-only"
GroupActivities = "Swift-only"
IdentityDocumentServices = "Swift-only"
IdentityDocumentServicesUI = "Swift-only"
ImagePlayground = "Swift-only"
ImmersiveMediaSupport = "Swift-only"
JournalingSuggestions = "Swift-only"
LightweightCodeRequirements = "Swift-only"
LiveCommunicationKit = "Swift-only"
Expand All @@ -63,23 +71,31 @@ ManagedSettingsUI = "Swift-only"
MarketplaceKit = "Swift-only"
MatterSupport = "Swift-only"
MusicKit = "Swift-only"
PaperKit = "Swift-only"
PermissionKit = "Swift-only"
ProximityReader = "Swift-only"
RealityFoundation = "Swift-only"
RealityKit = "Swift-only"
RelevanceKit = "Swift-only"
RoomPlan = "Swift-only"
SecureElementCredential = "Swift-only"
SwiftData = "Swift-only"
SwiftUI = "Swift-only"
SwiftUICore = "Swift-only"
TabletopKit = "Swift-only"
TabularData = "Swift-only"
TelephonyMessagingKit = "Swift-only"
TipKit = "Swift-only"
Translation = "Swift-only"
TranslationUIProvider = "Swift-only"
VisionEntitlementServices = "Mostly Swift-only"
VisionKit = "Swift-only"
VisualIntelligence = "Swift-only"
WeatherKit = "Swift-only"
WorkoutKit = "Swift-only"
WidgetKit = "Mostly Swift-only"
WiFiAware = "Swift-only"
WirelessInsights = "Swift-only"
WorkoutKit = "Swift-only"

AppleScriptKit = "Basically empty nowadays" # requires !swift
AppleScriptObjC = "Basically empty nowadays"
Expand All @@ -94,6 +110,7 @@ QTKit = "No headers present in Xcode's SDK"
StickerFoundation = "Basically empty"
StickerKit = "Basically empty"
System = "Deprecated wrapper over libSystem.dylib"
MetalPerformancePrimitives = "Header-only framework (no symbols)"

# Deprecated before macOS 10.12 (Rust's minimum supported macOS version)
AudioVideoBridging = "Deprecated, use AVKit/AVFoundation instead (maybe?)"
Expand Down Expand Up @@ -125,3 +142,7 @@ DeviceDiscoveryUI = "Needs Network first"

BrowserKit = "TODO"
SecurityUI = "TODO"
GameSave = "TODO"
TouchControls = "TODO"

MeshNetFramework = "Weirdly incomplete"
34 changes: 30 additions & 4 deletions crates/header-translator/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ pub struct Location {
impl Location {
fn new(module_path: impl Into<Box<str>>) -> Self {
let module_path = module_path.into();

// We don't care about the difference between the different
// DarwinFoundation modules (for now at least).
if let Some(rest) = module_path.strip_prefix("DarwinFoundation.") {
return Self::new(rest);
}
if let Some(rest) = module_path.strip_prefix("_DarwinFoundation1.") {
return Self::new(rest);
}
if let Some(rest) = module_path.strip_prefix("_DarwinFoundation2.") {
return Self::new(rest);
}
if let Some(rest) = module_path.strip_prefix("_DarwinFoundation3.") {
return Self::new(rest);
}

let module_path = match &*module_path {
// Remove submodules for Objective-C.
name if name.starts_with("ObjectiveC") => "ObjectiveC".into(),
Expand All @@ -83,7 +99,9 @@ impl Location {

// Various macros
name if name.starts_with("os_availability") => "__builtin__".into(),
"DarwinFoundation.cdefs" => "__builtin__".into(),
name if name.starts_with("_AvailabilityInternal") => "__builtin__".into(),
name if name.starts_with("availability") => "__builtin__".into(),
"cdefs" => "__builtin__".into(),
"Darwin.libkern.OSByteOrder" => "__builtin__".into(),
"TargetConditionals" => "__builtin__".into(),
"Darwin.AssertMacros" => "__builtin__".into(),
Expand All @@ -108,7 +126,7 @@ impl Location {
"_Builtin_stdint" | "_stdint" => "__builtin__".into(),
name if name.starts_with("_Builtin_stddef") => "__builtin__".into(),
// Implementation of the above
"DarwinFoundation.types.machine_types" => "__builtin__".into(),
name if name.starts_with("types.machine_types") => "__builtin__".into(),
// UINT_MAX, FLT_MIN, DBL_MAX, etc.
// Handled manually in `expr.rs`.
"_Builtin_limits" => "__builtin__".into(),
Expand All @@ -132,8 +150,8 @@ impl Location {
name if name.starts_with("sys_types") => "__libc__".into(),
name if name.starts_with("Darwin.POSIX") => "__libc__".into(),
name if name.starts_with("_signal") => "__libc__".into(),
"DarwinFoundation.types.sys_types" => "__libc__".into(),
"DarwinFoundation.qos" => "__libc__".into(),
"types.sys_types" => "__libc__".into(),
"qos" => "__libc__".into(),
"_stdio" => "__libc__".into(),
"_time.timespec" => "__libc__".into(),
"_fenv" => "__libc__".into(),
Expand All @@ -149,9 +167,12 @@ impl Location {
"ptrauth" => "__libc__".into(),
"Darwin.uuid" => "__libc__".into(),
"unistd" => "__libc__".into(),
"Darwin.malloc" => "__libc__".into(),
"_stdlib.malloc.malloc_type" => "__libc__".into(),

// Will be moved to the `mach2` crate in `libc` v1.0
name if name.starts_with("Darwin.Mach") => "__libc__".into(),
"mach.port.mach_port_t" => "__libc__".into(),
"mach.mach_port_t" => "__libc__".into(),
"_mach_port_t" => "__libc__".into(),

Expand All @@ -164,6 +185,11 @@ impl Location {
.replace("IOBluetoothUI.objc", "IOBluetoothUI.objc2")
.into(),

// TODO: Will hopefully be fixed in future Xcode betas
"_LocationEssentials.CLLocationEssentials" => "CoreLocation.CLLocation".into(),
"UIUtilities.UIGeometry" => "UIKit.UIGeometry".into(),
"UIUtilities.UICoordinateSpace" => "UIKit.UIView".into(),

_ => module_path,
};

Expand Down
2 changes: 2 additions & 0 deletions crates/header-translator/src/rust_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,8 @@ impl Ty {
| "MIDISysexSendRequestUMP"
| "MIDIDriverInterface"
| "cssm_list_element"
| "malloc_zone_t"
| "_malloc_zone_t"
)
) {
// Fake fields, we'll have to define it ourselves
Expand Down
5 changes: 4 additions & 1 deletion crates/header-translator/src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ fn verify_objc_decl(entity: &Entity<'_>, _context: &Context<'_>) {
(EntityKind::UnexposedAttr, _) => {
// Parsed in parse_attributes
}
(_, parent_kind) => error!(?parent_kind, "unknown in parent"),
(EntityKind::AnnotateAttr, _) if entity.get_name().unwrap() == "main-thread-only" => {
// Already parsed via. UnexposedAttr.
}
(_, parent_kind) => error!(?entity, ?parent_kind, "unknown in parent"),
}
});
}
Expand Down
37 changes: 30 additions & 7 deletions crates/header-translator/src/unexposed_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ impl UnexposedAttr {
| "CF_TYPED_EXTENSIBLE_ENUM"
| "NS_EXTENSIBLE_STRING_ENUM"
| "CF_EXTENSIBLE_STRING_ENUM" => Some(Self::TypedExtensibleEnum),
// FIXME: Attribute used directly in CoreGraphics, we really need
// to parse and check the contents of it here.
"swift_wrapper" => None,
"NS_SWIFT_BRIDGED_TYPEDEF" | "CF_SWIFT_BRIDGED_TYPEDEF" => Some(Self::BridgedTypedef),
"CF_IMPLICIT_BRIDGING_ENABLED" => Some(Self::BridgedImplicit),
"CF_BRIDGED_TYPE"
Expand Down Expand Up @@ -93,12 +96,25 @@ impl UnexposedAttr {
// Nullability attributes
s if s.starts_with("DISPATCH_NONNULL") => None,
s if s.starts_with("XPC_NONNULL") => None,
"NS_SWIFT_SENDABLE" | "AS_SWIFT_SENDABLE" | "CM_SWIFT_SENDABLE"
| "CT_SWIFT_SENDABLE" | "CV_SWIFT_SENDABLE" => Some(Self::Sendable),
"NS_SWIFT_NONSENDABLE" | "CM_SWIFT_NONSENDABLE" | "CV_SWIFT_NONSENDABLE" => {
Some(Self::NonSendable)
"NS_SWIFT_SENDABLE"
| "AS_SWIFT_SENDABLE"
| "CM_SWIFT_SENDABLE"
| "CT_SWIFT_SENDABLE"
| "CV_SWIFT_SENDABLE"
| "SEC_SWIFT_SENDABLE"
| "IOSFC_SWIFT_SENDABLE" => Some(Self::Sendable),
"NS_SWIFT_NONSENDABLE"
| "CM_SWIFT_NONSENDABLE"
| "CV_SWIFT_NONSENDABLE"
| "IOSFC_SWIFT_NONSENDABLE" => Some(Self::NonSendable),
// TODO
"NS_SWIFT_SENDING" | "CM_SWIFT_SENDING" => None,
"CM_SWIFT_SENDING_RETAINED_RESULT" | "CM_SWIFT_SENDING_RETAINED_PARAMETER" => {
Some(Self::ReturnsRetained)
}
"NS_SWIFT_UI_ACTOR" | "WK_SWIFT_UI_ACTOR" | "CARPLAY_TEMPLATE_UI_ACTOR" => {
Some(Self::UIActor)
}
"NS_SWIFT_UI_ACTOR" | "WK_SWIFT_UI_ACTOR" => Some(Self::UIActor),
"NS_SWIFT_NONISOLATED" | "UIKIT_SWIFT_ACTOR_INDEPENDENT" => Some(Self::NonIsolated),
// TODO
"CF_FORMAT_ARGUMENT" | "CF_FORMAT_FUNCTION" | "NS_FORMAT_FUNCTION"
Expand Down Expand Up @@ -161,6 +177,8 @@ impl UnexposedAttr {
| "CF_SWIFT_UNAVAILABLE"
| "CG_AVAILABLE_BUT_DEPRECATED"
| "CG_AVAILABLE_STARTING"
| "CG_SOFT_DEPRECATED_WITH_REPLACEMENT"
| "CG_ENUM_SOFT_DEPRECATED_WITH_REPLACEMENT"
| "CI_GL_DEPRECATED"
| "CI_GL_DEPRECATED_IOS"
| "CI_GL_DEPRECATED_MAC"
Expand Down Expand Up @@ -298,8 +316,12 @@ impl UnexposedAttr {
| "CB_CM_API_AVAILABLE"
| "CF_AUTOMATED_REFCOUNT_UNAVAILABLE"
| "CG_OBSOLETE"
| "CS_UNAVAILABLE_EMBEDDED"
| "CK_SHARE_ACCESS_REQUESTER_AVAILABILITY"
| "CK_SHARE_BLOCKED_IDENTITY_AVAILABILITY"
| "CKSHARE_REQUEST_ACCESS_INTERFACES_AVAILABILITY"
| "CM_VISION_OS_AVAILABLE"
| "CS_TVOS_UNAVAILABLE"
| "CS_UNAVAILABLE_EMBEDDED"
| "CSSM_DEPRECATED"
| "deprecated"
| "DEPRECATED_ATTRIBUTE"
Expand Down Expand Up @@ -369,7 +391,8 @@ impl UnexposedAttr {
| "DISPATCH_REFINED_FOR_SWIFT"
| "NS_REFINED_FOR_SWIFT"
| "AR_REFINED_FOR_SWIFT"
| "NS_SWIFT_DISABLE_ASYNC" => None,
| "NS_SWIFT_DISABLE_ASYNC"
| "CP_STRUCT_REF" => None,
// Possibly interesting?
"DISPATCH_COLD" => None,
"DISPATCH_MALLOC" => None,
Expand Down
12 changes: 6 additions & 6 deletions crates/objc2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@
//!
//! ## Supported operating systems
//!
//! - macOS: `10.12-15.5`
//! - iOS: `10.0-18.5` (including iPadOS and Mac Catalyst)
//! - tvOS: `10.0-18.5`
//! - watchOS: `5.0-11.5`
//! - visionOS: `1.0-2.5`
//! - macOS: `10.12-26.0`
//! - iOS: `10.0-26.0` (including iPadOS and Mac Catalyst)
//! - tvOS: `10.0-26.0`
//! - watchOS: `5.0-26.0`
//! - visionOS: `1.0-26.0`
//!
//! The minimum versions are the same as those supported by `rustc`. Higher
//! versions will also work, but the framework crates will not have bindings
//! available for newer APIs.
//!
//! The framework bindings are generated from the SDKs in Xcode 16.4. The
//! The framework bindings are generated from the SDKs in Xcode 26.0. The
//! Xcode version are updated usually within a week of [GitHub Actions]
//! supporting the new Xcode version, and we try to schedule crate releases
//! such that align fairly closely with Xcode updates. We only support stable
Expand Down
Loading
Loading