From 826f065e1240f75135358b91433e6732e15329f5 Mon Sep 17 00:00:00 2001 From: aodongbiao Date: Mon, 8 Aug 2022 18:46:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8README.md=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86syscap=E7=9A=84=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86requirements.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: aodongbiao --- README.md | 40 ++++++++++++++++++- README_ZH.md | 40 +++++++++++++++++++ tools/requirements.txt | 1 + ...sistency_check_tool.py => syscap_check.py} | 0 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 tools/requirements.txt rename tools/{syscap_consistency_check_tool.py => syscap_check.py} (100%) diff --git a/README.md b/README.md index 440ec7b..8bed5bd 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,10 @@ Main function: │ │ ├── main.c # command line implement │ │ └── syscap_tool.c # codec implement │ └── test -│ └── syscap_tool_test.c # syscap_tool test codec implement +│ | └── syscap_tool_test.c # syscap_tool test codec implement +| |—— tools +| │ │ +| │ └── syscap_check.py # syscap一致性检查脚本 ``` ### API @@ -79,6 +82,41 @@ SysCap tools usually integrate to IDE, APP store and bundle tools. Follow instru -o outpath, --input outpath : output path ``` +### Description and usage of Syscap Consistency Check Tool + +The tool provides the following functions: + +1. Collect syscap fields of all components (or specified components), compare them with arraySyscap in developtools/syscap_codec/include/syscap_define.h, and output the check results. If they are inconsistent, output the cause of the discrepancy +2. Collect the syscap fields of all components and compare them with the @syscap property set in *.d.ts in the interface/sdk-js/api directory. If the check results are inconsistent, output the cause of the inconsistency +3. Compare syscap attributes in all *.d.ts in interface/ sdk-js/api directory with arraySyscap in developtools/syscap_codec/include/syscap_define.h. If they are inconsistent, output the cause of the the inconsistency + +requirements: + +```txt +prettytable==3.3.0 +``` + +usage: + +```shell +# see the help +python3 syscap-check.py --help + +# The comparison of these three different types of data is mainly controlled by the check_target parameter, which has three values to choose from:component_codec、component_sdk、sdk_codec + +# check syscap field in all components for consistency with arraySyscap in syscap_define.h +python3 syscap_check.py --project_path path_of_openarmony --check_target component_codec + +# check that the SYSCAP field in bundle.json of the specified part is consistent with arraySyscap in syscap_define.h. Note: --bundles is valid only if --check_target is component_codec +python3 syscap_check.py --project_path path_of_openarmony --check_target component_codec --bundles path_of_component1/bundle.json path_of_component2/bundle.json + +# check the consistency of the syscap field of all components with the "@syscap" property set in *.d.ts +python3 syscap_check.py --project_path path_of_openarmony --check_target component_sdk + +# check the "@syscap" attribute set in *.d.ts for consistency with arraSyscap in syscap_define.h +python3 syscap_check.py --project_path path_of_openarmony --check_target sdk_codec +``` + ### Release Note v1.0.0 2022-3-8 first release, SysCap codec supported for Windows/Linux/Mac host. \ No newline at end of file diff --git a/README_ZH.md b/README_ZH.md index 3a7e5c3..abb25ee 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -43,6 +43,9 @@ │ │ │ │ └── syscap_codec_test.h │ │ │ └── syscap_codec_test.cpp │ │ └── syscap_tool_test.c # syscap_tool功能测试代码实现 +| |—— tools +| │ │ +| │ └── syscap_check.py # syscap一致性检查脚本 ``` ## API @@ -113,6 +116,43 @@ syscap_tool -Pdsi pcid.txt -o path/ ``` **说明:** -o 选项指定输出目录,缺省为当前目录。 +### syscap一致性看护脚本的说明与使用 + +本工具主要提供如下功能: + +1. 收集所有部件(或指定部件)的syscap字段并与developtools/sysap_codec/include/syscap_define.h中的arraySyscap比较,输出检查结果,若不一致,输出不一致的原因 +2. 收集所有部件的syscap字段并与interface/sdk-js/api目录下的*.d.ts中的“@syscap”属性集合比较,输出检查结果,若不一致,输出不一致的原因 +3. 收集所有interface/sdk-js/api目录下的*.d.ts中的syscap属性与developtools/syscap_codec/include/syscap_define.h中的arraySyscap比较,若不一致,输出不一致的原因 + +requirements: + +```txt +prettytable==3.3.0 +``` + +使用方法: + +```shell +# 查看帮助 +python3 syscap-check.py --help + +# 上述三种不同数据的比较主要通过--check_target参数控制,该参数有三个值可选:component_codec、component_sdk、sdk_codec + +# 检查所有部件的syscap字段与syscap_define.h中的arraySyscap一致性情况 +python3 syscap_check.py --project_path path_of_openarmony --check_target component_codec + +# 检查指定的部件的bundle.json中的syscap字段与syscap_define.h中的arraySyscap一致性情况,注意,只要当--check_target为component_codec时,--bundles才生效 +python3 syscap_check.py --project_path path_of_openarmony --check_target component_codec --bundles path_of_component1/bundle.json path_of_component2/bundle.json + +# 检查所有部件的syscap字段与*.d.ts中的“@syscap”属性集合的一致性情况 +python3 syscap_check.py --project_path path_of_openarmony --check_target component_sdk + +# 检查*.d.ts中的“@syscap"属性集合与syscap_define.h中的arraSyscap的一致性情况 +python3 syscap_check.py --project_path path_of_openarmony --check_target sdk_codec +``` + + + ## Release Note v1.1.0 2022-6-17 添加转字符串格式以及比较功能。 v1.0.0 2022-3-8 首版本,提供Windows/Linux/Mac平台的系统能力编解码。 \ No newline at end of file diff --git a/tools/requirements.txt b/tools/requirements.txt new file mode 100644 index 0000000..fbdaf5c --- /dev/null +++ b/tools/requirements.txt @@ -0,0 +1 @@ +prettytable==3.3.0 diff --git a/tools/syscap_consistency_check_tool.py b/tools/syscap_check.py similarity index 100% rename from tools/syscap_consistency_check_tool.py rename to tools/syscap_check.py