diff --git a/tests/verify_3rd_libs/ReadMe.md b/tests/verify_3rd_libs/ReadMe.md index e366a55c676abb8042d89901b5539871ce5cfd49..3d11f94b2557071519bf8b001d33d19fce0ab3d9 100644 --- a/tests/verify_3rd_libs/ReadMe.md +++ b/tests/verify_3rd_libs/ReadMe.md @@ -5,24 +5,22 @@ 当前仅支持在如下平台运行: - Windows +- Linux # 2. 准备工作 -## 2.1 下载所有三方库(如已下载请忽略) -```shell -./clone_all_libs.bat -``` -## 2.2 安装python包 +## 2.1 安装python包 本工具依赖下列python包,需要提前安装: -- datetime - json5 -- os - pandas -- shutil -- subprocess -- sys - xlsxwriter +- gitpython + +## 2.2 下载所有三方库(如已下载请忽略) +```shell +python init.py +``` ## 2.3 配置local.properties 修改本工具提供的`local.properties`模板文件 @@ -39,9 +37,16 @@ strict-ssl=false ## 2.6 xts测试需要JavaJDK依赖 可从华为镜像源下载https://repo.huaweicloud.com/java/jdk/8u202-b08/ -## 2.7 获取hvigor-wrapper.js -创建或者打开一个DevEco工程,配置hvigor-config.json5为`4.0.0`以上,执行完整sync。 -将`hvigor/hvigor-wrapper.js`路径下的该文件复制到该脚本的当前目录中。 +## 2.7 修改config.json +根据测试环境修改config.json: +1. 使用IDE客户端 + 1. 修改 `ide_enabled` 为 `true` + 2. 修改 `ide_path` +2. 使用command line tools + 1. 修改 `ide_enabled` 为 `false` + 2. 修改 `command_line_tools_path`、`java_home` + +当前不建议将 `parallel` 设置为 `true`,可能出现子进程终止导致某些 project 编译失败 # 3. 执行脚本 diff --git a/tests/verify_3rd_libs/config.json b/tests/verify_3rd_libs/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a318bbeae301160b3d3999508685473a0ecc629b --- /dev/null +++ b/tests/verify_3rd_libs/config.json @@ -0,0 +1,276 @@ +{ + "ide_enabled": false, + "ide_path": "D:\\DevEco Studio", + "command_line_tools_path": "/path/to/command-line-tools", + "java_home": "/path/to/jdk-17.0.2", + "parallel": false, + "target_version": 12, + "skip_repos": [ + "arangojs", + "ijkplayer", + "MMKV", + "pdfViewer" + ], + "repositories": [ + { + "name": "material-dialogs", + "url": "https://gitee.com/openharmony-sig/material-dialogs", + "checkout": "f8cf2e83afe3960f7cd4752902d6618ab7ed5311" + }, + { + "name": "arangojs", + "url": "https://gitee.com/openharmony-sig/arangojs", + "checkout": "1c1411bfb4ccdf1ad33966913af739c65eefb49c" + }, + { + "name": "axios", + "url": "https://gitee.com/openharmony-sig/axios", + "checkout": "5e41aa61a23b74b72bd43ef05f83ef4119d4adda" + }, + { + "name": "brotli", + "url": "https://gitee.com/openharmony-sig/brotli", + "checkout": "2f7e10338b6a79802e091b63f085396314829a83" + }, + { + "name": "crypto-js", + "url": "https://gitee.com/openharmony-sig/crypto-js", + "checkout": "ca2fa5d2fc6f7400f721731f7ee487802fdb7e0b" + }, + { + "name": "dataORM", + "url": "https://gitee.com/openharmony-sig/dataORM", + "checkout": "18e7844c3c05c0b36eb493a59b1681f18921ccf5", + "diff": "dataORM.diff" + }, + { + "name": "fileio-extra", + "url": "https://gitee.com/openharmony-sig/fileio-extra", + "checkout": "206045a1d249638c9f6eff1a55d3e93292d015d1" + }, + { + "name": "ijkplayer", + "url": "https://gitee.com/openharmony-sig/ijkplayer", + "checkout": "d8e2d5e1a6ef3c57491bf77a7a99f58e96e0ac7d" + }, + { + "name": "ImageViewZoom", + "url": "https://gitee.com/openharmony-sig/ImageViewZoom", + "checkout": "ae60765865f7cd38a5e49096918af72829f4c74a" + }, + { + "name": "is-png", + "url": "https://gitee.com/openharmony-sig/is-png", + "checkout": "0681d316cc92c878169f493240e3732ce88efd03" + }, + { + "name": "is-webp", + "url": "https://gitee.com/openharmony-sig/is-webp", + "checkout": "d89656de0f8f714e79504293f874fb0bde9b781f" + }, + { + "name": "jmustache", + "url": "https://gitee.com/openharmony-sig/jmustache", + "checkout": "60a5c48a454e89bbcb97efc2b4e50bd613473b34" + }, + { + "name": "juniversalchardet", + "url": "https://gitee.com/openharmony-sig/juniversalchardet", + "checkout": "b1f98e22f944e4d526e45571f3c30bcac2b48359" + }, + { + "name": "LiveEventBus", + "url": "https://gitee.com/openharmony-sig/LiveEventBus", + "checkout": "9fb4de12b0a04851bb9505224c935865a41e0eae", + "diff": "LiveEventBus.diff" + }, + { + "name": "MaterialProgressBar", + "url": "https://gitee.com/openharmony-sig/MaterialProgressBar", + "checkout": "29eeddbbbb1949e6f3c54bafc2f09966cd8d6242", + "diff": "MaterialProgressBar.diff" + }, + { + "name": "ohos_disklrucache", + "url": "https://gitee.com/openharmony-sig/ohos_disklrucache", + "checkout": "a00862c0c52668ab5b822d30ee7ac2e5283fa7db" + }, + { + "name": "ohos_mqtt", + "url": "https://gitee.com/openharmony-tpc/ohos_mqtt.git", + "params": "--recursive", + "checkout": "5d8a7bd61be3101d8edfce7c543e9e8d7c51fe07", + "diff": "ohos_mqtt.diff" + }, + { + "name": "ohos-gif-drawable", + "url": "https://gitee.com/openharmony-sig/ohos-gif-drawable", + "checkout": "d409faa809b341115409b0a0af453879701c298a" + }, + { + "name": "ohos-mbassador", + "url": "https://gitee.com/openharmony-sig/ohos-mbassador", + "checkout": "e03a1ca79866c348a46e0ba46f633eb74587ecd8" + }, + { + "name": "ohos-MPChart", + "url": "https://gitee.com/openharmony-sig/ohos-MPChart", + "checkout": "fd0e7f87516f1b47bee71be8533bea127953c354" + }, + { + "name": "ohos-svg", + "url": "https://gitee.com/openharmony-sig/ohos-svg", + "checkout": "0e675891f9a44648057a81b7f3fd2f0d541b685d" + }, + { + "name": "overscroll-decor", + "url": "https://gitee.com/openharmony-sig/overscroll-decor", + "checkout": "4d4685635a5ea861622f98b653947be2015d1447" + }, + { + "name": "PullToRefresh", + "url": "https://gitee.com/openharmony-sig/PullToRefresh", + "checkout": "91d9ffc26a28b0b2f05b43d9872e5fbd2f2d07f2" + }, + { + "name": "qr-code-generator", + "url": "https://gitee.com/openharmony-sig/qr-code-generator", + "checkout": "0629cbb7067a2be6edffba8a18255f95f48d5ca9", + "diff": "qr-code-generator.diff" + }, + { + "name": "RoundedImageView", + "url": "https://gitee.com/openharmony-sig/RoundedImageView", + "checkout": "f31fe52d95020a32a1ac80a1411f5092592e7f9f" + }, + { + "name": "subsampling-scale-image-view", + "url": "https://gitee.com/openharmony-sig/subsampling-scale-image-view", + "checkout": "249787a070663ca1b509a1f8ce3554d48cfbedef" + }, + { + "name": "TextLayoutBuilder", + "url": "https://gitee.com/openharmony-sig/TextLayoutBuilder", + "checkout": "daf465bfa8e09872235cc1c586346c77c24d7eec", + "diff": "TextLayoutBuilder.diff" + }, + { + "name": "arouter-api-onActivityResult", + "url": "https://gitee.com/openharmony-tpc/arouter-api-onActivityResult", + "checkout": "2f1cb39c1a44ed4df23d69cc7cf6ddbda2965798" + }, + { + "name": "CommonsCompress", + "url": "https://gitee.com/openharmony-tpc/CommonsCompress", + "checkout": "4e6b6de046d7b745df840f5429a51614ce6aa14d", + "diff": "CommonsCompress.diff" + }, + { + "name": "ImageKnife", + "url": "https://gitee.com/openharmony-tpc/ImageKnife", + "params": "--recurse-submodules", + "checkout": "afde885ae1dd1aaf72a2803fe9022a0747710e95", + "diff": "ImageKnife.diff" + }, + { + "name": "LargeImage", + "url": "https://gitee.com/openharmony-tpc/LargeImage", + "checkout": "cfc2b4eabcd343aecb0903a11542850dbd1c3f29" + }, + { + "name": "lottieETS", + "url": "https://gitee.com/openharmony-tpc/lottieETS", + "checkout": "7d8ed82f33548fed95a7e9da7ca1c03ecd85b9de" + }, + { + "name": "MMKV", + "url": "https://gitee.com/openharmony-tpc/MMKV", + "checkout": "57963044061fa53d95e88fd5852670233b2d39bb" + }, + { + "name": "ohos_coap", + "url": "https://gitee.com/openharmony-tpc/ohos_coap.git", + "params": "--recurse-submodules", + "checkout": "1d495cfda5df2fa396fde65a37ced8f2daaacc33" + }, + { + "name": "okio", + "url": "https://gitee.com/openharmony-tpc/okio", + "checkout": "4ad869130c487ae1498647334a086306545e8640" + }, + { + "name": "openharmony_tpc_samples", + "url": "https://gitee.com/openharmony-tpc/openharmony_tpc_samples", + "checkout": "440d3a643d12347fd8ec12f7f273a70c66b8df2e", + "diff": "openharmony_tpc_samples.diff" + }, + { + "name": "pdfViewer", + "url": "https://gitee.com/openharmony-tpc/pdfViewer", + "checkout": "49f482693803e052375c36e1f37a4c9fc17c1e5b" + }, + { + "name": "pinyin4js", + "url": "https://gitee.com/openharmony-tpc/pinyin4js", + "checkout": "2d27615baf86d3ba0d15a3d746f1365642909727" + }, + { + "name": "protobuf", + "url": "https://gitee.com/openharmony-tpc/protobuf", + "checkout": "6572430c33d65831cd2ef6f50f9d2c78d3135803" + }, + { + "name": "XmlGraphicsBatik", + "url": "https://gitee.com/openharmony-tpc/XmlGraphicsBatik", + "checkout": "d211c2f920fd194b78d3e37218e23ad63fd0f514" + }, + { + "name": "zxing", + "url": "https://gitee.com/openharmony-tpc/zxing", + "checkout": "a7a92b27d5633d3f51f9939d5143f5f9d4229de9" + }, + { + "name": "aki", + "url": "https://gitee.com/openharmony-sig/aki", + "checkout": "0c04f165ff4c8586d16fbe8a7494968f84161d41", + "diff": "aki.diff" + }, + { + "name": "mp4parser", + "url": "https://gitee.com/openharmony-tpc/mp4parser.git", + "params": "--recurse-submodules", + "checkout": "f29e261b65809e430789293a68a01974f04efd66" + }, + { + "name": "jama", + "url": "https://gitee.com/openharmony-sig/jama", + "checkout": "95f8c854d7d801d758c08c06e024e7b3a628a2bc" + }, + { + "name": "ohos_banner", + "url": "https://gitee.com/openharmony-sig/ohos_banner", + "checkout": "1e42ef9a4a7e07a66ff6e3a0e3f87ef7c86eeed8" + }, + { + "name": "ohos_highlightguide", + "url": "https://gitee.com/openharmony-sig/ohos_highlightguide", + "checkout": "7f0209f6c91e682dca50d2e488c4dc1c5306192b" + }, + { + "name": "ohos_jsonwebtoken", + "url": "https://gitee.com/openharmony-sig/ohos_jsonwebtoken", + "checkout": "8ba09c62827b19625c00496d5731f63a41a94908" + }, + { + "name": "ohos_video_trimmer", + "url": "https://gitee.com/openharmony-sig/ohos_video_trimmer", + "checkout": "c82c44f400b37408d71e245bf005dbb82d21557c" + }, + { + "name": "ohos_videocompressor", + "url": "https://gitee.com/openharmony-sig/ohos_videocompressor.git", + "params": "--recurse-submodules", + "checkout": "b21965c34102e66d11f22ff592218c571a99abaa" + } + ] +} \ No newline at end of file diff --git a/tests/verify_3rd_libs/diffs/CommonsCompress.diff b/tests/verify_3rd_libs/diffs/CommonsCompress.diff new file mode 100644 index 0000000000000000000000000000000000000000..57cf64c3c040c5914d8ee98bbd59d42790f0906b --- /dev/null +++ b/tests/verify_3rd_libs/diffs/CommonsCompress.diff @@ -0,0 +1,11 @@ +diff --git a/entry/src/ohosTest/resources/base/profile/test_pages.json b/entry/src/ohosTest/resources/base/profile/test_pages.json +index fcef82b..b7e7343 100644 +--- a/entry/src/ohosTest/resources/base/profile/test_pages.json ++++ b/entry/src/ohosTest/resources/base/profile/test_pages.json +@@ -1,5 +1,5 @@ + { + "src": [ +- "TestAbility/pages/index" ++ "testability/pages/Index" + ] + } diff --git a/tests/verify_3rd_libs/diffs/ImageKnife.diff b/tests/verify_3rd_libs/diffs/ImageKnife.diff new file mode 100644 index 0000000000000000000000000000000000000000..72114759c46f48d5c46b2e9a6165c8fb70e67f6f --- /dev/null +++ b/tests/verify_3rd_libs/diffs/ImageKnife.diff @@ -0,0 +1,13 @@ +diff --git a/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets b/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets +index 71dfa05..5394b2e 100644 +--- a/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets ++++ b/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets +@@ -13,7 +13,7 @@ + * limitations under the License. + */ + import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +-import { ImageKnifeOption, ImageKnifeRequest } from '@ohos/imageknife/Index'; ++import { ImageKnifeOption, ImageKnifeRequest } from '@ohos/imageknife/index'; + import { DefaultJobQueue } from '@ohos/imageknife/src/main/ets/queue/DefaultJobQueue'; + import { IJobQueue } from '@ohos/imageknife/src/main/ets/queue/IJobQueue'; + import taskpool from '@ohos.taskpool'; diff --git a/tests/verify_3rd_libs/diffs/LiveEventBus.diff b/tests/verify_3rd_libs/diffs/LiveEventBus.diff new file mode 100644 index 0000000000000000000000000000000000000000..fa346573d2ce383e27b876152f9c0818f8901ee8 --- /dev/null +++ b/tests/verify_3rd_libs/diffs/LiveEventBus.diff @@ -0,0 +1,13 @@ +diff --git a/library/src/main/ets/LiveEventBus/logger/DefaultLogger.ts b/library/src/main/ets/LiveEventBus/logger/DefaultLogger.ts +index 2e4fb42..2d4bf91 100644 +--- a/library/src/main/ets/LiveEventBus/logger/DefaultLogger.ts ++++ b/library/src/main/ets/LiveEventBus/logger/DefaultLogger.ts +@@ -17,7 +17,7 @@ + + import Logger from './Logger' + import Level from './Level' +-//import hilog from '@ohos.hilog'; ++import hilog from '@ohos.hilog'; + + const TAG:string = "[LiveEventBus]"; + const DOMAIN:number = 0xFF diff --git a/tests/verify_3rd_libs/diffs/MaterialProgressBar.diff b/tests/verify_3rd_libs/diffs/MaterialProgressBar.diff new file mode 100644 index 0000000000000000000000000000000000000000..b064d167cf1b23b538486be9fcf530167e68e90d --- /dev/null +++ b/tests/verify_3rd_libs/diffs/MaterialProgressBar.diff @@ -0,0 +1,26 @@ +diff --git a/library/src/main/ets/components/material/core/CircularComponent.ets b/library/src/main/ets/components/material/core/CircularComponent.ets +index 116ef7b..1c567f8 100644 +--- a/library/src/main/ets/components/material/core/CircularComponent.ets ++++ b/library/src/main/ets/components/material/core/CircularComponent.ets +@@ -25,7 +25,7 @@ export struct CircularComponent { + private mWidth: number = 0; + private mHeight: number = 0; + private progressMax: number = 100; +- @Param radius = 45; ++ @Param radius: number = 45; + @Param strokeWidth: number = 0; + @Param secondColor: ResourceColor = 0; + @Local secondProgressPathCmd: string = ''; +diff --git a/library/src/main/ets/components/material/core/HorizontalComponent.ets b/library/src/main/ets/components/material/core/HorizontalComponent.ets +index 6184acf..b5184a8 100644 +--- a/library/src/main/ets/components/material/core/HorizontalComponent.ets ++++ b/library/src/main/ets/components/material/core/HorizontalComponent.ets +@@ -21,7 +21,7 @@ export struct HorizontalComponent { + private bgBar: HorizontalPath = new HorizontalPath() + private secondBar: HorizontalPath = new HorizontalPath() + private mHeight: number = 0 +- @Param strokeWidth = 6 ++ @Param strokeWidth: number = 6 + private progressMax: number = 100 + @Param bgColor: ResourceColor = 0; + @Param color: ResourceColor = '#007DFF'; //0x029789 diff --git a/tests/verify_3rd_libs/diffs/TextLayoutBuilder.diff b/tests/verify_3rd_libs/diffs/TextLayoutBuilder.diff new file mode 100644 index 0000000000000000000000000000000000000000..1b9144595d91cdcc3347d25c3fc5444f382444f7 --- /dev/null +++ b/tests/verify_3rd_libs/diffs/TextLayoutBuilder.diff @@ -0,0 +1,20 @@ +diff --git a/entry/src/ohosTest/ets/test/Ability.test.ets b/entry/src/ohosTest/ets/test/Ability.test.ets +index 4fd0dae..645a81b 100644 +--- a/entry/src/ohosTest/ets/test/Ability.test.ets ++++ b/entry/src/ohosTest/ets/test/Ability.test.ets +@@ -15,7 +15,7 @@ + + import hilog from '@ohos.hilog'; + import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +-import { TextLayout } from '@ohos/TextLayoutBuilder'; ++import { TextLayout } from '@ohos/textlayoutbuilder'; + const BASE_COUNT: number = 2000; + export default function abilityTest() { + let layout: TextLayout.Layout = new TextLayout.Layout(); +@@ -116,4 +116,4 @@ function endTime(startTime: number, tag: string) { + let averageTime = ((endTime - startTime) * 1000 / BASE_COUNT) + console.log(tag + ":endTime:" + endTime) + console.log(tag + ":averageTime:" + averageTime + "μs"); +-} +\ No newline at end of file ++} diff --git a/tests/verify_3rd_libs/diffs/aki.diff b/tests/verify_3rd_libs/diffs/aki.diff new file mode 100644 index 0000000000000000000000000000000000000000..db07f4f3f7bd864705da19969de13d26f1451de6 --- /dev/null +++ b/tests/verify_3rd_libs/diffs/aki.diff @@ -0,0 +1,20 @@ +diff --git a/example/ohos/0_show_case/entry/src/main/cpp/CMakeLists.txt b/example/ohos/0_show_case/entry/src/main/cpp/CMakeLists.txt +index 0a698e3..2db0900 100644 +--- a/example/ohos/0_show_case/entry/src/main/cpp/CMakeLists.txt ++++ b/example/ohos/0_show_case/entry/src/main/cpp/CMakeLists.txt +@@ -2,7 +2,7 @@ + cmake_minimum_required(VERSION 3.4.1) + project(0_show_case) + +-set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}../../../../../../../../) ++set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../../) + + include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include) +@@ -12,4 +12,4 @@ add_subdirectory(${NATIVERENDER_ROOT_PATH} aki) + target_link_libraries(nativerender PUBLIC + aki_jsbind + ace_ndk.z +- libnative_window.so) +\ No newline at end of file ++ libnative_window.so) diff --git a/tests/verify_3rd_libs/diffs/dataORM.diff b/tests/verify_3rd_libs/diffs/dataORM.diff new file mode 100644 index 0000000000000000000000000000000000000000..f260a4cb5134cd24988bd4cec16c2306b07b9433 --- /dev/null +++ b/tests/verify_3rd_libs/diffs/dataORM.diff @@ -0,0 +1,18 @@ +diff --git a/library/src/main/ets/core/InternalUnitTestDaoAccess.ts b/library/src/main/ets/core/InternalUnitTestDaoAccess.ts +index f520a79..46f8b8f 100644 +--- a/library/src/main/ets/core/InternalUnitTestDaoAccess.ts ++++ b/library/src/main/ets/core/InternalUnitTestDaoAccess.ts +@@ -47,11 +47,11 @@ export class InternalUnitTestDaoAccess { + return this.dao.isEntityUpdateAble(); + } + +- public readEntity(cursor: ResultSet, offset: number): T { ++ public readEntity(cursor: any, offset: number): T { + return this.dao.readEntity(cursor, offset); + } + +- public readKey(cursor: ResultSet, offset: number): K { ++ public readKey(cursor: any, offset: number): K { + return this.dao.readKey(cursor, offset); + } + diff --git a/tests/verify_3rd_libs/diffs/ohos_mqtt.diff b/tests/verify_3rd_libs/diffs/ohos_mqtt.diff new file mode 100644 index 0000000000000000000000000000000000000000..d8d06ec0b2fb1cf25e245488023901ec77a1bd02 --- /dev/null +++ b/tests/verify_3rd_libs/diffs/ohos_mqtt.diff @@ -0,0 +1,11 @@ +diff --git a/entry/src/ohosTest/resources/base/profile/test_pages.json b/entry/src/ohosTest/resources/base/profile/test_pages.json +index fcef82b..2d90c65 100644 +--- a/entry/src/ohosTest/resources/base/profile/test_pages.json ++++ b/entry/src/ohosTest/resources/base/profile/test_pages.json +@@ -1,5 +1,5 @@ + { + "src": [ +- "TestAbility/pages/index" ++ "testability/pages/index" + ] + } diff --git a/tests/verify_3rd_libs/diffs/openharmony_tpc_samples.diff b/tests/verify_3rd_libs/diffs/openharmony_tpc_samples.diff new file mode 100644 index 0000000000000000000000000000000000000000..04d83ecdbebe68f8104f762dbc764055b12d79a7 --- /dev/null +++ b/tests/verify_3rd_libs/diffs/openharmony_tpc_samples.diff @@ -0,0 +1,128 @@ +diff --git a/EventBus/entry/oh-package.json5 b/EventBus/entry/oh-package.json5 +index 9545d2a5..8aaa3866 100644 +--- a/EventBus/entry/oh-package.json5 ++++ b/EventBus/entry/oh-package.json5 +@@ -1,7 +1,7 @@ + { + "license": "MIT license", + "devDependencies": { +- "@types/eventbusjs": "^0.2.0" ++ "eventbusjs": "^0.2.0" + + }, + "author": "ohos_tpc", +@@ -10,6 +10,6 @@ + "main": "", + "version": "1.0.0", + "dependencies": { +- "@types/eventbusjs": "^0.2.0" ++ "eventbusjs": "^0.2.0" + } + } +diff --git a/jsDiffDemo/entry/src/ohosTest/resources/base/profile/test_pages.json b/jsDiffDemo/entry/src/ohosTest/resources/base/profile/test_pages.json +index fcef82b4..2d90c65a 100644 +--- a/jsDiffDemo/entry/src/ohosTest/resources/base/profile/test_pages.json ++++ b/jsDiffDemo/entry/src/ohosTest/resources/base/profile/test_pages.json +@@ -1,5 +1,5 @@ + { + "src": [ +- "TestAbility/pages/index" ++ "testability/pages/index" + ] + } +diff --git a/node-pop3/library/src/main/ets/Command.ts b/node-pop3/library/src/main/ets/Command.ts +index 5e4d6e78..bb95f98d 100644 +--- a/node-pop3/library/src/main/ets/Command.ts ++++ b/node-pop3/library/src/main/ets/Command.ts +@@ -1,6 +1,7 @@ + // @ts-nocheck + + import Pop3Connection from '../ets/Connection'; ++import { Pop3LoginBean } from '@ohos/node-pop3'; + + import { listify, stream2String } from '../ets/helper'; + import to, { to } from './await-to-js'; +diff --git a/node-pop3/library/src/main/ets/Connection.ts b/node-pop3/library/src/main/ets/Connection.ts +index 1ac33868..6340e690 100644 +--- a/node-pop3/library/src/main/ets/Connection.ts ++++ b/node-pop3/library/src/main/ets/Connection.ts +@@ -6,6 +6,7 @@ import { EventEmitter } from '../polyfill/events'; + import { Readable } from '../polyfill/stream'; + import to from './await-to-js' + import Pop3Error from './Pop3Error' ++import { Pop3LoginBean } from '@ohos/node-pop3'; + import { + CRLF, + CRLF_BUFFER, +diff --git a/pakoDemo/entry/src/ohosTest/resources/base/profile/test_pages.json b/pakoDemo/entry/src/ohosTest/resources/base/profile/test_pages.json +index 2d90c65a..b7e7343c 100644 +--- a/pakoDemo/entry/src/ohosTest/resources/base/profile/test_pages.json ++++ b/pakoDemo/entry/src/ohosTest/resources/base/profile/test_pages.json +@@ -1,5 +1,5 @@ + { + "src": [ +- "testability/pages/index" ++ "testability/pages/Index" + ] + } +diff --git a/utilCode/entry/src/ohosTest/ets/test/List.test.ets b/utilCode/entry/src/ohosTest/ets/test/List.test.ets +index 79044254..e1ad6737 100644 +--- a/utilCode/entry/src/ohosTest/ets/test/List.test.ets ++++ b/utilCode/entry/src/ohosTest/ets/test/List.test.ets +@@ -19,7 +19,7 @@ import gcoordTest from './Gcoord.test' + import colorTest from './Color.test' + import timeTest from './Time.test' + import picture from './Picture.test' +-import portTime from './portTime.test' ++import portTime from './PortTime.test' + export default function testsuite() { + tempUtilsTest() + countryUtilsTest() +@@ -29,4 +29,4 @@ export default function testsuite() { + timeTest() + picture() + // portTime() +-} +\ No newline at end of file ++} +diff --git a/validator/entry/src/ohosTest/ets/test/toDateTest.test.ets b/validator/entry/src/ohosTest/ets/test/toDateTest.test.ets +index bbcce9cf..71bbba92 100644 +--- a/validator/entry/src/ohosTest/ets/test/toDateTest.test.ets ++++ b/validator/entry/src/ohosTest/ets/test/toDateTest.test.ets +@@ -39,29 +39,29 @@ export default function toDateTest() { + }) + + it('toDate1', 0, ()=> { +- let result = validator.toDate("2022/12/05") ++ let result: Date = validator.toDate("2022/12/05") + if(result == null) return + expect(result.toString()).assertEqual("Mon Dec 05 2022 00:00:00 GMT+0800") + }) + it('toDate2', 0, ()=> { +- let result = validator.toDate("2022-12-05") ++ let result: Date = validator.toDate("2022-12-05") + if(result == null) return + expect(result.toString()).assertEqual("Mon Dec 05 2022 08:00:00 GMT+0800") + }) + it('toDate3', 0, ()=> { +- let result = validator.toDate("2007-04-06T00:00") ++ let result: Date = validator.toDate("2007-04-06T00:00") + if(result == null) return + expect(result.toString()).assertEqual("Fri Apr 06 2007 00:00:00 GMT+0800") + }) + it('toDate4', 0, ()=> { +- let result = validator.toDate("2010-02-18T16:23:48.5") ++ let result: Date = validator.toDate("2010-02-18T16:23:48.5") + if(result == null) return + expect(result.toString()).assertEqual("Thu Feb 18 2010 16:23:48 GMT+0800") + }) + it('toDate5', 0, ()=> { +- let result = validator.toDate("2007-05-19 14:34:23") ++ let result: Date = validator.toDate("2007-05-19 14:34:23") + if(result == null) return + expect(result.toString()).assertEqual("Sat May 19 2007 14:34:23 GMT+0800") + }) + }) +-} +\ No newline at end of file ++} diff --git a/tests/verify_3rd_libs/diffs/qr-code-generator.diff b/tests/verify_3rd_libs/diffs/qr-code-generator.diff new file mode 100644 index 0000000000000000000000000000000000000000..f1525a1c3a6750317365f682d64d22d7bd5e7619 --- /dev/null +++ b/tests/verify_3rd_libs/diffs/qr-code-generator.diff @@ -0,0 +1,17 @@ +diff --git a/entry/src/ohosTest/ets/test/List.test.ets b/entry/src/ohosTest/ets/test/List.test.ets +index 0fe49c1..94e3e70 100644 +--- a/entry/src/ohosTest/ets/test/List.test.ets ++++ b/entry/src/ohosTest/ets/test/List.test.ets +@@ -19,9 +19,9 @@ + */ + + import abilityTest from './Ability.test' +-import qrCodeGeneratorTest from './QrCodeGenerator.test' ++import qrCodeGeneratorTest from './qrCodeGenerator.test' + + export default function testsuite() { + abilityTest() + qrCodeGeneratorTest() +-} +\ No newline at end of file ++} diff --git a/tests/verify_3rd_libs/init.py b/tests/verify_3rd_libs/init.py new file mode 100644 index 0000000000000000000000000000000000000000..5b96686d020b6b4125d92855a21a8623210df450 --- /dev/null +++ b/tests/verify_3rd_libs/init.py @@ -0,0 +1,57 @@ +import json +from git import Repo +from pathlib import Path + +root_dir = Path(__file__).parent +libs_dir = root_dir / "libs" + + +def clone_repo(repo_path, url, params): + if params: + print(f"Cloning {repo_path} from {url} with params {params}") + Repo.clone_from(url, repo_path, multi_options=params.split()) + else: + print(f"Cloning {repo_path} from {url}") + Repo.clone_from(url, repo_path) + + +def apply_diff(repo_path, diff_file): + if diff_file and diff_file.exists(): + print(f"Applying diff {diff_file} to {repo_path}") + repo = Repo(repo_path) + repo.git.apply(diff_file) + else: + print(f"No diff file {diff_file} found for {repo_path}") + + +def checkout_commit(repo_path, commit): + if commit: + print(f"Checking out commit {commit} in {repo_path}") + repo = Repo(repo_path) + repo.git.checkout(commit) + + +def main(): + libs_dir.mkdir(exist_ok=True, parents=True) + with open("config.json", "r") as f: + config = json.load(f) + + repositories: list[dict] = config.get("repositories", []) + for repo in repositories: + name = repo["name"] + url = repo["url"] + params = repo.get("params", "") + diff = repo.get("diff", "") + checkout = repo.get("checkout", "") + + repo_path = libs_dir / name + clone_repo(repo_path, url, params) + if checkout: + checkout_commit(repo_path, checkout) + if diff: + diff_file = root_dir / "diffs" / diff + apply_diff(repo_path, diff_file) + + +if __name__ == "__main__": + main() diff --git a/tests/verify_3rd_libs/verify_3rd_libs.py b/tests/verify_3rd_libs/verify_3rd_libs.py index 1e4de3eae14fbc3ac1417fd3ce52c11537c75b17..9c5844e5b9f1976b730552e29fe1cf855378b38a 100644 --- a/tests/verify_3rd_libs/verify_3rd_libs.py +++ b/tests/verify_3rd_libs/verify_3rd_libs.py @@ -15,13 +15,16 @@ # limitations under the License. -from datetime import datetime -import json5 +import json import os -import pandas as pd import shutil import subprocess import sys +from concurrent.futures import ProcessPoolExecutor, as_completed +from datetime import datetime + +import json5 +import pandas as pd def parse_args(): @@ -48,39 +51,44 @@ def read_build_profile_config(buildProfileJson): return content, runtimeOS -def need_update_sdk_version(buildProfileJson, buildProfileJsonContent, runtimeOS): +def need_update_sdk_version(buildProfileJsonContent, runtimeOS): + """修改 build-profile.json5 中 SdkVersion 配置 + 1. 相关配置都配置在 app.products[0] 下 + 2. runtimeOS 正确配置 + """ need = False - targetVersion = 11 if runtimeOS == 'OpenHarmony' else '4.1.0(11)' + targetVersion = configs["target_version"] if runtimeOS == 'OpenHarmony' else '5.0.0(12)' if 'compileSdkVersion' in buildProfileJsonContent['app']: currentCompileSdkVersion = buildProfileJsonContent['app']['compileSdkVersion'] currentcompatibleSdkVersion = buildProfileJsonContent['app']['compatibleSdkVersion'] - if currentCompileSdkVersion < 11: + if currentCompileSdkVersion != targetVersion: need = True - buildProfileJsonContent['app']['products'][0]['compileSdkVersion'] = 11 - buildProfileJsonContent['app']['products'][0]['compatibleSdkVersion'] = 11 - del buildProfileJsonContent['app']['compileSdkVersion'] - del buildProfileJsonContent['app']['compatibleSdkVersion'] + buildProfileJsonContent['app']['products'][0]['compileSdkVersion'] = targetVersion + buildProfileJsonContent['app']['products'][0]['compatibleSdkVersion'] = targetVersion + buildProfileJsonContent['app'].pop('compileSdkVersion', None) + buildProfileJsonContent['app'].pop('compatibleSdkVersion', None) + if 'runtimeOS' not in buildProfileJsonContent['app']['products'][0]: + need = True + buildProfileJsonContent['app']['products'][0]['runtimeOS'] = runtimeOS else: currentCompileSdkVersion = buildProfileJsonContent['app']['products'][0]['compileSdkVersion'] currentcompatibleSdkVersion = buildProfileJsonContent['app']['products'][0]['compatibleSdkVersion'] - if currentCompileSdkVersion < targetVersion: + if 'targetSdkVersion' in buildProfileJsonContent['app']['products'][0]: + targetSdkVersion = buildProfileJsonContent['app']['products'][0]['targetSdkVersion'] + else: + targetSdkVersion = None + if currentCompileSdkVersion != targetVersion: need = True buildProfileJsonContent['app']['products'][0]['compileSdkVersion'] = targetVersion - if currentcompatibleSdkVersion < targetVersion: + if currentcompatibleSdkVersion != targetVersion: need = True buildProfileJsonContent['app']['products'][0]['compatibleSdkVersion'] = targetVersion - if 'targetSdkVersion' in buildProfileJsonContent['app']['products'][0]: + if targetSdkVersion is not None and targetSdkVersion != targetVersion: need = True - buildProfileJsonContent['app']['products'][0]['targetSdkVersion'] = 11 - # # change arkTSVersion to 1.0 or 1.1 - # if 'arkTSVersion' not in buildProfileJsonContent['app']['products'][0]: - # need = True - # buildProfileJsonContent['app']['products'][0]['arkTSVersion'] = "1.0" - # - # # if need del arkTSVersion param - # if 'arkTSVersion' in buildProfileJsonContent['app']['products'][0]: - # need = True - # del buildProfileJsonContent['app']['products'][0]['arkTSVersion'] + buildProfileJsonContent['app']['products'][0]['targetSdkVersion'] = targetVersion + if 'runtimeOS' not in buildProfileJsonContent['app']['products'][0]: + need = True + buildProfileJsonContent['app']['products'][0]['runtimeOS'] = runtimeOS return need @@ -97,15 +105,29 @@ def read_hvigor_config(hvigorConfigJson): return content +def read_oh_package_config(ohPackageConfigJson): + if not os.path.exists(ohPackageConfigJson): + raise FileNotFoundError("FileNotFoundError " + ohPackageConfigJson) + with open(ohPackageConfigJson, "r", encoding='utf-8') as file: + content = json5.load(file) + return content + + +def read_module_config(moduleConfigJson): + if not os.path.exists(moduleConfigJson): + raise FileNotFoundError("FileNotFoundError " + moduleConfigJson) + with open(moduleConfigJson, "r", encoding='utf-8') as file: + content = json5.load(file) + return content + + def need_update_hvigor_version(hvigorConfigJsonContent, runtimeOS): need = False if runtimeOS == "OpenHarmony": - if hvigorConfigJsonContent['hvigorVersion'] != '4.0.4': - need = True - hvigorConfigJsonContent['hvigorVersion'] = '4.0.4' - if hvigorConfigJsonContent['dependencies']['@ohos/hvigor-ohos-plugin'] != '4.0.4': - need = True - hvigorConfigJsonContent['dependencies']['@ohos/hvigor-ohos-plugin'] = '4.0.4' + need = True + hvigorConfigJsonContent.pop('hvigorVersion', None) + hvigorConfigJsonContent['dependencies'] = {} + hvigorConfigJsonContent['modelVersion'] = "5.0.0" if runtimeOS == "HarmonyOS": if hvigorConfigJsonContent['hvigorVersion'] != '4.0.4': need = True @@ -116,11 +138,76 @@ def need_update_hvigor_version(hvigorConfigJsonContent, runtimeOS): return need +def need_update_oh_package_version(ohPackageConfigJsonContent, runtimeOS): + need = False + if runtimeOS == "OpenHarmony": + need = True + ohPackageConfigJsonContent['modelVersion'] = "5.0.0" + return need + + +def need_update_module_version(moduleConfigJsonContent, runtimeOS): + need = False + if runtimeOS == "OpenHarmony": + # 修改设备类型,OpenHarmony项目中不支持phone等设备类型,统一修改为default/tablet + need = True + moduleConfigJsonContent['module']['deviceTypes'] = ["default", "tablet"] + return need + + def update_hvigor_version(hvigorConfigJson, hvigorConfigJsonContent): with open(hvigorConfigJson, "w", encoding='utf-8', newline='\n') as file: json5.dump(hvigorConfigJsonContent, file, indent=2) +def update_oh_package_version(ohPackageConfigJson, ohPackageConfigJsonContent): + with open(ohPackageConfigJson, "w", encoding='utf-8') as file: + json5.dump(ohPackageConfigJsonContent, file, indent=2) + + +def update_module_version(moduleConfigJson, moduleConfigJsonContent): + with open(moduleConfigJson, "w", encoding='utf-8') as file: + json5.dump(moduleConfigJsonContent, file, indent=2) + + +def migrate_project(project, runtimeOS): + """参考 Migrate Assistant + 1. 移除项目目录中的 hvigorw、hvigorw.bat、hvigor/hvigor-wrapper.js + 2. 更新 oh-package.json5 中的 modelVersion + 3. 更新 hvigor/hvigor-config.json5 中的 modelVersion, dependencies, hvigorVersion + """ + deprecated_files = [ + os.path.join(project, "hvigorw"), + os.path.join(project, "hvigorw.bat"), + os.path.join(project, "hvigor", "hvigor-wrapper.js"), + ] + for f in deprecated_files: + if os.path.exists(f): + os.remove(f) + ohPackageJson = os.path.join(project, "oh-package.json5") + ohPackageJsonContent = read_oh_package_config(ohPackageJson) + if need_update_oh_package_version(ohPackageJsonContent, runtimeOS): + update_oh_package_version(ohPackageJson, ohPackageJsonContent) + hvigorConfigJson = os.path.join(project, "hvigor", "hvigor-config.json5") + hvigorConfigJsonContent = read_hvigor_config(hvigorConfigJson) + if need_update_hvigor_version(hvigorConfigJsonContent, runtimeOS): + update_hvigor_version(hvigorConfigJson, hvigorConfigJsonContent) + + +def update_module(project, runtimeOS): + """ + 主要更新 entry 和 ohosTest 两个模块的 module.json5 中配置的设备类型 + """ + moduleJson = os.path.join(project, "entry", "src", "main", "module.json5") + moduleJsonContent = read_module_config(moduleJson) + if need_update_module_version(moduleJsonContent, runtimeOS): + update_module_version(moduleJson, moduleJsonContent) + moduleJson = os.path.join(project, "entry", "src", "ohosTest", "module.json5") + moduleJsonContent = read_module_config(moduleJson) + if need_update_module_version(moduleJsonContent, runtimeOS): + update_module_version(moduleJson, moduleJsonContent) + + def prepare_project_config(project): if not os.path.exists(project): raise FileNotFoundError("FileNotFoundError " + project) @@ -131,21 +218,13 @@ def prepare_project_config(project): buildProfileJson = os.path.join(project, "build-profile.json5") buildProfileJsonContent, runtimeOS = read_build_profile_config(buildProfileJson) - if need_update_sdk_version(buildProfileJson, buildProfileJsonContent, runtimeOS): + if need_update_sdk_version(buildProfileJsonContent, runtimeOS): update_sdk_version(buildProfileJson, buildProfileJsonContent) - hvigorConfigJson = os.path.join(project, "hvigor", "hvigor-config.json5") - hvigorConfigJsonContent = read_hvigor_config(hvigorConfigJson) - if need_update_hvigor_version(hvigorConfigJsonContent, runtimeOS): - update_hvigor_version(hvigorConfigJson, hvigorConfigJsonContent) - wrapperJSPath = os.path.join(project, 'hvigor', 'hvigor-wrapper.js') - update_hvigor_wrapper(wrapperJSPath) - return buildProfileJsonContent + migrate_project(project, runtimeOS) + update_module(project, runtimeOS) - -def update_hvigor_wrapper(wrapperJSPath): - if os.path.exists('./hvigor-wrapper.js'): - shutil.copy2('./hvigor-wrapper.js', wrapperJSPath) + return buildProfileJsonContent def run_command(cmd, path): @@ -163,33 +242,32 @@ def get_stderr(result): def ohpm_install(project, buildProfileJsonContent): modules = buildProfileJsonContent['modules'] modulesNames = [m['name'] for m in modules] - install_cmd = 'ohpm install --all' + ohpm_tool = "ohpm.bat" if os.name == "nt" else "ohpm" + install_cmd = f"{ohpm_tool} install --all --registry https://repo.harmonyos.com/ohpm/ --strict_ssl true" log = '' result = run_command(install_cmd, project) log = result.stdout.decode() + get_stderr(result) install_cmd = 'cd ' + project + '; ' + install_cmd print(install_cmd) - print(log) if result.returncode != 0: return install_cmd, log, False for m in modulesNames: modulePackageJson = os.path.join(project, m, 'oh-package.json5') if os.path.exists(modulePackageJson): - cmd = 'ohpm install --all' + cmd = f"{ohpm_tool} install --all --registry https://repo.harmonyos.com/ohpm/ --strict_ssl true" result = run_command(cmd, os.path.join(project, m)) cmd = 'cd ' + os.path.join(project, m) + '; ' + cmd print(cmd) install_cmd = install_cmd + '\n' + cmd log = result.stdout.decode() + get_stderr(result) - print(log) if result.returncode != 0: return install_cmd, log, False return install_cmd, log, True def sync_project(project): - hvigorw_tool = ".\hvigorw.bat" if os.name == "nt" else "./hvigorw" - sync_cmd = f"{hvigorw_tool} --sync -p product=default --parallel;" + hvigorw_tool = "hvigorw.bat" if os.name == "nt" else "hvigorw" + sync_cmd = f"{hvigorw_tool} --sync -p product=default --analyze=normal --parallel --incremental --daemon" print(sync_cmd) result = run_command(sync_cmd, project) pass_info = "Finished ::init..." @@ -197,13 +275,12 @@ def sync_project(project): if not pass_info in result.stdout.decode(): ret = False log = result.stdout.decode() + get_stderr(result) - print(log) return "cd " + project + "; " + sync_cmd, log, True def build_entry(project): - hvigorw_tool = ".\hvigorw.bat" if os.name == "nt" else "./hvigorw" - build_entry_cmd = f"{hvigorw_tool} clean --mode module -p product=default assembleHap --parallel;" + hvigorw_tool = "hvigorw.bat" if os.name == "nt" else "hvigorw" + build_entry_cmd = f"{hvigorw_tool} clean --mode module -p product=default assembleHap --analyze=normal --parallel --incremental --daemon" print(build_entry_cmd) result = run_command(build_entry_cmd, project) pass_info = "BUILD SUCCESSFUL in" @@ -211,7 +288,6 @@ def build_entry(project): if not pass_info in result.stdout.decode(): ret = False log = result.stdout.decode() + get_stderr(result) - print(log) return build_entry_cmd, log, ret @@ -220,27 +296,23 @@ def build_libraries(project, buildProfileJsonContent): libs = [m['name'] + '@default' for m in modules if m['name'] != 'entry'] if len(libs) < 1: return "", "", True - hvigorw_tool = ".\hvigorw.bat" if os.name == "nt" else "./hvigorw" + hvigorw_tool = "hvigorw.bat" if os.name == "nt" else "hvigorw" build_lib_cmd = f'{hvigorw_tool} clean --mode module -p module=' + \ ','.join(libs) + \ - ' -p product=default assembleHar --parallel' + ' -p product=default assembleHar --analyze=normal --parallel --incremental --daemon' print(build_lib_cmd) result = run_command(build_lib_cmd, project) pass_info = "BUILD SUCCESSFUL in" - check_info = "LintArkTS..." ret = True if not pass_info in result.stdout.decode(): ret = False - if not check_info in result.stdout.decode(): - ret = False log = result.stdout.decode() + get_stderr(result) - print(log) return build_lib_cmd, log, ret def build_ohosTest(project): - hvigorw_tool = ".\hvigorw.bat" if os.name == "nt" else "./hvigorw" - build_ohosTest_cmd = f"{hvigorw_tool} --mode module -p module=entry@ohosTest -p buildMode=test clean assembleHap --parallel" + hvigorw_tool = "hvigorw.bat" if os.name == "nt" else "hvigorw" + build_ohosTest_cmd = f"{hvigorw_tool} --mode module -p module=entry@ohosTest -p buildMode=test clean assembleHap --parallel --incremental --daemon" print(build_ohosTest_cmd) result = run_command(build_ohosTest_cmd, project) pass_info = "BUILD SUCCESSFUL in" @@ -248,15 +320,22 @@ def build_ohosTest(project): if not pass_info in result.stdout.decode(): ret = False log = result.stdout.decode() + get_stderr(result) - print(log) return build_ohosTest_cmd, log, ret -def build_single_project(project, datas): +def clean_project(project): + hvigorw_tool = "hvigorw.bat" if os.name == "nt" else "hvigorw" + clean_cmd = f"{hvigorw_tool} -p product=default clean --analyze=normal --parallel --incremental --daemon" + print(clean_cmd) + result = run_command(clean_cmd, project) + + +def build_single_project(project): print("==================================================================") print("Start build " + project + "...") try: buildProfileJsonContent = prepare_project_config(project) + clean_project(project) cmd, log, ret = ohpm_install(project, buildProfileJsonContent) sync_ret = False @@ -282,6 +361,8 @@ def build_single_project(project, datas): cmd = cmd + '\n' + xts_cmd log = log + '\n' + xts_log + clean_project(project) + ret = ret and sync_ret and entry_ret and lib_ret and xts_ret except Exception as err: @@ -295,18 +376,44 @@ def build_single_project(project, datas): 'log': [log], 'ret': [ret] }) - datas = pd.concat([datas, data], ignore_index=True) - datas.reset_index() - return datas + return data + + +def build(project, configs): + """并行执行辅助函数,使用进程池时,由于configs是全局变量,需要传给子进程""" + project_name = os.path.basename(project) + if project_name not in configs["skip_repos"]: + new_data = build_single_project(project) + return new_data + return None def build_mutiple_projects(projects, datas): - for project in projects: - datas = build_single_project(project, datas) - try: - datas.to_excel('tmp.xlsx', index=False) - except: - datas.to_json('tmp.json', orient="records") + if configs["parallel"]: + results = [] + + with ProcessPoolExecutor(max_workers=2) as executor: + futures = { + executor.submit(build, project, configs): project + for project in projects + } + for future in as_completed(futures): + result = future.result() + if result is not None: + results.append(result) + + for result in results: + datas = pd.concat([datas, result], ignore_index=True) + datas.reset_index(drop=True, inplace=True) + else: + for project in projects: + project_name = os.path.basename(project) + if project_name not in configs['skip_repos']: + new_data = build_single_project(project) + if new_data is not None: + datas = pd.concat([datas, new_data], ignore_index=True) + datas.reset_index(drop=True, inplace=True) + return datas @@ -327,13 +434,19 @@ def count_error_type(df): df['error'][i] = error_count return df +def collect_failed_projects(datas): + failed_datas = datas[datas['ret'] == False] + failed_projects = failed_datas['name'].tolist() + return failed_projects -def main(): +def run(): starttime = datetime.now() projects = parse_args() datas = pd.DataFrame(columns=['name', 'cmd', 'log', 'ret']) datas = build_mutiple_projects(projects, datas) datas = count_error_type(datas) + skip_repos = configs['skip_repos'] + failed_projects = collect_failed_projects(datas) now = datetime.now().strftime("%Y%m%d_%H%M%S") try: datas.to_excel('tmp.xlsx', engine='xlsxwriter', index=False) @@ -342,6 +455,65 @@ def main(): datas.to_json('tmp.json', orient="records") os.rename('tmp.json', now + '_output.json') print(f"Test total cost {(datetime.now() - starttime).seconds} seconds") + if skip_repos: + print("==================================================================") + print(f"Skiped projects:") + for project in skip_repos: + print(project) + if failed_projects: + print("==================================================================") + print(f"Failed projects:") + for project in failed_projects: + print(project) + + +def set_environment_variables(): + if configs["ide_enabled"]: + ide_path = configs["ide_path"] + deveco_sdk_home = os.path.join(ide_path, "sdk") + current_path = os.environ.get("PATH", "") + new_path = ( + os.path.join(ide_path, "tools", "ohpm", "bin") + + os.pathsep + + os.path.join(ide_path, "tools", "hvigor", "bin") + + os.pathsep + + os.path.join(ide_path, "tools", "node") + + os.pathsep + + current_path + ) + os.environ["IDE_HOME"] = ide_path + os.environ["DEVECO_SDK_HOME"] = deveco_sdk_home + else: + tools_path = configs["command_line_tools_path"] + java_home = configs["java_home"] + current_path = os.environ.get("PATH", "") + new_path = ( + os.path.join(java_home, "bin") + + os.pathsep + + os.path.join(tools_path, "tool", "node", "bin") + + os.pathsep + + os.path.join(tools_path, "bin") + + os.pathsep + + current_path + ) + os.environ["JAVA_HOME"] = java_home + + os.environ["PATH"] = new_path + + +def process_config(): + script_dir = os.path.dirname(os.path.abspath(__file__)) + config_path = os.path.join(script_dir, 'config.json') + with open(config_path, 'r') as f: + config = json.load(f) + return config + + +def main(): + global configs + configs = process_config() + set_environment_variables() + run() if __name__ == "__main__":