codegen icon indicating copy to clipboard operation
codegen copied to clipboard

Code gen for avfoundation and what paths to use

Open bsutton opened this issue 5 years ago • 3 comments

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.

bsutton avatar Oct 15 '20 06:10 bsutton

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.

yulingtianxia avatar Oct 15 '20 06:10 yulingtianxia

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

bsutton avatar Oct 15 '20 07:10 bsutton

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

yulingtianxia avatar Oct 15 '20 08:10 yulingtianxia