Skip to content

Commit

Permalink
Revert "Listener/Async Blocks (dart-archive#601)"
Browse files Browse the repository at this point in the history
This reverts commit 416fccd.
  • Loading branch information
vaind committed Sep 12, 2023
1 parent 1e0fb4c commit 6aa2c26
Show file tree
Hide file tree
Showing 25 changed files with 333 additions and 535 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# TODO: Change to 3.2.0 stable once it's released.
sdk: [3.2.0-114.0.dev]
sdk: [3.0.0]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
Expand All @@ -45,7 +44,7 @@ jobs:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: 3.2.0-114.0.dev
sdk: 3.0.0
- name: Install dependencies
run: dart pub get
- name: Install libclang-14-dev
Expand All @@ -62,7 +61,7 @@ jobs:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: 3.2.0-114.0.dev
sdk: 3.0.0
- name: Install dependencies
run: dart pub get
- name: Build test dylib and bindings
Expand All @@ -84,7 +83,7 @@ jobs:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: 3.2.0-114.0.dev
sdk: 3.0.0
- name: Install dependencies
run: dart pub get
- name: Build test dylib and bindings
Expand Down
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

- Add support for ObjC Blocks that can be invoked from any thread, using
NativeCallable.listener.
- Fix invalid exceptional return value ObjCBlocks that return floats.
- Fix return_of_invalid_type analysis error for ObjCBlocks.
- Fix crash in ObjC methods and blocks that return structs by value.
- Fix ObjC methods returning instancetype having the wrong type in sublasses.
- Bump min SDK version to 3.2.0-114.0.dev.

# 9.0.1
Expand Down
55 changes: 26 additions & 29 deletions example/c_json/cjson_generated_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ class CJson {
}

late final _cJSON_ParsePtr = _lookup<
ffi
.NativeFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>>(
'cJSON_Parse');
ffi.NativeFunction<
ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>>('cJSON_Parse');
late final _cJSON_Parse = _cJSON_ParsePtr
.asFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>();

Expand Down Expand Up @@ -110,9 +109,8 @@ class CJson {
}

late final _cJSON_PrintPtr = _lookup<
ffi
.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<cJSON>)>>(
'cJSON_Print');
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(ffi.Pointer<cJSON>)>>('cJSON_Print');
late final _cJSON_Print = _cJSON_PrintPtr
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<cJSON>)>();

Expand All @@ -125,9 +123,9 @@ class CJson {
}

late final _cJSON_PrintUnformattedPtr = _lookup<
ffi
.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<cJSON>)>>(
'cJSON_PrintUnformatted');
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<cJSON>)>>('cJSON_PrintUnformatted');
late final _cJSON_PrintUnformatted = _cJSON_PrintUnformattedPtr
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<cJSON>)>();

Expand Down Expand Up @@ -288,9 +286,9 @@ class CJson {
}

late final _cJSON_GetStringValuePtr = _lookup<
ffi
.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<cJSON>)>>(
'cJSON_GetStringValue');
ffi.NativeFunction<
ffi.Pointer<ffi.Char> Function(
ffi.Pointer<cJSON>)>>('cJSON_GetStringValue');
late final _cJSON_GetStringValue = _cJSON_GetStringValuePtr
.asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<cJSON>)>();

Expand Down Expand Up @@ -501,9 +499,9 @@ class CJson {
}

late final _cJSON_CreateStringPtr = _lookup<
ffi
.NativeFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>>(
'cJSON_CreateString');
ffi.NativeFunction<
ffi.Pointer<cJSON> Function(
ffi.Pointer<ffi.Char>)>>('cJSON_CreateString');
late final _cJSON_CreateString = _cJSON_CreateStringPtr
.asFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>();

Expand All @@ -516,9 +514,9 @@ class CJson {
}

late final _cJSON_CreateRawPtr = _lookup<
ffi
.NativeFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>>(
'cJSON_CreateRaw');
ffi.NativeFunction<
ffi.Pointer<cJSON> Function(
ffi.Pointer<ffi.Char>)>>('cJSON_CreateRaw');
late final _cJSON_CreateRaw = _cJSON_CreateRawPtr
.asFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>();

Expand Down Expand Up @@ -551,9 +549,9 @@ class CJson {
}

late final _cJSON_CreateStringReferencePtr = _lookup<
ffi
.NativeFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>>(
'cJSON_CreateStringReference');
ffi.NativeFunction<
ffi.Pointer<cJSON> Function(
ffi.Pointer<ffi.Char>)>>('cJSON_CreateStringReference');
late final _cJSON_CreateStringReference = _cJSON_CreateStringReferencePtr
.asFunction<ffi.Pointer<cJSON> Function(ffi.Pointer<ffi.Char>)>();

Expand Down Expand Up @@ -1201,9 +1199,9 @@ class CJson {
}

late final _cJSON_SetNumberHelperPtr = _lookup<
ffi
.NativeFunction<ffi.Double Function(ffi.Pointer<cJSON>, ffi.Double)>>(
'cJSON_SetNumberHelper');
ffi.NativeFunction<
ffi.Double Function(
ffi.Pointer<cJSON>, ffi.Double)>>('cJSON_SetNumberHelper');
late final _cJSON_SetNumberHelper = _cJSON_SetNumberHelperPtr
.asFunction<double Function(ffi.Pointer<cJSON>, double)>();

Expand Down Expand Up @@ -1258,13 +1256,12 @@ final class cJSON extends ffi.Struct {
}

