Skip to content

Commit 2743aae

Browse files
committed
Add rust package for plugin system
1 parent ba8e47a commit 2743aae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+5779
-11
lines changed

app/lib/main.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import 'package:setonix/theme.dart';
1919
import 'package:shared_preferences/shared_preferences.dart';
2020
import 'package:flutter_localized_locales/flutter_localized_locales.dart';
2121
import 'package:window_manager/window_manager.dart';
22+
import 'package:setonix_plugin/setonix_plugin.dart';
2223

2324
import 'bloc/settings.dart';
2425
import 'pages/settings/page.dart';
@@ -44,6 +45,11 @@ Future<void> main(List<String> args) async {
4445
await networkService.init();
4546

4647
await setup(settingsCubit);
48+
49+
await initPluginSystem();
50+
if (kDebugMode) {
51+
print('6 + 8 = ${await simpleAdderTwinNormal(a: 6, b: 8)}');
52+
}
4753
runApp(
4854
MultiBlocProvider(
4955
providers: [

app/linux/flutter/generated_plugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
1212
)
1313

1414
list(APPEND FLUTTER_FFI_PLUGIN_LIST
15+
rust_lib_setonix_plugin
1516
)
1617

1718
set(PLUGIN_BUNDLED_LIBRARIES)

app/pubspec.lock

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ packages:
9494
url: "https://pub.dev"
9595
source: hosted
9696
version: "2.4.2"
97+
build_cli_annotations:
98+
dependency: transitive
99+
description:
100+
name: build_cli_annotations
101+
sha256: b59d2769769efd6c9ff6d4c4cede0be115a566afc591705c2040b707534b1172
102+
url: "https://pub.dev"
103+
source: hosted
104+
version: "2.1.0"
97105
build_config:
98106
dependency: transitive
99107
description:
@@ -454,6 +462,14 @@ packages:
454462
url: "https://pub.dev"
455463
source: hosted
456464
version: "0.7.5"
465+
flutter_rust_bridge:
466+
dependency: "direct main"
467+
description:
468+
name: flutter_rust_bridge
469+
sha256: "35c257fc7f98e34c1314d6c145e5ed54e7c94e8a9f469947e31c9298177d546f"
470+
url: "https://pub.dev"
471+
source: hosted
472+
version: "2.7.0"
457473
flutter_secure_storage:
458474
dependency: "direct main"
459475
description:
@@ -520,6 +536,14 @@ packages:
520536
description: flutter
521537
source: sdk
522538
version: "0.0.0"
539+
freezed_annotation:
540+
dependency: transitive
541+
description:
542+
name: freezed_annotation
543+
sha256: c2e2d632dd9b8a2b7751117abcfc2b4888ecfe181bd9fca7170d9ef02e595fe2
544+
url: "https://pub.dev"
545+
source: hosted
546+
version: "2.4.4"
523547
frontend_server_client:
524548
dependency: transitive
525549
description:
@@ -614,10 +638,10 @@ packages:
614638
dependency: transitive
615639
description:
616640
name: js
617-
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
641+
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
618642
url: "https://pub.dev"
619643
source: hosted
620-
version: "0.7.1"
644+
version: "0.6.7"
621645
json_annotation:
622646
dependency: transitive
623647
description:
@@ -960,6 +984,13 @@ packages:
960984
url: "https://pub.dev"
961985
source: hosted
962986
version: "3.0.2"
987+
rust_lib_setonix_plugin:
988+
dependency: "direct main"
989+
description:
990+
path: rust_builder
991+
relative: true
992+
source: path
993+
version: "0.0.1"
963994
rxdart:
964995
dependency: "direct main"
965996
description:
@@ -1023,6 +1054,13 @@ packages:
10231054
relative: true
10241055
source: path
10251056
version: "0.2.0"
1057+
setonix_plugin:
1058+
dependency: "direct main"
1059+
description:
1060+
path: "../plugin"
1061+
relative: true
1062+
source: path
1063+
version: "1.0.0"
10261064
share_plus:
10271065
dependency: transitive
10281066
description:

app/pubspec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ dependencies:
8989
markdown: ^7.2.2
9090
bloc_concurrency: ^0.2.5
9191
idb_shim: ^2.6.1+7
92+
rust_lib_setonix_plugin:
93+
path: rust_builder
94+
setonix_plugin:
95+
path: ../plugin
96+
flutter_rust_bridge: 2.7.0
9297
dependency_overrides:
9398
tiled:
9499
git:

app/rust_builder/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
build/

app/rust_builder/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Please ignore this folder, which is just glue to build Rust with Flutter.

app/rust_builder/android/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/workspace.xml
5+
/.idea/libraries
6+
.DS_Store
7+
/build
8+
/captures
9+
.cxx

app/rust_builder/android/build.gradle

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// The Android Gradle Plugin builds the native code with the Android NDK.
2+
3+
group 'com.flutter_rust_bridge.rust_lib_setonix_plugin'
4+
version '1.0'
5+
6+
buildscript {
7+
repositories {
8+
google()
9+
mavenCentral()
10+
}
11+
12+
dependencies {
13+
// The Android Gradle Plugin knows how to build native code with the NDK.
14+
classpath 'com.android.tools.build:gradle:7.3.0'
15+
}
16+
}
17+
18+
rootProject.allprojects {
19+
repositories {
20+
google()
21+
mavenCentral()
22+
}
23+
}
24+
25+
apply plugin: 'com.android.library'
26+
27+
android {
28+
if (project.android.hasProperty("namespace")) {
29+
namespace 'com.flutter_rust_bridge.rust_lib_setonix_plugin'
30+
}
31+
32+
// Bumping the plugin compileSdkVersion requires all clients of this plugin
33+
// to bump the version in their app.
34+
compileSdkVersion 33
35+
36+
// Use the NDK version
37+
// declared in /android/app/build.gradle file of the Flutter project.
38+
// Replace it with a version number if this plugin requires a specfic NDK version.
39+
// (e.g. ndkVersion "23.1.7779620")
40+
ndkVersion android.ndkVersion
41+
42+
compileOptions {
43+
sourceCompatibility JavaVersion.VERSION_1_8
44+
targetCompatibility JavaVersion.VERSION_1_8
45+
}
46+
47+
defaultConfig {
48+
minSdkVersion 19
49+
}
50+
}
51+
52+
apply from: "../cargokit/gradle/plugin.gradle"
53+
cargokit {
54+
manifestDir = "../../../plugin/rust"
55+
libname = "rust_lib_setonix_plugin"
56+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'rust_lib_setonix'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.flutter_rust_bridge.rust_lib_setonix">
3+
</manifest>

0 commit comments

Comments
 (0)