Skip to content

Commit

Permalink
Merge pull request #426 from silvanshade/more-frameworks
Browse files Browse the repository at this point in the history
Add HealthKit, MediaPlayer, MetricKit, PhotoKit frameworks
  • Loading branch information
madsmtm authored Feb 25, 2023
2 parents abf973e + 9596ab9 commit 797b146
Show file tree
Hide file tree
Showing 20 changed files with 933 additions and 50 deletions.
8 changes: 8 additions & 0 deletions crates/header-translator/framework-includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@

#import <GameKit/GameKit.h>

#import <HealthKit/HealthKit.h>

#import <IdentityLookup/IdentityLookup.h>

#import <InputMethodKit/InputMethodKit.h>
Expand All @@ -75,12 +77,18 @@

#import <MapKit/MapKit.h>

#import <MediaPlayer/MediaPlayer.h>

#import <Metal/Metal.h>

#import <MetalFX/MetalFX.h>

#import <MetalKit/MetalKit.h>

#import <MetricKit/MetricKit.h>

#import <Photos/Photos.h>

#import <QuartzCore/CoreAnimation.h>

#import <SoundAnalysis/SoundAnalysis.h>
Expand Down
18 changes: 18 additions & 0 deletions crates/header-translator/src/availability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ 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,
Expand All @@ -17,7 +19,9 @@ struct Unavailable {
#[derive(Debug, Clone, PartialEq, Default)]
struct Versions {
ios: Option<Version>,
ios_app_extension: Option<Version>,
macos: Option<Version>,
macos_app_extension: Option<Version>,
maccatalyst: Option<Version>,
watchos: Option<Version>,
tvos: Option<Version>,
Expand Down Expand Up @@ -76,12 +80,24 @@ impl Availability {
&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,
Expand Down Expand Up @@ -122,7 +138,9 @@ impl fmt::Display for Availability {
match &self.deprecated {
Versions {
ios: None,
ios_app_extension: None,
macos: None,
macos_app_extension: None,
maccatalyst: None,
watchos: None,
tvos: None,
Expand Down
1 change: 1 addition & 0 deletions crates/header-translator/src/data/HealthKit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data! {}
1 change: 1 addition & 0 deletions crates/header-translator/src/data/MediaPlayer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data! {}
1 change: 1 addition & 0 deletions crates/header-translator/src/data/MetricKit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data! {}
1 change: 1 addition & 0 deletions crates/header-translator/src/data/PhotoKit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data! {}
4 changes: 4 additions & 0 deletions crates/header-translator/src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ data! {
mod Foundation;
mod GameController;
mod GameKit;
mod HealthKit;
mod IdentityLookup;
mod InputMethodKit;
mod LocalAuthentication;
mod LocalAuthenticationEmbeddedUI;
mod LinkPresentation;
mod MailKit;
mod MapKit;
mod MediaPlayer;
mod Metal;
mod MetalFX;
mod MetalKit;
mod MetricKit;
mod OSAKit;
mod PhotoKit;
mod SoundAnalysis;
mod Speech;
mod StoreKit;
Expand Down
3 changes: 3 additions & 0 deletions crates/header-translator/src/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ impl MethodModifiers {
EntityKind::ObjCInstanceMethodDecl => {
warn!("method inside property/method");
}
EntityKind::VisibilityAttr => {
// TODO: Handle these visibility attributes
}
_ => error!("unknown"),
});

Expand Down
104 changes: 56 additions & 48 deletions crates/header-translator/src/unexposed_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,84 +74,92 @@ impl UnexposedAttr {
// Weak specifiers - would be interesting if Rust supported weak statics
"GK_EXTERN_WEAK" => None,
// Availability attributes - their data is already exposed.
"API_AVAILABLE"
| "API_UNAVAILABLE"
| "API_DEPRECATED"
"__IOS_AVAILABLE"
| "__OSX_AVAILABLE_STARTING"
| "__TVOS_AVAILABLE"
| "__WATCHOS_AVAILABLE"
| "API_AVAILABLE_BEGIN"
| "API_AVAILABLE"
| "API_DEPRECATED_WITH_REPLACEMENT"
| "API_DEPRECATED"
| "API_UNAVAILABLE_BEGIN"
| "NS_CLASS_AVAILABLE_MAC"
| "API_UNAVAILABLE"
| "CF_SWIFT_UNAVAILABLE"
| "CG_AVAILABLE_BUT_DEPRECATED"
| "CG_AVAILABLE_STARTING"
| "FPUI_AVAILABLE"
| "MP_API"
| "MP_DEPRECATED_WITH_REPLACEMENT"
| "MP_DEPRECATED"
| "MP_UNAVAILABLE_BEGIN"
| "MP_UNAVAILABLE"
| "NS_AVAILABLE_MAC"
| "NS_AVAILABLE"
| "NS_OPENGL_DEPRECATED"
| "NS_CLASS_AVAILABLE_MAC"
| "NS_CLASS_AVAILABLE"
| "NS_CLASS_DEPRECATED_IOS"
| "NS_CLASS_DEPRECATED"
| "NS_DEPRECATED_IOS"
| "NS_DEPRECATED_MAC"
| "NS_DEPRECATED"
| "NS_ENUM_AVAILABLE"
| "NS_ENUM_DEPRECATED_IOS"
| "NS_ENUM_DEPRECATED"
| "NS_EXTENSION_UNAVAILABLE"
| "NS_OPENGL_CLASS_DEPRECATED"
| "NS_OPENGL_DEPRECATED"
| "NS_OPENGL_ENUM_DEPRECATED"
| "NS_SWIFT_UNAVAILABLE"
| "OBJC_AVAILABLE"
| "OBJC_DEPRECATED"
| "NS_DEPRECATED"
| "NS_DEPRECATED_IOS"
| "NS_DEPRECATED_MAC"
| "CG_AVAILABLE_STARTING"
| "CG_AVAILABLE_BUT_DEPRECATED"
| "NS_SWIFT_UNAVAILABLE"
| "CF_SWIFT_UNAVAILABLE"
| "OBJC_SWIFT_UNAVAILABLE"
| "FPUI_AVAILABLE"
| "WEBKIT_AVAILABLE_MAC"
| "WEBKIT_DEPRECATED_MAC"
| "WEBKIT_CLASS_DEPRECATED_MAC"
| "WEBKIT_ENUM_DEPRECATED_MAC"
| "NS_AVAILABLE_MAC"
| "NS_CLASS_AVAILABLE"
| "NS_CLASS_DEPRECATED"
| "NS_CLASS_DEPRECATED_IOS"
| "NS_ENUM_AVAILABLE"
| "NS_ENUM_DEPRECATED"
| "NS_ENUM_DEPRECATED_IOS"
| "__OSX_AVAILABLE_STARTING"
| "__TVOS_AVAILABLE"
| "__WATCHOS_AVAILABLE"
| "__IOS_AVAILABLE" => {
| "WEBKIT_DEPRECATED_MAC"
| "WEBKIT_ENUM_DEPRECATED_MAC" => {
let _ = get_arguments();
None
}
"NS_UNAVAILABLE"
| "UNAVAILABLE_ATTRIBUTE"
| "NS_AUTOMATED_REFCOUNT_UNAVAILABLE"
| "NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE"
| "APPKIT_API_UNAVAILABLE_BEGIN_MACCATALYST"
| "__OSX_UNAVAILABLE"
"__IOS_PROHIBITED"
| "__IOS_UNAVAILABLE"
| "__OSX_AVAILABLE_BUT_DEPRECATED"
| "__TVOS_UNAVAILABLE"
| "__OSX_UNAVAILABLE"
| "__TVOS_PROHIBITED"
| "__WATCHOS_UNAVAILABLE"
| "__TVOS_UNAVAILABLE"
| "__WATCHOS_PROHIBITED"
| "__IOS_UNAVAILABLE"
| "UT_AVAILABLE_BEGIN"
| "__IOS_PROHIBITED" => None,
| "__WATCHOS_UNAVAILABLE"
| "APPKIT_API_UNAVAILABLE_BEGIN_MACCATALYST"
| "MP_INIT_UNAVAILABLE"
| "NS_AUTOMATED_REFCOUNT_UNAVAILABLE"
| "NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE"
| "NS_UNAVAILABLE"
| "UNAVAILABLE_ATTRIBUTE"
| "UT_AVAILABLE_BEGIN" => None,
s if s.starts_with("AVAILABLE_MAC_OS_X_VERSION_") => None,
s if s.starts_with("DEPRECATED_IN_MAC_OS_X_VERSION_") => None,
s if s.starts_with("FILEPROVIDER_API_AVAILABILITY_") => None,
// Might be interesting in the future
"NS_SWIFT_NAME"
| "CF_SWIFT_NAME"
| "NS_SWIFT_ASYNC_NAME"
| "WK_SWIFT_ASYNC_NAME"
| "NS_SWIFT_ASYNC_THROWS_ON_FALSE"
| "NS_SWIFT_UNAVAILABLE_FROM_ASYNC"
"CF_SWIFT_NAME"
| "NS_HEADER_AUDIT_BEGIN"
| "NS_REFINED_FOR_SWIFT_ASYNC"
| "NS_SWIFT_ASYNC_NAME"
| "NS_SWIFT_ASYNC_THROWS_ON_FALSE"
| "NS_SWIFT_ASYNC"
| "NS_SWIFT_NAME"
| "NS_SWIFT_UNAVAILABLE_FROM_ASYNC"
| "WK_SWIFT_ASYNC_NAME"
| "WK_SWIFT_ASYNC" => {
let _ = get_arguments();
None
}
"NS_SWIFT_NOTHROW"
"CF_REFINED_FOR_SWIFT"
| "NS_REFINED_FOR_SWIFT"
| "CF_REFINED_FOR_SWIFT"
| "NS_SWIFT_DISABLE_ASYNC"
| "NS_SWIFT_UI_ACTOR"
| "NS_SWIFT_SENDABLE"
| "NS_SWIFT_NONISOLATED"
| "NS_SWIFT_NONSENDABLE"
| "NS_SWIFT_NONISOLATED" => None,
| "NS_SWIFT_NOTHROW"
| "NS_SWIFT_SENDABLE"
| "NS_SWIFT_UI_ACTOR" => None,
_ => return Err(()),
})
}
Expand Down
77 changes: 77 additions & 0 deletions crates/header-translator/translation-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ ios = "3.0"
tvos = "9.0"
watchos = "3.0"

[library.HealthKit]
imports = ["CoreLocation", "Foundation", "UniformTypeIdentifiers"]
macos = "13.0"
maccatalyst = "13.0"
ios = "8.0"
watchos = "2.0"

[library.IdentityLookup]
imports = ["Foundation"]
macos = "10.15"
Expand Down Expand Up @@ -299,6 +306,14 @@ ios = "3.0"
tvos = "9.2"
watchos = "2.0"

[library.MediaPlayer]
imports = ["AppKit", "Foundation"]
macos = "10.12.1"
maccatalyst = "13.0"
ios = "2.0"
tvos = "9.0"
watchos = "5.0"

[library.Metal]
imports = ["Foundation"]
macos = "10.11"
Expand All @@ -324,6 +339,21 @@ maccatalyst = "13.0"
ios = "9.0"
tvos = "9.0"

[library.MetricKit]
imports = ["Foundation"]
macos = "12.0"
maccatalyst = "13.0"
ios = "13.0"

[library.Photos]
name = "PhotoKit"
imports = ["AppKit", "CoreLocation", "Foundation"]
macos = "10.11"
maccatalyst = "13.0"
ios = "8.0"
tvos = "10.0"
watchos = "9.0"

[library.OSAKit]
imports = ["AppKit", "Foundation"]
macos = "10.4"
Expand Down Expand Up @@ -1162,6 +1192,41 @@ skipped = true
skipped = true
[class.LAPublicKey.methods.verifyData_signature_secKeyAlgorithm_completion]
skipped = true
# Needs `CGImagePropertyOrientation` from `ImageIO`
[class.PHLivePhotoEditingContext.methods.orientation]
skipped = true
[class.PHImageManager.methods.requestImageDataAndOrientationForAsset_options_resultHandler]
skipped = true
# Needs `UIImageOrientation` from `UIKit`
[class.PHImageManager.methods.requestImageDataForAsset_options_resultHandler]
skipped = true
# Needs `CMTime` from `CoreMedia`
[class.PHLivePhotoEditingContext.methods.duration]
skipped = true
[class.PHLivePhotoEditingContext.methods.photoTime]
skipped = true
[protocol.PHLivePhotoFrame.methods.time]
skipped = true
# Needs `PHLivePhotoFrameProcessingBlock` (skipped because needs `CIImage`)
[class.PHLivePhotoEditingContext.methods.frameProcessor]
skipped = true
[class.PHLivePhotoEditingContext.methods.setFrameProcessor]
skipped = true
# Needs `CIImage` from `CoreImage`
[typedef.PHLivePhotoFrameProcessingBlock]
skipped = true
# Needs `dispatch_block_t`
[class.PHPhotoLibrary.methods.performChanges_completionHandler]
skipped = true
[class.PHPhotoLibrary.methods.performChangesAndWait_error]
skipped = true
# Needs `CMTimeRange` from `CoreMedia`
[class.MPAdTimeRange.methods.initWithTimeRange]
skipped = true
[class.MPAdTimeRange.methods.timeRange]
skipped = true
[class.MPAdTimeRange.methods.setTimeRange]
skipped = true

# Uses a pointer to SEL, which doesn't implement Encode yet
[protocol.NSMenuDelegate.methods]
Expand Down Expand Up @@ -1467,3 +1532,15 @@ skipped = true
# produces wrong values for most cases; manually define for now
[enum.LAError]
skipped = true

# fails to strip const from `typedef const NSString *const MXLaunchTaskID;`
[typedef.MXLaunchTaskID]
skipped = true
# fails to parse method argument with `MXLaunchTaskID`
[class.MXMetricManager.methods.extendLaunchMeasurementForTaskID_error]
skipped = true
[class.MXMetricManager.methods.finishExtendedLaunchMeasurementForTaskID_error]
skipped = true
# `os_log_t` not defined; skip for now
[class.MXMetricManager.methods.makeLogHandleWithCategory]
skipped = true
7 changes: 7 additions & 0 deletions crates/icrate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## icrate Unreleased - YYYY-MM-DD

### Added
* Added the following frameworks:
- `HealthKit`
- `MediaPlayer`
- `MetricKit`
- `PhotoKit`


## icrate 0.0.2 - 2023-02-07

Expand Down
Loading

0 comments on commit 797b146

Please sign in to comment.