diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5ed2a311247..71d60834cc7 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -41,7 +41,7 @@ CMakeLists.txt @ilikethese @etkmao /framework/ios/ @wwwcg @ruifanyuan # framework: voltron -/framework/voltron/ @lvfen @skindhu +/framework/voltron/ @lvfen @henryjin0511 # dom: others /dom/ @etkmao @ilikethese @@ -57,17 +57,17 @@ CMakeLists.txt @ilikethese @etkmao /renderer/tdf/ios/ @wwwcg @ruifanyuan # renderer: voltron -/renderer/voltron/ @lvfen @skindhu +/renderer/voltron/ @lvfen @henryjin0511 # module: vfs /modules/vfs/ @etkmao @ilikethese /modules/vfs/android/ @siguangli @iPel /modules/vfs/android/**/src/main/cpp/ @etkmao @ilikethese /modules/vfs/ios/ @wwwcg @ruifanyuan -/modules/vfs/voltron/ @lvfen @skindhu +/modules/vfs/voltron/ @lvfen @henryjin0511 # module: voltron -/modules/voltron/ @lvfen @skindhu +/modules/voltron/ @lvfen @henryjin0511 # module: android /modules/android/ @siguangli @iPel diff --git a/framework/voltron/CHANGELOG.md b/framework/voltron/CHANGELOG.md index 93f6ee00e5e..919eb2bfb46 100644 --- a/framework/voltron/CHANGELOG.md +++ b/framework/voltron/CHANGELOG.md @@ -1,5 +1,9 @@ ## 0.0.34 +- support voltron dynamic library load + +## 0.0.34 + - update voltron_render to 0.0.24 to fix width calculate error and add modal navigator param ## 0.0.33 diff --git a/framework/voltron/core/src/bridge/android/bridge_impl.cc b/framework/voltron/core/src/bridge/android/bridge_impl.cc index 88cc511d22c..061d17c0be4 100644 --- a/framework/voltron/core/src/bridge/android/bridge_impl.cc +++ b/framework/voltron/core/src/bridge/android/bridge_impl.cc @@ -243,7 +243,7 @@ void BridgeImpl::Destroy(int64_t scope_id, voltron::EraseObject(footstone::checked_numeric_cast< int64_t, uint32_t>(scope_id)); - JsDriverUtils::DestroyInstance(engine, scope, [callback](bool ret) { + JsDriverUtils::DestroyInstance(std::move(engine), std::move(scope), [callback](bool ret) { if (ret) { callback(INIT_CB_STATE::SUCCESS); } else { diff --git a/framework/voltron/example/android/build.gradle b/framework/voltron/example/android/build.gradle index 3aef9e69f0a..1162d4c4ba5 100644 --- a/framework/voltron/example/android/build.gradle +++ b/framework/voltron/example/android/build.gradle @@ -29,6 +29,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/framework/voltron/example/android/gradle/wrapper/gradle-wrapper.properties b/framework/voltron/example/android/gradle/wrapper/gradle-wrapper.properties index b8793d3c0d6..6b665338b34 100644 --- a/framework/voltron/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/framework/voltron/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/framework/voltron/example/lib/main.dart b/framework/voltron/example/lib/main.dart index 20c0f1d7df7..e33659c56e3 100644 --- a/framework/voltron/example/lib/main.dart +++ b/framework/voltron/example/lib/main.dart @@ -22,6 +22,8 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:voltron/voltron.dart'; import 'base_voltron_page.dart'; @@ -35,6 +37,7 @@ void main() { systemNavigationBarColor: Color(0XFFE5E5E5), )); } + runApp(MyApp()); } @@ -89,6 +92,18 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { + @override + void initState() { + super.initState(); + setLibrary(); + } + + void setLibrary() async { + // final path = (await getApplicationDocumentsDirectory()).path; + // 测试业务动态load library + // VoltronJSLoaderManager.initCustomLibrary(path: '$path/libs/arm64-v8a/', name: 'voltron_core'); + } + @override Widget build(BuildContext context) { return Scaffold( diff --git a/framework/voltron/lib/voltron/loader.dart b/framework/voltron/lib/voltron/loader.dart index c56bbc7c5c8..d4dd37e35b9 100644 --- a/framework/voltron/lib/voltron/loader.dart +++ b/framework/voltron/lib/voltron/loader.dart @@ -18,6 +18,7 @@ // limitations under the License. // +import 'package:voltron/voltron.dart'; import 'package:voltron_renderer/voltron_renderer.dart'; import '../engine.dart'; @@ -34,6 +35,19 @@ class VoltronJSLoaderManager { _engine = VoltronJSEngine.create(params); } + /// 自定义so或者dylib库路径和名称,可用于动态加载library库 + /// 此方法需要在创建引擎前调用 + /// 注意,调用此方法需要自己判断当前机器的cpu架构,否则会导致加载失败 + /// 另外调用此方法需要保证路径和名称正确性,否则会导致加载失败 + static void initCustomLibrary({required String path, required String name}) { + if (path.isNotEmpty) { + FfiManager.libPath = path; + } + if (name.isNotEmpty) { + FfiManager.libraryName = name; + } + } + // 框架初始化 static VoltronJSLoaderManager createLoaderManager( EngineInitParams params, diff --git a/framework/voltron/pubspec.yaml b/framework/voltron/pubspec.yaml index 11f966cb37b..30a782bce7d 100644 --- a/framework/voltron/pubspec.yaml +++ b/framework/voltron/pubspec.yaml @@ -22,7 +22,7 @@ name: voltron description: A flutter plugin project to render hippy page. -version: 0.0.34 +version: 0.0.36 homepage: https://hippyjs.org repository: https://github.com/Tencent/Hippy @@ -60,9 +60,9 @@ dependencies: connectivity_plus: ^3.0.6 uuid: ^3.0.6 ffi: ^2.0.0 - voltron_renderer: 0.0.24 - voltron_vfs: 0.0.6 - voltron_ffi: 0.0.5 + voltron_renderer: 0.0.26 + voltron_vfs: 0.0.7 + voltron_ffi: 0.0.6 dev_dependencies: flutter_test: diff --git a/modules/vfs/voltron/CHANGELOG.md b/modules/vfs/voltron/CHANGELOG.md index a44510908f2..e625d662bd4 100644 --- a/modules/vfs/voltron/CHANGELOG.md +++ b/modules/vfs/voltron/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.7 + +- update ffi_manager to 0.0.6 + ## 0.0.6 - fix build error diff --git a/modules/vfs/voltron/pubspec.yaml b/modules/vfs/voltron/pubspec.yaml index 665eebe24f4..2a131787bcb 100644 --- a/modules/vfs/voltron/pubspec.yaml +++ b/modules/vfs/voltron/pubspec.yaml @@ -22,7 +22,7 @@ name: voltron_vfs description: voltron vfs module -version: 0.0.6 +version: 0.0.7 homepage: https://hippyjs.org repository: https://github.com/Tencent/Hippy @@ -34,4 +34,4 @@ dependencies: flutter: sdk: flutter ffi: ^2.0.0 - voltron_ffi: 0.0.5 + voltron_ffi: 0.0.6 diff --git a/modules/voltron/ffi/CHANGELOG.md b/modules/voltron/ffi/CHANGELOG.md index 50bdbc70f26..744c3805ae0 100644 --- a/modules/voltron/ffi/CHANGELOG.md +++ b/modules/voltron/ffi/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.6 + +- support dynamic library lib + ## 0.0.5 - update ffi to 2.0.0 diff --git a/modules/voltron/ffi/lib/ffi_manager.dart b/modules/voltron/ffi/lib/ffi_manager.dart index d73751bea8d..d8d244475dc 100644 --- a/modules/voltron/ffi/lib/ffi_manager.dart +++ b/modules/voltron/ffi/lib/ffi_manager.dart @@ -30,6 +30,8 @@ import 'global_callback.dart'; enum _DefaultRegisterFuncType { globalCallback } class FfiManager { + static String libPath = ''; + static String libraryName = 'voltron_core'; static const String _kDefaultRegisterHeader = 'default'; final _interactiveCppRequests = ReceivePort()..listen(requestExecuteCallback); @@ -49,7 +51,7 @@ class FfiManager { String get registerFuncName => 'AddCallFunc'; - final DynamicLibrary _library = loadLibrary('voltron_core', isStatic: false); + final DynamicLibrary _library = loadLibrary(libraryName, isStatic: false, path: libPath); FfiManager._internal() { _initFfi = _library.lookupFunction< diff --git a/modules/voltron/ffi/pubspec.yaml b/modules/voltron/ffi/pubspec.yaml index 19f943003a2..beae5cf78b2 100644 --- a/modules/voltron/ffi/pubspec.yaml +++ b/modules/voltron/ffi/pubspec.yaml @@ -22,7 +22,7 @@ name: voltron_ffi description: voltron ffi module -version: 0.0.5 +version: 0.0.6 homepage: https://hippyjs.org repository: https://github.com/Tencent/Hippy diff --git a/renderer/voltron/CHANGELOG.md b/renderer/voltron/CHANGELOG.md index 1730c7b4d13..4237fbfe655 100644 --- a/renderer/voltron/CHANGELOG.md +++ b/renderer/voltron/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.0.26 + +- update ffi_manager to 0.0.6 + ## 0.0.24 - fix width calculate error and add modal navigator param diff --git a/renderer/voltron/pubspec.yaml b/renderer/voltron/pubspec.yaml index e423c0a45f9..47fc83137c3 100644 --- a/renderer/voltron/pubspec.yaml +++ b/renderer/voltron/pubspec.yaml @@ -23,7 +23,7 @@ name: voltron_renderer description: voltron renderer -version: 0.0.24 +version: 0.0.26 homepage: https://hippyjs.org repository: https://github.com/Tencent/Hippy @@ -46,7 +46,7 @@ dependencies: waterfall_flow: ^3.0.2 charset: ^1.1.0 ffi: ^2.0.0 - voltron_ffi: 0.0.5 + voltron_ffi: 0.0.6 dev_dependencies: flutter_test: