From e8c9dbfa3f73e614c6dad7346ef5ff29ba7741ac Mon Sep 17 00:00:00 2001 From: hyiso Date: Mon, 29 Apr 2024 11:59:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Flutter=20=E4=BE=9D=E8=B5=96=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E4=BD=BF=E7=94=A8=20flutter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hyiso --- packages/flutter_tools/lib/src/flutter_plugins.dart | 2 +- .../lib/src/ohos/ohos_dependencies_manager.dart | 12 ++++++++++++ .../lib/src/ohos/ohos_plugins_manager.dart | 10 +++++----- .../src/main/ets/entryability/EntryAbility.ets.tmpl | 2 +- .../entry/src/main/ets/pages/Index.ets.tmpl | 2 +- .../app_shared/ohos.tmpl/oh-package.json5.tmpl | 4 ++-- .../host_app_common/entry.tmpl/oh-package.json5.tmpl | 2 +- .../src/main/ets/entryability/EntryAbility.ets.tmpl | 2 +- .../entry.tmpl/src/main/ets/pages/Index.ets.tmpl | 2 +- .../flutter_module.tmpl/oh-package.json5.tmpl | 2 +- .../ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl | 2 +- .../main/ets/components/plugin/pluginClass.ets.tmpl | 2 +- .../entry/src/main/ets/entryability/EntryAbility.ets | 2 +- .../example/ohos/entry/src/main/ets/pages/Index.ets | 2 +- .../main/ets/plugins/GeneratedPluginRegistrant.ets | 2 +- .../integration_test/example/ohos/oh-package.json5 | 4 ++-- packages/integration_test/ohos/ohos/oh-package.json5 | 2 +- .../integration_test/FlutterDeviceScreenshot.ets | 2 +- .../integration_test/IntegrationTestPlugin.ets | 2 +- 19 files changed, 36 insertions(+), 24 deletions(-) diff --git a/packages/flutter_tools/lib/src/flutter_plugins.dart b/packages/flutter_tools/lib/src/flutter_plugins.dart index 70e6cb7d3a..599ae80452 100644 --- a/packages/flutter_tools/lib/src/flutter_plugins.dart +++ b/packages/flutter_tools/lib/src/flutter_plugins.dart @@ -527,7 +527,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { '''; const String _arktsPluginRegistryTemplate = ''' -import { FlutterEngine, Log } from '@ohos/flutter_ohos'; +import { FlutterEngine, Log } from 'flutter'; {{#methodChannelPlugins}} import {{class}} from '{{name}}'; {{/methodChannelPlugins}} diff --git a/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart b/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart index 7f5ec7cb80..ed6a5bc619 100644 --- a/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart +++ b/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart @@ -54,6 +54,7 @@ Future checkOhosPluginsDependencies(FlutterProject flutterProject) async { .map((Plugin p) => p.platforms[OhosPlugin.kConfigKey]! as OhosPlugin) .toList(); + await checkFlutterDependency(flutterProject.ohos.flutterModulePackageFile); if (pluginList.isEmpty) { globals.printStatus( 'OhosDependenciesManager: it no need to add plugins dependencies.'); @@ -155,6 +156,17 @@ Future removeDependencies( .writeAsStringSync(configNew, flush: true); } +/// 检查对 Flutter 的依赖是否是 @ohos/flutter_ohos +Future checkFlutterDependency(File packageFile) async { + final dynamic config = parsePakcageConfig(packageFile); + final Map dependencies = config['dependencies'] as Map? ?? + {}; + if (dependencies.containsKey('@ohos/flutter_ohos')) { + globals.printWarning('OhosDependenciesManager: deprecated flutter dependency "@ohos/flutter_ohos" found in $packageFile, please use "flutter" instead.'); + return; + } +} + dynamic parsePakcageConfig(File ohPackageFile) { if (!ohPackageFile.existsSync()) { throwToolExit('check if oh-package.json5 file:($ohPackageFile) exist ?'); 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 36e5b96012..f0f3b83c33 100644 --- a/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart +++ b/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart @@ -15,12 +15,9 @@ import 'dart:io' as io; -import 'package:json5/json5.dart'; - import '../base/common.dart'; import '../base/file_system.dart'; import '../build_info.dart'; -import '../cache.dart'; import '../flutter_plugins.dart'; import '../globals.dart' as globals; import '../platform_plugins.dart'; @@ -140,11 +137,14 @@ void checkDependencies( /// 如果包含@ohos/flutter_ohos,每次构建,都需要重新拷贝har文件,确保flutter.har文件的正确性 if (dependencies.any( - (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos')) { + (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos' + || element.moduleName == 'flutter')) { final OhosDependence flutterOhosDepence = dependencies.firstWhere( - (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos'); + (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos' + || element.moduleName == 'flutter'); copyOhosEmbeddingHarToModule( modulePath, flutterOhosDepence, buildInfo, ohosBuildData); + checkFlutterDependency(packageConfigFile); } } diff --git a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl index 8bc48be877..4621102264 100644 --- a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl +++ b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl @@ -13,7 +13,7 @@ * limitations under the License. */ -import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; +import { FlutterAbility, FlutterEngine } from 'flutter'; import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; export default class EntryAbility extends FlutterAbility { diff --git a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl index 1125f9fdd9..bcff3c137a 100644 --- a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl +++ b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl @@ -14,7 +14,7 @@ */ import common from '@ohos.app.ability.common'; -import { FlutterPage } from '@ohos/flutter_ohos' +import { FlutterPage } from 'flutter'; let storage = LocalStorage.getShared() const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' diff --git a/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl index 63ea525b73..1862c1706b 100644 --- a/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl @@ -21,12 +21,12 @@ "author": "", "license": "", "dependencies": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "flutter": "file:./har/flutter.har" }, "devDependencies": { "@ohos/hypium": "1.0.6" }, "overrides": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "flutter": "file:./har/flutter.har" } } diff --git a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl index 6f7b62b27e..415bab49a2 100644 --- a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl @@ -22,7 +22,7 @@ "license": "", "dependencies": { "@ohos/flutter_module": "../flutter_module", - '@ohos/flutter_ohos': 'file:../flutter_module/har/flutter.har', + 'flutter': 'file:../flutter_module/har/flutter.har', } } diff --git a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl index cfcd3afd2a..aaedf7fc69 100644 --- a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl +++ b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl @@ -13,7 +13,7 @@ * limitations under the License. */ -import { FlutterAbility } from '@ohos/flutter_ohos' +import { FlutterAbility } from 'flutter' export default class EntryAbility extends FlutterAbility { } diff --git a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl index 1125f9fdd9..248d9b0b06 100644 --- a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl +++ b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl @@ -14,7 +14,7 @@ */ import common from '@ohos.app.ability.common'; -import { FlutterPage } from '@ohos/flutter_ohos' +import { FlutterPage } from 'flutter' let storage = LocalStorage.getShared() const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' diff --git a/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl index 66138aafa4..74a46c3af3 100644 --- a/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl @@ -21,7 +21,7 @@ "author": "", "license": "OpenValley", "dependencies": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "flutter": "file:./har/flutter.har" } } diff --git a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl index bc5113b4e1..e77f195a01 100644 --- a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl @@ -6,6 +6,6 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "flutter": "file:./har/flutter.har" } } diff --git a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl index cc521f51b2..318356e4ee 100644 --- a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl +++ b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl @@ -5,7 +5,7 @@ import { MethodCallHandler, MethodChannel, MethodResult, -} from '@ohos/flutter_ohos'; +} from 'flutter'; /** {{pluginClass}} **/ export default class {{pluginClass}} implements FlutterPlugin, MethodCallHandler { diff --git a/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets index 8bc48be877..4621102264 100644 --- a/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets +++ b/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; +import { FlutterAbility, FlutterEngine } from 'flutter'; import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; export default class EntryAbility extends FlutterAbility { diff --git a/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets b/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets index ac2b5dc723..bcff3c137a 100644 --- a/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets +++ b/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets @@ -14,7 +14,7 @@ */ import common from '@ohos.app.ability.common'; -import { FlutterPage } from '@ohos/flutter_ohos'; +import { FlutterPage } from 'flutter'; let storage = LocalStorage.getShared() const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' diff --git a/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets index d68087d1fc..b86eb12290 100644 --- a/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +++ b/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { FlutterEngine, Log } from '@ohos/flutter_ohos'; +import { FlutterEngine, Log } from 'flutter'; import IntegrationTestPlugin from '@ohos/integration_test' /** diff --git a/packages/integration_test/example/ohos/oh-package.json5 b/packages/integration_test/example/ohos/oh-package.json5 index ca7efebc34..eb3b74a508 100644 --- a/packages/integration_test/example/ohos/oh-package.json5 +++ b/packages/integration_test/example/ohos/oh-package.json5 @@ -21,12 +21,12 @@ "author": "", "license": "", "dependencies": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "flutter": "file:./har/flutter.har" }, "devDependencies": { "@ohos/hypium": "1.0.6" }, "overrides": { - "@ohos/flutter_ohos": "file:./har/flutter.har" + "flutter": "file:./har/flutter.har" } } diff --git a/packages/integration_test/ohos/ohos/oh-package.json5 b/packages/integration_test/ohos/ohos/oh-package.json5 index f944e92f25..a052ad583e 100644 --- a/packages/integration_test/ohos/ohos/oh-package.json5 +++ b/packages/integration_test/ohos/ohos/oh-package.json5 @@ -6,6 +6,6 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "@ohos/flutter_ohos": "file:har/flutter.har", + "flutter": "file:har/flutter.har", } } diff --git a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets index ea9629b059..55387a3676 100644 --- a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets +++ b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets @@ -15,7 +15,7 @@ import { MethodChannel, MethodResult, -} from '@ohos/flutter_ohos'; +} from 'flutter'; import UIAbility from '@ohos.app.ability.UIAbility'; /** diff --git a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets index 1b9bf02b13..64db195e87 100644 --- a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets +++ b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets @@ -24,7 +24,7 @@ import { MethodCallHandler, MethodChannel, MethodResult, -} from '@ohos/flutter_ohos'; +} from 'flutter'; import UIAbility from '@ohos.app.ability.UIAbility'; const TAG = "IntegrationTestPlugin" -- Gitee From 46dfc3d2f3ecfe5dc292788a298997595c8246d5 Mon Sep 17 00:00:00 2001 From: hyiso Date: Fri, 10 May 2024 11:49:44 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9B=9E=E9=80=80=20'Pull=20Request=20!1?= =?UTF-8?q?=20:=20Flutter=20=E4=BE=9D=E8=B5=96=E5=90=8D=E7=A7=B0=E4=B8=8E?= =?UTF-8?q?=E5=85=B6=20package=20name=20=E4=BF=9D=E6=8C=81=E4=B8=80?= =?UTF-8?q?=E8=87=B4'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/flutter_tools/lib/src/flutter_plugins.dart | 2 +- .../lib/src/ohos/ohos_dependencies_manager.dart | 12 ------------ .../lib/src/ohos/ohos_plugins_manager.dart | 10 +++++----- .../src/main/ets/entryability/EntryAbility.ets.tmpl | 2 +- .../entry/src/main/ets/pages/Index.ets.tmpl | 2 +- .../app_shared/ohos.tmpl/oh-package.json5.tmpl | 4 ++-- .../host_app_common/entry.tmpl/oh-package.json5.tmpl | 2 +- .../src/main/ets/entryability/EntryAbility.ets.tmpl | 2 +- .../entry.tmpl/src/main/ets/pages/Index.ets.tmpl | 2 +- .../flutter_module.tmpl/oh-package.json5.tmpl | 2 +- .../ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl | 2 +- .../main/ets/components/plugin/pluginClass.ets.tmpl | 2 +- .../entry/src/main/ets/entryability/EntryAbility.ets | 2 +- .../example/ohos/entry/src/main/ets/pages/Index.ets | 2 +- .../main/ets/plugins/GeneratedPluginRegistrant.ets | 2 +- .../integration_test/example/ohos/oh-package.json5 | 4 ++-- packages/integration_test/ohos/ohos/oh-package.json5 | 2 +- .../integration_test/FlutterDeviceScreenshot.ets | 2 +- .../integration_test/IntegrationTestPlugin.ets | 2 +- 19 files changed, 24 insertions(+), 36 deletions(-) diff --git a/packages/flutter_tools/lib/src/flutter_plugins.dart b/packages/flutter_tools/lib/src/flutter_plugins.dart index 599ae80452..70e6cb7d3a 100644 --- a/packages/flutter_tools/lib/src/flutter_plugins.dart +++ b/packages/flutter_tools/lib/src/flutter_plugins.dart @@ -527,7 +527,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { '''; const String _arktsPluginRegistryTemplate = ''' -import { FlutterEngine, Log } from 'flutter'; +import { FlutterEngine, Log } from '@ohos/flutter_ohos'; {{#methodChannelPlugins}} import {{class}} from '{{name}}'; {{/methodChannelPlugins}} diff --git a/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart b/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart index ed6a5bc619..7f5ec7cb80 100644 --- a/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart +++ b/packages/flutter_tools/lib/src/ohos/ohos_dependencies_manager.dart @@ -54,7 +54,6 @@ Future checkOhosPluginsDependencies(FlutterProject flutterProject) async { .map((Plugin p) => p.platforms[OhosPlugin.kConfigKey]! as OhosPlugin) .toList(); - await checkFlutterDependency(flutterProject.ohos.flutterModulePackageFile); if (pluginList.isEmpty) { globals.printStatus( 'OhosDependenciesManager: it no need to add plugins dependencies.'); @@ -156,17 +155,6 @@ Future removeDependencies( .writeAsStringSync(configNew, flush: true); } -/// 检查对 Flutter 的依赖是否是 @ohos/flutter_ohos -Future checkFlutterDependency(File packageFile) async { - final dynamic config = parsePakcageConfig(packageFile); - final Map dependencies = config['dependencies'] as Map? ?? - {}; - if (dependencies.containsKey('@ohos/flutter_ohos')) { - globals.printWarning('OhosDependenciesManager: deprecated flutter dependency "@ohos/flutter_ohos" found in $packageFile, please use "flutter" instead.'); - return; - } -} - dynamic parsePakcageConfig(File ohPackageFile) { if (!ohPackageFile.existsSync()) { throwToolExit('check if oh-package.json5 file:($ohPackageFile) exist ?'); 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 f0f3b83c33..36e5b96012 100644 --- a/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart +++ b/packages/flutter_tools/lib/src/ohos/ohos_plugins_manager.dart @@ -15,9 +15,12 @@ import 'dart:io' as io; +import 'package:json5/json5.dart'; + import '../base/common.dart'; import '../base/file_system.dart'; import '../build_info.dart'; +import '../cache.dart'; import '../flutter_plugins.dart'; import '../globals.dart' as globals; import '../platform_plugins.dart'; @@ -137,14 +140,11 @@ void checkDependencies( /// 如果包含@ohos/flutter_ohos,每次构建,都需要重新拷贝har文件,确保flutter.har文件的正确性 if (dependencies.any( - (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos' - || element.moduleName == 'flutter')) { + (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos')) { final OhosDependence flutterOhosDepence = dependencies.firstWhere( - (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos' - || element.moduleName == 'flutter'); + (OhosDependence element) => element.moduleName == '@ohos/flutter_ohos'); copyOhosEmbeddingHarToModule( modulePath, flutterOhosDepence, buildInfo, ohosBuildData); - checkFlutterDependency(packageConfigFile); } } diff --git a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl index 4621102264..8bc48be877 100644 --- a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl +++ b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/entryability/EntryAbility.ets.tmpl @@ -13,7 +13,7 @@ * limitations under the License. */ -import { FlutterAbility, FlutterEngine } from 'flutter'; +import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; export default class EntryAbility extends FlutterAbility { diff --git a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl index bcff3c137a..1125f9fdd9 100644 --- a/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl +++ b/packages/flutter_tools/templates/app_shared/ohos.tmpl/entry/src/main/ets/pages/Index.ets.tmpl @@ -14,7 +14,7 @@ */ import common from '@ohos.app.ability.common'; -import { FlutterPage } from 'flutter'; +import { FlutterPage } from '@ohos/flutter_ohos' let storage = LocalStorage.getShared() const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' diff --git a/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl index 1862c1706b..63ea525b73 100644 --- a/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/app_shared/ohos.tmpl/oh-package.json5.tmpl @@ -21,12 +21,12 @@ "author": "", "license": "", "dependencies": { - "flutter": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har" }, "devDependencies": { "@ohos/hypium": "1.0.6" }, "overrides": { - "flutter": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har" } } diff --git a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl index 415bab49a2..6f7b62b27e 100644 --- a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/oh-package.json5.tmpl @@ -22,7 +22,7 @@ "license": "", "dependencies": { "@ohos/flutter_module": "../flutter_module", - 'flutter': 'file:../flutter_module/har/flutter.har', + '@ohos/flutter_ohos': 'file:../flutter_module/har/flutter.har', } } diff --git a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl index aaedf7fc69..cfcd3afd2a 100644 --- a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl +++ b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/entryability/EntryAbility.ets.tmpl @@ -13,7 +13,7 @@ * limitations under the License. */ -import { FlutterAbility } from 'flutter' +import { FlutterAbility } from '@ohos/flutter_ohos' export default class EntryAbility extends FlutterAbility { } diff --git a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl index 248d9b0b06..1125f9fdd9 100644 --- a/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl +++ b/packages/flutter_tools/templates/module/ohos/host_app_common/entry.tmpl/src/main/ets/pages/Index.ets.tmpl @@ -14,7 +14,7 @@ */ import common from '@ohos.app.ability.common'; -import { FlutterPage } from 'flutter' +import { FlutterPage } from '@ohos/flutter_ohos' let storage = LocalStorage.getShared() const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' diff --git a/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl index 74a46c3af3..66138aafa4 100644 --- a/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/module/ohos/module_library/flutter_module.tmpl/oh-package.json5.tmpl @@ -21,7 +21,7 @@ "author": "", "license": "OpenValley", "dependencies": { - "flutter": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har" } } diff --git a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl index e77f195a01..bc5113b4e1 100644 --- a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl +++ b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/oh-package.json5.tmpl @@ -6,6 +6,6 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "flutter": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har" } } diff --git a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl index 318356e4ee..cc521f51b2 100644 --- a/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl +++ b/packages/flutter_tools/templates/plugin/ohos.tmpl/projectName.tmpl/src/main/ets/components/plugin/pluginClass.ets.tmpl @@ -5,7 +5,7 @@ import { MethodCallHandler, MethodChannel, MethodResult, -} from 'flutter'; +} from '@ohos/flutter_ohos'; /** {{pluginClass}} **/ export default class {{pluginClass}} implements FlutterPlugin, MethodCallHandler { diff --git a/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets index 4621102264..8bc48be877 100644 --- a/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets +++ b/packages/integration_test/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { FlutterAbility, FlutterEngine } from 'flutter'; +import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos'; import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant'; export default class EntryAbility extends FlutterAbility { diff --git a/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets b/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets index bcff3c137a..ac2b5dc723 100644 --- a/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets +++ b/packages/integration_test/example/ohos/entry/src/main/ets/pages/Index.ets @@ -14,7 +14,7 @@ */ import common from '@ohos.app.ability.common'; -import { FlutterPage } from 'flutter'; +import { FlutterPage } from '@ohos/flutter_ohos'; let storage = LocalStorage.getShared() const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS' diff --git a/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets index b86eb12290..d68087d1fc 100644 --- a/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +++ b/packages/integration_test/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { FlutterEngine, Log } from 'flutter'; +import { FlutterEngine, Log } from '@ohos/flutter_ohos'; import IntegrationTestPlugin from '@ohos/integration_test' /** diff --git a/packages/integration_test/example/ohos/oh-package.json5 b/packages/integration_test/example/ohos/oh-package.json5 index eb3b74a508..ca7efebc34 100644 --- a/packages/integration_test/example/ohos/oh-package.json5 +++ b/packages/integration_test/example/ohos/oh-package.json5 @@ -21,12 +21,12 @@ "author": "", "license": "", "dependencies": { - "flutter": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har" }, "devDependencies": { "@ohos/hypium": "1.0.6" }, "overrides": { - "flutter": "file:./har/flutter.har" + "@ohos/flutter_ohos": "file:./har/flutter.har" } } diff --git a/packages/integration_test/ohos/ohos/oh-package.json5 b/packages/integration_test/ohos/ohos/oh-package.json5 index a052ad583e..f944e92f25 100644 --- a/packages/integration_test/ohos/ohos/oh-package.json5 +++ b/packages/integration_test/ohos/ohos/oh-package.json5 @@ -6,6 +6,6 @@ "author": "", "license": "Apache-2.0", "dependencies": { - "flutter": "file:har/flutter.har", + "@ohos/flutter_ohos": "file:har/flutter.har", } } diff --git a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets index 55387a3676..ea9629b059 100644 --- a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets +++ b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets @@ -15,7 +15,7 @@ import { MethodChannel, MethodResult, -} from 'flutter'; +} from '@ohos/flutter_ohos'; import UIAbility from '@ohos.app.ability.UIAbility'; /** diff --git a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets index 64db195e87..1b9bf02b13 100644 --- a/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets +++ b/packages/integration_test/ohos/ohos/src/main/ets/components/integration_test/IntegrationTestPlugin.ets @@ -24,7 +24,7 @@ import { MethodCallHandler, MethodChannel, MethodResult, -} from 'flutter'; +} from '@ohos/flutter_ohos'; import UIAbility from '@ohos.app.ability.UIAbility'; const TAG = "IntegrationTestPlugin" -- Gitee