From 28ac1300426dc0ea5079d968d5db0bdb78b692ef Mon Sep 17 00:00:00 2001 From: xuchang Date: Tue, 12 Sep 2023 14:46:55 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:=20#I80P0T=20Description:=20README?= =?UTF-8?q?=E4=B8=AD=E8=A1=A5=E5=85=85=E6=9E=84=E5=BB=BA=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=8B=B1=E6=96=87README=20Sig:=20Op?= =?UTF-8?q?enHarmony-SIG/flutter-flutter=20Feature=20or=20Bugfix:=20Featur?= =?UTF-8?q?e=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuchang --- README.en.md | 82 +++++++++++++++++++++ README.md | 204 +++++++++++++++++++++------------------------------ 2 files changed, 164 insertions(+), 122 deletions(-) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000..10c321e6db --- /dev/null +++ b/README.en.md @@ -0,0 +1,82 @@ +Flutter SDK repository +============== + +Original warehouse source: https://github.com/flutter/flutter + +## Warehouse description: +This warehouse is based on the compatible extension of flutter sdk for OpenHarmony, and can support the use of flutter tools instructions to compile and build OpenHarmony applications. + +## Build instructions: + +* Build environment: +Currently, the flutter tools command only supports use under Linux. + +* Build dependencies: +To build products relying on [flutter engine](https://github.com/flutter/engine), please add: --local-engine=\ in the running parameters of the flutter tools command. + +*Building steps: +1. Configure the OpenHarmony sdk path to the environment variable OHOS_SDK_HOME, +Please download first: [Command Line Tools for OpenHarmony](https://developer.harmonyos.com/cn/develop/deveco-studio#download_cli), and then refer to [ohsdkmgr usage guide](https://developer.harmonyos.com /cn/docs/documentation/doc-guides-V3/ide-command-line-ohsdkmgr-0000001545647965-V3) Download OpenHarmony sdk. +(PS: API 10 needs to download ohos-full-sdk from [Daily Build](http://ci.openharmony.cn/workbench/cicd/dailybuild/detail/component)) + +2. Configure the OHPM path to the environment variable OHPM_HOME, download address: [Command Line Tools for OpenHarmony](https://developer.harmonyos.com/cn/develop/deveco-studio#download_cli), guidance document: [ohpm usage guide] (https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ide-command-line-ohpm-0000001490235312-V3) + +3. Configure the signature tool, the key is SIGN_TOOL_HOME, download address: https://gitee.com/openharmony/developtools_hapsigner + +Signature tool configuration process: + * Compile according to readme.md to get hap-sign-tool.jar, make sure it is in the directory: ./hapsigntool/hap_sign_tool/build/libs/hap-sign-tool.jar + * Enter the autosign folder, add the profile_tmp.json file, and edit it as follows: + ```json + { + "version-name": "2.0.0", + "version-code": 2, + "app-distribution-type": "os_integration", + "uuid": "5027b99e-5f9e-465d-9508-a9e0134ffe18", + "validity": { + "not-before": 1594865258, + "not-after": 1689473258 + }, + "type": "release", + "bundle-info": { + "developer-id": "OpenHarmony", + "distribution-certificate": "-----BEGIN CERTIFICATE-----\nMIICSTCCAc+gAwIBAgIFAJV7uNUwCgYIKoZIzj0EAwIwYzELMAkGA1UEBhMCQ04x\nFDASBgNVBAoMC09wZW5IYXJtb255MRkwFwYDVQQLDBBPcGVuSGFybW9 ueSBUZWFt\nMSMwIQYDVQQDDBpPcGVuSGFybW9ueSBBcHBsaWNhdGlvbiBDQTAeFw0yMjAxMjkw\nNTU0MTRaFw0yMzAxMjkwNTU0MTRaMGgxCzAJBgNVBAYTAkNOMRQwEgYDVQQKDAtP\ncGVuSGFyb W9ueTEZMBcGA1UECwwQT3Blbkhhcm1vbnkgVGVhbTEoMCYGA1UEAwwf\nT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUmVsZWFzZTBZMBMGByqGSM49AgEGCCqG\nSM49AwEHA0IABAW8pFu7tHGUuWtddD5wvaz c1qN8ts9UPZH4pecbb/bSFWKh7X7R\n/eTVaRrCTSSdovI1dhoV5GjuFsKW+jT2TwSjazBpMB0GA1UdDgQWBBScyywAaAMj\nI7HcuIS42lvZx0Lj+zAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDA TBgNVHSUE\ nDDAKBggrBgEFBQcDAzAYBgwrBgEEAY9bAoJ4AQMECDAGAgEBCgEAMAoGCCqGSM49\nBAMCA2gAMGUCMFfNidGo6uK6KGT9zT1T5bY1NCHTH3P3muy5X1xudOgxWoOqIbnk\ntmQYB78dxWEHLQIxANfApAlXAD /0hnyNC8RDzfLOPEeay6jU9FXJj3AoR90rwZpR\noN9sYD6Oks4VGRw6yQ==\n-----END CERTIFICATE-----\n", + "bundle-name": "{{ohosId}}", + "apl": "normal", + "app-feature": "hos_normal_app" + }, + "acls": { + "allowed-acls": [ + "" + ] + }, + "permissions": { + "restricted-permissions": [] + }, + "issuer": "pki_internal" +} + ``` + The ohosId is replaced with the application id to be debugged (the next pr will be modified to automatically replace); +Edit autosign.config and createAppCertAndProfile.config, edit the value: sign.profile.inFile=profile_tmp.json + + * Configure the environment variable SIGN_TOOL_HOME, the value is \/autosign + +4. Configure \/bin, go to the environment variable PATH, and ensure that which flutter can find the \/bin/flutter location; + +5. Run flutter docker and check whether the environment variables are configured correctly; + +6. Open vscode and install the flutter plug-in. If the flutter sdk is configured correctly, you can find the OpenHarmony connection device and run and debug the application on vscode. + + + +## Compatible command list developed by OpenHarmony: +| Command name | Command description | Instructions for use | +| ------- | ------- | ------- | +| doctor | environment detection | flutter doctor | +| config | environment configuration | flutter config --\ \ | +| create | Create a new project | flutter create --platforms ohos,android --org \ \ | +| devices | Connected device discovery | flutter devices | +| install | application installation | flutter install | +| assemble | resource packaging | flutter assemble | +| build | application build | flutter build hap --target-platform ohos-arm --debug true | +| run | application run | flutter run | +| attach | debug mode | flutter attach | \ No newline at end of file diff --git a/README.md b/README.md index dc6f928054..0e7b53a6e3 100644 --- a/README.md +++ b/README.md @@ -1,122 +1,82 @@ - -

