Skip to content

[ffigen] Clarify docs for include/exclude rules #1420

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

Open
stuartmorgan-g opened this issue Aug 12, 2024 · 2 comments
Open

[ffigen] Clarify docs for include/exclude rules #1420

stuartmorgan-g opened this issue Aug 12, 2024 · 2 comments
Assignees
Labels
lang-objective_c Related to Objective C support package:ffigen

Comments

@stuartmorgan-g
Copy link

I'm trying to temporarily work around #1416 by excluding the classes that have the type problem, since I don't currently need them. I updated my config to:

exclude-all-by-default: true
objc-interfaces:
  include:
    - 'AVAudioSession'
    - 'AVPlayer'
    - 'FVPVideoPlayer'
  exclude:
    # Due to https://github.com/dart-lang/native/issues/1416
    - 'AVComposition'
    - 'AVFragmentedAsset'
    - 'AVFragmentedMovie'
    - 'AVMovie'
    - 'AVMutableComposition'
    - 'AVMutableMovie'

But the generated output still has those classes in it, so still doesn't compile. The README for ffigen says:

Note: exclude overrides include.

so I would expect this to prevent the classes from being generated. It's not clear to me why it's not.

@dcharkes dcharkes added the lang-objective_c Related to Objective C support label Aug 12, 2024
@liamappelbe
Copy link
Contributor

The include/exclude rules never prevent transitive deps from being pulled in, even if you explicitly exclude them. What the docs mean is that you can include using a broad regex like ".*", then exclude specific names from that regex. We should definitely clarify the docs.

I'm hesitant to filter transitive deps, because in general it's not clear how to handle it. In this specific case it makes intuitive sense to omit any methods that receive or return an ObjC interface that you've explicitly excluded. But for other cases it's not so easy to cut out a transitive dep on an ObjC interface (super types, struct members, block signatures, etc). There's also the question of whether/how this explicit exclusion logic would work for other entities that can be transitive deps (structs, unions, enums, etc). So we'd end up with special cased exclusion logic that only applies when an ObjC interface is a transitive dep only due to being used in a method on another ObjC interface.

So I think this specific case should be handled by method filtering instead.

@liamappelbe liamappelbe changed the title objc-interfaces:exclude: not working for removing transitive deps [ffigen] Clarify docs for include/exclude rules Aug 13, 2024
@stuartmorgan-g
Copy link
Author

So I think this specific case should be handled by method filtering instead.

Yes, method filtering would definitely address both the specific use case of needing to exclude these methods for now, and more generally serve as a way of cutting down transitive dependencies in a way that has clean cut points.

@liamappelbe liamappelbe added this to the ffigen 18.0.0 milestone Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-objective_c Related to Objective C support package:ffigen
Projects
Status: Todo
Development

No branches or pull requests

3 participants