From 7c4235591ec46adea5c10e7d7b33133da236c0e1 Mon Sep 17 00:00:00 2001 From: Alex Li Date: Tue, 8 Oct 2024 10:14:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Fix=20README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 38 +++++------- packages/agent_dart/README.md | 93 +----------------------------- packages/agent_dart_base/README.md | 1 + packages/agent_dart_ffi/README.md | 1 + 4 files changed, 17 insertions(+), 116 deletions(-) mode change 100644 => 120000 packages/agent_dart/README.md create mode 120000 packages/agent_dart_base/README.md create mode 120000 packages/agent_dart_ffi/README.md diff --git a/README.md b/README.md index 6d0d5869..6eb974a3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ An agent library built for Internet Computer for Dart and Flutter apps. -**Join the Discord channel: [![Discord](https://img.shields.io/discord/845497925298815036?color=purple&logo=discord&style=flat-square)](https://discord.gg/aNzRuePmUY)** +**Join the Discord channel: [![Discord](https://img.shields.io/discord/845497925298815036?color=purple&logo=discord&style=flat-square)](https://discord.gg/xRVJfPnKGd)** --- @@ -13,7 +13,7 @@ An agent library built for Internet Computer for Dart and Flutter apps. - [Agent Dart](#agent-dart) - [📃 Table of content](#-table-of-content) - - [⚡️ Quick start](#️-quick-start) + - [⚡️ Quick start](#-quick-start) - [For Dart/Flutter app](#for-dartflutter-app) - [For iOS projects](#for-ios-projects) - [For developing the plugin](#for-developing-the-plugin) @@ -22,11 +22,11 @@ An agent library built for Internet Computer for Dart and Flutter apps. - [📖 Documentation](#-documentation) - [🔧 Helpers/Tooling](#-helperstooling) - [💡 Examples](#-examples) - - [🧘‍♂️ Motivation](#️-motivation) + - [🧘‍♂️ Motivation](#-motivation) - [🏆 Milestones](#-milestones) - [👨‍💻 Contributing](#-contributing) - [🔗 Reference and related projects](#-reference-and-related-projects) - - [⚠️ FAQ](#️-faq) + - [⚠️ FAQ](#-faq) - [Build rust libraries for iOS/MacOS](#build-rust-libraries-for-iosmacos) - [Network problem in macOS](#network-problem-in-macos) @@ -69,9 +69,7 @@ make sure you've done the following setup the build settings. ## 🚦 Prerequisites - [CMake](https://cmake.org/) v3.2+ -- [Xcode](https://developer.apple.com/xcode/) v13+ - [Rust](https://www.rust-lang.org/) v1.64+ -- [Node.js](https://nodejs.org/) v16+ ## 🧰 Resources @@ -129,28 +127,20 @@ we will document them as much as possible. By contributing to agent_dart, you agree that your contributions will be licensed under its MIT License. 1. Fork this library and add your own branch like `{feat|fix|test|dep}-{detail}`. - 2. Follow the [Prerequisites](#-prerequisites). - 3. Build rust dependencies for all supported platforms: - -```shell -sh ./scripts/bootstrap -``` - + ```shell + sh ./scripts/bootstrap + ``` 4. Start the example. - -```shell -cd example -flutter run -``` - + ```shell + cd example + flutter run + ``` 5. Tests. (Unit Test and Integration Test) - -```shell -flutter test -``` - + ```shell + flutter test + ``` 6. Commit and make a pull request. ## 🔗 Reference and related projects diff --git a/packages/agent_dart/README.md b/packages/agent_dart/README.md deleted file mode 100644 index c05cf9fe..00000000 --- a/packages/agent_dart/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# flutter_agent_dart - -A new Flutter FFI plugin project. - -## Getting Started - -This project is a starting point for a Flutter -[FFI plugin](https://docs.flutter.dev/development/platform-integration/c-interop), -a specialized package that includes native code directly invoked with Dart FFI. - -## Project stucture - -This template uses the following structure: - -* `src`: Contains the native source code, and a CmakeFile.txt file for building - that source code into a dynamic library. - -* `lib`: Contains the Dart code that defines the API of the plugin, and which - calls into the native code using `dart:ffi`. - -* platform folders (`android`, `ios`, `windows`, etc.): Contains the build files - for building and bundling the native code library with the platform application. - -## Buidling and bundling native code - -The `pubspec.yaml` specifies FFI plugins as follows: - -```yaml - plugin: - platforms: - some_platform: - ffiPlugin: true -``` - -This configuration invokes the native build for the various target platforms -and bundles the binaries in Flutter applications using these FFI plugins. - -This can be combined with dartPluginClass, such as when FFI is used for the -implementation of one platform in a federated plugin: - -```yaml - plugin: - implements: some_other_plugin - platforms: - some_platform: - dartPluginClass: SomeClass - ffiPlugin: true -``` - -A plugin can have both FFI and method channels: - -```yaml - plugin: - platforms: - some_platform: - pluginClass: SomeName - ffiPlugin: true -``` - -The native build systems that are invoked by FFI (and method channel) plugins are: - -* For Android: Gradle, which invokes the Android NDK for native builds. - * See the documentation in android/build.gradle. -* For iOS and MacOS: Xcode, via CocoaPods. - * See the documentation in ios/flutter_agent_dart.podspec. - * See the documentation in macos/flutter_agent_dart.podspec. -* For Linux and Windows: CMake. - * See the documentation in linux/CMakeLists.txt. - * See the documentation in windows/CMakeLists.txt. - -## Binding to native code - -To use the native code, bindings in Dart are needed. -To avoid writing these by hand, they are generated from the header file -(`src/flutter_agent_dart.h`) by `package:ffigen`. -Regenerate the bindings by running `flutter pub run ffigen --config ffigen.yaml`. - -## Invoking native code - -Very short-running native functions can be directly invoked from any isolate. -For example, see `sum` in `lib/flutter_agent_dart.dart`. - -Longer-running functions should be invoked on a helper isolate to avoid -dropping frames in Flutter applications. -For example, see `sumAsync` in `lib/flutter_agent_dart.dart`. - -## Flutter help - -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. - diff --git a/packages/agent_dart/README.md b/packages/agent_dart/README.md new file mode 120000 index 00000000..fe840054 --- /dev/null +++ b/packages/agent_dart/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/packages/agent_dart_base/README.md b/packages/agent_dart_base/README.md new file mode 120000 index 00000000..fe840054 --- /dev/null +++ b/packages/agent_dart_base/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/packages/agent_dart_ffi/README.md b/packages/agent_dart_ffi/README.md new file mode 120000 index 00000000..fe840054 --- /dev/null +++ b/packages/agent_dart_ffi/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file