Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS/tvOS/watchOS/visionOS support in framework crates #408

Open
madsmtm opened this issue Jan 29, 2023 · 0 comments
Open

iOS/tvOS/watchOS/visionOS support in framework crates #408

madsmtm opened this issue Jan 29, 2023 · 0 comments
Labels
A-framework Affects the framework crates and the translator for them help wanted Extra attention is needed

Comments

@madsmtm
Copy link
Owner

madsmtm commented Jan 29, 2023

My plan was to do something like:

  1. Run the "collection" part of header-translator (e.g. main.rs::parse_sdk) for each platform
  2. 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 availability attribute that will end up adding a cfg attribute on it
  • For each file, --||--
  • On each platform, put all statements into some sort of HashMap with "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 cfg attributes (ideally in the same order as the input file)
  • Similarly for each method in classes/protocols/categories
  1. 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.

@madsmtm madsmtm added help wanted Extra attention is needed A-framework Affects the framework crates and the translator for them labels Jan 29, 2023
@madsmtm madsmtm added this to the icrate v0.1.0 milestone May 26, 2023
@madsmtm madsmtm modified the milestones: Usable icrate, Polish icrate Jun 19, 2023
@madsmtm madsmtm changed the title iOS/tvOS/watchOS support in icrate iOS/tvOS/watchOS/visionOS support in icrate Apr 12, 2024
@madsmtm madsmtm changed the title iOS/tvOS/watchOS/visionOS support in icrate iOS/tvOS/watchOS/visionOS support in framework crates May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant