From 8e27e8cad6a6d92699867e10373c727159e02b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rulong=20Chen=EF=BC=88=E9=99=88=E6=B1=9D=E9=BE=99=EF=BC=89?= Date: Fri, 6 Sep 2024 20:10:50 +0800 Subject: [PATCH] =?UTF-8?q?Revert:=20"=E4=BF=AE=E6=94=B9ohos=E5=B7=A5?= =?UTF-8?q?=E7=A8=8B=E7=BA=A7=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E6=97=B6?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84"=20Reaso?= =?UTF-8?q?n:=20=E8=B7=AF=E5=BE=84=E4=B8=AD=E5=8C=85=E5=90=AB=E7=AC=A6?= =?UTF-8?q?=E5=8F=B7=E8=BF=9E=E6=8E=A5=E7=9A=84=E5=9C=BA=E6=99=AF=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E8=AE=A1=E7=AE=97=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E4=BC=9A=E5=87=BA=E9=94=99=E3=80=82=E8=BF=99=E9=87=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9B=B8=E5=AF=B9=E8=B7=AF=E5=BE=84=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E7=9C=8B=E5=88=B0=E6=98=8E=E6=98=BE=E6=94=B6=E7=9B=8A=EF=BC=8C?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E5=9B=9E=E6=BB=9A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 详情:https://gitee.com/openharmony-sig/flutter_flutter/issues/IAPISU This reverts commit f1692a55aeff9758713c805b7174209be82a38d0. Signed-off-by: Rulong Chen(陈汝龙) --- .../lib/src/ohos/ohos_plugins_manager.dart | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart b/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart index 0a89fe2dd6..e4e8e2ddf5 100644 --- a/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart +++ b/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart @@ -51,7 +51,7 @@ Future checkOhosPluginsDependencies(FlutterProject flutterProject) async { if (flutterProject.isModule) { dependencies[plugin.name] = 'file:$absolutePath'; } else { - final String relativePath = _relative(absolutePath, from: globals.fs.path.dirname(packageFile.path)); + final String relativePath = globals.fs.path.relative(absolutePath, from: globals.fs.path.dirname(packageFile.path)); dependencies[plugin.name] = 'file:$relativePath'; } } @@ -86,14 +86,13 @@ Future addPluginsModules(FlutterProject flutterProject) async { } modules.add({ 'name': plugin.name, - 'srcPath': _relative( - globals.fs.path.join(plugin.path, OhosPlugin.kConfigKey), - from: flutterProject.ohos.ohosRoot.path, - ), + 'srcPath': globals.fs.path.join(plugin.path, OhosPlugin.kConfigKey), 'targets': >[ { 'name': 'default', - 'applyToProducts': ['default'] + 'applyToProducts': [ + 'default' + ] } ], }); @@ -120,12 +119,9 @@ Future addFlutterModuleAndPluginsSrcOverrides(FlutterProject flutterProjec final Map overrides = config['overrides'] as Map? ?? {}; for (final Plugin plugin in plugins) { - overrides[plugin.name] = _relative( - globals.fs.path.join(plugin.path, OhosPlugin.kConfigKey), - from: flutterProject.ohos.ohosRoot.path, - ); + overrides[plugin.name] = globals.fs.path.join(plugin.path, OhosPlugin.kConfigKey); } - final String relativePath = _relative(flutterProject.ohos.flutterModuleDirectory.path, from: flutterProject.ohos.ohosRoot.path); + final String relativePath = globals.fs.path.relative(flutterProject.ohos.flutterModuleDirectory.path, from: flutterProject.ohos.ohosRoot.path); overrides['@ohos/flutter_module'] = 'file:./$relativePath'; overrides['@ohos/flutter_ohos'] = 'file:./har/flutter.har'; final String configNew = const JsonEncoder.withIndent(' ').convert(config); @@ -193,7 +189,3 @@ Future addFlutterModuleAndPluginsOverrides(FlutterProject flutterProject) final String configNew = const JsonEncoder.withIndent(' ').convert(config); packageFile.writeAsStringSync(configNew, flush: true); } - -String _relative(String path, {String? from}) { - return globals.fs.path.relative(path, from: from).replaceAll(r'\', '/'); -} -- Gitee