diff --git a/pkgs/ffi/pubspec.yaml b/pkgs/ffi/pubspec.yaml index 71b07503c..59a6ea9a1 100644 --- a/pkgs/ffi/pubspec.yaml +++ b/pkgs/ffi/pubspec.yaml @@ -14,5 +14,5 @@ environment: resolution: workspace dev_dependencies: - dart_flutter_team_lints: ^2.0.0 + dart_flutter_team_lints: ^3.2.0 test: ^1.21.2 diff --git a/pkgs/ffigen/pubspec.yaml b/pkgs/ffigen/pubspec.yaml index a7c68337e..7dfa86f52 100644 --- a/pkgs/ffigen/pubspec.yaml +++ b/pkgs/ffigen/pubspec.yaml @@ -39,7 +39,7 @@ dependencies: dev_dependencies: async: ^2.11.0 coverage: ^1.11.0 - dart_flutter_team_lints: ^2.0.0 + dart_flutter_team_lints: ^3.2.0 json_schema: ^5.1.1 leak_tracker: ^10.0.7 objective_c: ^4.1.0 diff --git a/pkgs/jni/pubspec.yaml b/pkgs/jni/pubspec.yaml index 7a4bdb66c..c543413ff 100644 --- a/pkgs/jni/pubspec.yaml +++ b/pkgs/jni/pubspec.yaml @@ -31,7 +31,7 @@ dependencies: dev_dependencies: dart_flutter_team_lints: ^3.2.0 ## Pin ffigen version because we are depending on internal APIs. - ffigen: 8.0.2 + ffigen: ^16.0.0 logging: ^1.2.0 test: ^1.25.8 diff --git a/pkgs/jni/tool/generate_ffi_bindings.dart b/pkgs/jni/tool/generate_ffi_bindings.dart index c1a2b5e57..787df27fd 100644 --- a/pkgs/jni/tool/generate_ffi_bindings.dart +++ b/pkgs/jni/tool/generate_ffi_bindings.dart @@ -9,6 +9,7 @@ import 'dart:io'; import 'package:args/args.dart'; import 'package:ffigen/ffigen.dart' as ffigen; +import 'package:ffigen/src/header_parser.dart' as ffigen; import 'package:logging/logging.dart'; import 'wrapper_generators/generate_c_extensions.dart'; @@ -51,15 +52,15 @@ void main(List args) { }); logger.info('Generating C wrappers'); - final minimalConfig = ffigen.Config.fromFile(File('ffigen_exts.yaml')); + final minimalConfig = ffigen.YamlConfig.fromFile(File('ffigen_exts.yaml')); final minimalLibrary = ffigen.parse(minimalConfig); generateCWrappers(minimalLibrary); logger.info('Generating FFI bindings for package:jni'); - final config = ffigen.Config.fromFile(File('ffigen.yaml')); + final config = ffigen.YamlConfig.fromFile(File('ffigen.yaml')); final library = ffigen.parse(config); - final outputFile = File(config.output); + final outputFile = File(config.output.toFilePath()); library.generateFile(outputFile); logger.info('Generating Dart extensions'); diff --git a/pkgs/jni/tool/wrapper_generators/ffigen_util.dart b/pkgs/jni/tool/wrapper_generators/ffigen_util.dart index 975dc5f9d..2b65e7ccb 100644 --- a/pkgs/jni/tool/wrapper_generators/ffigen_util.dart +++ b/pkgs/jni/tool/wrapper_generators/ffigen_util.dart @@ -9,7 +9,11 @@ final dummyWriter = Writer( lookUpBindings: [], ffiNativeBindings: [], noLookUpBindings: [], + nativeEntryPoints: [], className: 'unused', + silenceEnumWarning: true, + generateForPackageObjectiveC: false, + nativeAssetId: null, ); /// Find compound having [name] in [library]. diff --git a/pkgs/jni/tool/wrapper_generators/generate_c_extensions.dart b/pkgs/jni/tool/wrapper_generators/generate_c_extensions.dart index a5ccef5d4..ceba196a6 100644 --- a/pkgs/jni/tool/wrapper_generators/generate_c_extensions.dart +++ b/pkgs/jni/tool/wrapper_generators/generate_c_extensions.dart @@ -91,7 +91,7 @@ String getWrapperFuncName(String name) { } // Returns declaration of function field in GlobalJniEnv struct -String getFunctionFieldDecl(Member field, {required bool isField}) { +String getFunctionFieldDecl(CompoundMember field, {required bool isField}) { final fieldType = field.type; if (fieldType is PointerType && fieldType.child is NativeFunc) { final nativeFunc = fieldType.child as NativeFunc; @@ -226,7 +226,7 @@ const _noCheckException = { 'ExceptionDescribe', }; -String? getWrapperFunc(Member field) { +String? getWrapperFunc(CompoundMember field) { final fieldType = field.type; if (fieldType is PointerType && fieldType.child is NativeFunc) { final functionType = (fieldType.child as NativeFunc).type; diff --git a/pkgs/jni/tool/wrapper_generators/generate_dart_extensions.dart b/pkgs/jni/tool/wrapper_generators/generate_dart_extensions.dart index 740434148..98a8ce012 100644 --- a/pkgs/jni/tool/wrapper_generators/generate_dart_extensions.dart +++ b/pkgs/jni/tool/wrapper_generators/generate_dart_extensions.dart @@ -76,7 +76,7 @@ String getCheckedGetter(Type returnType) { } String? getGlobalEnvExtensionFunction( - Member field, + CompoundMember field, Type? checkedReturnType, { required bool isLeaf, }) { @@ -276,7 +276,7 @@ class GlobalJniEnv { } String? getFunctionPointerExtensionFunction( - Member field, { + CompoundMember field, { bool indirect = false, bool implicitThis = false, required bool isLeaf,