- - - Flutter - -

-
- -[![Build Status - Cirrus][]][Build status] -[![Discord badge][]][Discord instructions] -[![Twitter handle][]][Twitter badge] -[![codecov](https://codecov.io/gh/flutter/flutter/branch/master/graph/badge.svg?token=11yDrJU2M2)](https://codecov.io/gh/flutter/flutter) -[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5631/badge)](https://bestpractices.coreinfrastructure.org/projects/5631) -[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/flutter/flutter/badge)](https://api.securityscorecards.dev/projects/github.com/flutter/flutter) - -Flutter is Google's SDK for crafting beautiful, fast user experiences for -mobile, web, and desktop from a single codebase. Flutter works with existing -code, is used by developers and organizations around the world, and is free and -open source. - -## Documentation - -* [Install Flutter](https://flutter.dev/get-started/) -* [Flutter documentation](https://docs.flutter.dev/) -* [Development wiki](https://github.com/flutter/flutter/wiki) -* [Contributing to Flutter](https://github.com/flutter/flutter/blob/master/CONTRIBUTING.md) - -For announcements about new releases, follow the -[flutter-announce@googlegroups.com](https://groups.google.com/forum/#!forum/flutter-announce) -mailing list. Our documentation also tracks [breaking -changes](https://docs.flutter.dev/release/breaking-changes) across releases. - -## Terms of service - -The Flutter tool may occasionally download resources from Google servers. By -downloading or using the Flutter SDK, you agree to the Google Terms of Service: -https://policies.google.com/terms - -For example, when installed from GitHub (as opposed to from a prepackaged -archive), the Flutter tool will download the Dart SDK from Google servers -immediately when first run, as it is used to execute the `flutter` tool itself. -This will also occur when Flutter is upgraded (e.g. by running the `flutter -upgrade` command). - -## About Flutter - -We think Flutter will help you create beautiful, fast apps, with a productive, -extensible and open development model, whether you're targeting iOS or Android, -web, Windows, macOS, Linux or embedding it as the UI toolkit for a platform of -your choice. - -### Beautiful user experiences - -We want to enable designers to deliver their full creative vision without being -forced to water it down due to limitations of the underlying framework. -Flutter's [layered architecture] gives you control over every pixel on the -screen and its powerful compositing capabilities let you overlay and animate -graphics, video, text, and controls without limitation. Flutter includes a full -[set of widgets][widget catalog] that deliver pixel-perfect experiences whether -you're building for iOS ([Cupertino]) or other platforms ([Material]), along with -support for customizing or creating entirely new visual components. - -

Reflectly hero image

- -### Fast results - -Flutter is fast. It's powered by the same hardware-accelerated 2D graphics -library that underpins Chrome and Android: [Skia]. We architected Flutter to -support glitch-free, jank-free graphics at the native speed of your device. -Flutter code is powered by the world-class [Dart platform], which enables -compilation to 32-bit and 64-bit ARM machine code for iOS and Android, as well -as JavaScript for the web and Intel x64 for desktop devices. - -

Dart diagram

- -### Productive development - -Flutter offers [stateful hot reload][Hot reload], allowing you to make changes to your code -and see the results instantly without restarting your app or losing its state. - -[![Hot reload animation][]][Hot reload] - -### Extensible and open model - -Flutter works with any development tool (or none at all), and also includes -editor plug-ins for both [Visual Studio Code] and [IntelliJ / Android Studio]. -Flutter provides [tens of thousands of packages][Flutter packages] to speed your -development, regardless of your target platform. And accessing other native code -is easy, with support for both FFI ([on Android][Android FFI], [on iOS][iOS FFI], -[on macOS][macOS FFI], and [on Windows][Windows FFI]) as well as -[platform-specific APIs][platform channels]. - -Flutter is a fully open-source project, and we welcome contributions. -Information on how to get started can be found in our -[contributor guide](CONTRIBUTING.md). - -[flutter.dev]: https://flutter.dev -[Build Status - Cirrus]: https://api.cirrus-ci.com/github/flutter/flutter.svg -[Build status]: https://cirrus-ci.com/github/flutter/flutter/master -[Discord instructions]: https://github.com/flutter/flutter/wiki/Chat -[Discord badge]: https://img.shields.io/discord/608014603317936148 -[Twitter handle]: https://img.shields.io/twitter/follow/flutterdev.svg?style=social&label=Follow -[Twitter badge]: https://twitter.com/intent/follow?screen_name=flutterdev -[layered architecture]: https://docs.flutter.dev/resources/inside-flutter -[architectural overview]: https://docs.flutter.dev/resources/architectural-overview -[widget catalog]: https://flutter.dev/widgets/ -[Cupertino]: https://docs.flutter.dev/development/ui/widgets/cupertino -[Material]: https://docs.flutter.dev/development/ui/widgets/material -[Skia]: https://skia.org/ -[Dart platform]: https://dart.dev/ -[Hot reload animation]: https://github.com/flutter/website/blob/main/src/assets/images/docs/tools/android-studio/hot-reload.gif?raw=true -[Hot reload]: https://docs.flutter.dev/development/tools/hot-reload -[Visual Studio Code]: https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter -[IntelliJ / Android Studio]: https://plugins.jetbrains.com/plugin/9212-flutter -[Flutter packages]: https://pub.dev/flutter -[Android FFI]: https://docs.flutter.dev/development/platform-integration/android/c-interop -[iOS FFI]: https://docs.flutter.dev/development/platform-integration/ios/c-interop -[macOS FFI]: https://docs.flutter.dev/development/platform-integration/macos/c-interop -[Windows FFI]: https://docs.flutter.dev/development/platform-integration/windows/building#integrating-with-windows -[platform channels]: https://docs.flutter.dev/development/platform-integration/platform-channels -[interop example]: https://github.com/flutter/flutter/tree/master/examples/platform_channel +Flutter SDK 仓库 +============== + +原始仓来源:https://github.com/flutter/flutter + +## 仓库说明: +本仓库是基于flutter sdk对于OpenHarmony的兼容拓展,可支持使用flutter tools指令编译和构建OpenHarmony应用程序。 + +## 构建说明: + +* 构建环境: +目前flutter tools指令仅支持linux下使用 + +* 构建依赖: +依赖[flutter engine](https://github.com/flutter/engine)构建产物,请在flutter tools指令运行参数中添加:--local-engine=\ + +* 构建步骤: +1. 配置OpenHarmony sdk路径到环境变量OHOS_SDK_HOME, +请先下载:[Command Line Tools for OpenHarmony](https://developer.harmonyos.com/cn/develop/deveco-studio#download_cli),然后参考[ohsdkmgr使用指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ide-command-line-ohsdkmgr-0000001545647965-V3) 下载OpenHarmony sdk。 +(PS:api 10需要从[每日构建](http://ci.openharmony.cn/workbench/cicd/dailybuild/detail/component)下载ohos-full-sdk) + +2. 配置OHPM路径到环境变量OHPM_HOME,下载地址:[Command Line Tools for OpenHarmony](https://developer.harmonyos.com/cn/develop/deveco-studio#download_cli),指导文档:[ohpm使用指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ide-command-line-ohpm-0000001490235312-V3) + +3. 配置签名工具,key为SIGN_TOOL_HOME,下载地址:https://gitee.com/openharmony/developtools_hapsigner + +签名工具配置流程: + * 按照readme.md,编译得到 hap-sign-tool.jar ,确保其在目录下:./hapsigntool/hap_sign_tool/build/libs/hap-sign-tool.jar + * 进入autosign文件夹,新增profile_tmp.json文件,编辑如下: + ```json + { + "version-name": "2.0.0", + "version-code": 2, + "app-distribution-type": "os_integration", + "uuid": "5027b99e-5f9e-465d-9508-a9e0134ffe18", + "validity": { + "not-before": 1594865258, + "not-after": 1689473258 + }, + "type": "release", + "bundle-info": { + "developer-id": "OpenHarmony", + "distribution-certificate": "-----BEGIN CERTIFICATE-----\nMIICSTCCAc+gAwIBAgIFAJV7uNUwCgYIKoZIzj0EAwIwYzELMAkGA1UEBhMCQ04x\nFDASBgNVBAoMC09wZW5IYXJtb255MRkwFwYDVQQLDBBPcGVuSGFybW9ueSBUZWFt\nMSMwIQYDVQQDDBpPcGVuSGFybW9ueSBBcHBsaWNhdGlvbiBDQTAeFw0yMjAxMjkw\nNTU0MTRaFw0yMzAxMjkwNTU0MTRaMGgxCzAJBgNVBAYTAkNOMRQwEgYDVQQKDAtP\ncGVuSGFybW9ueTEZMBcGA1UECwwQT3Blbkhhcm1vbnkgVGVhbTEoMCYGA1UEAwwf\nT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUmVsZWFzZTBZMBMGByqGSM49AgEGCCqG\nSM49AwEHA0IABAW8pFu7tHGUuWtddD5wvazc1qN8ts9UPZH4pecbb/bSFWKh7X7R\n/eTVaRrCTSSdovI1dhoV5GjuFsKW+jT2TwSjazBpMB0GA1UdDgQWBBScyywAaAMj\nI7HcuIS42lvZx0Lj+zAJBgNVHRMEAjAAMA4GA1UdDwEB/wQEAwIHgDATBgNVHSUE\nDDAKBggrBgEFBQcDAzAYBgwrBgEEAY9bAoJ4AQMECDAGAgEBCgEAMAoGCCqGSM49\nBAMCA2gAMGUCMFfNidGo6uK6KGT9zT1T5bY1NCHTH3P3muy5X1xudOgxWoOqIbnk\ntmQYB78dxWEHLQIxANfApAlXAD/0hnyNC8RDzfLOPEeay6jU9FXJj3AoR90rwZpR\noN9sYD6Oks4VGRw6yQ==\n-----END CERTIFICATE-----\n", + "bundle-name": "{{ohosId}}", + "apl": "normal", + "app-feature": "hos_normal_app" + }, + "acls": { + "allowed-acls": [ + "" + ] + }, + "permissions": { + "restricted-permissions": [] + }, + "issuer": "pki_internal" +} + ``` + 其中ohosId替换为待调试应用id(下一个pr将会修改为自动替换); +编辑autosign.config和createAppCertAndProfile.config,编辑值:sign.profile.inFile=profile_tmp.json + + * 配置环境变量SIGN_TOOL_HOME,值为\/autosign + +4. 配置\<当前项目目录\>/bin,到环境变量PATH,确保which flutter能找到\/bin/flutter位置; + +5. 运行flutter docker,检查环境变量配置是否都正确; + +6. 打开vscode,安装好flutter插件,如果flutter sdk配置正确,可发现OpenHarmony连接设备,可在vscode上运行和调试应用。 + + + +## 已兼容OpenHarmony开发的指令列表: +| 指令名称 | 指令描述 | 使用说明 | +| ------- | ------- | ------- | +| doctor | 环境检测 | flutter doctor | +| config | 环境配置 | flutter config --\ \ | +| create | 创建新项目 | flutter create --platforms ohos,android --org \ \ | +| devices | 已连接设备查找 | flutter devices | +| install | 应用安装 | flutter install | +| assemble | 资源打包 | flutter assemble | +| build | 应用构建 | flutter build hap --target-platform ohos-arm --debug true | +| run | 应用运行 | flutter run | +| attach | 调试模式 | flutter attach | -- Gitee