-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Labels
A-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for themhelp wantedExtra attention is neededExtra attention is needed
Milestone
Description
My plan was to do something like:
- Run the "collection" part of
header-translator(e.g.main.rs::parse_sdk) for each platform - Compare the output against each other:
- For each framework, if it exists on one platform but not the others, add it to the list of frameworks, but with appropriate
availabilityattribute that will end up adding acfgattribute on it - For each file, --||--
- On each platform, put all statements into some sort of
HashMapwith "top-level" information (name of stmt, which generics a class has, and so on (but not which methods a class has implemented))- Use this to figure out which statements are on which some platforms
- Add that to the final output, with relevant
cfgattributes (ideally in the same order as the input file)
- Add that to the final output, with relevant
- Use this to figure out which statements are on which some platforms
- Similarly for each method in classes/protocols/categories
- Output the combined result
The result is that we would only have to distribute one crate, and that crate would have the correct cfg attributes, which is very useful for the documentation on docs.rs (since it could directly show us which things are available on which platforms).
As an example, let's take NSPointerArray: On this, there are five methods on macOS, and three on iOS, pointerArrayWithStrongObjects and pointerArrayWithWeakObjects are only available on iOS. So the result we'd like is that these two got a #[cfg(target_os = "macos")] on them.
All of this is the ideal solution; before we get there though, we're going to be doing a bunch of hacks, #600 contains an example of one of these.
marysaka, simlay and yerkesilvanshade, simlay and yerke
Metadata
Metadata
Assignees
Labels
A-frameworkAffects the framework crates and the translator for themAffects the framework crates and the translator for themhelp wantedExtra attention is neededExtra attention is needed