-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Labels
A-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for themenhancementNew feature or requestNew feature or request
Milestone
Description
Apple has the concept of "umbrella frameworks", frameworks that include other "sub-frameworks". objc2 doesn't currently handle these, no crates are provided for any umbrella framework or any sub-framework.
I'm trying to add a crate for AVFoundation, which is such an umbrella framework, so I've done some digging into how those work, here are my observations:
- Some Umbrella frameworks contain their own definitions and headers (example: AVFoundation) in addition to having sub-frameworks, others (example: CoreServices) only have a dummy header that includes all their sub-frameworks, providing no definitions of their own.
- Most sub-frameworks (example: MPSCore in MetalPerformanceShaders) are "interesting" to external developers and have their own headers, others (example: MPSBenchmarkLoop in MetalPerformanceShaders) have no headers at all and seem to be Apple-internal.
- Some sub-frameworks (example: HIServices in ApplicationServices) are actual folders that contain some data, others (example AVFAudio in AVFoundation) are actually top-level frameworks, in such cases, the sub-framework folder is just an alias / symlink pointing to the top-level framework.
- Apple's documentation is completely inconsistent as to where the documentation of sub-frameworks and sub-framework members is placed. For example, everything in Quartz is under /Quartz, with QuartzFilters being under /Quartz/QuartzFilter, NOT /Quartz/QuartzFilters. This is despite some Quartz sub-frameworks (like PDFKit) being aliases to top-level frameworks. Curiously enough, the PDFKit documentation can also be directly accessed under /pdfkit, and it seems to be the exact same documentation (this is not a redirect, the navigator changes to show the entirety of quartz when you're browsing under /quartz/pdfkit, but the content seems to be the same). Meanwhile, most AVFAudio topics can be browsed through both AVFoundation and AVFAudio, with the "speech synthesis" topic not being available in AVFAudio despite its sub-pages being under /avfaudio. To make things more confusing, when viewing any page related to speech synthesis, the navigator shown is for AVFoundation and not AVFAudio, despite the page being under /avfaudio. This doesn't seem to happen for any other audio-related pages, even if we navigate to them through the AVFoundation docs and not through AVFAudio, the navigator shown is for AVFAudio.
Apple seems to be entirely confused here about what actually constitutes a sub-framework and what is a top-level framework in its own right, and so we can no longer rely on deriving the docs URL from the framework's name.
Here are the problems we'd need to handle to get these into objc2:
- Where should sub-frameworks be placed? The alternatives I see are separate crates for sub-frameworks, modules inside a crate, a flat hierarchy, or some combination of the two, like separate crates for "aliased" top-level frameworks and using the same crate for the frameworks that don't exist anywhere else. The last option seems the most sensible, though probably requiring the most work (I'm not familiar with the header translator's code so not sure about this).
- Should parent frameworks re-export all declarations from their children? This is what is done in Objective C, and I suggest to follow suit here.
- When generating the documentation of a framework crate, what URL should we provide? How can we make sure that the documentation for the speech stuff is discoverable? If we provide /avfaudio, that documentation isn't there, it's under /avfoundation. Then there's the problem of QuartzFilters actually being /quartz/quartzfilter. I think we need an optional URL field in
translation-config.toml
. - How are sub-frameworks discovered, are they found and translated automatically or do they have to be manually specified? If the former, what should we do about completely headerless frameworks?
kanx99 and madsmtm
Metadata
Metadata
Assignees
Labels
A-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for themenhancementNew feature or requestNew feature or request