增加HapBuild项目

Signed-off-by: ywx1281445 <yuandongping@huawei.com>
This commit is contained in:
ywx1281445 2023-12-16 11:59:27 +08:00
parent 176f7e3948
commit bbfee1202b
79 changed files with 18814 additions and 0 deletions

11
OAT.xml
View File

@ -150,6 +150,13 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filepath" name="code/BasicFeature/Native/NdkNativeWindow/screenshots/device/GetAvailableCount.jpg" desc="Provided by code/BasicFeature/Native/NdkNativeWindow"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkNativeWindow/screenshots/device/Main.jpg" desc="Provided by code/BasicFeature/Native/NdkNativeWindow"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkNativeWindow/screenshots/device/ProduceBuffer.jpg" desc="Provided by code/BasicFeature/Native/NdkNativeWindow"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/tool/sign_tool/OpenHarmonyProfileDebug.pem" desc="Provided by code/Project/HapBuild"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/tool/sign_tool/OpenHarmonyApplication.pem" desc="Provided by code/Project/HapBuild"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/tool/sign_tool/OpenHarmonyProfileRelease.pem" desc="Provided by code/Project/HapBuild"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/tool/hap-sign-tool.jar" desc="Provided by code/Project/HapBuild"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/tool/sign_tool/OpenHarmony.p12" desc="Provided by code/Project/HapBuild"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/resources/app1-signed.hap" desc="Provided by code/Project/HapBuild"/>
</filefilter>
<filefilter name="defaultPolicyFilter" desc="License文件头校验策略的过滤条件" >
<filteritem type="filename" name="oh-package.json5" desc="OpenHarmony工程编译入口脚本无需添加License头"/>
@ -157,6 +164,8 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filename" name="hvigorw.bat" desc="OpenHarmony工程编译配置文件无需添加License头"/>
<filteritem type="filename" name="hvigor-config.json5" desc="OpenHarmony工程编译配置文件无需添加License头"/>
<filteritem type="filename" name="hvigor-wrapper.js" desc="OpenHarmony工程编译配置文件无需添加License头"/>
<filteritem type="filepath" name="code/Project/HapBuild/test-tool/LinuxContains.py" desc="预测试工具配置文件无需添加License头"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/resources/echoHilog.bat" desc="预测试工具配置文件无需添加License头"/>
</filefilter>
<filefilter name="copyrightPolicyFilter" desc="Copyright文件头校验策略的过滤条件" >
<filteritem type="filename" name="oh-package.json5" desc="OpenHarmony工程编译入口脚本无需添加版权头"/>
@ -164,6 +173,8 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filename" name="hvigorw.bat" desc="OpenHarmony工程编译配置文件无需添加版权头"/>
<filteritem type="filename" name="hvigor-config.json5" desc="OpenHarmony工程编译配置文件无需添加版权头"/>
<filteritem type="filename" name="hvigor-wrapper.js" desc="OpenHarmony工程编译配置文件无需添加版权头"/>
<filteritem type="filepath" name="code/Project/HapBuild/test-tool/LinuxContains.py" desc="预测试工具配置文件,无需添加版权头"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/resources/echoHilog.bat" desc="预测试工具配置文件,无需添加版权头"/>
</filefilter>
</filefilterlist>
</oatconfig>

View File

@ -0,0 +1,89 @@
# 流水线预测试工具
## 介绍
本示例主要展示了流水线预测试工具的使用示例,主要介绍了自动化构建及测试的实现原理。
## 效果预览
![image](./screenshots/ciweb.png)
## 安装教程
按照[部署文档](./deplydoc.md)安装部署项目。
## 使用说明
1. 打开浏览器访问127.0.0.1:3000/swagger。
2. 在`/sn`下点击`Try it out`,再点击`Execute`,即可获得`/sn`接口返回的连接开发板的sn号。
3. 在`/hap-build/{PRId}`下点击`Try it out`输入想要构建、测试的PRId再点击`Execute`等待构建、测试任务结束可以看到接口返回构建和测试的结果同时在PR下方的评论区也会有评论。
## 工程目录
```
|-- ci
| |-- config.dev.ts
| `-- src
| |-- app.controller.ts // /sn接口
| |-- hap-build
| | |-- hap-build.controller.ts // /hap-build/{PRId}接口
| | `-- utils
| | |-- buildListProject.ts // 安装测试应用
| | |-- checkProjectIfInFull.ts // 判断涉及项目使用SDk类型
| | |-- editLinuxContains.ts // 修改配置文件
| | |-- getModifyFileList.ts // 下载PR修改文件
| | `-- getProjectPath.ts // 获取PR修改项目路径
| |-- main.ts
| `-- util
| `-- index.ts // 发送评论、执行脚本工具函数
|-- deplydoc.md // 部署文档
|-- screenshots // 文档截图
|-- test-tool
| |-- CombinationConfig.json // 联合测试应用列表
| |-- FA_Model_And_Lower_Case_List.json // FA模型应用列表
| |-- InstallAndTestSpecial_ci.py // 安装测试应用脚本
| |-- LinuxContains.py // 安装测试配置文件
| |-- install_list_capability.json // 特殊安装配置文件
| `-- special_list.json // 特殊安装应用列表
`-- compile-tool // 编译工具
|-- bin // 编译脚本
|-- config // 编译配置文件
`-- tool // 签名工具
```
## 具体实现
1. 执行hdc命令`hdc list targets`获取当前连接开发板sn号[源码参考](./ci/src/app.controller.ts)。
2. 使用gitee官方web hook读取PR修改文件列表并将修改写入本地sample仓中再根据修改文件路径找出对应的项目使用[编译工具](./compile-tool)中`compile-ohpm-ci.sh`脚本编译项目中的`entry`及`ohostest`包。
3. [InstallAndTestSpecial_ci.py](./test-tool//InstallAndTestSpecial_ci.py)脚本来安装entry包、ohosTest测试包以及拉起自动化测试用例。
## 相关权限
不涉及
## 依赖
- Ubuntu22.04.02 LTS
- Node16及以上
- Java jdk11
- Python3
## 约束与限制
本示例需要按照[部署文档](./deplydoc.md)成功搭建环境才可顺利运行。
## 下载
如需单独下载本工程,执行如下命令:
```
git init
git config core.sparsecheckout true
echo code/Project/HapBuild > .git/info/sparse-checkout
git remote add origin https://gitee.com/openharmony/applications_app_samples.git
git pull origin master
```

View File

@ -0,0 +1,25 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};

2
code/Project/HapBuild/ci/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules/
dist/

View File

@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const ACCESS_TOKEN = 'accessToken';
export const PROJECT_PATH = '/home/userName/HapBuild/compile-tool/projects/ut_samples_master';
export const CONFIG_PATH = '/home/userName/HapBuild/compile-tool/config/ut_samples_master.config';
export const COMPILE_SH_PATH = '/home/userName/HapBuild/compile-tool/bin/compile-ohpm-ci.sh';
export const SIGN_HAP_PATH = '/home/userName/HapBuild/compile-tool/out/ut_samples_master/full-sdk/hap-out-with-signed';
export const TEST_TOOL_PATH = '/home/userName/HapBuild/test-tool/InstallAndTestSpecial_ci.py';
export const CONTAINS_PATH = '/home/userName/HapBuild/test-tool/LinuxContains.py';
export const SIGN_FULL_PATH = '/home/userName/HapBuild/compile-tool/out/ut_samples_master/full-sdk/hap-out-with-signed/';
export const SIGN_PUBLIC_PATH = '/home/userName/HapBuild/compile-tool/out/ut_samples_master/public-sdk/hap-out-with-signed/';

View File

@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/nest-cli",
"collection": "@nestjs/schematics",
"sourceRoot": "src",
"compilerOptions": {
"deleteOutDir": true
}
}

14921
code/Project/HapBuild/ci/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
{
"name": "ci",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/mapped-types": "*",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^7.1.16",
"axios": "^1.6.2",
"node-fetch": "^2.6.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1",
"swagger-ui-express": "^5.0.0"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
"@nestjs/schematics": "^10.0.0",
"@nestjs/testing": "^10.0.0",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.5.0",
"prettier": "^3.0.0",
"source-map-support": "^0.5.21",
"supertest": "^6.3.3",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.3",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.1.3"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Test, TestingModule } from '@nestjs/testing';
import { AppController } from './app.controller';
import { AppService } from './app.service';
describe('AppController', () => {
let appController: AppController;
beforeEach(async () => {
const app: TestingModule = await Test.createTestingModule({
controllers: [AppController],
providers: [AppService],
}).compile();
appController = app.get<AppController>(AppController);
});
describe('root', () => {
it('should return "Hello World!"', () => {
expect(appController.getHello()).toBe('Hello World!');
});
});
});

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Controller, Get, Param } from '@nestjs/common';
import { AppService } from './app.service';
import { executeCommand, logger } from './util';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
@ApiTags('获取设备SN')
@Controller()
export class AppController {
constructor(private readonly appService: AppService) { }
@ApiOperation({
summary: '获取设备SN'
})
@Get('sn')
async findAll(): Promise<string> {
try {
let sn = await executeCommand('hdc list targets');
sn = sn.slice(1).slice(0, sn.length - 6);
if (sn.indexOf('Empty') !== -1) {
logger(AppController.name).log(`获取设备号失败,当前终端没有连接设备`);
return JSON.stringify({
status: 'failed',
sn: '',
msg: '当前终端没有连接设备'
});
};
logger(AppController.name).log(`获取设备号成功 ` + sn);
return JSON.stringify({
status: 'success',
sn,
msg: '获取设备号成功'
});
} catch (error) {
logger(AppController.name).log(`获取设备号失败 ` + JSON.stringify(error));
return JSON.stringify({
status: 'failed',
sn: '',
msg: `获取设备号失败 ` + JSON.stringify(error)
});
};
}
}

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { HapBuildModule } from './hap-build/hap-build.module';
@Module({
imports: [HapBuildModule],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@nestjs/common';
@Injectable()
export class AppService {
getHello(): string {
return 'Hello World!';
}
}

View File

@ -0,0 +1,16 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class CreateHapBuildDto {}

View File

@ -0,0 +1,19 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PartialType } from '@nestjs/mapped-types';
import { CreateHapBuildDto } from './create-hap-build.dto';
export class UpdateHapBuildDto extends PartialType(CreateHapBuildDto) {}

View File

@ -0,0 +1,16 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export class HapBuild {}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Test, TestingModule } from '@nestjs/testing';
import { HapBuildController } from './hap-build.controller';
import { HapBuildService } from './hap-build.service';
describe('HapBuildController', () => {
let controller: HapBuildController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [HapBuildController],
providers: [HapBuildService],
}).compile();
controller = module.get<HapBuildController>(HapBuildController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { HapBuildService } from './hap-build.service';
import { CreateHapBuildDto } from './dto/create-hap-build.dto';
import { UpdateHapBuildDto } from './dto/update-hap-build.dto';
import { getModifyFilelist } from './utils/getModifyFileList';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
@ApiTags('编译App hap')
@Controller('hap-build')
export class HapBuildController {
constructor(private readonly hapBuildService: HapBuildService) { }
@Get(':PRId')
getFilelist(@Param('PRId') PRId: number) {
return getModifyFilelist(PRId);
}
}

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Module } from '@nestjs/common';
import { HapBuildService } from './hap-build.service';
import { HapBuildController } from './hap-build.controller';
@Module({
controllers: [HapBuildController],
providers: [HapBuildService],
})
export class HapBuildModule {}

View File

@ -0,0 +1,33 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Test, TestingModule } from '@nestjs/testing';
import { HapBuildService } from './hap-build.service';
describe('HapBuildService', () => {
let service: HapBuildService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [HapBuildService],
}).compile();
service = module.get<HapBuildService>(HapBuildService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Injectable } from '@nestjs/common';
import { CreateHapBuildDto } from './dto/create-hap-build.dto';
import { UpdateHapBuildDto } from './dto/update-hap-build.dto';
@Injectable()
export class HapBuildService {
create(createHapBuildDto: CreateHapBuildDto) {
return 'This action adds a new hapBuild';
}
findAll() {
return `This action returns all hapBuild`;
}
findOne(id: number) {
return `This action returns a #${id} hapBuild`;
}
update(id: number, updateHapBuildDto: UpdateHapBuildDto) {
return `This action updates a #${id} hapBuild`;
}
remove(id: number) {
return `This action removes a #${id} hapBuild`;
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { executeCommand } from "src/util";
import { CONFIG_PATH, COMPILE_SH_PATH, TEST_TOOL_PATH, PROJECT_PATH } from 'config.dev';
import { editLinuxContains } from "./editLinuxContains";
import { commitPRRequest } from '../../util/index';
interface TestResultProps {
successNum?: string;
failNum?: string;
diedNum?: string;
specialNum?: string;
testNum?: string;
testSuccessNum?: string;
testFailNum?: string;
testErrorNum?: string
};
export async function buildListProject(PRId: number, projectPath: Array<string>) {
let resultArray: Array<string> = [];
let result: string = '';
await executeCommand('cd ~');
for (const item of projectPath) {
result = await executeCommand(`${COMPILE_SH_PATH} --p=${CONFIG_PATH} --compile_dir=${item}`);
if (result.includes('hap_build success')) {
resultArray.push(item + ' build success!\n');
} else {
resultArray.push(item + ' build fail!\n');
};
// 测试
editLinuxContains(item);
const testResult: string = await executeCommand(`python3 ${TEST_TOOL_PATH}`);
const textResultObj: TestResultProps = {} as TestResultProps;
('successNum' + testResult.split('successNum')[1]).replace(/[\n\r]/g, '').split(' ').forEach(val => {
const [key, value] = val.split(':');
textResultObj[key] = value;
});
if (textResultObj.successNum == '1') {
resultArray.push(item + ' test success!\n');
} else {
resultArray.push(item + ' test fail!\n');
};
console.log(resultArray);
}
console.log(resultArray);
let comment = resultArray.join('');
commitPRRequest(PRId, comment);
return resultArray;
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CONFIG_PATH } from 'config.dev';
const fs = require('fs');
interface ConfigType {
name?: string,
url?: string,
branch?: string,
fullSdkAssembleList?: string,
basicSignList?: string,
coreSignList?: string
systemAppList?: string
};
function checkProjectIfInFull(projectName: string) {
try {
const config: ConfigType = {};
const configContent = fs.readFileSync(CONFIG_PATH, 'utf8');
configContent.split('\n').forEach((line: string) => {
if (line.trim() !== '') {
const [key = '', value = ''] = line.split('=');
config[key.trim()] = value.trim();
};
});
const fullSdkAssembleList: string[] = config.fullSdkAssembleList.split(';');
return fullSdkAssembleList.includes(projectName);
} catch (e) {
return false;
};
}
export { checkProjectIfInFull };

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { CONTAINS_PATH, SIGN_FULL_PATH, SIGN_PUBLIC_PATH } from 'config.dev';
import { checkProjectIfInFull } from "./checkProjectIfInFull"
const fs = require('fs');
interface ContainsType {
SIGN_HAP_PATH?: string;
FA_MODAL_AND_LOWER_CASE_LIST?: string;
INSTALL_LIST_CAPABILITY?: string;
SAVE_XML_PATH?: string;
COMBIN_CONFIG?: string;
SPECIAL_LIST?: string;
SPECIAL_HAP?: string;
TARGET_PATH?: string;
};
function editLinuxContains(targetPath: string) {
try {
const config: ContainsType = {};
const configContent = fs.readFileSync(CONTAINS_PATH, 'utf8');
configContent.trim().split('\n').forEach((line: string) => {
if (line.trim() !== '') {
const [key = '', value = ''] = line.split('=');
config[key.trim()] = value.trim();
};
});
if (checkProjectIfInFull(targetPath)) {
config.SIGN_HAP_PATH = `r'${SIGN_FULL_PATH}'`;
} else {
config.SIGN_HAP_PATH = `r'${SIGN_PUBLIC_PATH}'`;
};
const target = targetPath.split('/').join('_');
config.TARGET_PATH = `r'${target}'`;
console.log(Object.entries(config).length);
const updatedConfigContent = Object.entries(config).map(([key, value]) => `${key} = ${value}`).join('\n');
fs.writeFileSync(CONTAINS_PATH, updatedConfigContent);
return {
status: true,
msg: ''
};
} catch (e) {
return {
status: false,
msg: JSON.stringify(e)
};
};
}
export { editLinuxContains };

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { getProjectPath } from '../utils/getProjectPath';
import { logger, executeCommand } from 'src/util';
import { ACCESS_TOKEN, PROJECT_PATH } from 'config.dev';
const fetch = require('node-fetch');
const fs = require('fs');
async function getModifyFilelist(PRId: number) {
console.log(PRId);
const axios = require('axios');
const owner = 'OpenHarmony';
const repo = 'applications_app_samples';
let filesModify = [];
// 重置本地代码
let re1 = await executeCommand('git fetch --all', PROJECT_PATH);
let re2 = await executeCommand('git reset --hard origin/master', PROJECT_PATH);
let re3 = await executeCommand('git pull', PROJECT_PATH);
await axios.get(`https://gitee.com/api/v5/repos/${owner}/${repo}/pulls/${PRId}/files?access_token=${ACCESS_TOKEN}`)
.then((response: { data: any }) => {
response.data.forEach(async (item: { raw_url: string, filename: string, patch: { new_path: string } }) => {
console.log(JSON.stringify(item.patch.new_path));
// 获取修改代码源文件
const dirArr = item.filename.split('/');
const savePath = PROJECT_PATH + '/' + item.filename;
if (dirArr.length >= 2) {
let dir = PROJECT_PATH + '/' + dirArr[0]
for (let i = 1; i < dirArr.length; i++) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir)
}
dir += ('/' + dirArr[i])
}
}
fetch(item.raw_url).then(res => {
const dest = fs.createWriteStream(savePath)
res.body.pipe(dest)
}).catch(err => {
logger('GetModifyFile').log(`保存文件失败err: ${JSON.stringify(err)}`);
})
filesModify.push(item.patch.new_path);
})
return filesModify;
})
.catch((error: any) => {
console.log(JSON.stringify(error))
return JSON.stringify(error)
})
console.log(filesModify)
return getProjectPath(PRId, filesModify);
}
export { getModifyFilelist }

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { buildListProject } from "./buildListProject";
import { PROJECT_PATH } from "config.dev";
function getProjectPath(PRId: number, modifyPath: Array<string>) {
let projectPath = [];
const fs = require('fs');
modifyPath.forEach((item: string) => {
let iteraterArray = item.split('/');
let pathString = '';
for (let i = 0; i < iteraterArray.length; i++) {
if (!fs.existsSync(PROJECT_PATH + pathString + '/build-profile.json5')) {
pathString = `${pathString}/${iteraterArray[i]}`;
} else if (!projectPath.includes(pathString.substring(1))) {
pathString = pathString.substring(1);
projectPath.push(pathString);
break;
};
};
});
console.log('PR修改文件的项目路径是 ');
console.log(projectPath);
return buildListProject(PRId, projectPath);
}
export { getProjectPath };

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const options = new DocumentBuilder()
.setTitle('流水线 HapBuild')
.setDescription('自动化拉取,构建,测试')
.setVersion('1.0')
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('swagger', app, document);
await app.listen(3000);
}
bootstrap();

