From 5e0296145488d099b4f66c40944de6e2d7f04bbf Mon Sep 17 00:00:00 2001 From: Alex Li Date: Wed, 9 Oct 2024 14:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Roll=20FRB=20(#83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ packages/agent_dart/lib/frb.dart | 1 + packages/agent_dart/pubspec.yaml | 2 +- .../lib/agent/agent/http/fetch.dart | 2 -- packages/agent_dart_base/lib/frb.dart | 2 ++ packages/agent_dart_base/pubspec.yaml | 3 +-- .../agent_dart_base/test/identity/ed25519.dart | 2 -- packages/agent_dart_base/test/test_utils.dart | 4 ---- packages/agent_dart_ffi/lib/agent_dart_ffi.dart | 3 +++ packages/agent_dart_ffi/lib/src/api.dart | 2 +- packages/agent_dart_ffi/lib/src/frb_generated.dart | 14 ++++++++++++-- .../agent_dart_ffi/lib/src/frb_generated.io.dart | 2 +- .../agent_dart_ffi/lib/src/frb_generated.web.dart | 2 +- packages/agent_dart_ffi/lib/src/p256.dart | 2 +- packages/agent_dart_ffi/lib/src/schnorr.dart | 2 +- packages/agent_dart_ffi/lib/src/secp256k1.dart | 2 +- packages/agent_dart_ffi/lib/src/types.dart | 2 +- .../agent_dart_ffi/native/agent_dart/Cargo.toml | 4 ++-- .../native/agent_dart/src/frb_generated.rs | 8 ++++---- packages/agent_dart_ffi/pubspec.yaml | 4 ++-- 20 files changed, 39 insertions(+), 28 deletions(-) create mode 100644 packages/agent_dart/lib/frb.dart create mode 100644 packages/agent_dart_base/lib/frb.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 81efb04d..b3708931 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ that can be found in the LICENSE file. --> # Changelog +## 1.0.0-dev.27 + +- Support `flutter_rust_bridge` 2.5. + ## 1.0.0-dev.26 - Reorg exports/imports so people can directly import `agent_dart_base/agent_dart_base.dart` diff --git a/packages/agent_dart/lib/frb.dart b/packages/agent_dart/lib/frb.dart new file mode 100644 index 00000000..2ba59555 --- /dev/null +++ b/packages/agent_dart/lib/frb.dart @@ -0,0 +1 @@ +export 'package:agent_dart_base/frb.dart'; diff --git a/packages/agent_dart/pubspec.yaml b/packages/agent_dart/pubspec.yaml index c2a8c230..29a18606 100644 --- a/packages/agent_dart/pubspec.yaml +++ b/packages/agent_dart/pubspec.yaml @@ -1,5 +1,5 @@ name: agent_dart -version: 1.0.0-dev.26 +version: 1.0.0-dev.27 description: | An agent library built for Internet Computer, diff --git a/packages/agent_dart_base/lib/agent/agent/http/fetch.dart b/packages/agent_dart_base/lib/agent/agent/http/fetch.dart index 4e683459..250a3515 100644 --- a/packages/agent_dart_base/lib/agent/agent/http/fetch.dart +++ b/packages/agent_dart_base/lib/agent/agent/http/fetch.dart @@ -5,8 +5,6 @@ import 'package:http/http.dart' as http; import '../../types.dart'; -// import 'index.dart'; - const defaultTimeout = Duration(seconds: 30); /// [defaultFetch] is a wrapper of [http.get], diff --git a/packages/agent_dart_base/lib/frb.dart b/packages/agent_dart_base/lib/frb.dart new file mode 100644 index 00000000..ac30380c --- /dev/null +++ b/packages/agent_dart_base/lib/frb.dart @@ -0,0 +1,2 @@ +export 'package:agent_dart_ffi/agent_dart_ffi.dart' + show AnyhowException, ExternalLibrary; diff --git a/packages/agent_dart_base/pubspec.yaml b/packages/agent_dart_base/pubspec.yaml index a04b2c1f..ef665f7b 100644 --- a/packages/agent_dart_base/pubspec.yaml +++ b/packages/agent_dart_base/pubspec.yaml @@ -1,5 +1,5 @@ name: agent_dart_base -version: 1.0.0-dev.26 +version: 1.0.0-dev.27 description: The Dart plugin that bridges Rust implementation for agent_dart. repository: https://github.com/AstroxNetwork/agent_dart @@ -20,7 +20,6 @@ dependencies: convert: ^3.0.1 crypto: ^3.0.2 fixnum: ^1.0.1 - flutter_rust_bridge: '>=2.1.0 <2.2.0' http: ^1.0.0 js: '>=0.6.4 <0.8.0' meta: ^1.7.0 diff --git a/packages/agent_dart_base/test/identity/ed25519.dart b/packages/agent_dart_base/test/identity/ed25519.dart index 0a4b75e5..bb5d3bbe 100644 --- a/packages/agent_dart_base/test/identity/ed25519.dart +++ b/packages/agent_dart_base/test/identity/ed25519.dart @@ -4,8 +4,6 @@ import 'dart:typed_data'; import 'package:agent_dart_base/agent_dart_base.dart'; import 'package:test/test.dart'; -// import 'package:agent_dart/utils/extension.dart'; - void main() { ed25519Test(); } diff --git a/packages/agent_dart_base/test/test_utils.dart b/packages/agent_dart_base/test/test_utils.dart index 127b762b..641030f8 100644 --- a/packages/agent_dart_base/test/test_utils.dart +++ b/packages/agent_dart_base/test/test_utils.dart @@ -1,12 +1,8 @@ -// import 'dart:ffi'; - import 'dart:ffi'; import 'package:agent_dart_ffi/agent_dart_ffi.dart'; -import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'; import 'package:test/test.dart'; -// import 'package:p4d_rust_binding/utils/utils.dart'; const isAssertionError = TypeMatcher(); Matcher assertionThrowsContains(String str) { diff --git a/packages/agent_dart_ffi/lib/agent_dart_ffi.dart b/packages/agent_dart_ffi/lib/agent_dart_ffi.dart index b713a9d1..eecae2c5 100644 --- a/packages/agent_dart_ffi/lib/agent_dart_ffi.dart +++ b/packages/agent_dart_ffi/lib/agent_dart_ffi.dart @@ -1,3 +1,6 @@ +export 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart' + show AnyhowException, ExternalLibrary; + export 'src/api.dart'; export 'src/frb_generated.dart' show AgentDart; export 'src/lib.dart'; diff --git a/packages/agent_dart_ffi/lib/src/api.dart b/packages/agent_dart_ffi/lib/src/api.dart index 6c7a72aa..963a9916 100644 --- a/packages/agent_dart_ffi/lib/src/api.dart +++ b/packages/agent_dart_ffi/lib/src/api.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/packages/agent_dart_ffi/lib/src/frb_generated.dart b/packages/agent_dart_ffi/lib/src/frb_generated.dart index e79a8b7c..1fd053be 100644 --- a/packages/agent_dart_ffi/lib/src/frb_generated.dart +++ b/packages/agent_dart_ffi/lib/src/frb_generated.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field @@ -36,6 +36,16 @@ class AgentDart ); } + /// Initialize flutter_rust_bridge in mock mode. + /// No libraries for FFI are loaded. + static void initMock({ + required AgentDartApi api, + }) { + instance.initMockImpl( + api: api, + ); + } + /// Dispose flutter_rust_bridge /// /// The call to this function is optional, since flutter_rust_bridge (and everything else) @@ -58,7 +68,7 @@ class AgentDart kDefaultExternalLibraryLoaderConfig; @override - String get codegenVersion => '2.1.0'; + String get codegenVersion => '2.5.0'; @override int get rustContentHash => 796173266; diff --git a/packages/agent_dart_ffi/lib/src/frb_generated.io.dart b/packages/agent_dart_ffi/lib/src/frb_generated.io.dart index bcbbfe9d..b091914a 100644 --- a/packages/agent_dart_ffi/lib/src/frb_generated.io.dart +++ b/packages/agent_dart_ffi/lib/src/frb_generated.io.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field diff --git a/packages/agent_dart_ffi/lib/src/frb_generated.web.dart b/packages/agent_dart_ffi/lib/src/frb_generated.web.dart index 29417433..69985159 100644 --- a/packages/agent_dart_ffi/lib/src/frb_generated.web.dart +++ b/packages/agent_dart_ffi/lib/src/frb_generated.web.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field diff --git a/packages/agent_dart_ffi/lib/src/p256.dart b/packages/agent_dart_ffi/lib/src/p256.dart index c1013087..6d06497f 100644 --- a/packages/agent_dart_ffi/lib/src/p256.dart +++ b/packages/agent_dart_ffi/lib/src/p256.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/packages/agent_dart_ffi/lib/src/schnorr.dart b/packages/agent_dart_ffi/lib/src/schnorr.dart index fab52015..e847e4ac 100644 --- a/packages/agent_dart_ffi/lib/src/schnorr.dart +++ b/packages/agent_dart_ffi/lib/src/schnorr.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/packages/agent_dart_ffi/lib/src/secp256k1.dart b/packages/agent_dart_ffi/lib/src/secp256k1.dart index ded9244d..0e3eb4f2 100644 --- a/packages/agent_dart_ffi/lib/src/secp256k1.dart +++ b/packages/agent_dart_ffi/lib/src/secp256k1.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/packages/agent_dart_ffi/lib/src/types.dart b/packages/agent_dart_ffi/lib/src/types.dart index 85a21571..bf87f1e5 100644 --- a/packages/agent_dart_ffi/lib/src/types.dart +++ b/packages/agent_dart_ffi/lib/src/types.dart @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. // ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import diff --git a/packages/agent_dart_ffi/native/agent_dart/Cargo.toml b/packages/agent_dart_ffi/native/agent_dart/Cargo.toml index f4f61480..e88dd155 100644 --- a/packages/agent_dart_ffi/native/agent_dart/Cargo.toml +++ b/packages/agent_dart_ffi/native/agent_dart/Cargo.toml @@ -34,12 +34,12 @@ lazy_static = "1.4.0" tokio = { version = "1", default-features = false, features = [ "rt-multi-thread", "time", "sync" ] } hex = "0.4.3" ecdsa = { version = "0.14.6", features = ["der"], default-features = false } -flutter_rust_bridge = "=2.1.0" +flutter_rust_bridge = "=2.5.0" [dev-dependencies] [build-dependencies] -flutter_rust_bridge_codegen = "=2.1.0" +flutter_rust_bridge_codegen = "=2.5.0" [profile.release] debug = false diff --git a/packages/agent_dart_ffi/native/agent_dart/src/frb_generated.rs b/packages/agent_dart_ffi/native/agent_dart/src/frb_generated.rs index 26c626b1..b7f1c636 100644 --- a/packages/agent_dart_ffi/native/agent_dart/src/frb_generated.rs +++ b/packages/agent_dart_ffi/native/agent_dart/src/frb_generated.rs @@ -1,5 +1,5 @@ // This file is automatically generated, so please do not edit it. -// Generated by `flutter_rust_bridge`@ 2.1.0. +// @generated by `flutter_rust_bridge`@ 2.5.0. #![allow( non_camel_case_types, @@ -36,7 +36,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_opaque = RustOpaqueMoi, default_rust_auto_opaque = RustAutoOpaqueMoi, ); -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.1.0"; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.5.0"; pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 796173266; // Section: executor @@ -2372,7 +2372,7 @@ impl SseEncode for i32 { #[cfg(not(target_family = "wasm"))] mod io { // This file is automatically generated, so please do not edit it. - // Generated by `flutter_rust_bridge`@ 2.1.0. + // @generated by `flutter_rust_bridge`@ 2.5.0. // Section: imports @@ -2394,7 +2394,7 @@ pub use io::*; #[cfg(target_family = "wasm")] mod web { // This file is automatically generated, so please do not edit it. - // Generated by `flutter_rust_bridge`@ 2.1.0. + // @generated by `flutter_rust_bridge`@ 2.5.0. // Section: imports diff --git a/packages/agent_dart_ffi/pubspec.yaml b/packages/agent_dart_ffi/pubspec.yaml index 41ae6e20..828f99c1 100644 --- a/packages/agent_dart_ffi/pubspec.yaml +++ b/packages/agent_dart_ffi/pubspec.yaml @@ -1,5 +1,5 @@ name: agent_dart_ffi -version: 1.0.0-dev.26 +version: 1.0.0-dev.27 description: The FFI plugin that bridges Rust implementation for agent_dart. repository: https://github.com/AstroxNetwork/agent_dart @@ -9,7 +9,7 @@ environment: sdk: '>=3.4.0 <4.0.0' dependencies: - flutter_rust_bridge: '>=2.1.0 <2.2.0' + flutter_rust_bridge: '>=2.5.0 <2.6.0' freezed_annotation: ^2.2.0 dev_dependencies: