Skip to content

Upgrading ffigen 21 to 22

Breaking21.0.0 → 22.0.0Breaking21New1Changed1Fixed3

BreakingUpgrade verdict

21 breaking changes.

  • Instead of passing rename functions, you now set a name directly on each AST node.
  • The includeTransitive option is gone and behaves as if always false.
  • Several configuration classes that no longer hold anything have been removed.
  • The Headers config class is now called Input.
Top 3 of 21 that need code or config changes
Breaking21
Replaces rename and renameMember callbacks with .name setters on AST nodes.
renamerenameMember.name
Removes Interfaces/Protocols.includeTransitive, which is now always false.
Interfaces.includeTransitiveProtocols.includeTransitive
Deletes many now empty sub-config classes.
Renames Headers to Input.
HeadersInput
Removes libraryImports, which was dead code.
libraryImports
Removes useSupportedTypedefs, treating it as always true.
useSupportedTypedefs
Overhauls the Dart config API, replacing callback based config elements with a Visitor pattern and renaming many config fields.
VisitorFfiGenerator
Replaces include and includeMember callbacks with .isIncluded on AST nodes.
includeincludeMember.isIncluded
Replaces Functions/Globals.includeSymbolAddress with .exposeSymbolAddress on AST nodes.
Functions.includeSymbolAddressGlobals.includeSymbolAddress.exposeSymbolAddress
Replaces Functions.includeTypedef with .generateTypedefs on the Func AST node.
Functions.includeTypedef.generateTypedefsFunc
Replaces Structs.packingOverride with Struct.pack.
Structs.packingOverrideStruct.pack
Moves Enums.style and .silenceWarning to the EnumClass AST node.
Enums.styleEnums.silenceWarningEnumClass
Moves Functions.isLeaf and .recordUse to the Func AST node.
Functions.isLeafFunctions.recordUseFunc
Moves Structs/Unions.dependencies to the Struct/Union AST nodes.
Structs.dependenciesUnions.dependenciesStructUnion
Moves Interfaces/Protocols.module to the ObjCInterface/ObjCProtocol AST nodes.
Interfaces.moduleProtocols.moduleObjCInterfaceObjCProtocol
Replaces Categories.includeTransitive with ObjCInterface.includeCategories.
Categories.includeTransitiveObjCInterface.includeCategories
Consolidates Typedefs.includeUnused into Typealias.isIncluded using the TypealiasInclude enum (never, ifUsed, always).
Typedefs.includeUnusedTypealias.isIncludedTypealiasInclude
Consolidates imported fields and importedTypesByUsr into FfiGenerator.importType, now a callback.
importedimportedTypesByUsrFfiGenerator.importType
Replaces Output.dartFile with DartOutput to prepare for the upcoming multi-file output format.
Output.dartFileDartOutput
Makes preamble non-null.
preamble
Makes the generate function async.
generate

