mirror of
https://github.com/flutter/flutter.git
synced 2026-01-09 07:51:35 +08:00
Bump ffigen in templates (#180513)
This commit is contained in:
parent
fa8898f682
commit
03d6c1d479
@ -11,10 +11,6 @@ headers:
|
||||
include-directives:
|
||||
- 'src/{{projectName}}.h'
|
||||
ffi-native:
|
||||
preamble: |
|
||||
// ignore_for_file: always_specify_types
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
comments:
|
||||
style: any
|
||||
length: full
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
// ignore_for_file: always_specify_types
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
//
|
||||
// Generated by `package:ffigen`.
|
||||
// ignore_for_file: type=lint, unused_import
|
||||
import 'dart:ffi' as ffi;
|
||||
|
||||
/// A very short-lived native function.
|
||||
@ -13,10 +10,7 @@ import 'dart:ffi' as ffi;
|
||||
/// They will block the Dart execution while running the native function, so
|
||||
/// only do this for native functions which are guaranteed to be short-lived.
|
||||
@ffi.Native<ffi.IntPtr Function(ffi.IntPtr, ffi.IntPtr)>()
|
||||
external int sum(
|
||||
int a,
|
||||
int b,
|
||||
);
|
||||
external int sum(int a, int b);
|
||||
|
||||
/// A longer lived native function, which occupies the thread calling it.
|
||||
///
|
||||
@ -24,7 +18,4 @@ external int sum(
|
||||
/// block Dart execution. This will cause dropped frames in Flutter applications.
|
||||
/// Instead, call these native functions on a separate isolate.
|
||||
@ffi.Native<ffi.IntPtr Function(ffi.IntPtr, ffi.IntPtr)>()
|
||||
external int sum_long_running(
|
||||
int a,
|
||||
int b,
|
||||
);
|
||||
external int sum_long_running(int a, int b);
|
||||
|
||||
@ -9,10 +9,10 @@ dependencies:
|
||||
code_assets: ^1.0.0
|
||||
hooks: ^1.0.0
|
||||
logging: ^1.3.0
|
||||
native_toolchain_c: ^0.17.3
|
||||
native_toolchain_c: ^0.17.4
|
||||
|
||||
dev_dependencies:
|
||||
ffi: ^2.1.3
|
||||
ffigen: ^13.0.0
|
||||
ffi: ^2.1.4
|
||||
ffigen: ^20.1.1
|
||||
flutter_lints: ^6.0.0
|
||||
test: ^1.25.8
|
||||
test: ^1.28.0
|
||||
|
||||
@ -10,10 +10,6 @@ headers:
|
||||
- 'src/{{projectName}}.h'
|
||||
include-directives:
|
||||
- 'src/{{projectName}}.h'
|
||||
preamble: |
|
||||
// ignore_for_file: always_specify_types
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
comments:
|
||||
style: any
|
||||
length: full
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
// ignore_for_file: always_specify_types
|
||||
// ignore_for_file: camel_case_types
|
||||
// ignore_for_file: non_constant_identifier_names
|
||||
|
||||
// AUTO GENERATED FILE, DO NOT EDIT.
|
||||
//
|
||||
// Generated by `package:ffigen`.
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: type=lint, unused_import
|
||||
import 'dart:ffi' as ffi;
|
||||
|
||||
/// Bindings for `src/{{projectName}}.h`.
|
||||
@ -15,31 +11,24 @@ import 'dart:ffi' as ffi;
|
||||
class {{pluginDartClass}}Bindings {
|
||||
/// Holds the symbol lookup function.
|
||||
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
_lookup;
|
||||
_lookup;
|
||||
|
||||
/// The symbols are looked up in [dynamicLibrary].
|
||||
{{pluginDartClass}}Bindings(ffi.DynamicLibrary dynamicLibrary)
|
||||
: _lookup = dynamicLibrary.lookup;
|
||||
: _lookup = dynamicLibrary.lookup;
|
||||
|
||||
/// The symbols are looked up with [lookup].
|
||||
{{pluginDartClass}}Bindings.fromLookup(
|
||||
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
lookup)
|
||||
: _lookup = lookup;
|
||||
ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) lookup,
|
||||
) : _lookup = lookup;
|
||||
|
||||
/// A very short-lived native function.
|
||||
///
|
||||
/// For very short-lived functions, it is fine to call them on the main isolate.
|
||||
/// They will block the Dart execution while running the native function, so
|
||||
/// only do this for native functions which are guaranteed to be short-lived.
|
||||
int sum(
|
||||
int a,
|
||||
int b,
|
||||
) {
|
||||
return _sum(
|
||||
a,
|
||||
b,
|
||||
);
|
||||
int sum(int a, int b) {
|
||||
return _sum(a, b);
|
||||
}
|
||||
|
||||
late final _sumPtr =
|
||||
@ -51,19 +40,14 @@ class {{pluginDartClass}}Bindings {
|
||||
/// Do not call these kind of native functions in the main isolate. They will
|
||||
/// block Dart execution. This will cause dropped frames in Flutter applications.
|
||||
/// Instead, call these native functions on a separate isolate.
|
||||
int sum_long_running(
|
||||
int a,
|
||||
int b,
|
||||
) {
|
||||
return _sum_long_running(
|
||||
a,
|
||||
b,
|
||||
);
|
||||
int sum_long_running(int a, int b) {
|
||||
return _sum_long_running(a, b);
|
||||
}
|
||||
|
||||
late final _sum_long_runningPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Int, ffi.Int)>>(
|
||||
'sum_long_running');
|
||||
late final _sum_long_running =
|
||||
_sum_long_runningPtr.asFunction<int Function(int, int)>();
|
||||
'sum_long_running',
|
||||
);
|
||||
late final _sum_long_running = _sum_long_runningPtr
|
||||
.asFunction<int Function(int, int)>();
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
{{#withFfi}}
|
||||
ffi: ^2.1.3
|
||||
ffigen: ^13.0.0
|
||||
ffigen: ^20.1.1
|
||||
{{/withFfi}}
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user