final class cJSON_Hooks extends ffi.Struct {
external ffi
.Pointer<ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(ffi.Size sz)>>
external ffi.Pointer<
ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(ffi.Size sz)>>
malloc_fn;

external ffi
.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> ptr)>>
free_fn;
external ffi.Pointer<
ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void> ptr)>> free_fn;
}

typedef cJSON_bool = ffi.Int;
Expand Down
2 changes: 1 addition & 1 deletion example/c_json/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: c_json_example

environment:
sdk: ">=3.2.0-114.0.dev <4.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
ffi: ^2.0.1
Expand Down
2 changes: 1 addition & 1 deletion example/ffinative/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: ffinative_example

environment:
sdk: ">=3.2.0-114.0.dev <4.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
ffi: ^2.0.1
Expand Down
28 changes: 14 additions & 14 deletions example/libclang-example/generated_bindings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ class LibClang {
}

late final _clang_CXIndex_setInvocationEmissionPathOptionPtr = _lookup<
ffi
.NativeFunction<NativeClang_CXIndex_setInvocationEmissionPathOption>>(
ffi.NativeFunction<
NativeClang_CXIndex_setInvocationEmissionPathOption>>(
'clang_CXIndex_setInvocationEmissionPathOption');
late final _clang_CXIndex_setInvocationEmissionPathOption =
_clang_CXIndex_setInvocationEmissionPathOptionPtr
Expand Down Expand Up @@ -2938,8 +2938,8 @@ class LibClang {
}

late final _clang_Cursor_getTemplateArgumentUnsignedValuePtr = _lookup<
ffi
.NativeFunction<NativeClang_Cursor_getTemplateArgumentUnsignedValue>>(
ffi.NativeFunction<
NativeClang_Cursor_getTemplateArgumentUnsignedValue>>(
'clang_Cursor_getTemplateArgumentUnsignedValue');
late final _clang_Cursor_getTemplateArgumentUnsignedValue =
_clang_Cursor_getTemplateArgumentUnsignedValuePtr
Expand Down Expand Up @@ -4849,8 +4849,8 @@ class LibClang {
}

late final _clang_CXXConstructor_isConvertingConstructorPtr = _lookup<
ffi
.NativeFunction<NativeClang_CXXConstructor_isConvertingConstructor>>(
ffi.NativeFunction<
NativeClang_CXXConstructor_isConvertingConstructor>>(
'clang_CXXConstructor_isConvertingConstructor');
late final _clang_CXXConstructor_isConvertingConstructor =
_clang_CXXConstructor_isConvertingConstructorPtr
Expand Down Expand Up @@ -6850,8 +6850,8 @@ class _SymbolAddresses {
get clang_CXIndex_getGlobalOptions =>
_library._clang_CXIndex_getGlobalOptionsPtr;
ffi.Pointer<
ffi
.NativeFunction<NativeClang_CXIndex_setInvocationEmissionPathOption>>
ffi.NativeFunction<
NativeClang_CXIndex_setInvocationEmissionPathOption>>
get clang_CXIndex_setInvocationEmissionPathOption =>
_library._clang_CXIndex_setInvocationEmissionPathOptionPtr;
ffi.Pointer<ffi.NativeFunction<NativeClang_getFileName>>
Expand Down Expand Up @@ -7148,8 +7148,8 @@ class _SymbolAddresses {
get clang_Cursor_getTemplateArgumentValue =>
_library._clang_Cursor_getTemplateArgumentValuePtr;
ffi.Pointer<
ffi
.NativeFunction<NativeClang_Cursor_getTemplateArgumentUnsignedValue>>
ffi.NativeFunction<
NativeClang_Cursor_getTemplateArgumentUnsignedValue>>
get clang_Cursor_getTemplateArgumentUnsignedValue =>
_library._clang_Cursor_getTemplateArgumentUnsignedValuePtr;
ffi.Pointer<ffi.NativeFunction<NativeClang_equalTypes>>
Expand Down Expand Up @@ -7406,8 +7406,8 @@ class _SymbolAddresses {
get clang_Module_getTopLevelHeader =>
_library._clang_Module_getTopLevelHeaderPtr;
ffi.Pointer<
ffi
.NativeFunction<NativeClang_CXXConstructor_isConvertingConstructor>>
ffi.NativeFunction<
NativeClang_CXXConstructor_isConvertingConstructor>>
get clang_CXXConstructor_isConvertingConstructor =>
_library._clang_CXXConstructor_isConvertingConstructorPtr;
ffi.Pointer<ffi.NativeFunction<NativeClang_CXXConstructor_isCopyConstructor>>
Expand Down Expand Up @@ -11104,8 +11104,8 @@ typedef DartClang_indexLoc_getCXSourceLocation = CXSourceLocation Function(
/// The visitor should return one of the \c CXVisitorResult values
/// to direct \c clang_Type_visitFields.
typedef CXFieldVisitor = ffi.Pointer<
ffi
.NativeFunction<ffi.Int32 Function(CXCursor C, CXClientData client_data)>>;
ffi.NativeFunction<
ffi.Int32 Function(CXCursor C, CXClientData client_data)>>;
typedef NativeClang_Type_visitFields = ffi.UnsignedInt Function(
CXType T, CXFieldVisitor visitor, CXClientData client_data);
typedef DartClang_Type_visitFields = int Function(
Expand Down
2 changes: 1 addition & 1 deletion example/libclang-example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: libclang_example

environment:
sdk: ">=3.2.0-114.0.dev <4.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
ffi: ^2.0.1
Expand Down
Loading

0 comments on commit 6aa2c26

Please sign in to comment.