dart-native / codegen

Generator for dart_native bindings. Codegen can transform native SDK to Flutter plugin.
BSD 3-Clause "New" or "Revised" License
79 stars 3 forks source link

Code gen for avfoundation and what paths to use #43

Open bsutton opened 3 years ago

bsutton commented 3 years ago

I'm trying to generate code for the ios avfoundation headers.

I'm uncertain what paths to pass to the codegen tool:

The xcode project has a Frameworks directory with a large no. of frameworks many of which are dependant on each other.

Can I just pass a single framework directory?

e.g.

codegen -o ios_dart AVFoundation.framework

Do then just look at imports to see what other frameworks should be generated or am I better of just generating code for the entire set of frameworks?

Some guidance on the conversion process in the doco might be useful.

yulingtianxia commented 3 years ago

If A.framework imports B.framework, we need generate both A and B. The outputs are two Flutter plugins(A and B).

Here is an example in package.json

codegen dart_native/dart_native/example/ios/Runner/RuntimeStub.h -o test/dart/ --project-name my_package -t plugin

When using -t and --project-name option, codegen will create a Flutter plugin.

bsutton commented 3 years ago

Does it still need to be generated as a plugin? We have no native code so doesn't that make it a simple package?

yulingtianxia commented 3 years ago

Does it still need to be generated as a plugin? We have no native code so doesn't that make it a simple package?

Yeah, for system frameworks, you can make a simple package by -t package

Usage:

Usage: codegen [options] <input>

Generate dart code from native API.

Options:
  -V, --version                 output the version number
  -l, --language <language>     [objc, java, auto(default)] (default: "auto")
  -o, --output <output>         Output directory
  -t, --template <template>     Generate a shareable Flutter project containing
                                modular Dart code.
                                Specify the type of project to create:
                                [package, plugin]
  --project-name <projectName>  The project name for this new Flutter project.
                                This must be a valid dart package name.
  -h, --help                    display help for command