@@ -91,6 +91,12 @@ The following configuration options are available-
9191
9292``` yaml
9393output : ' generated_bindings.dart'
94+ ` ` `
95+ or
96+ ` ` ` yaml
97+ output :
98+ bindings : ' generated_bindings.dart'
99+ ...
94100```
95101 </td >
96102 </tr >
@@ -521,6 +527,36 @@ language: 'objc'
521527` ` `
522528 </td>
523529 </tr>
530+ <tr>
531+ <td>output -> symbol-file</td>
532+ <td>Generates a symbol file yaml containing all types defined in the generated output.</td>
533+ <td>
534+
535+ ` ` ` yaml
536+ output:
537+ ...
538+ symbol-file:
539+ # Although file paths are supported here, prefer Package Uri's here
540+ # so that other pacakges can use them.
541+ output: 'package:some_pkg/symbols.yaml'
542+ import-path: 'package:some_pkg/base.dart'
543+ ` ` `
544+ </td>
545+ </tr>
546+ <tr>
547+ <td>import -> symbol-files</td>
548+ <td>Import symbols from a symbol file. Used for sharing type definitions from other pacakges.</td>
549+ <td>
550+
551+ ` ` ` yaml
552+ import:
553+ symbol-files:
554+ # Both package Uri and file paths are supported here.
555+ - 'package:some_pkg/symbols.yaml'
556+ - 'path/to/some/symbol_file.yaml'
557+ ` ` `
558+ </td>
559+ </tr>
524560</tbody>
525561</table>
526562
@@ -757,3 +793,16 @@ Ffigen can sometimes generate a lot of logs, especially when it's parsing a lot
757793 Level options are - `[all, fine, info (default), warning, severe]`.
758794 The `all` and `fine` will print a ton of logs are meant for debugging
759795 purposes only.
796+
797+ # ## How can type definitions be shared?
798+
799+ Ffigen can share type definitions using symbol files.
800+ - A package can generate a symbol file using the `output -> symbol-file` config.
801+ - And another package can then import this, using `import -> symbol-files` config.
802+ - Doing so will reuse all the types such as Struct/Unions, and will automatically
803+ exclude generating other types (E.g functions, enums, macros).
804+
805+ Checkout `examples/shared_bindings` for details.
806+
807+ For manually reusing definitions from another package, the `library-imports`
808+ and `type-map` config can be used.
0 commit comments