Generated by DepDelta from published Dart source. Not mixed with prose notes.

  • removed: class Categories: final extends Declarations
  • removed: class Declarations: final
  • removed: class Enums: final extends Declarations
  • removed: class Functions: final extends Declarations
  • removed: class Globals: final extends Declarations
  • removed: class Headers: final
  • removed: class Integers: final
  • removed: class Interfaces: final extends Declarations
  • removed: class Macros: final extends Declarations
  • removed: class Protocols: final extends Declarations
  • removed: class Structs: final extends Declarations
  • removed: class Typedefs: final extends Declarations
  • removed: class Unions: final extends Declarations
  • removed: class UnnamedEnums: final extends Declarations
  • removed: ctor Categories({ super.include, super.includeMember, super.rename, super.renameMember, this.includeTransitive = …, })
  • removed: ctor Declarations({ this.include = …, this.includeMember = …, this.includeSymbolAddress = …, this.rename = …, this.renameMember = …, })
  • removed: ctor Enums({ super.include, super.rename, super.renameMember, this.style = …, this.silenceWarning = …, })
  • removed: ctor Functions({ super.include, super.includeSymbolAddress, super.rename, super.renameMember, this.includeTypedef = …, this.isLeaf = …, this.recordUse = …, this.varArgs = …, List<VarArgFunction>>{}, })
  • removed: ctor Globals({super.rename, super.include, super.includeSymbolAddress})
  • removed: ctor Headers({ this.entryPoints = …, this.include = …, this.compilerOptions, this.ignoreSourceErrors = …, })
  • removed: ctor Integers({ @Deprecated( 'This field will change type. See ' 'https://github.com/dart-lang/native/issues/2595.', ) this.imported = …, })
  • removed: ctor Interfaces({ super.include, super.includeMember, super.rename, super.renameMember, this.includeTransitive = …, this.module = …, })
  • removed: ctor Macros({super.rename, super.include})
  • removed: ctor Protocols({ super.include, super.includeMember, super.rename, super.renameMember, this.includeTransitive = …, this.module = …, })
  • removed: ctor Structs({ super.include, super.rename, super.renameMember, this.dependencies = …, @Deprecated( 'This field will change type. See ' 'https://github.com/dart-lang/native/issues/2595.', ) this.imported = …, this.packingOverride = …, })
  • removed: ctor Typedefs({ super.rename, super.include, @Deprecated( 'This field will change type. See ' 'https://github.com/dart-lang/native/issues/2595.', ) this.imported = …, this.includeUnused = …, this.useSupportedTypedefs = …, })
  • removed: ctor Unions({ super.include, super.rename, super.renameMember, this.dependencies = …, @Deprecated( 'This field will change type. See ' 'https://github.com/dart-lang/native/issues/2595.', ) this.imported = …, })
  • removed: ctor UnnamedEnums({super.include, super.rename, super.renameMember})
  • removed: field Categories.includeTransitive: final bool
  • removed: field Enums.silenceWarning: final bool
  • removed: field FfiGenerator.enums: final Enums
  • removed: field FfiGenerator.functions: final Functions
  • removed: field FfiGenerator.globals: final Globals
  • removed: field FfiGenerator.headers: final Headers
  • removed: field FfiGenerator.importedTypesByUsr: final Map<String, ImportedType>
  • removed: field FfiGenerator.integers: final Integers
  • removed: field FfiGenerator.libraryImports: final List<LibraryImport>
  • removed: field FfiGenerator.macros: final Macros
  • removed: field FfiGenerator.structs: final Structs
  • removed: field FfiGenerator.typedefs: final Typedefs
  • removed: field FfiGenerator.unions: final Unions
  • removed: field FfiGenerator.unnamedEnums: final UnnamedEnums
  • removed: field Functions.varArgs: final Map<String, List<VarArgFunction>>
  • removed: field Headers.compilerOptions: final List<String>?
  • removed: field Headers.entryPoints: final List<Uri>
  • removed: field Headers.ignoreSourceErrors: final bool
  • removed: field Integers.imported: final List<ImportedType>
  • removed: field Interfaces.includeTransitive: final bool
  • removed: field ObjectiveC.categories: final Categories
  • removed: field ObjectiveC.interfaces: final Interfaces
  • removed: field ObjectiveC.protocols: final Protocols
  • removed: field Output.dartFile: final Uri
  • removed: field Protocols.includeTransitive: final bool
  • removed: field Structs.dependencies: final CompoundDependencies
  • removed: field Structs.imported: final List<ImportedType>
  • removed: field Typedefs.imported: final List<ImportedType>
  • removed: field Typedefs.includeUnused: final bool
  • removed: field Typedefs.useSupportedTypedefs: final bool
  • removed: field Unions.dependencies: final CompoundDependencies
  • removed: field Unions.imported: final List<ImportedType>
  • removed: method Declarations.Function(Declaration declaration): String
  • removed: method Declarations.Function(Declaration declaration): bool
  • removed: method Declarations.Function(Declaration declaration, String member): String
  • removed: method Declarations.Function(Declaration declaration, String member): bool
  • removed: method Enums.Function(Declaration declaration, EnumStyle? suggestedStyle): EnumStyle
  • removed: method Functions.Function(Declaration declaration): bool
  • removed: method Headers.Function(Uri header): bool
  • removed: method Interfaces.Function(Declaration declaration): String?
  • removed: method Protocols.Function(Declaration declaration): String?
  • removed: method Structs.Function(Declaration declaration): PackingValue?
  • removed: static field Categories.excludeAll: const
  • removed: static field Categories.includeAll: const
  • removed: static field Enums.excludeAll: const
  • removed: static field Enums.includeAll: const
  • removed: static field Functions.excludeAll: const
  • removed: static field Functions.includeAll: const
  • removed: static field Globals.excludeAll: const
  • removed: static field Globals.includeAll: const
  • removed: static field Interfaces.excludeAll: const
  • removed: static field Interfaces.includeAll: const
  • removed: static field Macros.excludeAll: const
  • removed: static field Macros.includeAll: const
  • removed: static field Protocols.excludeAll: const
  • removed: static field Protocols.includeAll: const
  • removed: static field Structs.excludeAll: const
  • removed: static field Structs.includeAll: const
  • removed: static field Typedefs.excludeAll: const Typedefs
  • removed: static field Typedefs.includeAll: const Typedefs
  • removed: static field Unions.excludeAll: const
  • removed: static field Unions.includeAll: const
  • removed: static field UnnamedEnums.excludeAll: const
  • removed: static field UnnamedEnums.includeAll: const
  • removed: static method Categories.includeSet(Set<String> names): Categories
  • removed: static method Declarations.Function(Declaration): String
  • removed: static method Declarations.Function(Declaration): bool
  • removed: static method Declarations.Function(Declaration, String): String
  • removed: static method Declarations.Function(Declaration, String): bool
  • removed: static method Declarations.excludeAll(Declaration declaration): bool
  • removed: static method Declarations.includeAll(Declaration declaration): bool
  • removed: static method Declarations.includeAllMembers(Declaration declaration, String member): bool
  • removed: static method Declarations.useMemberOriginalName(Declaration declaration, String member): String
  • removed: static method Declarations.useOriginalName(Declaration declaration): String
  • removed: static method Enums.includeSet(Set<String> names): Enums
  • removed: static method Functions.includeSet(Set<String> names): Functions
  • removed: static method Globals.includeSet(Set<String> names): Globals
  • removed: static method Interfaces.includeSet(Set<String> names): Interfaces
  • removed: static method Interfaces.noModule(Declaration declaration): String?
  • removed: static method Macros.includeSet(Set<String> names): Macros
  • removed: static method Protocols.includeSet(Set<String> names): Protocols
  • removed: static method Protocols.noModule(Declaration declaration): String?
  • removed: static method Structs.includeSet(Set<String> names): Structs
  • removed: static method Typedefs.includeSet(Set<String> names): Typedefs
  • removed: static method Unions.includeSet(Set<String> names): Unions
  • removed: static method UnnamedEnums.includeSet(Set<String> names): UnnamedEnums
  • changed: ctor FfiGenerator({ this.headers = …, this.enums = …, this.functions = …, this.globals = …, this.integers = …, this.macros = …, this.structs = …, this.cpp, this.typedefs = …, this.unions = …, this.unnamedEnums = …, this.objectiveC, required this.output, @Deprecated( 'Will be folded into imported fields of the various declarations. See ' 'https://github.com/dart-lang/native/issues/2596.', ) this.i… → ctor FfiGenerator({ this.input = …, this.cpp, this.objectiveC, required this.output, this.visitors = …, this.importType = …, @Deprecated('Only visible for YamlConfig plumbing.') this.libclangDylib, })
  • changed: ctor ObjectiveC({ this.categories = …, this.interfaces = …, this.protocols = …, this.externalVersions = …, @Deprecated('Only for internal use.') this.generateForPackageObjectiveC = …, }) → ctor ObjectiveC({ this.externalVersions = …, @Deprecated('Only for internal use.') this.generateForPackageObjectiveC = …, })
  • changed: ctor Output({ required this.dartFile, this.objectiveCFile, this.cppFile, this.symbolFile, this.commentType = …, this.preamble, this.format = …, this.style = …, this.recordUseMapping, }) → ctor Output({ required this.dart, this.objectiveCFile, this.cppFile, this.symbolFile, this.commentType = …, this.preamble = …, this.format = …, this.style = …, this.recordUseMapping, })
  • changed: ctor VarArgFunction(this.postfix, this.types) → ctor VarArgFunction({this.postfix = …, required this.types})
  • changed: field Output.preamble: final String? → field Output.preamble: final String
  • changed: field VarArgFunction.postfix: final String → field VarArgFunction.postfix: String
  • changed: field VarArgFunction.types: final List<Type> → field VarArgFunction.types: List<String>
  • changed: method FfiGenerator.generate({Logger? logger, Uri? libclangDylib}): void → method FfiGenerator.generate({Logger? logger, Uri? libclangDylib}): Future<void>
  • added: class AstNode: abstract
  • added: class Cpp: final
  • added: class CppClass extends DeclNode
  • added: class CppMethod extends NamedNode
  • added: class DartOutput: final
  • added: class DeclNode: abstract extends NamedNode
  • added: class EnumClass extends DeclNode
  • added: class EnumConstant extends NamedNode
  • added: class Field extends NamedNode
  • added: class Func extends DeclNode
  • added: class Global extends DeclNode
  • added: class Input: final
  • added: class MacroConstant extends DeclNode
  • added: class NamedNode: abstract extends AstNode
  • added: class ObjCCategory extends DeclNode
  • added: class ObjCInterface extends DeclNode
  • added: class ObjCMethod extends NamedNode
  • added: class ObjCProtocol extends DeclNode
  • added: class Param extends NamedNode
  • added: class Struct extends DeclNode
  • added: class Typealias extends DeclNode
  • added: class Union extends DeclNode
  • added: class UnnamedEnumConstant extends DeclNode
  • added: class Visitor: abstract base
  • added: ctor AstNode()
  • added: ctor Cpp()
  • added: ctor CppClass(this._cppClass)
  • added: ctor CppMethod(this.parent, this._method)
  • added: ctor DartOutput({required this.path})
  • added: ctor DeclNode()
  • added: ctor EnumClass(this._enumClass)
  • added: ctor EnumConstant(this.parent, this._constant)
  • added: ctor Field(this.parent, this._member)
  • added: ctor Func(this._func)
  • added: ctor Global(this._global)
  • added: ctor Input({ this.entryPoints = …, this.include = …, this.compilerOptions, this.ignoreSourceErrors = …, })
  • added: ctor MacroConstant(this._macro)
  • added: ctor NamedNode()
  • added: ctor ObjCCategory(this._category)
  • added: ctor ObjCInterface(this._interface)
  • added: ctor ObjCMethod(this.parent, this._method)
  • added: ctor ObjCProtocol(this._protocol)
  • added: ctor Param(this.parent, this._parameter)
  • added: ctor Struct(this._struct)
  • added: ctor Typealias(this._typealias)
  • added: ctor Union(this._union)
  • added: ctor UnnamedEnumConstant(this._constant)
  • added: ctor Visitor({ void Function(Func) func, void Function(Struct) struct, void Function(Union) union, void Function(EnumClass) enumClass, void Function(Global) global, void Function(MacroConstant) macroConstant, void Function(Typealias) typealias, void Function(ObjCInterface) objCInterface, void Function(ObjCProtocol) objCProtocol, void Function(ObjCCategory) objCCategory, void Function(CppClass) cp…
  • added: ctor Visitor.base()
  • added: enum TypealiasInclude
  • added: field CppClass.methods: late final List<CppMethod>
  • added: field CppMethod.params: late final List<Param>
  • added: field CppMethod.parent: final CppClass
  • added: field DartOutput.path: final Uri
  • added: field EnumClass.constants: late final List<EnumConstant>
  • added: field EnumConstant.parent: final EnumClass
  • added: field FfiGenerator.input: final Input
  • added: field FfiGenerator.visitors: final List<Visitor>
  • added: field Field.parent: final DeclNode
  • added: field Func.params: late final List<Param>
  • added: field Input.compilerOptions: final List<String>?
  • added: field Input.entryPoints: final List<Uri>
  • added: field Input.ignoreSourceErrors: final bool
  • added: field ObjCCategory.interface: late final ObjCInterface
  • added: field ObjCCategory.methods: late final List<ObjCMethod>
  • added: field ObjCInterface.methods: late final List<ObjCMethod>
  • added: field ObjCMethod.params: late final List<Param>
  • added: field ObjCMethod.parent: final DeclNode
  • added: field ObjCProtocol.methods: late final List<ObjCMethod>
  • added: field Output.dart: final DartOutput
  • added: field Param.parent: final NamedNode
  • added: field Struct.members: late final List<Field>
  • added: field Union.members: late final List<Field>
  • added: get CppClass.isIncluded: bool
  • added: get CppClass.name: String
  • added: get CppClass.originalName: String
  • added: get CppClass.usr: String
  • added: get CppMethod.isIncluded: bool
  • added: get CppMethod.name: String
  • added: get CppMethod.originalName: String
  • added: get DeclNode.usr: String
  • added: get EnumClass.isIncluded: bool
  • added: get EnumClass.name: String
  • added: get EnumClass.originalName: String
  • added: get EnumClass.silenceWarning: bool
  • added: get EnumClass.style: EnumStyle?
  • added: get EnumClass.usr: String
  • added: get EnumConstant.name: String
  • added: get EnumConstant.originalName: String
  • added: get Field.name: String
  • added: get Field.originalName: String
  • added: get Func.exposeSymbolAddress: bool
  • added: get Func.generateTypedefs: bool
  • added: get Func.isIncluded: bool
  • added: get Func.isLeaf: bool
  • added: get Func.isVariadic: bool
  • added: get Func.name: String
  • added: get Func.originalName: String
  • added: get Func.recordUse: bool
  • added: get Func.usr: String
  • added: get Func.varArgs: List<VarArgFunction>
  • added: get Global.exposeSymbolAddress: bool
  • added: get Global.isIncluded: bool
  • added: get Global.name: String
  • added: get Global.originalName: String
  • added: get Global.usr: String
  • added: get MacroConstant.isIncluded: bool
  • added: get MacroConstant.name: String
  • added: get MacroConstant.originalName: String
  • added: get MacroConstant.usr: String
  • added: get NamedNode.name: String
  • added: get NamedNode.originalName: String
  • added: get ObjCCategory.isIncluded: bool
  • added: get ObjCCategory.name: String
  • added: get ObjCCategory.originalName: String
  • added: get ObjCCategory.usr: String
  • added: get ObjCInterface.includeCategories: bool
  • added: get ObjCInterface.isIncluded: bool
  • added: get ObjCInterface.module: String?
  • added: get ObjCInterface.name: String
  • added: get ObjCInterface.originalName: String
  • added: get ObjCInterface.usr: String
  • added: get ObjCMethod.isIncluded: bool
  • added: get ObjCMethod.isPropertyGetter: bool
  • added: get ObjCMethod.isPropertySetter: bool
  • added: get ObjCMethod.name: String
  • added: get ObjCMethod.originalName: String
  • added: get ObjCMethod.selector: String
  • added: get ObjCProtocol.isIncluded: bool
  • added: get ObjCProtocol.module: String?
  • added: get ObjCProtocol.name: String
  • added: get ObjCProtocol.originalName: String
  • added: get ObjCProtocol.usr: String
  • added: get Param.name: String
  • added: get Param.originalName: String
  • added: get Struct.dependencies: CompoundDependencies
  • added: get Struct.isIncluded: bool
  • added: get Struct.name: String
  • added: get Struct.originalName: String
  • added: get Struct.pack: int?
  • added: get Struct.usr: String
  • added: get Typealias.isIncluded: TypealiasInclude
  • added: get Typealias.name: String
  • added: get Typealias.originalName: String
  • added: get Typealias.usr: String
  • added: get Union.dependencies: CompoundDependencies
  • added: get Union.isIncluded: bool
  • added: get Union.name: String
  • added: get Union.originalName: String
  • added: get Union.usr: String
  • added: get UnnamedEnumConstant.isIncluded: bool
  • added: get UnnamedEnumConstant.name: String
  • added: get UnnamedEnumConstant.originalName: String
  • added: get UnnamedEnumConstant.usr: String
  • added: member TypealiasInclude.always
  • added: member TypealiasInclude.ifUsed
  • added: member TypealiasInclude.never
  • added: method AstNode.accept(Visitor visitor): void
  • added: method CppClass.accept(Visitor visitor): void
  • added: method CppMethod.accept(Visitor visitor): void
  • added: method EnumClass.accept(Visitor visitor): void
  • added: method EnumConstant.accept(Visitor visitor): void
  • added: method FfiGenerator.Function(Declaration declaration): ImportedType?
  • added: method Field.accept(Visitor visitor): void
  • added: method Func.accept(Visitor visitor): void
  • added: method Global.accept(Visitor visitor): void
  • added: method Input.Function(Uri header): bool
  • added: method MacroConstant.accept(Visitor visitor): void
  • added: method ObjCCategory.accept(Visitor visitor): void
  • added: method ObjCInterface.accept(Visitor visitor): void
  • added: method ObjCMethod.accept(Visitor visitor): void
  • added: method ObjCProtocol.accept(Visitor visitor): void
  • added: method Param.accept(Visitor visitor): void
  • added: method Struct.accept(Visitor visitor): void
  • added: method Typealias.accept(Visitor visitor): void
  • added: method Union.accept(Visitor visitor): void
  • added: method UnnamedEnumConstant.accept(Visitor visitor): void
  • added: method Visitor.visitAll(Iterable<AstNode> nodes): void
  • added: method Visitor.visitCppClass(CppClass node): void
  • added: method Visitor.visitCppMethod(CppMethod node): void
  • added: method Visitor.visitEnum(EnumClass node): void
  • added: method Visitor.visitEnumConstant(EnumConstant node): void
  • added: method Visitor.visitField(Field node): void
  • added: method Visitor.visitFunc(Func node): void
  • added: method Visitor.visitGlobal(Global node): void
  • added: method Visitor.visitMacro(MacroConstant node): void
  • added: method Visitor.visitObjCCategory(ObjCCategory node): void
  • added: method Visitor.visitObjCInterface(ObjCInterface node): void
  • added: method Visitor.visitObjCMethod(ObjCMethod node): void
  • added: method Visitor.visitObjCProtocol(ObjCProtocol node): void
  • added: method Visitor.visitParam(Param node): void
  • added: method Visitor.visitStruct(Struct node): void
  • added: method Visitor.visitTypealias(Typealias node): void
  • added: method Visitor.visitUnion(Union node): void
  • added: method Visitor.visitUnnamedEnumConstant(UnnamedEnumConstant node): void
  • added: set CppClass.isIncluded(bool value)
  • added: set CppClass.name(String value)
  • added: set CppMethod.isIncluded(bool value)
  • added: set CppMethod.name(String value)
  • added: set EnumClass.isIncluded(bool value)
  • added: set EnumClass.name(String value)
  • added: set EnumClass.silenceWarning(bool value)
  • added: set EnumClass.style(EnumStyle? value)
  • added: set EnumConstant.name(String value)
  • added: set Field.name(String value)
  • added: set Func.exposeSymbolAddress(bool value)
  • added: set Func.generateTypedefs(bool value)
  • added: set Func.isIncluded(bool value)
  • added: set Func.isLeaf(bool value)
  • added: set Func.name(String value)
  • added: set Func.recordUse(bool value)
  • added: set Func.varArgs(List<VarArgFunction> value)
  • added: set Global.exposeSymbolAddress(bool value)
  • added: set Global.isIncluded(bool value)
  • added: set Global.name(String value)
  • added: set MacroConstant.isIncluded(bool value)
  • added: set MacroConstant.name(String value)
  • added: set NamedNode.name(String value)
  • added: set ObjCCategory.isIncluded(bool value)
  • added: set ObjCCategory.name(String value)
  • added: set ObjCInterface.includeCategories(bool value)
  • added: set ObjCInterface.isIncluded(bool value)
  • added: set ObjCInterface.module(String? value)
  • added: set ObjCInterface.name(String value)
  • added: set ObjCMethod.isIncluded(bool value)
  • added: set ObjCMethod.name(String value)
  • added: set ObjCProtocol.isIncluded(bool value)
  • added: set ObjCProtocol.module(String? value)
  • added: set ObjCProtocol.name(String value)
  • added: set Param.name(String value)
  • added: set Struct.dependencies(CompoundDependencies value)
  • added: set Struct.isIncluded(bool value)
  • added: set Struct.name(String value)
  • added: set Struct.pack(int? value)
  • added: set Typealias.isIncluded(TypealiasInclude value)
  • added: set Typealias.name(String value)
  • added: set Union.dependencies(CompoundDependencies value)
  • added: set Union.isIncluded(bool value)
  • added: set Union.name(String value)
  • added: set UnnamedEnumConstant.isIncluded(bool value)
  • added: set UnnamedEnumConstant.name(String value)