Skip to content
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
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ jobs:
- fmt
- lint

env:
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -277,7 +280,7 @@ jobs:
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}

- name: Run header translator
run: cargo run --features=run --bin=header-translator -- /Applications/Xcode.app/Contents/Developer
run: cargo run --features=run --bin=header-translator

- name: Verify that no files changed
run: git diff --exit-code --submodule=diff
Expand Down
1 change: 1 addition & 0 deletions crates/header-translator/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl<'a> Context<'a> {
include_dir: sdk.path.join("usr/include"),
system_headers: HashSet::from([
Path::new("MacTypes.h"),
Path::new("objc/objc.h"),
Path::new("objc/NSObject.h"),
Path::new("objc/NSObjCRuntime.h"),
]),
Expand Down
16 changes: 7 additions & 9 deletions crates/header-translator/src/data/Metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ data! {
unsafe -setGeometryDescriptors;
}

// TODO macOS 13
// class MTLAccelerationStructureGeometryDescriptor {
// unsafe -setPrimitiveDataBuffer;
// unsafe -setPrimitiveDataStride;
// unsafe -setPrimitiveDataElementSize;
// unsafe -setIntersectionFunctionTableOffset;
// }
class MTLAccelerationStructureGeometryDescriptor {
unsafe -setPrimitiveDataBuffer;
unsafe -setPrimitiveDataStride;
unsafe -setPrimitiveDataElementSize;
unsafe -setIntersectionFunctionTableOffset;
}

class MTLAccelerationStructureTriangleGeometryDescriptor {
unsafe +descriptor;
Expand Down Expand Up @@ -110,8 +109,7 @@ data! {
unsafe -removeAllDebugMarkers;
unsafe -remoteStorageBuffer;
unsafe -newRemoteBufferViewForDevice;
// TODO macOS 13
// unsafe -gpuAddress;
unsafe -gpuAddress;
}

class MTLCaptureDescriptor {
Expand Down
5 changes: 4 additions & 1 deletion crates/header-translator/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ impl<N: ToOptionString> ItemIdentifier<N> {
pub fn with_name(name: N, entity: &Entity<'_>, context: &Context<'_>) -> Self {
let (mut library_name, mut file_name) = context
.get_library_and_file_name(entity)
.expect("ItemIdentifier get library and file");
.unwrap_or_else(|| {
warn!(?entity, "ItemIdentifier from unknown header");
("Unknown".to_string(), None)
});

// TODO: Get rid of this hack
if library_name == "CoreGraphics" {
Expand Down
17 changes: 10 additions & 7 deletions crates/header-translator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};

use apple_sdk::{AppleSdk, DeveloperDirectory, Platform, SdkPath, SimpleSdk};
use clang::{Clang, EntityKind, EntityVisitResult, Index, TranslationUnit};
use tracing::{debug_span, info, info_span, trace, trace_span};
use tracing::{debug_span, error, info, info_span, trace, trace_span};
use tracing_subscriber::filter::LevelFilter;
use tracing_subscriber::layer::{Layer, SubscriberExt};
use tracing_subscriber::registry::Registry;
Expand Down Expand Up @@ -36,6 +36,7 @@ fn main() -> Result<(), BoxError> {
.with_filter(LevelFilter::INFO),
)
.init();
let _span = info_span!("running").entered();

let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let workspace_dir = manifest_dir.parent().unwrap();
Expand All @@ -46,11 +47,11 @@ fn main() -> Result<(), BoxError> {
let clang = Clang::new()?;
let index = Index::new(&clang, true, true);

let developer_dir = DeveloperDirectory::from(PathBuf::from(
std::env::args_os()
.nth(1)
.expect("must specify developer directory as first argument"),
));
let developer_dir = if let Some(path) = std::env::args_os().nth(1) {
DeveloperDirectory::from(PathBuf::from(path))
} else {
DeveloperDirectory::from_xcode_select()?
};

let sdks: Vec<_> = developer_dir
.platforms()
Expand All @@ -70,7 +71,9 @@ fn main() -> Result<(), BoxError> {
})
.collect();

assert_eq!(sdks.len(), 8, "should have one of each platform: {sdks:?}");
if sdks.len() != 8 {
error!("should have one of each platform: {sdks:?}");
}

let mut final_result = None;

Expand Down
9 changes: 9 additions & 0 deletions crates/header-translator/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ skipped = true
skipped = true
[class.NSString.methods.initWithFormat_locale_arguments]
skipped = true
[class.NSString.methods.initWithValidatedFormat_validFormatSpecifiers_arguments_error]
skipped = true
[class.NSString.methods.initWithValidatedFormat_validFormatSpecifiers_locale_arguments_error]
skipped = true
[fn.NSLogv]
skipped = true

Expand Down Expand Up @@ -626,6 +630,10 @@ skipped = true
skipped = true
[protocol.MTLTexture.methods.iosurface]
skipped = true
[class.ASAuthorizationProviderExtensionLoginManager.methods]
saveCertificate_keyType = { skipped = true }
copyKeyForKeyType = { skipped = true }
copyIdentityForKeyType = { skipped = true }

# Uses a pointer to SEL, which doesn't implement Encode yet
[protocol.NSMenuDelegate.methods]
Expand Down Expand Up @@ -785,6 +793,7 @@ newRenderPipelineStateWithDescriptor_options_reflection_error = { skipped = true
newComputePipelineStateWithFunction_options_reflection_error = { skipped = true }
newComputePipelineStateWithDescriptor_options_reflection_error = { skipped = true }
newRenderPipelineStateWithTileDescriptor_options_reflection_error = { skipped = true }
newRenderPipelineStateWithMeshDescriptor_options_reflection_error = { skipped = true }

# Uses unions internally
[struct.MTLPackedFloat3]
Expand Down
2 changes: 2 additions & 0 deletions crates/icrate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Added
* Added the `CoreAnimation` framework.
* Updated the SDK version from XCode `14.0.1` to `14.2`.
- See differences [here](https://sdk.news/macOS-13.0/).


## icrate 0.0.1 - 2022-12-24
Expand Down
28 changes: 28 additions & 0 deletions crates/icrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ AppKit_NSComboBox = [
AppKit_NSComboBoxCell = [
"AppKit_NSTextFieldCell",
]
AppKit_NSComboButton = [
"AppKit_NSControl",
]
AppKit_NSControl = [
"AppKit_NSView",
]
Expand Down Expand Up @@ -492,6 +495,7 @@ AppKit_NSPressGestureRecognizer = [
"AppKit_NSGestureRecognizer",
]
AppKit_NSPressureConfiguration = []
AppKit_NSPreviewRepresentingActivityItem = []
AppKit_NSPrintInfo = []
AppKit_NSPrintOperation = []
AppKit_NSPrintPanel = []
Expand Down Expand Up @@ -677,6 +681,9 @@ AppKit_NSTextLayoutFragment = []
AppKit_NSTextLayoutManager = []
AppKit_NSTextLineFragment = []
AppKit_NSTextList = []
AppKit_NSTextListElement = [
"AppKit_NSTextParagraph",
]
AppKit_NSTextParagraph = [
"AppKit_NSTextElement",
]
Expand Down Expand Up @@ -816,6 +823,7 @@ AppKit_all = [
"AppKit_NSColorWell",
"AppKit_NSComboBox",
"AppKit_NSComboBoxCell",
"AppKit_NSComboButton",
"AppKit_NSControl",
"AppKit_NSController",
"AppKit_NSCursor",
Expand Down Expand Up @@ -911,6 +919,7 @@ AppKit_all = [
"AppKit_NSPredicateEditorRowTemplate",
"AppKit_NSPressGestureRecognizer",
"AppKit_NSPressureConfiguration",
"AppKit_NSPreviewRepresentingActivityItem",
"AppKit_NSPrintInfo",
"AppKit_NSPrintOperation",
"AppKit_NSPrintPanel",
Expand Down Expand Up @@ -1002,6 +1011,7 @@ AppKit_all = [
"AppKit_NSTextLayoutManager",
"AppKit_NSTextLineFragment",
"AppKit_NSTextList",
"AppKit_NSTextListElement",
"AppKit_NSTextParagraph",
"AppKit_NSTextRange",
"AppKit_NSTextSelection",
Expand Down Expand Up @@ -1078,6 +1088,9 @@ AuthenticationServices_ASAuthorizationPlatformPublicKeyCredentialRegistrationReq
]
AuthenticationServices_ASAuthorizationProviderExtensionAuthorizationRequest = []
AuthenticationServices_ASAuthorizationProviderExtensionAuthorizationResult = []
AuthenticationServices_ASAuthorizationProviderExtensionKerberosMapping = []
AuthenticationServices_ASAuthorizationProviderExtensionLoginConfiguration = []
AuthenticationServices_ASAuthorizationProviderExtensionLoginManager = []
AuthenticationServices_ASAuthorizationPublicKeyCredentialParameters = []
AuthenticationServices_ASAuthorizationRequest = []
AuthenticationServices_ASAuthorizationSecurityKeyPublicKeyCredentialAssertion = []
Expand Down Expand Up @@ -1129,6 +1142,9 @@ AuthenticationServices_all = [
"AuthenticationServices_ASAuthorizationPlatformPublicKeyCredentialRegistrationRequest",
"AuthenticationServices_ASAuthorizationProviderExtensionAuthorizationRequest",
"AuthenticationServices_ASAuthorizationProviderExtensionAuthorizationResult",
"AuthenticationServices_ASAuthorizationProviderExtensionKerberosMapping",
"AuthenticationServices_ASAuthorizationProviderExtensionLoginConfiguration",
"AuthenticationServices_ASAuthorizationProviderExtensionLoginManager",
"AuthenticationServices_ASAuthorizationPublicKeyCredentialParameters",
"AuthenticationServices_ASAuthorizationRequest",
"AuthenticationServices_ASAuthorizationSecurityKeyPublicKeyCredentialAssertion",
Expand Down Expand Up @@ -1409,6 +1425,7 @@ Foundation_NSArray = []
Foundation_NSAssertionHandler = []
Foundation_NSAttributedString = []
Foundation_NSAttributedStringMarkdownParsingOptions = []
Foundation_NSAttributedStringMarkdownSourcePosition = []
Foundation_NSAutoreleasePool = []
Foundation_NSBackgroundActivityScheduler = []
Foundation_NSBlockOperation = [
Expand Down Expand Up @@ -1903,6 +1920,7 @@ Foundation_all = [
"Foundation_NSAssertionHandler",
"Foundation_NSAttributedString",
"Foundation_NSAttributedStringMarkdownParsingOptions",
"Foundation_NSAttributedStringMarkdownSourcePosition",
"Foundation_NSAutoreleasePool",
"Foundation_NSBackgroundActivityScheduler",
"Foundation_NSBlockOperation",
Expand Down Expand Up @@ -2172,6 +2190,9 @@ Metal_MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor = [
Metal_MTLAccelerationStructureMotionTriangleGeometryDescriptor = [
"Metal_MTLAccelerationStructureGeometryDescriptor",
]
Metal_MTLAccelerationStructurePassDescriptor = []
Metal_MTLAccelerationStructurePassSampleBufferAttachmentDescriptor = []
Metal_MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray = []
Metal_MTLAccelerationStructureTriangleGeometryDescriptor = [
"Metal_MTLAccelerationStructureGeometryDescriptor",
]
Expand Down Expand Up @@ -2208,6 +2229,7 @@ Metal_MTLFunctionStitchingFunctionNode = []
Metal_MTLFunctionStitchingGraph = []
Metal_MTLFunctionStitchingInputNode = []
Metal_MTLHeapDescriptor = []
Metal_MTLIOCommandQueueDescriptor = []
Metal_MTLIndirectCommandBufferDescriptor = []
Metal_MTLInstanceAccelerationStructureDescriptor = [
"Metal_MTLAccelerationStructureDescriptor",
Expand All @@ -2217,6 +2239,7 @@ Metal_MTLIntersectionFunctionDescriptor = [
]
Metal_MTLIntersectionFunctionTableDescriptor = []
Metal_MTLLinkedFunctions = []
Metal_MTLMeshRenderPipelineDescriptor = []
Metal_MTLMotionKeyframeData = []
Metal_MTLPipelineBufferDescriptor = []
Metal_MTLPipelineBufferDescriptorArray = []
Expand Down Expand Up @@ -2285,6 +2308,9 @@ Metal_all = [
"Metal_MTLAccelerationStructureGeometryDescriptor",
"Metal_MTLAccelerationStructureMotionBoundingBoxGeometryDescriptor",
"Metal_MTLAccelerationStructureMotionTriangleGeometryDescriptor",
"Metal_MTLAccelerationStructurePassDescriptor",
"Metal_MTLAccelerationStructurePassSampleBufferAttachmentDescriptor",
"Metal_MTLAccelerationStructurePassSampleBufferAttachmentDescriptorArray",
"Metal_MTLAccelerationStructureTriangleGeometryDescriptor",
"Metal_MTLArgument",
"Metal_MTLArgumentDescriptor",
Expand Down Expand Up @@ -2317,11 +2343,13 @@ Metal_all = [
"Metal_MTLFunctionStitchingGraph",
"Metal_MTLFunctionStitchingInputNode",
"Metal_MTLHeapDescriptor",
"Metal_MTLIOCommandQueueDescriptor",
"Metal_MTLIndirectCommandBufferDescriptor",
"Metal_MTLInstanceAccelerationStructureDescriptor",
"Metal_MTLIntersectionFunctionDescriptor",
"Metal_MTLIntersectionFunctionTableDescriptor",
"Metal_MTLLinkedFunctions",
"Metal_MTLMeshRenderPipelineDescriptor",
"Metal_MTLMotionKeyframeData",
"Metal_MTLPipelineBufferDescriptor",
"Metal_MTLPipelineBufferDescriptorArray",
Expand Down
10 changes: 5 additions & 5 deletions crates/icrate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

Rust bindings to Apple's frameworks.

These are automatically generated from the SDKs in Xcode 14.0.1 (will be periodically updated).
These are automatically generated from the SDKs in Xcode 14.2 (will be periodically updated).

Currently supports:
- macOS: `10.7-12.3`
- iOS/iPadOS: `7.0-16.0` (WIP)
- tvOS: `9.0-16.0` (WIP)
- watchOS: `1.0-9.0` (WIP)
- macOS: `10.7-13.1`
- iOS/iPadOS: `7.0-16.2` (WIP)
- tvOS: `9.0-16.1` (WIP)
- watchOS: `1.0-9.1` (WIP)

This crate is part of the [`objc2` project](https://github.com/madsmtm/objc2),
see that for related crates.
2 changes: 1 addition & 1 deletion crates/icrate/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub(crate) use std::os::raw::{
};

#[cfg(feature = "objective-c")]
pub(crate) use objc2::ffi::{NSInteger, NSIntegerMax, NSUInteger, NSUIntegerMax};
pub(crate) use objc2::ffi::{NSInteger, NSIntegerMax, NSUInteger, NSUIntegerMax, IMP};
#[cfg(feature = "objective-c")]
pub(crate) use objc2::rc::{Allocated, Id, Owned, Ownership, Shared};
#[cfg(feature = "objective-c")]
Expand Down
2 changes: 1 addition & 1 deletion crates/icrate/src/generated