View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Logger } from '@nestjs/common';
import { exec } from 'child_process';
import axios from 'axios';
import { ACCESS_TOKEN, PROJECT_PATH } from 'config.dev';
const FormData = require('form-data');
// 日志打印
const logger = (appName: string): Logger => new Logger(appName, { timestamp: true });
// 执行命令行
const executeCommand = (command: string, cwd: string = './'): Promise<string> => {
return new Promise((resolve, reject) => {
exec(command, { cwd }, (error, stdout, stderr) => {
if (error) {
logger('Command').error(JSON.stringify(error));
reject(error);
} else {
logger('Command').log(JSON.stringify(stdout));
resolve(JSON.stringify(stdout));
}
});
});
};
const apiUrl = 'https://gitee.com/api/v5';
const owner = 'OpenHarmony';
const repo = 'applications_app_samples';
// 根据PR号获取
const getPRRequest = async (prNumber: string) => {
try {
const getPRUrl = `${apiUrl}/repos/${owner}/${repo}/pulls/${prNumber}`;
const response = await axios.get(getPRUrl, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${ACCESS_TOKEN}`
}
});
logger('GetPR').log('获取PR成功 ');
return response.data;
} catch (error) {
logger('GetPR').error('获取PR失败 ' + JSON.stringify(error));
}
}
const pullPRCode = async (prNumber: string) => {
let PRMsg
try {
PRMsg = await getPRRequest(prNumber);
} catch (error) {
logger('pullPRCode').error('获取PR失败');
return {
status: 'failed',
msg: '获取PR失败' + JSON.stringify(error)
};
}
let msg = '';
try {
await executeCommand(`git remote add ${prNumber} git@gitee.com:${PRMsg.user.login}/${PRMsg.head.repo.path}.git`, '../../applications_app_samples');
await executeCommand(`git fetch ${prNumber}`, '../../applications_app_samples');
await executeCommand(`git checkout ${prNumber}/${PRMsg.head.ref}`, '../../applications_app_samples');
logger('pullPRCode').log('拉取PR代码成功');
msg = '拉取PR代码成功';
} catch (error) {
logger('pullPRCode').error('拉取PR代码失败 ' + JSON.stringify(error));
msg = '拉取PR代码失败 ' + JSON.stringify(error);
}
return {
status: 'success',
msg
};
}
// 评论指定PR
const commitPRRequest = async (prNumber: number, content: string) => {
const commitPRUrl = `${apiUrl}/repos/${owner}/${repo}/pulls/${prNumber}/comments`;
const form = new FormData();
form.append('access_token', ACCESS_TOKEN);
form.append('body', content);
return axios.post(commitPRUrl, form, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(response => {
if (response.status === 201) {
logger('CommitPR').log('评论指定PR成功');
return {
status: 'success'
};
}
logger('CommitPR').log('评论指定PR失败');
return {
status: 'failed'
};
}, error => { });
}
export {
executeCommand,
logger,
getPRRequest,
commitPRRequest,
pullPRCode
};

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
});
});

View File

@ -0,0 +1,9 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
}
}

View File

@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
}

View File

@ -0,0 +1,21 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2021",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false
}
}

View File

@ -0,0 +1,4 @@
/out
/projects
/sdk*

View File

@ -0,0 +1,696 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
CUR_PATH=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
BASE_PATH=$(dirname ${CUR_PATH})
#时间统计
startTime=`date +%Y%m%d-%H:%M:%S`
startTime_s=`date +%s`
#npm
npm config set @ohos:registry=https://repo.harmonyos.com/npm/
#ohpm
#ohpm config set @ohos:registry=https://repo.harmonyos.com/ohpm/
TEST_HAP_PATH=entry/build/default/outputs/ohosTest/entry-ohosTest-unsigned.hap
HAP_PATH=entry/build/default/outputs/default/entry-default-unsigned.hap
STAGE_TEST_HAP_PATH=product/build/default/outputs/ohosTest/product-ohosTest-unsigned.hap
STAGE_HAP_PATH=product/build/default/outputs/default/product-default-unsigned.hap
TIME=16
RESOLVE=0
arg_sign="true"
arg_sdk_path=${BASE_PATH}/sdk
arg_full_sdk_path=${BASE_PATH}/sdk-full
arg_help="0"
arg_compile_dir=""
arg_jdk=""
arg_node=""
arg_ohpm="false"
arg_p=""
url=""
tag_url='url='
name=""
tag_name='name='
branch=""
tag_branch='branch='
full_list=()
tag_full_list='fullSdkAssembleList='
basic_list=()
tag_basic_list='basicSignList='
core_list=()
tag_core_list='coreSignList='
system_app_list=()
tag_system_app_list='systemAppList='
normal_list=()
public_list=()
#没测试用例
simple_list=()
function print_help() {
cat <<EOF
use assembleHap [options] <mainclass> [args...]
--p=config path
--sign=true/false - Whether the signature (default:$arg_sign)
--sdk_path=[public sdk absolute address] (default:$arg_sdk_path)
--full_sdk_path=[full sdk absolute address] (default:$arg_full_sdk_path)
--ohpm=true/false -whether use ohpm (default:$arg_ohpm)
--help - prints help screen
EOF
}
function parse_arguments() {
local helperKey="";
local helperValue="";
local current="";
while [ "$1" != "" ]; do
current=$1;
helperKey=${current#*--};
helperKey=${helperKey%%=*};
helperKey=$(echo "$helperKey" | tr '-' '_');
helperValue=${current#*=};
if [ "$helperValue" == "$current" ]; then
helperValue="1";
fi
# echo "eval arg_$helperKey=\"$helperValue\"";
eval "arg_$helperKey=\"$helperValue\"";
shift
done
}
parse_arguments ${@};
if [ "$arg_help" != "0" ]; then
print_help;
exit 1;
fi
if [ "$arg_p" == "" ]; then
echo "--p cannot be empty"
exit 1
fi
if [ "$arg_jdk" != "" ]; then
export JAVA_HOME=${arg_jdk}
export PATH=$JAVA_HOME/bin:$PATH
fi
if [ "$arg_node" != "" ]; then
export NODE_HOME=${arg_node}
export PATH=$NODE_HOME:$PATH
fi
function clear_dir(){
if [ ! -d "$1" ]; then
mkdir -p $1
else
rm -rf $1/*
fi
}
function clear_file(){
if [ -f "$1" ]; then
rm $1
fi
touch $1
}
function del_dir(){
if [ -d "$1" ]; then
rm -rf $1/*
fi
}
function del_file(){
if [ -f "$1" ]; then
rm $1
fi
}
function is_project_root(){
if [[ -f $1"/build-profile.json5" && -f $1"/hvigorfile.js" ]] || [[ -f $1"/build-profile.json5" && -f $1"/hvigorfile.ts" ]]; then
while read line
do
if [[ ${line} =~ "srcPath" ]]; then
pa=${line%\"*}
pa=${pa##*\".}
if [ -d "$1/AppScope" ]; then
is_entry=`cat $1${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"entry\""`
is_feature=`cat $1${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
if [[ -d $1${pa}"/src/ohosTest" ]]; then
return 0
fi
fi
else
is_entry=`cat $1${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"entry\""`
is_feature=`cat $1${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
if [[ -d $1${pa}"/src/ohosTest" ]]; then
return 0
fi
fi
fi
fi
done < $1"/build-profile.json5"
return 1
else
return 2
fi
}
function read_project(){
if [ -d "$1" ]
then
# 是项目工程根目录则记录当前路径 否则递归判断
is_project_root $1
res=$?
if [ ${res} -eq 0 ]; then
public_list[${#public_list[*]}]=${1#*compile-tool/projects/${name}/}
elif [ ${res} -eq 1 ]; then
simple_list[${#simple_list[*]}]=${1#*compile-tool/projects/${name}/}
elif [ ${res} -eq 2 ]; then
for file in `ls $1`
do
read_project "${1}/${file}"
done
fi
fi
}
function exclude_full_project(){
if [ ${#full_list[*]} -eq 0 ]; then
return
fi
diff_list=()
full_true_list=()
f=0
t=0
flag=0
for item1 in "${public_list[@]}"; do
for item2 in "${full_list[@]}"; do
if [[ "${item1}" == "${item2}" ]]; then
full_true_list[f]=${item2}
f=$((f+1))
flag=1
break
fi
done
if [ ${flag} -eq 0 ]; then
diff_list[t]=${item1}
t=$((t+1))
else
flag=0
fi
done
public_list=(${diff_list[@]})
full_list=(${full_true_list[@]})
echo "use public sdk project numbers = "${#public_list[@]}
echo "use full sdk project numbers = "${#full_list[@]}
}
function del_module_name(){
local name=${1}
for i in "${!module_name[@]}"
do
if [[ "${module_name[i]}" == "${name}" ]]; then
unset module_name[i]
echo "移除"${name}" , 剩余 : "${module_name[@]} >> ${compile_result_error}/${hap}".log" 2>&1
return 0
fi
done
return 1
}
function load_dep(){
local cur_m_n=${1}
local cur_module
for cur_module in ${module_list[@]}
do
if [[ "${cur_module}" =~ "${cur_m_n}" ]]; then
del_module_name ${cur_m_n}
for m_n_1 in ${module_name[@]}
do
rr=$(cat ${cur_module}"/package.json" | grep "${m_n_1}")
if [[ "${rr}" != "" ]]; then
load_dep ${m_n_1}
fi
done
cd ${cur_module}
echo ${cur_module}" 执行npm install" >> ${compile_result_error}/${hap}".log" 2>&1
npm i >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
}
function load_oh_dep(){
local cur_m_n=${1}
local cur_module
for cur_module in ${module_list[@]}
do
if [[ "${cur_module}" =~ "${cur_m_n}" ]]; then
del_module_name ${cur_m_n}
for m_n_1 in ${module_name[@]}
do
rr=$(cat ${cur_module}"/oh-package.json5" | grep "${m_n_1}")
if [[ "${rr}" != "" ]]; then
load_oh_dep ${m_n_1}
fi
done
cd ${cur_module}
echo ${cur_module}" 执行ohpm install" >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -e "oh-package.json5" ]]; then
ohpm i >> ${compile_result_error}/${hap}".log" 2>&1
else
ohpm init >> ${compile_result_error}/${hap}".log" 2>&1
ohpm install >> ${compile_result_error}/${hap}".log" 2>&1
fi
fi
done
}
function compile(){
# echo "compile $1"
hap=${1////_}
project_path=${BASE_PATH}/projects/${name}/${1}
compile_result=${2}
compile_result_error=${3}
nosign_hap_result=${4}
compile_result_success=${5}
if [ ! -d "${project_path}" ]; then
echo "${project_path} 路径不存在"
return
fi
if [ -e "${project_path}/local.properties" ]; then
rm ${project_path}"/local.properties"
fi
# echo "sdk.dir="${arg_full_sdk_path} >> ${project_path}"/local.properties" 2>&1
cd ${project_path}
if [[ -e "${project_path}/package.json" ]]; then
sed -i 's/\"@ohos\/hypium\".*\.[0-9]*\"/\"@ohos\/hypium\": \"1.0.3\"/g' ./package.json
sed -i 's/\"@ohos\/hvigor-ohos-plugin\".*\.[0-9]*\"/\"@ohos\/hvigor-ohos-plugin\": \"1.3.1\"/g' ./package.json
sed -i 's/\"@ohos\/hvigor\".*\.[0-9]*\"/\"@ohos\/hvigor\": \"1.3.1\"/g' ./package.json
fi
module_list=()
module_name=()
out_module=()
bundle_name=""
while read line
do
if [[ ${line} =~ "srcPath" ]]; then
pa=${line%\"*}
pa=${pa##*\".}
module_list[${#module_list[*]}]=${project_path}${pa}
del_dir ${project_path}${pa}/node_modules
del_file ${project_path}${pa}/package-lock.json
del_dir ${project_path}${pa}/oh_modules
del_file ${project_path}${pa}/oh-package-lock.json5
module_name[${#module_name[*]}]=${pa}
if [ -d "${project_path}/AppScope" ]; then
cur_bundle_line=`cat ${project_path}/AppScope/app.json5 | grep "\"bundleName\""`
bundle_name=${cur_bundle_line%\"*}
bundle_name=${bundle_name##*\"}
# echo "bundleName : "${bundle_name}
is_entry=`cat ${project_path}${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"entry\""`
is_feature=`cat ${project_path}${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
echo "hap输出module: "${project_path}${pa} >> ${compile_result_error}/${hap}".log" 2>&1
out_module[${#out_module[*]}]=${project_path}${pa}
fi
else
cur_bundle_line=`cat ${project_path}${pa}/src/main/config.json | grep "\"bundleName\""`
bundle_name=${cur_bundle_line%\"*}
bundle_name=${bundle_name##*\"}
# echo "bundleName : "${bundle_name}
is_entry=`cat ${project_path}${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"entry\""`
is_feature=`cat ${project_path}${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
echo "hap输出module: "${project_path}${pa} >> ${compile_result_error}/${hap}".log" 2>&1
out_module[${#out_module[*]}]=${project_path}${pa}
fi
fi
fi
done < ${project_path}"/build-profile.json5"
if [[ -e "${project_path}/oh-package.json5" ]]; then #如果是ohpm包管理方式
for module in ${module_list[@]}
do
del_module_name ${module##${project_path}}
if [ $? -eq 0 ]; then
for m_n in ${module_name[@]}
do
echo "查找 ${m_n} 是否是${module} 的依赖" >> ${compile_result_error}/${hap}".log" 2>&1
rr=$(cat ${module}"/oh-package.json5" | grep "${m_n}")
if [[ "${rr}" != "" ]]; then
echo "处理循环依赖 : "${m_n} >> ${compile_result_error}/${hap}".log" 2>&1
load_oh_dep ${m_n}
fi
done
cd ${module}
echo ${module}" 执行ohpm install" >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -e "oh-package.json5" ]]; then
ohpm i >> ${compile_result_error}/${hap}".log" 2>&1
else
ohpm init >> ${compile_result_error}/${hap}".log" 2>&1
ohpm install >> ${compile_result_error}/${hap}".log" 2>&1
fi
fi
done
else
for module in ${module_list[@]}
do
del_module_name ${module##${project_path}}
if [ $? -eq 0 ]; then
for m_n in ${module_name[@]}
do
echo "查找 ${m_n} 是否是${module} 的依赖" >> ${compile_result_error}/${hap}".log" 2>&1
rr=$(cat ${module}"/package.json" | grep "${m_n}")
if [[ "${rr}" != "" ]]; then
echo "处理循环依赖 : "${m_n} >> ${compile_result_error}/${hap}".log" 2>&1
load_dep ${m_n}
fi
done
cd ${module}
echo ${module}" 执行npm install" >> ${compile_result_error}/${hap}".log" 2>&1
npm i >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
fi
cd ${project_path}
del_dir ${project_path}/node_modules
del_dir ${project_path}/oh_modules
del_file ${project_path}/package-lock.json
del_file ${project_path}/oh-package-lock.json5
echo ${project_path}" 执行npm install" >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -e "${project_path}/oh-package.json5" ]]; then
ohpm i >> ${compile_result_error}/${hap}".log" 2>&1
chmod +x hvigorw
./hvigorw clean --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
else
npm install >> ${compile_result_error}/${hap}".log" 2>&1
node ./node_modules/@ohos/hvigor/bin/hvigor.js clean --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
fi
rm -rf ${project_path}/sign_tool
cp -r ${BASE_PATH}/tool/sign_tool ${project_path}
cd ${project_path}/sign_tool
if [[ $(echo ${basic_list[@]} | grep "${hap//_//}") != "" ]]; then
echo "${hap} 使用basic签名" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"normal\"/\"system_basic\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
elif [[ $(echo ${core_list[@]} | grep "${hap//_//}") != "" ]]; then
echo "${hap} 使用core签名" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"normal\"/\"system_core\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
fi
if [[ $(echo ${system_app_list[@]} | grep "${hap//_//}") != "" ]]; then
echo "${hap} 系统应用" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"hos_normal_app\"/\"hos_system_app\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
fi
if [ "${bundle_name}" != "" ]; then
echo "bundleName = ${bundle_name}" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"com.OpenHarmony.app.test\"/\"${bundle_name}\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
fi
sign_hap_num=0
for module in ${out_module[@]}
do
cd ${project_path}
cur_out_module_name=${module##*/}
if [[ -e "${project_path}/oh-package.json5" ]]; then
chmod +x hvigorw
./hvigorw --mode module -p module=${cur_out_module_name} assembleHap --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -d ${module}"/src/ohosTest" ]]; then
./hvigorw --mode module -p module=${cur_out_module_name}@ohosTest assembleHap --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
fi
else
node ./node_modules/@ohos/hvigor/bin/hvigor.js --mode module -p module=${cur_out_module_name} assembleHap --no-daemon>> ${compile_result_error}/${hap}".log" 2>&1
if [[ -d ${module}"/src/ohosTest" ]]; then
node ./node_modules/@ohos/hvigor/bin/hvigor.js --mode module -p module=${cur_out_module_name}@ohosTest assembleHap --no-daemon>> ${compile_result_error}/${hap}".log" 2>&1
fi
fi
is_sign=false
echo "module = ${module} , cur_out_module_name=${cur_out_module_name}" >> ${compile_result_error}/${hap}".log" 2>&1
if [ ! -d ${module}/build/default/outputs/default/ -o ! -d ${module}/build/default/outputs/ohosTest/ -a -d ${module}"/src/ohosTest" ]; then
echo "module = ${module}, assembleHap error !!!" >> ${compile_result_error}/${hap}".log" 2>&1
continue
fi
sign_hap_path=""
test_sign_hap_path=""
nosign_hap_path=""
test_nosign_hap_path=""
for out_file in `ls ${module}/build/default/outputs/default/`
do
if [[ "${out_file}" =~ "-unsigned.hap" ]]; then
echo "发现unsigned包 : "${out_file}",开始使用签名工具签名" >> ${compile_result_error}/${hap}".log" 2>&1
nosign_hap_path=${module}/build/default/outputs/default/${out_file}
sign_hap_path=${module}/build/default/outputs/default/${out_file/unsigned/signed}
cd ${project_path}/sign_tool
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-profile -keyAlias "openharmony application profile release" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "OpenHarmonyProfileRelease.pem" -inFile "UnsgnedReleasedProfileTemplate.json" -keystoreFile "OpenHarmony.p12" -outFile "openharmony_sx.p7b" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-app -keyAlias "openharmony application release" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "OpenHarmonyApplication.pem" -profileFile "openharmony_sx.p7b" -inFile "${nosign_hap_path}" -keystoreFile "OpenHarmony.p12" -outFile "${sign_hap_path}" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
if [[ -d ${module}"/src/ohosTest" ]]; then
for out_file in `ls ${module}/build/default/outputs/ohosTest/`
do
if [[ "${out_file}" =~ "-unsigned.hap" ]]; then
echo "发现unsigned包 : "${out_file}",开始使用签名工具签名" >> ${compile_result_error}/${hap}".log" 2>&1
test_nosign_hap_path=${module}/build/default/outputs/ohosTest/${out_file}
test_sign_hap_path=${module}/build/default/outputs/ohosTest/${out_file/unsigned/signed}
cd ${project_path}/sign_tool
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-profile -keyAlias "openharmony application profile release" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "OpenHarmonyProfileRelease.pem" -inFile "UnsgnedReleasedProfileTemplate.json" -keystoreFile "OpenHarmony.p12" -outFile "openharmony_sx.p7b" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-app -keyAlias "openharmony application release" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "OpenHarmonyApplication.pem" -profileFile "openharmony_sx.p7b" -inFile "${test_nosign_hap_path}" -keystoreFile "OpenHarmony.p12" -outFile "${test_sign_hap_path}" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
fi
if [[ ${sign_hap_path} != "" && -f ${sign_hap_path} && ( -f ${test_sign_hap_path} || ! -d ${module}"/src/ohosTest") ]]; then
cp ${sign_hap_path} ${compile_result}/${hap}_${cur_out_module_name}_signed.hap
cp ${nosign_hap_path} ${nosign_hap_result}/${hap}_${cur_out_module_name}_signed.hap
if [[ -d ${module}"/src/ohosTest" ]]; then
cp ${test_sign_hap_path} ${compile_result}/${hap}_${cur_out_module_name}_ohosTest_signed.hap
cp ${test_nosign_hap_path} ${nosign_hap_result}/${hap}_${cur_out_module_name}_ohosTest_signed.hap
fi
sign_hap_num=$(expr ${sign_hap_num} + 1)
echo "${module} assembleHap success !!!" >> ${compile_result_error}/${hap}".log" 2>&1
else
echo "${module} assembleHap error !!!" >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
if [[ ${#out_module[@]} == ${sign_hap_num} ]]; then
#rm ${compile_result_error}/${hap}".log"
mv ${compile_result_error}/${hap}.log ${compile_result_success}/${hap}.log
echo "success compile ${hap} !!! "
else
echo "error compile ${hap} QwQ ,log at ${compile_result_error}/${hap}.log"
fi
}
function compile_project(){
echo "use public sdk compile..."
project_path=${1}
project_name=${2}
COMPILE_RESULT=${BASE_PATH}/out/${project_name}/public-sdk/hap-out-with-nosigned
COMPILE_RESULT_ERROR=${BASE_PATH}/out/${project_name}/public-sdk/compile-error-log
COMPILE_RESULT_SUCCESS=${BASE_PATH}/out/${project_name}/public-sdk/compile-success-log
SIGN_RESULT=${BASE_PATH}/out/${project_name}/public-sdk/hap-out-with-signed
clear_dir $COMPILE_RESULT
clear_dir $COMPILE_RESULT_ERROR
clear_dir $COMPILE_RESULT_SUCCESS
clear_dir $SIGN_RESULT
export OHOS_SDK_HOME=${arg_sdk_path}
export OHOS_BASE_SDK_HOME=${arg_sdk_path}
echo "OHOS_SDK_HOME="${OHOS_SDK_HOME}
echo "OHOS_BASE_SDK_HOME="${OHOS_BASE_SDK_HOME}
EOF=0
curr=0
while [ $EOF -ne 1 ]; do
for ((i=1; i<=$TIME; i++)); do
if [ ${curr} -eq ${#public_list[@]} ]; then
EOF=1
break
fi
compile ${public_list[$curr]} ${SIGN_RESULT} ${COMPILE_RESULT_ERROR} ${COMPILE_RESULT} ${COMPILE_RESULT_SUCCESS} &
curr=$((curr+1))
done
wait
done
}
function compile_project_full(){
echo "use full sdk compile..."
project_path=${1}
project_name=${2}
COMPILE_RESULT=${BASE_PATH}/out/${project_name}/full-sdk/hap-out-with-nosigned
COMPILE_RESULT_ERROR=${BASE_PATH}/out/${project_name}/full-sdk/compile-error-log
COMPILE_RESULT_SUCCESS=${BASE_PATH}/out/${project_name}/full-sdk/compile-success-log
SIGN_RESULT=${BASE_PATH}/out/${project_name}/full-sdk/hap-out-with-signed
clear_dir $COMPILE_RESULT
clear_dir $COMPILE_RESULT_ERROR
clear_dir $COMPILE_RESULT_SUCCESS
clear_dir $SIGN_RESULT
export OHOS_SDK_HOME=${arg_full_sdk_path}
export OHOS_BASE_SDK_HOME=${arg_full_sdk_path}
echo "OHOS_SDK_HOME="${OHOS_SDK_HOME}
echo "OHOS_BASE_SDK_HOME="${OHOS_BASE_SDK_HOME}
EOF=0
curr=0
while [ $EOF -ne 1 ]; do
for ((i=1; i<=$TIME; i++)); do
if [ ${curr} -eq ${#full_list[@]} ]; then
EOF=1
break
fi
compile ${full_list[$curr]} ${SIGN_RESULT} ${COMPILE_RESULT_ERROR} ${COMPILE_RESULT} ${COMPILE_RESULT_SUCCESS} &
curr=$((curr+1))
done
wait
done
}
function load(){
project_url=${1}
project_branch=${2}
project_name=${3}
# if test -d ${BASE_PATH}/projects/${project_name}
# then
# echo "${project_name} exists,ready for update..."
# cd ${BASE_PATH}/projects/${project_name}
# git reset --hard origin/${project_branch}
# git checkout -b ${project_branch} origin/${project_branch}
# git checkout ${project_branch}
# git lfs fetch origin ${project_branch}
# git pull
# else
# echo "${project_name} dose not exist,ready to download..."
# if [ ! -d ${BASE_PATH}/projects ]; then
# mkdir -p ${BASE_PATH}/projects
# fi
# cd ${BASE_PATH}/projects
# git lfs clone -b ${project_branch} ${project_url} ${project_name}
# git checkout -b ${project_branch} origin/${project_branch}
# fi
if [ -d "${BASE_PATH}/projects/${project_name}/${arg_compile_dir}" ]; then
read_project ${BASE_PATH}/projects/${project_name}/${arg_compile_dir}
exclude_full_project
compile_project ${BASE_PATH}/projects/${project_name} ${project_name}
compile_project_full ${BASE_PATH}/projects/${project_name} ${project_name}
fi
}
while read line
do
if [[ ${line} == ${tag_url}* ]]; then
url=${line##*${tag_url}}
elif [[ ${line} == ${tag_branch}* ]]; then
branch=${line##*${tag_branch}}
elif [[ ${line} == ${tag_name}* ]]; then
name=${line##*${tag_name}}
elif [[ ${line} == ${tag_full_list}* ]]; then
temp_string=${line##*${tag_full_list}}
full_list=(${temp_string//;/ })
elif [[ ${line} == ${tag_basic_list}* ]]; then
temp_string=${line##*${tag_basic_list}}
basic_list=(${temp_string//;/ })
elif [[ ${line} == ${tag_core_list}* ]]; then
temp_string=${line##*${tag_core_list}}
core_list=(${temp_string//;/ })
elif [[ ${line} == ${tag_system_app_list}* ]]; then
temp_string=${line##*${tag_system_app_list}}
system_app_list=(${temp_string//;/ })
fi
done < ${arg_p}
load ${url} ${branch} ${name}
endTime=`date +%Y%m%d-%H:%M:%S`
endTime_s=`date +%s`
sumTime=$[ $endTime_s - $startTime_s ]
# echo "$startTime ---> $endTime" "耗时:$sumTime seconds"
# echo "| public-sdk--|-------------|-------------|-------------|-------------|-------------"
# echo "| 仓库 | 项目数量 | 成功数量 | 失败数量 | Hap数量 | 签名成功 "
# echo "|-------------|-------------|-------------|-------------|-------------"
# echo "| ${name} | ${#public_list[@]} | $(ls -l ${BASE_PATH}/out/${name}/public-sdk/compile-success-log|grep "^-"|wc -l) | $(ls -l ${BASE_PATH}/out/${name}/public-sdk/compile-error-log|grep "^-"|wc -l) | "`expr $(ls -l ${BASE_PATH}/out/${name}/public-sdk/hap-out-with-nosigned|grep "^-"|wc -l) / 2`" | "`expr $(ls -l ${BASE_PATH}/out/${name}/public-sdk/hap-out-with-signed|grep "^-"|wc -l) / 2`
# if (( $(ls -l ${BASE_PATH}/out/${name}/public-sdk/compile-error-log|grep "^-"|wc -l) > 0 )); then
# echo "| 失败项目列表|-------------|-------------|-------------|-------------|-------------"
# for z in `ls ${BASE_PATH}/out/${name}/public-sdk/compile-error-log`
# do
# z=${z//_//}
# z=${z%.log}
# echo "| "${z}" |"
# done
# fi
# echo "| 失败项目日志汇总地址|-------------|-------------|-------------|-------------------"
# echo "| ${BASE_PATH}/out/${name}/public-sdk/compile-error-log"
# echo "| full-sdk----|-------------|-------------|-------------|-------------|-------------"
# echo "| 仓库 | 项目数量 | 成功数量 | 失败数量 | Hap数量 | 签名成功 "
# echo "|-------------|-------------|-------------|-------------|-------------|-------------"
# echo "| ${name} | ${#full_list[@]} | $(ls -l ${BASE_PATH}/out/${name}/full-sdk/compile-success-log|grep "^-"|wc -l) | $(ls -l ${BASE_PATH}/out/${name}/full-sdk/compile-error-log|grep "^-"|wc -l) | "`expr $(ls -l ${BASE_PATH}/out/${name}/full-sdk/hap-out-with-nosigned|grep "^-"|wc -l) / 2`" | "`expr $(ls -l ${BASE_PATH}/out/${name}/full-sdk/hap-out-with-signed|grep "^-"|wc -l) / 2`
# if (( $(ls -l ${BASE_PATH}/out/${name}/full-sdk/compile-error-log|grep "^-"|wc -l) > 0 )); then
# echo "| 失败项目列表|-------------|-------------|-------------|-------------|-------------"
# for z in `ls ${BASE_PATH}/out/${name}/full-sdk/compile-error-log`
# do
# z=${z//_//}
# z=${z%.log}
# echo "| "${z}" |"
# done
# fi
# echo "| 失败项目日志汇总地址|-------------|-------------|-------------------"
# echo "| ${BASE_PATH}/out/${name}/full-sdk/compile-error-log"
# echo "|-------------|-------------|-------------|-------------|-------------"
# echo "| 成功项目日志汇总地址|-------------|-------------|-------------------"
# echo "| ${BASE_PATH}/out/${name}/full-sdk/compile-success-log"
# echo "| 不含测试用例项目|-------------|-------------|-------------------"
# for simple in ${simple_list[@]};do
# echo "| "${simple}" |"
# done
# echo "|-------------|-------------|-------------|-------------|-------------"
# echo "compile completed..."
if (( $(ls -l ${BASE_PATH}/out/${name}/public-sdk/compile-error-log|grep "^-"|wc -l) > 0 ) || ( $(ls -l ${BASE_PATH}/out/${name}/full-sdk/compile-error-log|grep "^-"|wc -l) > 0 ));then
echo "hap_build fail"
else
echo "hap_build success"
fi

View File

@ -0,0 +1,691 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
CUR_PATH=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
BASE_PATH=$(dirname ${CUR_PATH})
#时间统计
startTime=`date +%Y%m%d-%H:%M:%S`
startTime_s=`date +%s`
#npm
npm config set @ohos:registry=https://repo.harmonyos.com/npm/
#ohpm
#ohpm config set @ohos:registry=https://repo.harmonyos.com/ohpm/
TEST_HAP_PATH=entry/build/default/outputs/ohosTest/entry-ohosTest-unsigned.hap
HAP_PATH=entry/build/default/outputs/default/entry-default-unsigned.hap
STAGE_TEST_HAP_PATH=product/build/default/outputs/ohosTest/product-ohosTest-unsigned.hap
STAGE_HAP_PATH=product/build/default/outputs/default/product-default-unsigned.hap
TIME=16
RESOLVE=0
arg_sign="true"
arg_sdk_path=${BASE_PATH}/sdk
arg_full_sdk_path=${BASE_PATH}/sdk-full
arg_help="0"
arg_compile_dir=""
arg_jdk=""
arg_node=""
arg_ohpm="false"
arg_p=""
url=""
tag_url='url='
name=""
tag_name='name='
branch=""
tag_branch='branch='
full_list=()
tag_full_list='fullSdkAssembleList='
basic_list=()
tag_basic_list='basicSignList='
core_list=()
tag_core_list='coreSignList='
system_app_list=()
tag_system_app_list='systemAppList='
normal_list=()
public_list=()
#没测试用例
simple_list=()
function print_help() {
cat <<EOF
use assembleHap [options] <mainclass> [args...]
--p=config path
--sign=true/false - Whether the signature (default:$arg_sign)
--sdk_path=[public sdk absolute address] (default:$arg_sdk_path)
--full_sdk_path=[full sdk absolute address] (default:$arg_full_sdk_path)
--ohpm=true/false -whether use ohpm (default:$arg_ohpm)
--help - prints help screen
EOF
}
function parse_arguments() {
local helperKey="";
local helperValue="";
local current="";
while [ "$1" != "" ]; do
current=$1;
helperKey=${current#*--};
helperKey=${helperKey%%=*};
helperKey=$(echo "$helperKey" | tr '-' '_');
helperValue=${current#*=};
if [ "$helperValue" == "$current" ]; then
helperValue="1";
fi
# echo "eval arg_$helperKey=\"$helperValue\"";
eval "arg_$helperKey=\"$helperValue\"";
shift
done
}
parse_arguments ${@};
if [ "$arg_help" != "0" ]; then
print_help;
exit 1;
fi
if [ "$arg_p" == "" ]; then
echo "--p cannot be empty"
exit 1
fi
if [ "$arg_jdk" != "" ]; then
export JAVA_HOME=${arg_jdk}
export PATH=$JAVA_HOME/bin:$PATH
fi
if [ "$arg_node" != "" ]; then
export NODE_HOME=${arg_node}
export PATH=$NODE_HOME:$PATH
fi
function clear_dir(){
if [ ! -d "$1" ]; then
mkdir -p $1
else
rm -rf $1/*
fi
}
function clear_file(){
if [ -f "$1" ]; then
rm $1
fi
touch $1
}
function del_dir(){
if [ -d "$1" ]; then
rm -rf $1/*
fi
}
function del_file(){
if [ -f "$1" ]; then
rm $1
fi
}
function is_project_root(){
if [[ -f $1"/build-profile.json5" && -f $1"/hvigorfile.js" ]] || [[ -f $1"/build-profile.json5" && -f $1"/hvigorfile.ts" ]]; then
while read line
do
if [[ ${line} =~ "srcPath" ]]; then
pa=${line%\"*}
pa=${pa##*\".}
if [ -d "$1/AppScope" ]; then
is_entry=`cat $1${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"entry\""`
is_feature=`cat $1${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
if [[ -d $1${pa}"/src/ohosTest" ]]; then
return 0
fi
fi
else
is_entry=`cat $1${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"entry\""`
is_feature=`cat $1${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
if [[ -d $1${pa}"/src/ohosTest" ]]; then
return 0
fi
fi
fi
fi
done < $1"/build-profile.json5"
return 1
else
return 2
fi
}
function read_project(){
if [ -d "$1" ]
then
# 是项目工程根目录则记录当前路径 否则递归判断
is_project_root $1
res=$?
if [ ${res} -eq 0 ]; then
public_list[${#public_list[*]}]=${1#*compile-tool/projects/${name}/}
elif [ ${res} -eq 1 ]; then
simple_list[${#simple_list[*]}]=${1#*compile-tool/projects/${name}/}
elif [ ${res} -eq 2 ]; then
for file in `ls $1`
do
read_project "${1}/${file}"
done
fi
fi
}
function exclude_full_project(){
if [ ${#full_list[*]} -eq 0 ]; then
return
fi
diff_list=()
full_true_list=()
f=0
t=0
flag=0
for item1 in "${public_list[@]}"; do
for item2 in "${full_list[@]}"; do
if [[ "${item1}" == "${item2}" ]]; then
full_true_list[f]=${item2}
f=$((f+1))
flag=1
break
fi
done
if [ ${flag} -eq 0 ]; then
diff_list[t]=${item1}
t=$((t+1))
else
flag=0
fi
done
public_list=(${diff_list[@]})
full_list=(${full_true_list[@]})
echo "use public sdk project numbers = "${#public_list[@]}
echo "use full sdk project numbers = "${#full_list[@]}
}
function del_module_name(){
local name=${1}
for i in "${!module_name[@]}"
do
if [[ "${module_name[i]}" == "${name}" ]]; then
unset module_name[i]
echo "移除"${name}" , 剩余 : "${module_name[@]} >> ${compile_result_error}/${hap}".log" 2>&1
return 0
fi
done
return 1
}
function load_dep(){
local cur_m_n=${1}
local cur_module
for cur_module in ${module_list[@]}
do
if [[ "${cur_module}" =~ "${cur_m_n}" ]]; then
del_module_name ${cur_m_n}
for m_n_1 in ${module_name[@]}
do
rr=$(cat ${cur_module}"/package.json" | grep "${m_n_1}")
if [[ "${rr}" != "" ]]; then
load_dep ${m_n_1}
fi
done
cd ${cur_module}
echo ${cur_module}" 执行npm install" >> ${compile_result_error}/${hap}".log" 2>&1
npm i >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
}
function load_oh_dep(){
local cur_m_n=${1}
local cur_module
for cur_module in ${module_list[@]}
do
if [[ "${cur_module}" =~ "${cur_m_n}" ]]; then
del_module_name ${cur_m_n}
for m_n_1 in ${module_name[@]}
do
rr=$(cat ${cur_module}"/oh-package.json5" | grep "${m_n_1}")
if [[ "${rr}" != "" ]]; then
load_oh_dep ${m_n_1}
fi
done
cd ${cur_module}
echo ${cur_module}" 执行ohpm install" >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -e "oh-package.json5" ]]; then
ohpm i >> ${compile_result_error}/${hap}".log" 2>&1
else
ohpm init >> ${compile_result_error}/${hap}".log" 2>&1
ohpm install >> ${compile_result_error}/${hap}".log" 2>&1
fi
fi
done
}
function compile(){
# echo "compile $1"
hap=${1////_}
project_path=${BASE_PATH}/projects/${name}/${1}
compile_result=${2}
compile_result_error=${3}
nosign_hap_result=${4}
compile_result_success=${5}
if [ ! -d "${project_path}" ]; then
echo "${project_path} 路径不存在"
return
fi
if [ -e "${project_path}/local.properties" ]; then
rm ${project_path}"/local.properties"
fi
# echo "sdk.dir="${arg_full_sdk_path} >> ${project_path}"/local.properties" 2>&1
cd ${project_path}
if [[ -e "${project_path}/package.json" ]]; then
sed -i 's/\"@ohos\/hypium\".*\.[0-9]*\"/\"@ohos\/hypium\": \"1.0.3\"/g' ./package.json
sed -i 's/\"@ohos\/hvigor-ohos-plugin\".*\.[0-9]*\"/\"@ohos\/hvigor-ohos-plugin\": \"1.3.1\"/g' ./package.json
sed -i 's/\"@ohos\/hvigor\".*\.[0-9]*\"/\"@ohos\/hvigor\": \"1.3.1\"/g' ./package.json
fi
module_list=()
module_name=()
out_module=()
bundle_name=""
while read line
do
if [[ ${line} =~ "srcPath" ]]; then
pa=${line%\"*}
pa=${pa##*\".}
module_list[${#module_list[*]}]=${project_path}${pa}
del_dir ${project_path}${pa}/node_modules
del_file ${project_path}${pa}/package-lock.json
del_dir ${project_path}${pa}/oh_modules
del_file ${project_path}${pa}/oh-package-lock.json5
module_name[${#module_name[*]}]=${pa}
if [ -d "${project_path}/AppScope" ]; then
cur_bundle_line=`cat ${project_path}/AppScope/app.json5 | grep "\"bundleName\""`
bundle_name=${cur_bundle_line%\"*}
bundle_name=${bundle_name##*\"}
# echo "bundleName : "${bundle_name}
is_entry=`cat ${project_path}${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"entry\""`
is_feature=`cat ${project_path}${pa}/src/main/module.json5 | sed 's/ //g' | grep "\"type\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
echo "hap输出module: "${project_path}${pa} >> ${compile_result_error}/${hap}".log" 2>&1
out_module[${#out_module[*]}]=${project_path}${pa}
fi
else
cur_bundle_line=`cat ${project_path}${pa}/src/main/config.json | grep "\"bundleName\""`
bundle_name=${cur_bundle_line%\"*}
bundle_name=${bundle_name##*\"}
# echo "bundleName : "${bundle_name}
is_entry=`cat ${project_path}${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"entry\""`
is_feature=`cat ${project_path}${pa}/src/main/config.json | sed 's/ //g' | grep "\"moduleType\":\"feature\""`
if [[ "${is_entry}" != "" || "${is_feature}" != "" ]]; then
echo "hap输出module: "${project_path}${pa} >> ${compile_result_error}/${hap}".log" 2>&1
out_module[${#out_module[*]}]=${project_path}${pa}
fi
fi
fi
done < ${project_path}"/build-profile.json5"
if [[ -e "${project_path}/oh-package.json5" ]]; then #如果是ohpm包管理方式
for module in ${module_list[@]}
do
del_module_name ${module##${project_path}}
if [ $? -eq 0 ]; then
for m_n in ${module_name[@]}
do
echo "查找 ${m_n} 是否是${module} 的依赖" >> ${compile_result_error}/${hap}".log" 2>&1
rr=$(cat ${module}"/oh-package.json5" | grep "${m_n}")
if [[ "${rr}" != "" ]]; then
echo "处理循环依赖 : "${m_n} >> ${compile_result_error}/${hap}".log" 2>&1
load_oh_dep ${m_n}
fi
done
cd ${module}
echo ${module}" 执行ohpm install" >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -e "oh-package.json5" ]]; then
ohpm i >> ${compile_result_error}/${hap}".log" 2>&1
else
ohpm init >> ${compile_result_error}/${hap}".log" 2>&1
ohpm install >> ${compile_result_error}/${hap}".log" 2>&1
fi
fi
done
else
for module in ${module_list[@]}
do
del_module_name ${module##${project_path}}
if [ $? -eq 0 ]; then
for m_n in ${module_name[@]}
do
echo "查找 ${m_n} 是否是${module} 的依赖" >> ${compile_result_error}/${hap}".log" 2>&1
rr=$(cat ${module}"/package.json" | grep "${m_n}")
if [[ "${rr}" != "" ]]; then
echo "处理循环依赖 : "${m_n} >> ${compile_result_error}/${hap}".log" 2>&1
load_dep ${m_n}
fi
done
cd ${module}
echo ${module}" 执行npm install" >> ${compile_result_error}/${hap}".log" 2>&1
npm i >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
fi
cd ${project_path}
del_dir ${project_path}/node_modules
del_dir ${project_path}/oh_modules
del_file ${project_path}/package-lock.json
del_file ${project_path}/oh-package-lock.json5
echo ${project_path}" 执行npm install" >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -e "${project_path}/oh-package.json5" ]]; then
ohpm i >> ${compile_result_error}/${hap}".log" 2>&1
chmod +x hvigorw
./hvigorw clean --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
else
npm install >> ${compile_result_error}/${hap}".log" 2>&1
node ./node_modules/@ohos/hvigor/bin/hvigor.js clean --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
fi
rm -rf ${project_path}/sign_tool
cp -r ${BASE_PATH}/tool/sign_tool ${project_path}
cd ${project_path}/sign_tool
if [[ $(echo ${basic_list[@]} | grep "${hap//_//}") != "" ]]; then
echo "${hap} 使用basic签名" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"normal\"/\"system_basic\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
elif [[ $(echo ${core_list[@]} | grep "${hap//_//}") != "" ]]; then
echo "${hap} 使用core签名" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"normal\"/\"system_core\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
fi
if [[ $(echo ${system_app_list[@]} | grep "${hap//_//}") != "" ]]; then
echo "${hap} 系统应用" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"hos_normal_app\"/\"hos_system_app\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
fi
if [ "${bundle_name}" != "" ]; then
echo "bundleName = ${bundle_name}" >> ${compile_result_error}/${hap}".log" 2>&1
sed -i "s/\"com.OpenHarmony.app.test\"/\"${bundle_name}\"/g" ./UnsgnedReleasedProfileTemplate.json >> ${compile_result_error}/${hap}".log" 2>&1
fi
sign_hap_num=0
for module in ${out_module[@]}
do
cd ${project_path}
cur_out_module_name=${module##*/}
if [[ -e "${project_path}/oh-package.json5" ]]; then
chmod +x hvigorw
./hvigorw --mode module -p module=${cur_out_module_name} assembleHap --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
if [[ -d ${module}"/src/ohosTest" ]]; then
./hvigorw --mode module -p module=${cur_out_module_name}@ohosTest assembleHap --no-daemon >> ${compile_result_error}/${hap}".log" 2>&1
fi
else
node ./node_modules/@ohos/hvigor/bin/hvigor.js --mode module -p module=${cur_out_module_name} assembleHap --no-daemon>> ${compile_result_error}/${hap}".log" 2>&1
if [[ -d ${module}"/src/ohosTest" ]]; then
node ./node_modules/@ohos/hvigor/bin/hvigor.js --mode module -p module=${cur_out_module_name}@ohosTest assembleHap --no-daemon>> ${compile_result_error}/${hap}".log" 2>&1
fi
fi
is_sign=false
echo "module = ${module} , cur_out_module_name=${cur_out_module_name}" >> ${compile_result_error}/${hap}".log" 2>&1
if [ ! -d ${module}/build/default/outputs/default/ -o ! -d ${module}/build/default/outputs/ohosTest/ -a -d ${module}"/src/ohosTest" ]; then
echo "module = ${module}, assembleHap error !!!" >> ${compile_result_error}/${hap}".log" 2>&1
continue
fi
sign_hap_path=""
test_sign_hap_path=""
nosign_hap_path=""
test_nosign_hap_path=""
for out_file in `ls ${module}/build/default/outputs/default/`
do
if [[ "${out_file}" =~ "-unsigned.hap" ]]; then
echo "发现unsigned包 : "${out_file}",开始使用签名工具签名" >> ${compile_result_error}/${hap}".log" 2>&1
nosign_hap_path=${module}/build/default/outputs/default/${out_file}
sign_hap_path=${module}/build/default/outputs/default/${out_file/unsigned/signed}
cd ${project_path}/sign_tool
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-profile -keyAlias "openharmony application profile release" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "OpenHarmonyProfileRelease.pem" -inFile "UnsgnedReleasedProfileTemplate.json" -keystoreFile "OpenHarmony.p12" -outFile "openharmony_sx.p7b" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-app -keyAlias "openharmony application release" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "OpenHarmonyApplication.pem" -profileFile "openharmony_sx.p7b" -inFile "${nosign_hap_path}" -keystoreFile "OpenHarmony.p12" -outFile "${sign_hap_path}" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
if [[ -d ${module}"/src/ohosTest" ]]; then
for out_file in `ls ${module}/build/default/outputs/ohosTest/`
do
if [[ "${out_file}" =~ "-unsigned.hap" ]]; then
echo "发现unsigned包 : "${out_file}",开始使用签名工具签名" >> ${compile_result_error}/${hap}".log" 2>&1
test_nosign_hap_path=${module}/build/default/outputs/ohosTest/${out_file}
test_sign_hap_path=${module}/build/default/outputs/ohosTest/${out_file/unsigned/signed}
cd ${project_path}/sign_tool
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-profile -keyAlias "openharmony application profile release" -signAlg "SHA256withECDSA" -mode "localSign" -profileCertFile "OpenHarmonyProfileRelease.pem" -inFile "UnsgnedReleasedProfileTemplate.json" -keystoreFile "OpenHarmony.p12" -outFile "openharmony_sx.p7b" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
java -jar ${BASE_PATH}/tool/hap-sign-tool.jar sign-app -keyAlias "openharmony application release" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "OpenHarmonyApplication.pem" -profileFile "openharmony_sx.p7b" -inFile "${test_nosign_hap_path}" -keystoreFile "OpenHarmony.p12" -outFile "${test_sign_hap_path}" -keyPwd "123456" -keystorePwd "123456" >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
fi
if [[ ${sign_hap_path} != "" && -f ${sign_hap_path} && ( -f ${test_sign_hap_path} || ! -d ${module}"/src/ohosTest") ]]; then
cp ${sign_hap_path} ${compile_result}/${hap}_${cur_out_module_name}_signed.hap
cp ${nosign_hap_path} ${nosign_hap_result}/${hap}_${cur_out_module_name}_signed.hap
if [[ -d ${module}"/src/ohosTest" ]]; then
cp ${test_sign_hap_path} ${compile_result}/${hap}_${cur_out_module_name}_ohosTest_signed.hap
cp ${test_nosign_hap_path} ${nosign_hap_result}/${hap}_${cur_out_module_name}_ohosTest_signed.hap
fi
sign_hap_num=$(expr ${sign_hap_num} + 1)
echo "${module} assembleHap success !!!" >> ${compile_result_error}/${hap}".log" 2>&1
else
echo "${module} assembleHap error !!!" >> ${compile_result_error}/${hap}".log" 2>&1
fi
done
if [[ ${#out_module[@]} == ${sign_hap_num} ]]; then
#rm ${compile_result_error}/${hap}".log"
mv ${compile_result_error}/${hap}.log ${compile_result_success}/${hap}.log
echo "success compile ${hap} !!! "
else
echo "error compile ${hap} QwQ ,log at ${compile_result_error}/${hap}.log"
fi
}
function compile_project(){
echo "use public sdk compile..."
project_path=${1}
project_name=${2}
COMPILE_RESULT=${BASE_PATH}/out/${project_name}/public-sdk/hap-out-with-nosigned
COMPILE_RESULT_ERROR=${BASE_PATH}/out/${project_name}/public-sdk/compile-error-log
COMPILE_RESULT_SUCCESS=${BASE_PATH}/out/${project_name}/public-sdk/compile-success-log
SIGN_RESULT=${BASE_PATH}/out/${project_name}/public-sdk/hap-out-with-signed
clear_dir $COMPILE_RESULT
clear_dir $COMPILE_RESULT_ERROR
clear_dir $COMPILE_RESULT_SUCCESS
clear_dir $SIGN_RESULT
export OHOS_SDK_HOME=${arg_sdk_path}
export OHOS_BASE_SDK_HOME=${arg_sdk_path}
echo "OHOS_SDK_HOME="${OHOS_SDK_HOME}
echo "OHOS_BASE_SDK_HOME="${OHOS_BASE_SDK_HOME}
EOF=0
curr=0
while [ $EOF -ne 1 ]; do
for ((i=1; i<=$TIME; i++)); do
if [ ${curr} -eq ${#public_list[@]} ]; then
EOF=1
break
fi
compile ${public_list[$curr]} ${SIGN_RESULT} ${COMPILE_RESULT_ERROR} ${COMPILE_RESULT} ${COMPILE_RESULT_SUCCESS} &
curr=$((curr+1))
done
wait
done
}
function compile_project_full(){
echo "use full sdk compile..."
project_path=${1}
project_name=${2}
COMPILE_RESULT=${BASE_PATH}/out/${project_name}/full-sdk/hap-out-with-nosigned
COMPILE_RESULT_ERROR=${BASE_PATH}/out/${project_name}/full-sdk/compile-error-log
COMPILE_RESULT_SUCCESS=${BASE_PATH}/out/${project_name}/full-sdk/compile-success-log
SIGN_RESULT=${BASE_PATH}/out/${project_name}/full-sdk/hap-out-with-signed
clear_dir $COMPILE_RESULT
clear_dir $COMPILE_RESULT_ERROR
clear_dir $COMPILE_RESULT_SUCCESS
clear_dir $SIGN_RESULT
export OHOS_SDK_HOME=${arg_full_sdk_path}
export OHOS_BASE_SDK_HOME=${arg_full_sdk_path}
echo "OHOS_SDK_HOME="${OHOS_SDK_HOME}
echo "OHOS_BASE_SDK_HOME="${OHOS_BASE_SDK_HOME}
EOF=0
curr=0
while [ $EOF -ne 1 ]; do
for ((i=1; i<=$TIME; i++)); do
if [ ${curr} -eq ${#full_list[@]} ]; then
EOF=1
break
fi
compile ${full_list[$curr]} ${SIGN_RESULT} ${COMPILE_RESULT_ERROR} ${COMPILE_RESULT} ${COMPILE_RESULT_SUCCESS} &
curr=$((curr+1))
done
wait
done
}
function load(){
project_url=${1}
project_branch=${2}
project_name=${3}
if test -d ${BASE_PATH}/projects/${project_name}
then
echo "${project_name} exists,ready for update..."
cd ${BASE_PATH}/projects/${project_name}
git reset --hard origin/${project_branch}
git checkout -b ${project_branch} origin/${project_branch}
git checkout ${project_branch}
git lfs fetch origin ${project_branch}
git pull
else
echo "${project_name} dose not exist,ready to download..."
if [ ! -d ${BASE_PATH}/projects ]; then
mkdir -p ${BASE_PATH}/projects
fi
cd ${BASE_PATH}/projects
git lfs clone -b ${project_branch} ${project_url} ${project_name}
git checkout -b ${project_branch} origin/${project_branch}
fi
if [ -d "${BASE_PATH}/projects/${project_name}/${arg_compile_dir}" ]; then
read_project ${BASE_PATH}/projects/${project_name}/${arg_compile_dir}
exclude_full_project
compile_project ${BASE_PATH}/projects/${project_name} ${project_name}
compile_project_full ${BASE_PATH}/projects/${project_name} ${project_name}
fi
}
while read line
do
if [[ ${line} == ${tag_url}* ]]; then
url=${line##*${tag_url}}
elif [[ ${line} == ${tag_branch}* ]]; then
branch=${line##*${tag_branch}}
elif [[ ${line} == ${tag_name}* ]]; then
name=${line##*${tag_name}}
elif [[ ${line} == ${tag_full_list}* ]]; then
temp_string=${line##*${tag_full_list}}
full_list=(${temp_string//;/ })
elif [[ ${line} == ${tag_basic_list}* ]]; then
temp_string=${line##*${tag_basic_list}}
basic_list=(${temp_string//;/ })
elif [[ ${line} == ${tag_core_list}* ]]; then
temp_string=${line##*${tag_core_list}}
core_list=(${temp_string//;/ })
elif [[ ${line} == ${tag_system_app_list}* ]]; then
temp_string=${line##*${tag_system_app_list}}
system_app_list=(${temp_string//;/ })
fi
done < ${arg_p}
load ${url} ${branch} ${name}
endTime=`date +%Y%m%d-%H:%M:%S`
endTime_s=`date +%s`
sumTime=$[ $endTime_s - $startTime_s ]
echo "$startTime ---> $endTime" "耗时:$sumTime seconds"
echo "| public-sdk--|-------------|-------------|-------------|-------------|-------------"
echo "| 仓库 | 项目数量 | 成功数量 | 失败数量 | Hap数量 | 签名成功 "
echo "|-------------|-------------|-------------|-------------|-------------"
echo "| ${name} | ${#public_list[@]} | $(ls -l ${BASE_PATH}/out/${name}/public-sdk/compile-success-log|grep "^-"|wc -l) | $(ls -l ${BASE_PATH}/out/${name}/public-sdk/compile-error-log|grep "^-"|wc -l) | "`expr $(ls -l ${BASE_PATH}/out/${name}/public-sdk/hap-out-with-nosigned|grep "^-"|wc -l) / 2`" | "`expr $(ls -l ${BASE_PATH}/out/${name}/public-sdk/hap-out-with-signed|grep "^-"|wc -l) / 2`
if (( $(ls -l ${BASE_PATH}/out/${name}/public-sdk/compile-error-log|grep "^-"|wc -l) > 0 )); then
echo "| 失败项目列表|-------------|-------------|-------------|-------------|-------------"
for z in `ls ${BASE_PATH}/out/${name}/public-sdk/compile-error-log`
do
z=${z//_//}
z=${z%.log}
echo "| "${z}" |"
done
fi
echo "| 失败项目日志汇总地址|-------------|-------------|-------------|-------------------"
echo "| ${BASE_PATH}/out/${name}/public-sdk/compile-error-log"
echo "| full-sdk----|-------------|-------------|-------------|-------------|-------------"
echo "| 仓库 | 项目数量 | 成功数量 | 失败数量 | Hap数量 | 签名成功 "
echo "|-------------|-------------|-------------|-------------|-------------|-------------"
echo "| ${name} | ${#full_list[@]} | $(ls -l ${BASE_PATH}/out/${name}/full-sdk/compile-success-log|grep "^-"|wc -l) | $(ls -l ${BASE_PATH}/out/${name}/full-sdk/compile-error-log|grep "^-"|wc -l) | "`expr $(ls -l ${BASE_PATH}/out/${name}/full-sdk/hap-out-with-nosigned|grep "^-"|wc -l) / 2`" | "`expr $(ls -l ${BASE_PATH}/out/${name}/full-sdk/hap-out-with-signed|grep "^-"|wc -l) / 2`
if (( $(ls -l ${BASE_PATH}/out/${name}/full-sdk/compile-error-log|grep "^-"|wc -l) > 0 )); then
echo "| 失败项目列表|-------------|-------------|-------------|-------------|-------------"
for z in `ls ${BASE_PATH}/out/${name}/full-sdk/compile-error-log`
do
z=${z//_//}
z=${z%.log}
echo "| "${z}" |"
done
fi
echo "| 失败项目日志汇总地址|-------------|-------------|-------------------"
echo "| ${BASE_PATH}/out/${name}/full-sdk/compile-error-log"
echo "|-------------|-------------|-------------|-------------|-------------"
echo "| 成功项目日志汇总地址|-------------|-------------|-------------------"
echo "| ${BASE_PATH}/out/${name}/full-sdk/compile-success-log"
echo "| 不含测试用例项目|-------------|-------------|-------------------"
for simple in ${simple_list[@]};do
echo "| "${simple}" |"
done
echo "|-------------|-------------|-------------|-------------|-------------"
echo "compile completed..."

View File

@ -0,0 +1,174 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
#npm
npm config set @ohos:registry=https://repo.harmonyos.com/npm/
date_time=`date +"%Y%m%d%H%M%S"`
CUR_PATH=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
BASE_PATH=$(dirname ${CUR_PATH})
TEMP_SDK_PAK=${BASE_PATH}/temp_sdk_${date_time}
function clear_dir(){
if [ ! -d "$1" ]; then
mkdir -p $1
else
rm -rf $1/*
fi
}
function create_dir(){
if [ ! -d "$1" ]; then
mkdir -p $1
fi
}
arg_sdk_path=${BASE_PATH}/sdk
arg_full_sdk_path=${BASE_PATH}/sdk-full
arg_conf_path=${BASE_PATH}/config/init_sdk.config
arg_help="0"
function print_help() {
cat <<EOF
use assembleHap [options] <mainclass> [args...]
--sdk_path=[public sdk absolute address] (default:$arg_sdk_path)
--full_sdk_path=[full sdk absolute address] (default:$arg_full_sdk_path)
--conf_path=[config absolute address] (default:$arg_conf_path)]
--help - prints help screen
EOF
}
function parse_arguments() {
local helperKey="";
local helperValue="";
local current="";
while [ "$1" != "" ]; do
current=$1;
helperKey=${current#*--};
helperKey=${helperKey%%=*};
helperKey=$(echo "$helperKey" | tr '-' '_');
helperValue=${current#*=};
if [ "$helperValue" == "$current" ]; then
helperValue="1";
fi
# echo "eval arg_$helperKey=\"$helperValue\"";
eval "arg_$helperKey=\"$helperValue\"";
shift
done
}
parse_arguments ${@};
if [ "$arg_help" != "0" ]; then
print_help;
exit 1;
fi
function init_sdk_dir(){
echo "init sdk dir..."
clear_dir ${arg_sdk_path}
clear_dir ${arg_full_sdk_path}
}
function load_sdk(){
source_path=""
sdk_type=${1}
sdk_version=${2}
sdk_url=${3}
echo "loading sdk from ${sdk_url}..."
target_path=${BASE_PATH}
if [[ "${sdk_type}" == "public" ]]; then
target_path=${arg_sdk_path}
elif [[ "${sdk_type}" == "full" ]]; then
target_path=${arg_full_sdk_path}
else
echo "the ${sdk_url} is invalid"
exit 1
fi
clear_dir ${TEMP_SDK_PAK}
cd ${TEMP_SDK_PAK}
wget ${sdk_url}
for z in `ls`
do
if [ "${z##*.}" == "gz" ]; then
tar -zxf ${z}
fi
done
for z in ${TEMP_SDK_PAK}/*
do
if [ -d ${z}/linux ]; then
source_path=${z}
fi
done
cd ${source_path}/linux/
for z in `ls`
do
if [ "${z##*.}" != "zip" ]; then
continue
fi
echo "unzip ${z}ing..."
unzip -oq ${z}
done
for z in ${source_path}/linux/*
do
if [ "${z##*.}" == "zip" ]; then
continue
fi
if [ -f "${z}" ]; then
continue
fi
create_dir ${target_path}/${sdk_version}
echo "moving... ${z} to ${target_path}/${sdk_version}/${z##*/}"
mv ${z} ${target_path}/${sdk_version}/${z##*/}
if [ ${z##*/} == "ets" ]; then
echo "ets npm install"
cd ${target_path}/${sdk_version}/${z##*/}/build-tools/ets-loader
npm install > /dev/null 2>&1
fi
if [ ${z##*/} == "js" ]; then
echo "js npm install"
cd ${target_path}/${sdk_version}/${z##*/}/build-tools/ace-loader
npm install > /dev/null 2>&1
fi
done
rm -rf ${TEMP_SDK_PAK}
}
init_sdk_dir
while read line
do
if [ ${line:0:1} == "#" ]; then
continue
fi
sdk_desc=(${line//;/ })
load_sdk ${sdk_desc[0]} ${sdk_desc[1]} ${sdk_desc[2]}
done < ${arg_conf_path}
echo "sdk init success.."
exit 0

View File

@ -0,0 +1,177 @@
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
#npm
npm config set @ohos:registry=https://repo.harmonyos.com/npm/
date_time=`date +"%Y%m%d%H%M%S"`
CUR_PATH=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
BASE_PATH=$(dirname ${CUR_PATH})
TEMP_SDK_PAK=${BASE_PATH}/temp_sdk_${date_time}
arg_url=""
arg_sdk_path=""
arg_api_version=""
arg_help="0"
function clear_dir(){
if [ ! -d "$1" ]; then
mkdir -p $1
else
rm -rf $1/*
fi
}
function get_sdk_type(){
sdk_url=${1}
is_public=$(echo ${sdk_url} | grep "\-public")
if [[ ${is_public} != "" ]]; then
arg_sdk_type="public"
return
fi
is_full=$(echo ${sdk_url} | grep "\-full")
if [[ ${is_full} != "" ]]; then
arg_sdk_type="full"
fi
arg_sdk_type="unknown"
}
function print_help() {
cat <<EOF
use update_sdk [options] <mainclass> [args...]
--url=[sdk url]
--sdk_path=[public sdk absolute address]
--help - prints help screen
EOF
}
function parse_arguments() {
local helperKey="";
local helperValue="";
local current="";
while [ "$1" != "" ]; do
current=$1;
helperKey=${current#*--};
helperKey=${helperKey%%=*};
helperKey=$(echo "$helperKey" | tr '-' '_');
helperValue=${current#*=};
if [ "$helperValue" == "$current" ]; then
helperValue="1";
fi
# echo "eval arg_$helperKey=\"$helperValue\"";
eval "arg_$helperKey=\"$helperValue\"";
shift
done
}
parse_arguments ${@};
if [ "$arg_help" != "0" ]; then
print_help;
exit 1;
fi
if [ "${arg_url}" == "" ]; then
echo "--url is not null"
exit 1;
fi
if [ "${arg_sdk_path}" == "" ]; then
echo "--sdk_path is not null"
exit 1;
fi
# 添加交互式判断 sdk目录是否删除 判空等操作
clear_dir ${arg_sdk_path}
clear_dir ${TEMP_SDK_PAK}
cd ${TEMP_SDK_PAK}
wget ${arg_url}
for z in `ls`
do
if [ "${z##*.}" == "gz" ]; then
tar -zxf ${z}
fi
done
source_path=""
for z in ${TEMP_SDK_PAK}/*
do
if [ -d ${z}/linux ]; then
source_path=${z}
fi
done
cd ${source_path}/linux/
for z in `ls`
do
if [ "${z##*.}" != "zip" ]; then
continue
fi
echo "unzip ${z}ing..."
unzip -oq ${z}
done
if [ "${arg_api_version}" == "" ]; then
for z in ${source_path}/linux/*
do
if [ "${z##*.}" == "zip" ]; then
continue
fi
if [ -f "${z}" ]; then
continue
fi
if [ -f "${z}/oh-uni-package.json" ]; then
arg_api_version=$(cat ${z}/oh-uni-package.json | grep "apiVersion")
break
fi
done
fi
echo "apiVersion is ${arg_api_version##*:}"
target_path=${arg_sdk_path}
for z in ${source_path}/linux/*
do
if [ "${z##*.}" == "zip" ]; then
continue
fi
if [ -f "${z}" ]; then
continue
fi
echo "moving... ${z} to ${target_path}"
mv ${z} ${target_path}/
if [ ${z##*/} == "ets" ]; then
echo "ets npm install"
cd ${target_path}/${z##*/}/build-tools/ets-loader
npm install > /dev/null 2>&1
fi
if [ ${z##*/} == "js" ]; then
echo "js npm install"
cd ${target_path}/${z##*/}/build-tools/ace-loader
npm install > /dev/null 2>&1
fi
done
rm -rf ${TEMP_SDK_PAK}
echo "sdk undate success.."
exit 0

View File

@ -0,0 +1,6 @@
public;8;https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-public.tar.gz
public;9;http://download.ci.openharmony.cn/version/Master_Version/OpenHarmony_3.2.12.2/20230510_103810/version-Master_Version-OpenHarmony_3.2.12.2-20230510_103810-ohos-sdk-public.tar.gz
public;10;http://download.ci.openharmony.cn/version/Release_Version/OpenHarmony_4.0.10.7_sp8/20230919_112913/version-Release_Version-OpenHarmony_4.0.10.7_sp8-20230919_112913-ohos-sdk-public_4.0-release.tar.gz
full;8;https://mirrors.huaweicloud.com/openharmony/os/3.1.6/ohos-sdk-full.tar.gz
full;9;http://download.ci.openharmony.cn/version/Master_Version/OpenHarmony_3.2.12.2/20230510_103752/version-Master_Version-OpenHarmony_3.2.12.2-20230510_103752-ohos-sdk-full.tar.gz
full;10;http://download.ci.openharmony.cn/version/Release_Version/OpenHarmony_4.0.10.7_sp8/20230919_112909/version-Release_Version-OpenHarmony_4.0.10.7_sp8-20230919_112909-ohos-sdk-full_4.0-release.tar.gz

View File

@ -0,0 +1,7 @@
name=samples_master
url=https://gitee.com/openharmony/applications_app_samples.git
branch=master
fullSdkAssembleList=code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/BasicFeature/Security/PaySecurely;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Media/VoiceCallDemo;code/BasicFeature/WindowManagement/WindowRatio;code/SuperFeature/DistributedAppDev/DistributeCalc;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/BasicFeature/DataManagement/Preferences;code/BasicFeature/FileManagement/MediaCollections;code/BasicFeature/Media/GamePuzzle;code/BasicFeature/Media/AVRecorder;code/BasicFeature/DFX/AppRecovery;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/Solutions/Tools/JsClock;code/BasicFeature/Media/Audio;code/BasicFeature/Media/QRCodeScan;code/Solutions/Shopping/OrangeShopping;code/BasicFeature/ApplicationModels/CustomShare;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/BasicFeature/FileManagement/FileManager;code/BasicFeature/IDL/AbilityConnectServiceExtension;code/BasicFeature/Media/Recorder;code/BasicFeature/TaskManagement/ContinuousTask;code/BasicFeature/TaskManagement/Flybird;code/BasicFeature/TaskManagement/TransientTask;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/Telephony/Message;code/BasicFeature/Web/Browser;code/LaunguageBaseClassLibrary/Process;code/LaunguageBaseClassLibrary/LanguageBaseClassLibrary;code/BasicFeature/DeviceManagement/DeviceManagementCollection;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/Solutions/Game/DistributedDataGobang;code/Solutions/Game/Lottie;code/Solutions/Media/MultiMedia;code/Solutions/Tools/FlipClock;code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc;code/SuperFeature/DistributedAppDev/ArkTSDistributedMusicPlayer;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/DistributedRdb;code/SuperFeature/DistributedAppDev/Kvstore;code/SuperFeature/Widget/FormGame;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/SystemFeature/ApplicationModels/Launcher;code/SystemFeature/ApplicationModels/MissionManager;code/SystemFeature/ApplicationModels/StaticSubscriber;code/SystemFeature/Connectivity/Bluetooth;code/SystemFeature/Connectivity/Upload;code/SystemFeature/Connectivity/Wlan;code/SystemFeature/DataManagement/CrossAppDataShare;code/SystemFeature/DeviceManagement/PowerManager;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/DeviceManagement/StorageStatistic;code/SystemFeature/Internationalnation/International;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Media/Screenshot;code/SystemFeature/Security/AbilityAccessCtrl;code/SystemFeature/WindowManagement/WindowExtAbility
basicSignList=code/BasicFeature/WindowManagement/WindowRatio;code/BasicFeature/Media/Recorder;code/SuperFeature/DistributedAppDev/DistributedRdb;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/Kvstore;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc;code/Solutions/Game/DistributedDataGobang;code/SystemFeature/Connectivity/Bluetooth;code/SystemFeature/DeviceManagement/PowerManager;code/SystemFeature/Internationalnation/International;code/SuperFeature/DistributedAppDev/ArkTSDistributedMusicPlayer;code/Solutions/InputMethod/KikaInput;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/BasicFeature/WindowManagement/WindowManage;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Contact;code/BasicFeature/Telephony/Call;code/BasicFeature/Media/Audio;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/BasicFeature/FileManagement/FileManager;ability/FormLauncher;common/International;device/DeviceUsageStatistics;Telephony/Contact;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Observer;code/BasicFeature/Telephony/SimManager;Account/DistributeAccount;code/BasicFeature/TaskManagement/Flybird;UI/JsTimer;ETSUI/BringApp;
coreSignList=code_BasicFeature_Web_RunJsInWeb;code/BasicFeature/Web/Browser;code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/BasicFeature/Security/PaySecurely;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Media/VoiceCallDemo;code/SuperFeature/DistributedAppDev/DistributeCalc;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/SystemFeature/Connectivity/Upload;code/BasicFeature/Notification/CustomCommonEvent;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/Media/GamePuzzle;code/SystemFeature/DataManagement/CrossAppDataShare;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/BasicFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Media/AVRecorder;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/Solutions/Media/MultiMedia;code/SystemFeature/ApplicationModels/MissionManager;code/SystemFeature/ApplicationModels/StaticSubscriber;code/SystemFeature/Connectivity/Wlan;code/SystemFeature/DeviceManagement/StorageStatistic;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Media/Screenshot;code/SystemFeature/Security/AbilityAccessCtrl;code/Solutions/Tools/FlipClock;code/Solutions/Shopping/OrangeShopping;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/TaskManagement/TransientTask;code/BasicFeature/ApplicationModels/CustomShare;media/ScreenRecorder;ability/GalleryForm;FileManager/StorageStatistic;Graphics/Screenshot;ability/MissionManager;Communication/Wlan;code/BasicFeature/Media/QRCodeScan;Safety/AbilityAccessCtrl;Basic/Screenshot;Notification/Notification;code/SystemFeature/ApplicationModels/Launcher
systemAppList=code_BasicFeature_Web_RunJsInWeb;code/BasicFeature/Web/Browser;code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/Solutions/Game/DistributedDataGobang;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/ApplicationModels/CustomShare;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/SuperFeature/DistributedAppDev/DistributedRdb;code/BasicFeature/Security/PaySecurely;code/SystemFeature/Connectivity/Bluetooth;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Telephony/Message;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/BasicFeature/Media/VoiceCallDemo;code/BasicFeature/WindowManagement/WindowRatio;code/SuperFeature/DistributedAppDev/DistributeCalc;code/SystemFeature/Internationalnation/International;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/FileManagement/FileManager;code/BasicFeature/Media/QRCodeScan;code/SystemFeature/ApplicationModels/MissionManager;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/SystemFeature/Connectivity/Upload;code/SystemFeature/DeviceManagement/StorageStatistic;code/BasicFeature/Notification/CustomCommonEvent;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/Media/GamePuzzle;code/SystemFeature/DataManagement/CrossAppDataShare;code/BasicFeature/Media/Recorder;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/BasicFeature/Media/AVRecorder;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/SystemFeature/Media/Screenshot;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Connectivity/Wlan;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/Solutions/Media/MultiMedia;code/Solutions/Tools/JsClock;code/Solutions/Tools/FlipClock;code/SystemFeature/ApplicationModels/Launcher;FileManager/FileManager

View File

@ -0,0 +1,7 @@
name=ut_samples_master
url=https://gitee.com/openharmony/applications_app_samples
branch=master
fullSdkAssembleList=code/BasicFeature/Notification/CustomCommonEvent;code/DocsSample/ApplicationModels/WidgetUpdateByProxy;code/DocsSample/ApplicationModels/FAModelAbilityDevelop;code/DocsSample/ApplicationModels/StageModelAbilityInteraction;code/DocsSample/ApplicationModels/StageModelAbilityDevelop;code/DocsSample/ApplicationModels/StageProcessThread;code/DocsSample/ApplicationModels/StageServiceWidgetCards;code/SystemFeature/InsightIntent/IntentExecute;code/BasicFeature/Media/Image;code/BasicFeature/Security/Huks;code/BasicFeature/Ads/OAIDSample;code/BasicFeature/Connectivity/VPN;code/BasicFeature/Resource/ResourceManager;code/BasicFeature/Telephony/Call;code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/BasicFeature/Security/PaySecurely;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Media/VoiceCallDemo;code/BasicFeature/WindowManagement/WindowRatio;code/SuperFeature/DistributedAppDev/DistributeCalc;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/BasicFeature/DataManagement/Preferences;code/BasicFeature/FileManagement/MediaCollections;code/BasicFeature/Media/GamePuzzle;code/BasicFeature/Media/AVRecorder;code/BasicFeature/DFX/AppRecovery;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/Solutions/Tools/JsClock;code/BasicFeature/Media/Audio;code/BasicFeature/Media/QRCodeScan;code/Solutions/Shopping/OrangeShopping;code/BasicFeature/ApplicationModels/CustomShare;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/BasicFeature/FileManagement/FileManager;code/BasicFeature/IDL/AbilityConnectServiceExtension;code/BasicFeature/Media/Recorder;code/BasicFeature/TaskManagement/ContinuousTask;code/BasicFeature/TaskManagement/Flybird;code/BasicFeature/TaskManagement/TransientTask;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/Telephony/Message;code/BasicFeature/Web/Browser;code/LaunguageBaseClassLibrary/Process;code/LaunguageBaseClassLibrary/LanguageBaseClassLibrary;code/BasicFeature/DeviceManagement/DeviceManagementCollection;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/Solutions/Game/DistributedDataGobang;code/Solutions/Game/Lottie;code/Solutions/Media/MultiMedia;code/Solutions/Tools/FlipClock;code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc;code/SuperFeature/DistributedAppDev/ArkTSDistributedMusicPlayer;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/DistributedRdb;code/SuperFeature/DistributedAppDev/Kvstore;code/SuperFeature/Widget/FormGame;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/SystemFeature/ApplicationModels/Launcher;code/SystemFeature/ApplicationModels/MissionManager;code/SystemFeature/ApplicationModels/StaticSubscriber;code/SystemFeature/Connectivity/Bluetooth;code/SystemFeature/Connectivity/Upload;code/SystemFeature/Connectivity/Wlan;code/SystemFeature/DataManagement/CrossAppDataShare;code/SystemFeature/DeviceManagement/PowerManager;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/DeviceManagement/StorageStatistic;code/SystemFeature/Internationalnation/International;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Media/Screenshot;code/SystemFeature/Security/AbilityAccessCtrl;code/SystemFeature/WindowManagement/WindowExtAbility
basicSignList=code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/BasicFeature/WindowManagement/WindowRatio;code/BasicFeature/Media/Recorder;code/SuperFeature/DistributedAppDev/DistributedRdb;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/Kvstore;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc;code/Solutions/Game/DistributedDataGobang;code/SystemFeature/Connectivity/Bluetooth;code/SystemFeature/DeviceManagement/PowerManager;code/SystemFeature/Internationalnation/International;code/SuperFeature/DistributedAppDev/ArkTSDistributedMusicPlayer;code/Solutions/InputMethod/KikaInput;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/BasicFeature/WindowManagement/WindowManage;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Contact;code/BasicFeature/Telephony/Call;code/BasicFeature/Media/Audio;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/BasicFeature/FileManagement/FileManager;ability/FormLauncher;common/International;device/DeviceUsageStatistics;Telephony/Contact;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Observer;code/BasicFeature/Telephony/SimManager;Account/DistributeAccount;code/BasicFeature/TaskManagement/Flybird;UI/JsTimer;ETSUI/BringApp;
coreSignList=code/BasicFeature/Connectivity/VPN;code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/BasicFeature/Security/PaySecurely;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Media/VoiceCallDemo;code/SuperFeature/DistributedAppDev/DistributeCalc;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/SystemFeature/Connectivity/Upload;code/BasicFeature/Notification/CustomCommonEvent;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/Media/GamePuzzle;code/SystemFeature/DataManagement/CrossAppDataShare;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/BasicFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Media/AVRecorder;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/Solutions/Media/MultiMedia;code/SystemFeature/ApplicationModels/MissionManager;code/SystemFeature/ApplicationModels/StaticSubscriber;code/SystemFeature/Connectivity/Wlan;code/SystemFeature/DeviceManagement/StorageStatistic;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Media/Screenshot;code/SystemFeature/Security/AbilityAccessCtrl;code/Solutions/Tools/FlipClock;code/Solutions/Shopping/OrangeShopping;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/TaskManagement/TransientTask;code/BasicFeature/ApplicationModels/CustomShare;media/ScreenRecorder;ability/GalleryForm;FileManager/StorageStatistic;Graphics/Screenshot;ability/MissionManager;Communication/Wlan;code/BasicFeature/Media/QRCodeScan;Safety/AbilityAccessCtrl;Basic/Screenshot;Notification/Notification;code/SystemFeature/ApplicationModels/Launcher
systemAppList=code/BasicFeature/Connectivity/VPN;code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/Solutions/Game/DistributedDataGobang;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/ApplicationModels/CustomShare;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/SuperFeature/DistributedAppDev/DistributedRdb;code/BasicFeature/Security/PaySecurely;code/SystemFeature/Connectivity/Bluetooth;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Telephony/Message;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/BasicFeature/Media/VoiceCallDemo;code/BasicFeature/WindowManagement/WindowRatio;code/SuperFeature/DistributedAppDev/DistributeCalc;code/SystemFeature/Internationalnation/International;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/FileManagement/FileManager;code/BasicFeature/Media/QRCodeScan;code/SystemFeature/ApplicationModels/MissionManager;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/SystemFeature/Connectivity/Upload;code/SystemFeature/DeviceManagement/StorageStatistic;code/BasicFeature/Notification/CustomCommonEvent;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/Media/GamePuzzle;code/SystemFeature/DataManagement/CrossAppDataShare;code/BasicFeature/Media/Recorder;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/BasicFeature/Media/AVRecorder;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/SystemFeature/Media/Screenshot;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Connectivity/Wlan;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/Solutions/Media/MultiMedia;code/Solutions/Tools/JsClock;code/Solutions/Tools/FlipClock;code/SystemFeature/ApplicationModels/Launcher;FileManager/FileManager

View File

@ -0,0 +1,7 @@
name=ut_samples_master_ohpm
url=https://gitee.com/username/applications_app_samples.git
branch=master
fullSdkAssembleList=code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/BasicFeature/Security/PaySecurely;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Media/VoiceCallDemo;code/BasicFeature/WindowManagement/WindowRatio;code/SuperFeature/DistributedAppDev/DistributeCalc;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/BasicFeature/DataManagement/Preferences;code/BasicFeature/FileManagement/MediaCollections;code/BasicFeature/Media/GamePuzzle;code/BasicFeature/Media/AVRecorder;code/BasicFeature/DFX/AppRecovery;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/Solutions/Tools/JsClock;code/BasicFeature/Media/Audio;code/BasicFeature/Media/QRCodeScan;code/Solutions/Shopping/OrangeShopping;code/BasicFeature/ApplicationModels/CustomShare;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/BasicFeature/FileManagement/FileManager;code/BasicFeature/IDL/AbilityConnectServiceExtension;code/BasicFeature/Media/Recorder;code/BasicFeature/TaskManagement/ContinuousTask;code/BasicFeature/TaskManagement/Flybird;code/BasicFeature/TaskManagement/TransientTask;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/Telephony/Message;code/BasicFeature/Web/Browser;code/LaunguageBaseClassLibrary/Process;code/LaunguageBaseClassLibrary/LanguageBaseClassLibrary;code/BasicFeature/DeviceManagement/DeviceManagementCollection;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/Solutions/Game/DistributedDataGobang;code/Solutions/Game/Lottie;code/Solutions/Media/MultiMedia;code/Solutions/Tools/FlipClock;code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc;code/SuperFeature/DistributedAppDev/ArkTSDistributedMusicPlayer;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/DistributedRdb;code/SuperFeature/DistributedAppDev/Kvstore;code/SuperFeature/Widget/FormGame;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/SystemFeature/ApplicationModels/Launcher;code/SystemFeature/ApplicationModels/MissionManager;code/SystemFeature/ApplicationModels/StaticSubscriber;code/SystemFeature/Connectivity/Bluetooth;code/SystemFeature/Connectivity/Upload;code/SystemFeature/Connectivity/Wlan;code/SystemFeature/DataManagement/CrossAppDataShare;code/SystemFeature/DeviceManagement/PowerManager;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/DeviceManagement/StorageStatistic;code/SystemFeature/Internationalnation/International;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Media/Screenshot;code/SystemFeature/Security/AbilityAccessCtrl;code/SystemFeature/WindowManagement/WindowExtAbility
basicSignList=code/BasicFeature/WindowManagement/WindowRatio;code/BasicFeature/Media/Recorder;code/SuperFeature/DistributedAppDev/DistributedRdb;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/Kvstore;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc;code/Solutions/Game/DistributedDataGobang;code/SystemFeature/Connectivity/Bluetooth;code/SystemFeature/DeviceManagement/PowerManager;code/SystemFeature/Internationalnation/International;code/SuperFeature/DistributedAppDev/ArkTSDistributedMusicPlayer;code/Solutions/InputMethod/KikaInput;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/BasicFeature/WindowManagement/WindowManage;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Contact;code/BasicFeature/Telephony/Call;code/BasicFeature/Media/Audio;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/BasicFeature/FileManagement/FileManager;ability/FormLauncher;common/International;device/DeviceUsageStatistics;Telephony/Contact;code/BasicFeature/Telephony/Message;code/BasicFeature/Telephony/Observer;code/BasicFeature/Telephony/SimManager;Account/DistributeAccount;code/BasicFeature/TaskManagement/Flybird;UI/JsTimer;ETSUI/BringApp;
coreSignList=code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/BasicFeature/Security/PaySecurely;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Media/VoiceCallDemo;code/SuperFeature/DistributedAppDev/DistributeCalc;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/SystemFeature/Connectivity/Upload;code/BasicFeature/Notification/CustomCommonEvent;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/Media/GamePuzzle;code/SystemFeature/DataManagement/CrossAppDataShare;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/BasicFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Media/AVRecorder;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/Solutions/Media/MultiMedia;code/SystemFeature/ApplicationModels/MissionManager;code/SystemFeature/ApplicationModels/StaticSubscriber;code/SystemFeature/Connectivity/Wlan;code/SystemFeature/DeviceManagement/StorageStatistic;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Media/Screenshot;code/SystemFeature/Security/AbilityAccessCtrl;code/Solutions/Tools/FlipClock;code/Solutions/Shopping/OrangeShopping;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/TaskManagement/TransientTask;code/BasicFeature/ApplicationModels/CustomShare;media/ScreenRecorder;ability/GalleryForm;FileManager/StorageStatistic;Graphics/Screenshot;ability/MissionManager;Communication/Wlan;code/BasicFeature/Media/QRCodeScan;Safety/AbilityAccessCtrl;Basic/Screenshot;Notification/Notification;code/SystemFeature/ApplicationModels/Launcher
systemAppList=code/BasicFeature/FileManagement/Photos;code/BasicFeature/FileManagement/FileShare/SandboxShare;code/BasicFeature/FileManagement/FileShare/Picker;code/SuperFeature/Widget/FormExtAbility;code/SuperFeature/DistributedAppDev/DistributedNote;code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer;code/SystemFeature/ApplicationModels/StaticSubscriber;code/Solutions/Game/DistributedDataGobang;code/UI/ArkTsComponentCollection/ComponentCollection;code/BasicFeature/ApplicationModels/CustomShare;code/BasicFeature/Notification/CustomNotificationPush;code/BasicFeature/FileManagement/FileBackupExtension;code/SuperFeature/DistributedAppDev/DistributedRdb;code/BasicFeature/Security/PaySecurely;code/SystemFeature/Connectivity/Bluetooth;code/BasicFeature/Connectivity/WebSocket;code/SystemFeature/Interantionalnation/International;code/BasicFeature/Connectivity/Bluetooth;code/SystemFeature/ApplicationModels/PersistentProxyForm;code/SystemFeature/ApplicationModels/Template;code/SuperFeature/Widget/RequestAddForm;code/SystemFeature/ApplicationModels/Receiver;code/SystemFeature/ApplicationModels/ProcessProxyForm;code/SystemFeature/ApplicationModels/Template;code/BasicFeature/Telephony/Message;code/SuperFeature/DistributedAppDev/DistributedAuthentication;code/BasicFeature/Media/VoiceCallDemo;code/BasicFeature/WindowManagement/WindowRatio;code/SuperFeature/DistributedAppDev/DistributeCalc;code/SystemFeature/Internationalnation/International;code/BasicFeature/Connectivity/Socket;code/SystemFeature/Media/Camera;code/SuperFeature/DistributedAppDev/DistributedAccount;code/SystemFeature/ApplicationModels/TestRely/LauncherTest/CrossChainBack;code/Project/ResourceAllocation/ApplicationThemeSwitch;code/SystemFeature/DeviceManagement/DeviceManagementCollection;code/BasicFeature/Notification/CustomNotification;code/Solutions/InputMethod/KikaInputMethod;code/BasicFeature/FileManagement/FileManager;code/BasicFeature/Media/QRCodeScan;code/SystemFeature/ApplicationModels/MissionManager;code/BasicFeature/Media/AVSession/MediaController;code/BasicFeature/Media/AVSession/MediaProvider;code/SystemFeature/Connectivity/Upload;code/SystemFeature/DeviceManagement/StorageStatistic;code/BasicFeature/Notification/CustomCommonEvent;code/BasicFeature/ApplicationModels/StageModel;code/BasicFeature/Media/GamePuzzle;code/SystemFeature/DataManagement/CrossAppDataShare;code/BasicFeature/Media/Recorder;code/SystemFeature/DeviceManagement/Screen;code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility;code/BasicFeature/Media/AVRecorder;code/SystemFeature/Security/AbilityAccessCtrl;code/SuperFeature/Widget/ArkTSCard/MusicControl;code/SystemFeature/Media/Screenshot;code/SystemFeature/Media/ScreenRecorder;code/SystemFeature/Connectivity/Wlan;code/BasicFeature/TaskManagement/WorkScheduler;code/BasicFeature/DeviceUsageStatistics/DeviceUsageStatistics;code/Solutions/Media/MultiMedia;code/Solutions/Tools/JsClock;code/Solutions/Tools/FlipClock;code/SystemFeature/ApplicationModels/Launcher;FileManager/FileManager

View File

@ -0,0 +1,6 @@
@echo off
set time0=%time: =0%
set aa=log_%Date:~2,2%%Date:~5,2%%Date:~8,2%_%time0:~0,2%%time0:~3,2%
echo print to hilog-%aa%.txt
hdc shell hilog > hilog-%aa%.txt
pause

BIN
code/Project/HapBuild/compile-tool/tool/hap-sign-tool.jar (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,44 @@
-----BEGIN CERTIFICATE-----
MIICRDCCAcmgAwIBAgIED+E4izAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE0MThaFw00OTEyMzExMjE0MThaMGgxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEoMCYG
A1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTB2MBAGByqGSM49
AgEGBSuBBAAiA2IABE023XmRaw2DnO8NSsb+KG/uY0FtS3u5LQucdr3qWVnRW5ui
QIL6ttNZBEeLTUeYcJZCpayg9Llf+1SmDA7dY4iP2EcRo4UN3rilovtfFfsmH4ty
3SApHVFzWUl+NwdH8KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
AQYwHQYDVR0OBBYEFBc6EKGrGXzlAE+s0Zgnsphadw7NMAwGCCqGSM49BAMDBQAD
ZwAwZAIwd1p3JzHN93eoPped1li0j64npgqNzwy4OrkehYAqNXpcpaEcLZ7UxW8E
I2lZJ3SbAjAkqySHb12sIwdSFKSN9KCMMEo/eUT5dUXlcKR2nZz0MJdxT5F51qcX
1CumzkcYhgU=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG
A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr
gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26
uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf
+OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G
A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL
oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf
qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm
Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICMzCCAbegAwIBAgIEaOC/zDAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy
MTIxOTMxWhcNNDkxMjMxMTIxOTMxWjBoMQswCQYDVQQGEwJDTjEUMBIGA1UEChML
T3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xKDAmBgNVBAMT
H09wZW5IYXJtb255IEFwcGxpY2F0aW9uIFJlbGVhc2UwWTATBgcqhkjOPQIBBggq
hkjOPQMBBwNCAATbYOCQQpW5fdkYHN45v0X3AHax12jPBdEDosFRIZ1eXmxOYzSG
JwMfsHhUU90E8lI0TXYZnNmgM1sovubeQqATo1IwUDAfBgNVHSMEGDAWgBTbhrci
FtULoUu33SV7ufEFfaItRzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFPtxruhl
cRBQsJdwcZqLu9oNUVgaMAwGCCqGSM49BAMDBQADaAAwZQIxAJta0PQ2p4DIu/ps
LMdLCDgQ5UH1l0B4PGhBlMgdi2zf8nk9spazEQI/0XNwpft8QAIwHSuA2WelVi/o
zAlF08DnbJrOOtOnQq5wHOPlDYB4OtUzOYJk9scotrEnJxJzGsh/
-----END CERTIFICATE-----

View File

@ -0,0 +1,44 @@
-----BEGIN CERTIFICATE-----
MIICRDCCAcmgAwIBAgIED+E4izAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE0MThaFw00OTEyMzExMjE0MThaMGgxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEoMCYG
A1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTB2MBAGByqGSM49
AgEGBSuBBAAiA2IABE023XmRaw2DnO8NSsb+KG/uY0FtS3u5LQucdr3qWVnRW5ui
QIL6ttNZBEeLTUeYcJZCpayg9Llf+1SmDA7dY4iP2EcRo4UN3rilovtfFfsmH4ty
3SApHVFzWUl+NwdH8KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
AQYwHQYDVR0OBBYEFBc6EKGrGXzlAE+s0Zgnsphadw7NMAwGCCqGSM49BAMDBQAD
ZwAwZAIwd1p3JzHN93eoPped1li0j64npgqNzwy4OrkehYAqNXpcpaEcLZ7UxW8E
I2lZJ3SbAjAkqySHb12sIwdSFKSN9KCMMEo/eUT5dUXlcKR2nZz0MJdxT5F51qcX
1CumzkcYhgU=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG
A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr
gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26
uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf
+OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G
A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL
oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf
qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm
Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICODCCAb2gAwIBAgIEFKYJUDAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy
MTIyMTI1WhcNNDkxMjMxMTIyMTI1WjBuMQswCQYDVQQGEwJDTjEUMBIGA1UEChML
T3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xLjAsBgNVBAMT
JU9wZW5IYXJtb255IEFwcGxpY2F0aW9uIFByb2ZpbGUgRGVidWcwWTATBgcqhkjO
PQIBBggqhkjOPQMBBwNCAATZNH/LPiyU8ar4uBIFyi40yCUTX1nqsXExvaDVHkC+
ZZT+6D+gVK+Dxz1fH0lCt1IgTAxQBd0OVTM9i+PJIE3ao1IwUDAfBgNVHSMEGDAW
gBTbhrciFtULoUu33SV7ufEFfaItRzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYE
FFQ8O5FRWjHrsdwhrA15sSEVovdyMAwGCCqGSM49BAMDBQADZwAwZAIweioYr8UT
KDiyo2PQPHqgsyVsNPVk9kZaC9yrpIawN+55fevOXzFiuGP0IjCLhCFSAjA+69aB
La2cynFQtEOk59rSD5v0ZHIgzJX4L+ROAumr/qt1O14yWTJA7jzZuHPIT3c=
-----END CERTIFICATE-----

View File

@ -0,0 +1,44 @@
-----BEGIN CERTIFICATE-----
MIICRDCCAcmgAwIBAgIED+E4izAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE0MThaFw00OTEyMzExMjE0MThaMGgxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEoMCYG
A1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTB2MBAGByqGSM49
AgEGBSuBBAAiA2IABE023XmRaw2DnO8NSsb+KG/uY0FtS3u5LQucdr3qWVnRW5ui
QIL6ttNZBEeLTUeYcJZCpayg9Llf+1SmDA7dY4iP2EcRo4UN3rilovtfFfsmH4ty
3SApHVFzWUl+NwdH8KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
AQYwHQYDVR0OBBYEFBc6EKGrGXzlAE+s0Zgnsphadw7NMAwGCCqGSM49BAMDBQAD
ZwAwZAIwd1p3JzHN93eoPped1li0j64npgqNzwy4OrkehYAqNXpcpaEcLZ7UxW8E
I2lZJ3SbAjAkqySHb12sIwdSFKSN9KCMMEo/eUT5dUXlcKR2nZz0MJdxT5F51qcX
1CumzkcYhgU=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICYTCCAeWgAwIBAgIEHmXAPTAMBggqhkjOPQQDAwUAMGgxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEoMCYGA1UEAxMfT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gUm9vdCBDQTAeFw0y
MTAyMDIxMjE1MzJaFw00OTEyMzExMjE1MzJaMGMxCzAJBgNVBAYTAkNOMRQwEgYD
VQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVhbTEjMCEG
A1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwdjAQBgcqhkjOPQIBBgUr
gQQAIgNiAAQhnu7Hna8XNa2KyqRf5+lBJScE4xqf89N0g0OuqAb2re8nGsvWkw26
uDekfnBYicd+G3Cydqa2zFIwV7Talyg2ULW3r8KbGpyl84mJEPPRmCGJ+H9gtCsf
+OrJ4Y76LVWjYzBhMB8GA1UdIwQYMBaAFBc6EKGrGXzlAE+s0Zgnsphadw7NMA8G
A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTbhrciFtUL
oUu33SV7ufEFfaItRzAMBggqhkjOPQQDAwUAA2gAMGUCMG3cXjiDmXTvf7D4Omhf
qcc2nuO+EMfWE+N9ZhBP5UhV34mAGWi3SfLU6rcV0urWEQIxAMYIb3epOnKhUrcm
Lfu1WKzFlpYQwmw73RaCHP2I3k6NcuWOYeNwWXSNZ8o0nzvaLg==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIICPDCCAb+gAwIBAgIEN6dtvjAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO
MRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh
bTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy
MTIyMTA1WhcNNDkxMjMxMTIyMTA1WjBwMQswCQYDVQQGEwJDTjEUMBIGA1UEChML
T3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xMDAuBgNVBAMT
J09wZW5IYXJtb255IEFwcGxpY2F0aW9uIFByb2ZpbGUgUmVsZWFzZTBZMBMGByqG
SM49AgEGCCqGSM49AwEHA0IABFfPAuu5prLiQXG+FcmSKJqtRjeDDZgfAeitKsSM
3tzhHk2oN/UD0vHGbgIrVD8fv8igUZEJFsOTNM4DbovGGJqjUjBQMB8GA1UdIwQY
MBaAFNuGtyIW1QuhS7fdJXu58QV9oi1HMA4GA1UdDwEB/wQEAwIHgDAdBgNVHQ4E
FgQUy2Hpvad6TtTPlbOE7AX99l8NAVIwDAYIKoZIzj0EAwMFAANpADBmAjEArI6u
CYJiea5IJBFC7JBluWgGshKdEHdGPv3sopi34kKPZNxm9eGn9OGNBjZg/qqdAjEA
oIZqet/+DDpB7CRdTAUhisGmgE8w3ETgiibdUhrAAUOo6SSzozUQeKn+c37l5A+z
-----END CERTIFICATE-----

View File

@ -0,0 +1,35 @@
{
"version-name": "2.0.0",
"version-code": 2,
"uuid": "fe686e1b-3770-4824-a938-961b140a7c98",
"validity": {
"not-before": 1610519532,
"not-after": 1705127532
},
"type": "debug",
"bundle-info": {
"developer-id": "OpenHarmony",
"development-certificate": "-----BEGIN CERTIFICATE-----\nMIICMzCCAbegAwIBAgIEaOC/zDAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO\nMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh\nbTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy\nMTIxOTMxWhcNNDkxMjMxMTIxOTMxWjBoMQswCQYDVQQGEwJDTjEUMBIGA1UEChML\nT3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xKDAmBgNVBAMT\nH09wZW5IYXJtb255IEFwcGxpY2F0aW9uIFJlbGVhc2UwWTATBgcqhkjOPQIBBggq\nhkjOPQMBBwNCAATbYOCQQpW5fdkYHN45v0X3AHax12jPBdEDosFRIZ1eXmxOYzSG\nJwMfsHhUU90E8lI0TXYZnNmgM1sovubeQqATo1IwUDAfBgNVHSMEGDAWgBTbhrci\nFtULoUu33SV7ufEFfaItRzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFPtxruhl\ncRBQsJdwcZqLu9oNUVgaMAwGCCqGSM49BAMDBQADaAAwZQIxAJta0PQ2p4DIu/ps\nLMdLCDgQ5UH1l0B4PGhBlMgdi2zf8nk9spazEQI/0XNwpft8QAIwHSuA2WelVi/o\nzAlF08DnbJrOOtOnQq5wHOPlDYB4OtUzOYJk9scotrEnJxJzGsh/\n-----END CERTIFICATE-----\n",
"bundle-name": "com.OpenHarmony.app.test",
"apl": "normal",
"app-feature": "hos_normal_app"
},
"acls": {
"allowed-acls": [
""
]
},
"permissions": {
"restricted-permissions": [
""
]
},
"debug-info": {
"device-ids": [
"69C7505BE341BDA5948C3C0CB44ABCD530296054159EFE0BD16A16CD0129CC42",
"7EED06506FCE6325EB2E2FAA019458B856AB10493A6718C7679A73F958732865"
],
"device-id-type": "udid"
},
"issuer": "pki_internal"
}

View File

@ -0,0 +1,28 @@
{
"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-----\nMIICMzCCAbegAwIBAgIEaOC/zDAMBggqhkjOPQQDAwUAMGMxCzAJBgNVBAYTAkNO\nMRQwEgYDVQQKEwtPcGVuSGFybW9ueTEZMBcGA1UECxMQT3Blbkhhcm1vbnkgVGVh\nbTEjMCEGA1UEAxMaT3Blbkhhcm1vbnkgQXBwbGljYXRpb24gQ0EwHhcNMjEwMjAy\nMTIxOTMxWhcNNDkxMjMxMTIxOTMxWjBoMQswCQYDVQQGEwJDTjEUMBIGA1UEChML\nT3Blbkhhcm1vbnkxGTAXBgNVBAsTEE9wZW5IYXJtb255IFRlYW0xKDAmBgNVBAMT\nH09wZW5IYXJtb255IEFwcGxpY2F0aW9uIFJlbGVhc2UwWTATBgcqhkjOPQIBBggq\nhkjOPQMBBwNCAATbYOCQQpW5fdkYHN45v0X3AHax12jPBdEDosFRIZ1eXmxOYzSG\nJwMfsHhUU90E8lI0TXYZnNmgM1sovubeQqATo1IwUDAfBgNVHSMEGDAWgBTbhrci\nFtULoUu33SV7ufEFfaItRzAOBgNVHQ8BAf8EBAMCB4AwHQYDVR0OBBYEFPtxruhl\ncRBQsJdwcZqLu9oNUVgaMAwGCCqGSM49BAMDBQADaAAwZQIxAJta0PQ2p4DIu/ps\nLMdLCDgQ5UH1l0B4PGhBlMgdi2zf8nk9spazEQI/0XNwpft8QAIwHSuA2WelVi/o\nzAlF08DnbJrOOtOnQq5wHOPlDYB4OtUzOYJk9scotrEnJxJzGsh/\n-----END CERTIFICATE-----\n",
"bundle-name": "com.OpenHarmony.app.test",
"apl": "normal",
"app-feature": "hos_normal_app"
},
"acls": {
"allowed-acls": [
""
]
},
"permissions": {
"restricted-permissions": []
},
"issuer": "pki_internal",
"app-privilege-capabilities":["AllowAppDataNotCleared","AllowAppUsePrivilegeExtension","AllowAppMultiProcess","AllowAbilityPriorityQueried","AllowAbilityExcludeFromMissions","AllowFormVisibleNotify"]
}

View File

@ -0,0 +1,296 @@
# 流水线工具部署文档
## wsl ubuntu 安装
### 开发者模式开启
安装首先要启用windows的开发者模式左下角搜索 `开发者设置`并启用。
![image](./screenshots/windev.png)
![image](./screenshots//windev2.png)
### 启用windows功能
左下角搜索 `启用或关闭windows功能`,勾选 `适用于Linux的windows子系统`
![image](./screenshots/winfunction.png)
### linux-Ubuntu 下载
桌面左下角搜索 `Microsoft store`打开商店, 搜索linux下载Ubuntu22.04.02 LTS。
![image](./screenshots//ubuntu.png)
下载完成后直接双击启动,会自动安装,一两分钟后安装完毕,按提示设置**用户名**、**密码**。
![image](./screenshots/linux.png)
## ubuntu环境配置
### 基本指令下载
在ubuntu命令行工具中输入以下命令安装工具。
```
sudo apt-get update
sudo apt-get install git-lfs bison flex gnupg build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses-dev x11proto-core-dev libx11-dev libc++1 lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 libtinfo5 bc genext2fs liblz4-tool libssl-dev ruby gdb libelf-dev libxcursor-dev libxrandr-dev libxinerama-dev
```
### 安装JDK
```
sudo apt-get update
sudo apt-get install openjdk-11-jdk
```
安装完毕后输入 `java -version`验证
![image](./screenshots/javaverify.png)
### 安装node
```
cd ~
mkdir Node
cd Node
wget https://nodejs.org/download/release/v16.19.1/node-v16.19.1-linux-x64.tar.xz
tar -xvf node-v16.19.1-linux-x64.tar.xz
```
![image](./screenshots/nodedownload.png)
### 配置node环境变量
```
cd node-v16.19.1-linux-x64
pwd
```
右键复制输出的路径按照以下命令打开配置文件编辑将userName替换为真实的用户名。
```
vim ~/.bashrc
// 添加以下内容
export NODE_HOME=/home/userName/Node/node-v16.19.1-linux-x64
export PATH=$NODE_HOME:$PATH
export NODE_HOME_BIN=/home/userName/Node/node-v16.19.1-linux-x64/bin
export PATH=$NODE_HOME_BIN:$PATH
```
![image](./screenshots/setnode.png)
编辑完键盘按esc 然后输入 `:wq`回车保存。
输入以下命令重载入环境变量,并验证。
```
source ~/.bashrc
node -v
```
![image](./screenshots/nodeversion.png)
### 安装ohpm工具
下载ohpm工具压缩包并解压
```
wget "https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/a6/v3/cXARnGbKTt-4sPEi3GcnJA/ohcommandline-tools-linux-2.0.0.1.zip?HW-CC-KV=V1&HW-CC-Date=20230512T075353Z&HW-CC-Expire=315360000&HW-CC-Sign=C82B51F3C9F107AB460EC26392E25B2E20EF1A6CAD10A26929769B21B8C8D5B6" -O ohpmTool.zip
unzip ohpmTool.zip
```
![image](./screenshots/ohpmdownload.png)
初始化ohpm
```
cd oh-command-line-tools/ohpm/bin/
pwd
./init
```
![image](./screenshots/ohpminit.png)
复制一下上面pwd输出的结果然后手动添加ohpm的目录到环境变量。
```
vim ~/.bashrc
// 添加以下内容
export OHPM_HOME=/home/userName/oh-command-line-tools/ohpm/bin
export PATH=$OHPM_HOME:$PATH
```
![image](./screenshots/setohpm.png)
重新加载环境变量,并验证。
```
source ~/.bashrc
cd ~
ohpm
```
![image](./screenshots//ohpmversion.png)
## HapBuild工具下载
```
cd ~
git init
git config core.sparsecheckout true
echo code/Project/HapBuild > .git/info/sparse-checkout
git remote add origin https://gitee.com/openharmony/applications_app_samples.git
git pull origin master
```
### 下载SDK
```
cd ~
cd HapBuild/compile-tool
cd bin
./init-sdk.sh
```
![image](./screenshots/compiletooldownload.png)
执行完以上命令后开始下载SDK,一共要下8个SDK耗时较长。
下载完SDK后手动添加hdc的目录到环境变量。
```
cd ~
cd /home/userName/HapBuild/compile-tool/sdk/10/toolchains
pwd
vim ~/.bashrc
// 添加以下内容
export HDC_HOME=/home/userName/HapBuild/compile-tool/sdk/10/toolchains
export PATH=$HDC_HOME:$PATH
```
![image](./screenshots/sethdc.png)
重新加载环境变量,并验证。
```
source ~/.bashrc
cd ~
hdc
```
![image](./screenshots/hdcversion.png)
### 初始化本地sample仓
```
Cd ~
$PWD/HapBuild/compile-tool/bin/compile-ut-ohpm.sh --p=$PWD/HapBuild/compile-tool/config/ut_samples_master.config --compile_dir=code
```
仓库克隆完毕即可退出。
### 修改项目配置文件
打开项目路径下的 `ci/config.dev.ts`编辑后台服务配置文件,修改配置文件路径为真实路径。
打开gitee官网[申请私人令牌](https://gitee.com/profile/personal_access_tokens),将申请到的私人令牌复制,替换 `accessToken`
```
vim ~/HapBuild/ci/config.dev.ts
// 将accessToken替换成从gitee上申请的私人令牌将userName改为真实用户名
export const ACCESS_TOKEN = 'accessToken';
export const PROJECT_PATH = '/home/userName/HapBuild/compile-tool/projects/ut_samples_master';
export const CONFIG_PATH = '/home/userName/HapBuild/compile-tool/config/ut_samples_master.config';
export const COMPILE_SH_PATH = '/home/userName/HapBuild/compile-tool/bin/compile-ohpm-ci.sh';
export const SIGN_HAP_PATH = '/home/userName/HapBuild/compile-tool/out/ut_samples_master/full-sdk/hap-out-with-signed';
export const TEST_TOOL_PATH = '/home/userName/HapBuild/test-tool/InstallAndTestSpecial_ci.py';
export const CONTAINS_PATH = '/home/userName/HapBuild/test-tool/LinuxContains.py';
export const SIGN_FULL_PATH = '/home/userName/HapBuild/compile-tool/out/ut_samples_master/full-sdk/hap-out-with-signed/';
export const SIGN_PUBLIC_PATH = '/home/userName/HapBuild/compile-tool/out/ut_samples_master/public-sdk/hap-out-with-signed/';
```
修改完成后保存退出。
打开项目路径下的 `test-tool/LinuxContains.py`编辑测试脚本配置文件。
```
vim ~/HapBuild/test-tool/LinuxContains.py
// 将userName改为真实用户名
SIGN_HAP_PATH = r'/home/userName/HapBuild/compile-tool/out/ut_samples_master/full-sdk/hap-out-with-signed/'
FA_MODAL_AND_LOWER_CASE_LIST = r'/home/userName/HapBuild/test-tool/FA_Model_And_Lower_Case_List.json'
INSTALL_LIST_CAPABILITY = r'/home/userName/HapBuild/test-tool/install_list_capability.json'
SAVE_XML_PATH = r'/home/userName/HapBuild/test-tool'
COMBIN_CONFIG = r'/home/userName/HapBuild/test-tool/CombinationConfig.json'
SPECIAL_LIST = r'/home/userName/HapBuild/test-tool/special_list.json'
SPECIAL_HAP = r'code_UI_JsComponentCollection_JsComponentCollection;code_SuperFeature_MultiDeviceAppDev_JsAdaptiveCapabilities;code_BasicFeature_FileManagement_FileShare_SandboxShare;code_SystemFeature_DeviceManagement_DeviceManagementCollection;code_BasicFeature_Security_PaySecurely_paySDK;code_SystemFeature_ApplicationModels_Launcher;code_SuperFeature_DistributedAppDev_JsDistributedMusicPlayer;code_SuperFeature_DistributedAppDev_DistributeCalc;code_Solutions_Tools_JsClock;code_BasicFeature_Notification_CustomNotificationBadge'
TARGET_PATH = r'code_Solutions_Game_DistributedDataGobang'
```
### 下载依赖
下载测试脚本所需python环境及python依赖。
```
cd ~
sudo apt update
sudo apt install python3
```
检测是否安装完成。
```
python3 --version
```
![image](./screenshots/pythonversion.png)
下载依赖。
```
sudo apt update
sudo apt install python3-pip
pip install paramiko
```
## 运行ci模块
初始化ci下载依赖。
```
cd ~/HapBuild/ci
npm i -g @nestjs/cli
npm i
npm run build
npm install pm2 -g
```
> pm2如果安装不上可以尝试清除 npm 缓存 `npm cache clean --force`再使用淘宝npm镜像 `npm config set registry https://registry.npm.taobao.org/`,最后再尝试安装 `npm install pm2 -g`
运行项目。
```
cd ~/HapBuild/ci
pm2 start dist/src/main.js
```
![image](./screenshots/cistart.png)
使用以下命令可以看到项目的运行情况。
```
pm2 status
```
![image](./screenshots/cistatus.png)
使用以下命令停止该项目。
```
pm2 stop dist/src/main.js
```
![image](./screenshots/cistop.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,8 @@
{
"code_SystemFeature_DataManagement_CrossAppDataShare_dataUser_signed.hap": ["code_SystemFeature_DataManagement_CrossAppDataShare_dataProvider_signed.hap"],
"code_SystemFeature_ApplicationModels_StaticSubscriber_entry_signed.hap": ["code_SystemFeature_ApplicationModels_StaticSubscriber_publish_signed.hap"],
"code_BasicFeature_ApplicationModels_CustomShare_entry_signed.hap": ["code_Solutions_IM_Chat_entry_signed.hap"],
"code_Project_ApplicationHap_MultiHap_entry_signed.hap": ["code_Project_ApplicationHap_MultiHap_audioFeature_signed.hap","code_Project_ApplicationHap_MultiHap_videoFeature_signed.hap"],
"code_BasicFeature_Media_AVSession_MediaController_entry_signed.hap": ["code_BasicFeature_Media_AVSession_MediaProvider_entry_signed.hap"],
"code_BasicFeature_Security_PaySecurely_entry_signed.hap":["code_BasicFeature_Security_PaySecurely_paySDK_signed.hap"]
}

View File

@ -0,0 +1,6 @@
{
"ohos.samples.socket":"code_BasicFeature_Connectivity_Socket",
"ohos.samples.etsvibrator":"code_BasicFeature_DeviceManagement_Vibrator_BasicVibration",
"ohos.samples.etsdefiningpagelayoutandconnection":"code_UI_ArkTsComponentCollection_DefiningPageLayoutAndConnection",
"com.example.nbody":"code_Performance_ArkRuntime_NBody"
}

View File

@ -0,0 +1,487 @@
'''
# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
'''
import datetime
import json
import os
import re
import shutil
import stat
import subprocess
import sys
import time
import paramiko
import LinuxContains
install_fail_dict = {}
install_success_dict = {}
total_hap_num = 0
hap_install_success = 0
hap_install_fail = 0
special_num = 0
special_hap_list = []
depend_config_map = dict
CONFIG_PATH='D:\\window_manager_config.xml'
FINGER_PRINT = '8E93863FC32EE238060BF69A9B37E2608FFFB21F93C862DD511CBAC9F30024B5'
repeat_time = 0
snapshot = 1
def exec_cmd(cmd):
f = os.popen("hdc shell " + "\"" + cmd + "\"")
# print(cmd)
text = f.read()
f.close()
return text
def exec_cmd_path(cmd, path):
f = os.popen("hdc shell " + "\"" + cmd + "\" >> " + path)
# print(cmd)
text = f.read()
f.close()
return text
def exec_cmd_simple(cmd):
f = os.popen(cmd)
# print(cmd)
text = f.read()
f.close()
return text
def exists(file_path):
return os.path.exists(file_path)
def get_haps(local_dir):
files = os.listdir(local_dir)
hap_list = []
for file in files:
if "_signed" in file:
hap_list.append(file)
return hap_list
def install_hap(hap, hap_path, base_dir):
# print("install " + hap_path + "\\" + hap)
if not exists(os.path.join(hap_path, hap)):
return
install_res = exec_cmd_simple("hdc install -r {}".format(hap_path + "/" + hap))
# print(install_res)
if not install_res.__contains__("msg:install bundle successfully."):
install_res = install_res.replace("\nAppMod finish\n\n", "")
install_fail_dict[hap] = install_res
else:
exec_cmd_simple("echo install {0} success! >> {1}".format(hap, "{0}/auto_test.log".format(base_dir)))
install_success_dict[hap] = install_res
time.sleep(2)
def install_depend_haps(curr_haps, hap_path, base_dir):
for hap in curr_haps:
if not depend_config_map.get(hap):
continue
depend_haps = depend_config_map.get(hap)
for depend_hap in depend_haps:
install_hap(depend_hap, hap_path, base_dir)
install_depend_haps(depend_haps, hap_path, base_dir)
def get_test_bundle(begin_bundles):
end_bundles = get_all_bundles()
return list(set(end_bundles) - set(begin_bundles))
def install_haps(local_hap, hap_path, base_dir):
for hap in local_hap:
install_hap(hap, hap_path, base_dir)
def start_log():
cmd_clean = "rm -r /data/log/hilog/*"
cmd_start = "hilog -w start -l 1M"
exec_cmd(cmd_clean)
exec_cmd(cmd_start)
def stop_log():
cmd_stop = "hilog -w stop"
exec_cmd(cmd_stop)
def recv_log(local_log):
# 输出日志结果
file_path = local_log
cmd = "hdc file recv /data/log/hilog/ {}".format(file_path)
exec_cmd_simple(cmd)
def test_install_hap_with_error_snapshot(uninstall_bundles, base_dir):
with open(LinuxContains.FA_MODAL_AND_LOWER_CASE_LIST,'r',encoding='utf-8') as fp:
FA_Python_Obj=json.load(fp)
is_stage_model=0
for key,value in FA_Python_Obj.items():
for bundle_name in uninstall_bundles:
# print("key: "+key)
bundle_name=bundle_name.strip()
if bundle_name==key:
is_stage_model=is_stage_model+1
if is_stage_model == 0:
cmd = r"hdc shell aa test -b {} -p com.example.entry_test -m entry_test -s unittest /ets/TestRunner/OpenHarmonyTestRunner -s timeout 30000000 "
else:
cmd= r"hdc shell aa test -b {} -p com.example.entry_test -m entry_test -s unittest OpenHarmonyTestRunner -s timeout 30000000 "
path = "{0}/auto_test.log".format(base_dir)
if len(uninstall_bundles) != 1:
exec_cmd_simple("echo uninstall_bundles:{0}, >> {1}".format(uninstall_bundles, path))
for bundle in uninstall_bundles:
bundle = bundle.strip()
exec_cmd_simple("echo ================start {0} ui test================{1} >> {2}".format(bundle,
datetime.datetime.now().strftime(
'%Y-%m-%d %H:%M:%S'),
path))
# print("test " + bundle)
tmp_cmd = cmd.format(bundle)
# print(tmp_cmd)
p = subprocess.Popen(tmp_cmd, shell=True, close_fds=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, encoding="utf-8")
current = "-1"
auto_log = open("{0}/auto_test.log".format(base_dir), mode='a')
while True:
line = p.stdout.readline()
auto_log.writelines(line)
if line and "current" in line:
nums = re.findall(r"\d+", line)
if (len(nums) == 0):
current = "0"
else:
current = nums[0]
if line and "stack" in line:
exec_cmd_simple(
"hdc shell snapshot_display -f /data/snapshot/{0}_{1}.jpeg".format(bundle, current))
if line == '' and p.poll() != None:
break
exec_cmd_simple("hdc file recv /data/snapshot/. {}/snapshot".format(base_dir))
exec_cmd_simple("hdc shell rm -rf /data/snapshot/*")
auto_log.flush()
auto_log.close()
time.sleep(5)
def test_install_hap(test_bundles, base_dir):
cmd = r"aa test -b {} -p com.example.entry_test -m entry_test -s unittest OpenHarmonyTestRunner -s timeout 30000000"
path = "{0}/auto_test.log".format(base_dir)
for bundle in test_bundles:
bundle = bundle.strip()
if bundle == 'ohos.samples.launcher':
cmd_launcher = 'hdc shell aa start -b ohos.samples.launcher -a MainAbility'
os.system(cmd_launcher)
exec_cmd_simple("echo ================start {0} ui test================{1} >> {2}".format(bundle,
datetime.datetime.now().strftime(
'%Y-%m-%d %H:%M:%S'),
path))
# print("test " + bundle)
tmp_cmd = cmd.format(bundle)
exec_cmd_path(tmp_cmd, path)
time.sleep(5)
def uninstall_bundles(install_bundles):
for bundle in install_bundles:
# print("uninstall " + bundle)
uninstall_res = exec_cmd_simple("hdc uninstall {}".format(bundle))
def clear_dir(dir_path):
if os.path.exists(dir_path):
shutil.rmtree(dir_path)
os.makedirs(dir_path)
def clear_file(file_path):
if os.path.exists(file_path):
os.remove(file_path)
os.system(r"type nul>{}".format(file_path))
def get_all_bundles():
bundles = exec_cmd("bm dump -a")
bundles = bundles.splitlines()
del bundles[0]
return bundles
def batch_install(haps, base_dir):
start_log()
exec_cmd_simple("hdc shell power-shell setmode 602")
# exec_cmd_simple("hdc shell setenforce 0")
exec_cmd_simple("hdc shell param set persist.ace.testmode.enabled 1")
exec_cmd_simple("hdc shell mkdir /data/snapshot")
limit = 2
count = 0
time = 0
cur_batch_hap = []
special_haps = LinuxContains.SPECIAL_HAP.split(";")
target_paths = LinuxContains.TARGET_PATH.split(";")
begin_bundles = get_all_bundles()
while time <= repeat_time:
for hap in haps:
isTargetPath = False
for target_path in target_paths:
if hap.startswith(target_path):
isTargetPath = True
if not isTargetPath:
continue
isSpecialSkip = False
for special_hap in special_haps:
if special_hap in hap:
global special_num
isSpecialSkip = True
special_hap_list.append(hap)
special_num = special_num + 1
break
if isSpecialSkip:
continue
cur_batch_hap.append(hap)
count = count + 1
if count == limit:
install_haps(cur_batch_hap, LinuxContains.SIGN_HAP_PATH, base_dir)
test_bundles = get_test_bundle(begin_bundles)
install_depend_haps(cur_batch_hap, LinuxContains.SIGN_HAP_PATH, base_dir)
all_install_bundles = get_test_bundle(begin_bundles)
if snapshot == 0:
test_install_hap(test_bundles, base_dir)
else:
test_install_hap_with_error_snapshot(test_bundles, base_dir)
count = 0
uninstall_bundles(all_install_bundles)
cur_batch_hap.clear()
if len(cur_batch_hap) != 0:
install_haps(cur_batch_hap, LinuxContains.SIGN_HAP_PATH, base_dir)
test_bundles = get_test_bundle(begin_bundles)
install_depend_haps(cur_batch_hap, LinuxContains.SIGN_HAP_PATH, base_dir)
all_install_bundles = get_test_bundle(begin_bundles)
if snapshot == 0:
test_install_hap(test_bundles, base_dir)
else:
test_install_hap_with_error_snapshot(test_bundles, base_dir)
uninstall_bundles(all_install_bundles)
cur_batch_hap.clear()
time += 1
stop_log()
recv_log(base_dir + "/")
def handle_test_log(base_dir):
file = open("{0}/auto_test.log".format(base_dir), encoding='utf-8', errors='ignore')
p_num = 0
fail_num = 0
success_num = 0
test_exp_num = 0
test_pass_num = 0
test_fail_num = 0
test_error_num = 0
died_num = 0
fail_dict = []
died_dict = []
curr_name = ""
has_result = 1
for x in file:
if x.startswith(r"================start"):
if (has_result == 0):
fail_num = fail_num + 1
fail_dict.append(curr_name)
else:
has_result = 0
p_num = p_num + 1
curr_name = x.split(" ")[1]
if x.startswith(r"OHOS_REPORT_RESULT"):
has_result = 1
nums = re.findall(r"\d+", x)
if len(nums) == 4 or len(nums) == 5:
if nums[0] == nums[3] and int(nums[0]) != 0:
success_num = success_num + 1
else:
fail_num = fail_num + 1
fail_dict.append(curr_name)
test_exp_num = test_exp_num + int(nums[0])
test_fail_num = test_fail_num + int(nums[1])
test_error_num = test_error_num + int(nums[2])
test_pass_num = test_pass_num + int(nums[3])
else:
fail_num = fail_num + 1
fail_dict.append(curr_name)
elif x.__contains__("App died"):
has_result = 1
died_num = died_num + 1
died_dict.append(curr_name)
file.close()
error_log = open("{0}/auto_test.log".format(base_dir), mode='a')
error_log.writelines(
"共完成测试项目 {0}个,成功{1}个,失败{2}个,异常中止(App died){3}个,特殊应用跳过{4}\n".format(
int(p_num + special_num / 2), success_num, fail_num, died_num, int(special_num / 2)))
error_log.writelines(
"共完成测试用例 {0}个,成功{1}个,失败{2}个,错误{3}\n".format(test_exp_num, test_pass_num, test_fail_num,
test_error_num))
print("successNum:{0} failNum:{1} diedNum:{2} specialNum:{3} testNum:{4} testSuccessNum:{5} testFailNum:{6} testErrorNum:{7}".format(success_num,
fail_num, died_num, int(special_num / 2), test_exp_num, test_pass_num, test_fail_num, test_error_num))
if len(fail_dict) > 0:
error_log.writelines("失败工程BundleName如下\n")
for x in fail_dict:
error_log.writelines(" " + x + "\n")
if len(died_dict) > 0:
error_log.writelines("异常中止(App died)工程BundleName如下\n")
for x in died_dict:
error_log.writelines(" " + x + "\n")
error_log.writelines("安装失败项目数量:{0}\n".format(len(install_fail_dict)))
for i in install_fail_dict:
error_log.writelines('{0} : {1}'.format(i, install_fail_dict[i]))
if len(special_hap_list) > 0:
error_log.writelines("特殊安装跳过Hap数量:{0}\n".format(special_num))
for i in special_hap_list:
error_log.writelines(i + "\n")
error_log.flush()
error_log.close()
if fail_num != 0 or died_num != 0 or len(install_fail_dict) != 0:
print ('test failed !!')
else:
return ('test success !!')
def init_out():
base_dir = sys.path[0]
out_path = "{0}/ui_test_out/{1}".format(base_dir, datetime.datetime.now().strftime('%Y%m%d'))
print(out_path)
clear_dir(out_path)
clear_dir("{0}/errorLog".format(out_path))
clear_dir("{0}/successLog".format(out_path))
clear_dir("{0}/SampleSignHap".format(out_path))
clear_file("{0}/auto_test.log".format(out_path))
clear_dir("{0}/hilog".format(out_path))
clear_dir("{0}/snapshot".format(out_path))
return out_path
def add_permission(bundle_name, finger_print):
KEY_NAME = 'install_list'
f = open(LinuxContains.INSTALL_LIST_CAPABILITY, 'r')
if bundle_name in f.read():
with open(LinuxContains.INSTALL_LIST_CAPABILITY, "r", encoding="utf-8") as f:
old_data = json.load(f)
# print(bundle_name + " 已存在,需要修改权限")
for i in old_data[KEY_NAME]:
if i['bundleName'] == bundle_name:
i['app_signature'][0] = finger_print
with open(LinuxContains.INSTALL_LIST_CAPABILITY, "w", encoding="utf-8") as f:
json.dump(old_data, f)
else:
# 追加权限
permission_fields = {
"bundleName": bundle_name,
"app_signature": [finger_print],
"allowAppUsePrivilegeExtension": True
}
with open(LinuxContains.INSTALL_LIST_CAPABILITY, "r", encoding="utf-8") as f:
old_data = json.load(f)
# 这里就是那个列表List
old_data[KEY_NAME].append(permission_fields)
# print(bundle_name + " 不存在,需要追加权限")
with open(LinuxContains.INSTALL_LIST_CAPABILITY, "w", encoding="utf-8") as f:
json.dump(old_data, f)
def pull_list():
cmd_pull = "hdc shell mount -o rw,remount / & hdc file recv /system/etc/app/install_list_capability.json"
os.system(cmd_pull)
def push_list():
cmd_push = "hdc shell mount -o rw,remount / & hdc file send install_list_capability.json /system/etc/app/install_list_capability.json & hdc shell chmod 777 /system/etc/app/install_list_capability.json & hdc shell reboot"
# print(cmd_push)
os.system(cmd_push)
time.sleep(40) # 等待重启
cmd_unlock = 'hdc shell power-shell wakeup & hdc shell uinput -T -m 100 200 100 900 600 & hdc shell power-shell setmode 602' # 亮屏并解锁屏幕
# print("设置屏幕常亮")
# print(cmd_unlock)
os.system(cmd_unlock)
def load_config_to_dict(config_file):
with open(config_file, encoding='utf-8') as a:
# 读取文件
global depend_config_map
depend_config_map = json.load(a)
# print(type (depend_config_map))
def replace_enable(file,old_str,new_str):
with open(file, "r", encoding="utf-8") as f1,open("%s.bak" % file, "w", encoding="utf-8") as f2:
for line in f1:
if old_str in line:
line = line.replace(old_str, new_str)
f2.write(line)
os.remove(file)
os.rename("%s.bak" % file, file)
def pull_config():
cmd='hdc shell mount -o rw,remount / & hdc file recv system/etc/window/resources/window_manager_config.xml {0}'.format(LinuxContains.SAVE_XML_PATH)
os.system(cmd)
def push_config():
cmd='hdc file send {0}/window_manager_config.xml system/etc/window/resources/window_manager_config.xml'.format(LinuxContains.SAVE_XML_PATH)
os.system(cmd)
if __name__ == '__main__':
load_config_to_dict(LinuxContains.COMBIN_CONFIG)
# print(depend_config_map)
# 创建ui_test_out文件夹及子文件夹
out_base = init_out()
# pull_config()
# replace_enable(CONFIG_PATH,'decor enable="false"','decor enable="true"')
# push_config()
# 拉install_list_capability.json
pull_list()
# 特殊安装应用,添加权限
with open(LinuxContains.SPECIAL_LIST,'r',encoding='utf-8') as fp:
python_obj=json.load(fp)
for key,value in python_obj.items():
add_permission(value[0],FINGER_PRINT)
# 推install_list_capability.json重启解锁
push_list()
# sftp_from_remote("{0}\\SampleSignHap".format(out_base), "{0}\\errorLog".format(out_base),
# "{0}\\successLog".format(out_base))
haps = get_haps(LinuxContains.SIGN_HAP_PATH)
total_hap_num = len(haps) / 2
batch_install(haps, out_base)
handle_test_log(out_base)

View File

@ -0,0 +1,8 @@
SIGN_HAP_PATH = r'/home/userName/HapBuild/compile-tool/out/ut_samples_master/full-sdk/hap-out-with-signed/'
FA_MODAL_AND_LOWER_CASE_LIST = r'/home/userName/HapBuild/test-tool/FA_Model_And_Lower_Case_List.json'
INSTALL_LIST_CAPABILITY = r'/home/userName/HapBuild/test-tool/install_list_capability.json'
SAVE_XML_PATH = r'/home/userName/HapBuild/test-tool'
COMBIN_CONFIG = r'/home/userName/HapBuild/test-tool/CombinationConfig.json'
SPECIAL_LIST = r'/home/userName/HapBuild/test-tool/special_list.json'
SPECIAL_HAP = r'code_UI_JsComponentCollection_JsComponentCollection;code_SuperFeature_MultiDeviceAppDev_JsAdaptiveCapabilities;code_BasicFeature_FileManagement_FileShare_SandboxShare;code_SystemFeature_DeviceManagement_DeviceManagementCollection;code_BasicFeature_Security_PaySecurely_paySDK;code_SystemFeature_ApplicationModels_Launcher;code_SuperFeature_DistributedAppDev_JsDistributedMusicPlayer;code_SuperFeature_DistributedAppDev_DistributeCalc;code_Solutions_Tools_JsClock;code_BasicFeature_Notification_CustomNotificationBadge'
TARGET_PATH = r'code_Solutions_Game_DistributedDataGobang'

View File

@ -0,0 +1,10 @@
{
"Flybird":["ohos.samples.flybird"],
"AbilityConnectServiceExtension":["com.example.abilityconnectserviceextension"],
"Launcher":["ohos.samples.launcher"],
"ArkTSDistributedMusicPlayer":["ohos.samples.etsdistributedmusicplayer"],
"AppMarket":["ohos.samples.appmarket"],
"MusicAlbum":["ohos.samples.MusicAlbum"],
"StageModel":["ohos.samples.stagemodel"],
"Provider":["ohos.samples.crossappdatashare"]
}