From 0900c2d283e8b06d88c4111b0ff495dd7e5e87c6 Mon Sep 17 00:00:00 2001 From: wangtiantian Date: Mon, 11 Jul 2022 11:37:33 +0800 Subject: [PATCH 1/3] IssueNo: #I5GF2B:add patch check file Description: add patch check file Sig:SIG_ApplicaitonFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: wangtiantian --- quick_fix_check/BUILD.gn | 19 ++++++ quick_fix_check/patch.json | 123 +++++++++++++++++++++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 quick_fix_check/BUILD.gn create mode 100644 quick_fix_check/patch.json diff --git a/quick_fix_check/BUILD.gn b/quick_fix_check/BUILD.gn new file mode 100644 index 00000000..2f282d39 --- /dev/null +++ b/quick_fix_check/BUILD.gn @@ -0,0 +1,19 @@ +# Copyright (c) 2022 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("//build/ohos.gni") + +ohos_prebuilt_etc("patchSchema_json") { + source = "patch.json" + install_enable = false +} diff --git a/quick_fix_check/patch.json b/quick_fix_check/patch.json new file mode 100644 index 00000000..58f1eb16 --- /dev/null +++ b/quick_fix_check/patch.json @@ -0,0 +1,123 @@ +{ + "title": "JSON schema for patch.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": true, + "required": [ + "app", + "module" + ], + "propertyNames": { + "enum": [ + "app", + "module" + ] + }, + "properties": { + "app": { + "description": "Indicates the patch information", + "type": "object", + "required": [ + "bundleName", + "versionCode", + "versionName", + "patchVersionCode", + "patchVersionName" + ], + "propertyNames": { + "enum": [ + "bundleName", + "versionCode", + "versionName", + "patchVersionCode", + "patchVersionName" + ] + }, + "properties": { + "bundleName": { + "description": "Indicates the bundle name of the application. It uniquely identifies the application. The value is a string with 7 to 127 bytes of a reverse domain name, for example, com.huawei.himusic. It is recommended that the first label of this attribute is the top-level domain com, the second label is the vendor or individual name, and the third label is the application name. This label is a string type and cannot be defaulted.", + "type": "string", + "maxLength": 127, + "minLength": 7, + "pattern": "^(([a-zA-Z]|[a-zA-Z][0-9a-zA-Z_]+)[.]([0-9a-zA-Z_.]+))|([{]([a-zA-Z]|[a-zA-Z][0-9a-zA-Z_]+)[}](.huawei.com))|[{](bundleName)[}]$" + }, + "versionCode": { + "description": "Indicates the versionCode number of the application. The value is an integer greater than 0. A larger value generally represents a later version.The system determines the application version based on the tag value.This label cannot be left blank.", + "type": "integer", + "minimum": 0, + "maximum": 2147483647 + }, + "versionName": { + "description": "Indicates the text description of the application version.Used for displaying to users. A string can contain a maximum of 127 bytes.This label cannot be left blank.", + "type": "string", + "maxLength": 127, + "pattern": "^[0-9.]+|(?=.*[{])(?=.*[}])[0-9a-zA-Z_.{}]+$" + }, + "patchVersionCode": { + "description": "Indicates the versionCode number of the patch. The value is an integer greater than 0. A larger value generally represents a later version.The system determines the application version based on the tag value.This label cannot be left blank.", + "type": "integer", + "minimum": 0, + "maximum": 2147483647 + }, + "patchVersionName": { + "description": "Indicates the text description of the patch version.Used for displaying to users. A string can contain a maximum of 127 bytes.This label cannot be left blank.", + "type": "string", + "maxLength": 127, + "pattern": "^[0-9.]+|(?=.*[{])(?=.*[}])[0-9a-zA-Z_.{}]+$" + } + } + }, + "module": { + "description": "Indicates the configuration of a patch file", + "type": "object", + "required": [ + "name", + "type", + "deviceTypes", + "originalModuleHash" + ], + "propertyNames": { + "enum": [ + "name", + "type", + "deviceTypes", + "originalModuleHash" + ] + }, + "properties": { + "name": { + "description": "Indicates the module name.", + "type": "string", + "maxLength": 31 + }, + "type": { + "description": "Indicates the type of the patch.", + "type": "string", + "enum": [ + "entry", + "feature", + "har", + "patch" + ] + }, + "deviceTypes": { + "description": "Indicates the type of devices on which the patch can run.This label cannot be left blank.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "phone", + "tablet" + ] + } + }, + "originalModuleHash": { + "description": "Indicates the sha256 of the module hash value.", + "type": "string", + "maxLength": 512 + } + } + } + } +} \ No newline at end of file -- Gitee From a7ea2065fed442625b73d47a4ba16df4bc87a61c Mon Sep 17 00:00:00 2001 From: wangtiantian Date: Mon, 11 Jul 2022 20:55:01 +0800 Subject: [PATCH 2/3] IssueNo: #I5GF2B:add patch check file Description: add patch check file Sig:SIG_ApplicaitonFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: wangtiantian --- {quick_fix_check => patchcheck}/BUILD.gn | 0 {quick_fix_check => patchcheck}/patch.json | 16 +++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) rename {quick_fix_check => patchcheck}/BUILD.gn (100%) rename {quick_fix_check => patchcheck}/patch.json (94%) diff --git a/quick_fix_check/BUILD.gn b/patchcheck/BUILD.gn similarity index 100% rename from quick_fix_check/BUILD.gn rename to patchcheck/BUILD.gn diff --git a/quick_fix_check/patch.json b/patchcheck/patch.json similarity index 94% rename from quick_fix_check/patch.json rename to patchcheck/patch.json index 58f1eb16..5c4395e9 100644 --- a/quick_fix_check/patch.json +++ b/patchcheck/patch.json @@ -94,9 +94,6 @@ "description": "Indicates the type of the patch.", "type": "string", "enum": [ - "entry", - "feature", - "har", "patch" ] }, @@ -107,15 +104,20 @@ "items": { "type": "string", "enum": [ - "phone", - "tablet" + "default", + "tablet", + "tv", + "wearable", + "car", + "router" ] } }, "originalModuleHash": { - "description": "Indicates the sha256 of the module hash value.", + "description": "Indicates the sha256 of the module hash value. The value is a string with 64 bytes.", "type": "string", - "maxLength": 512 + "maxLength": 64, + "minLength": 64 } } } -- Gitee From 6f56311fc1f57acff9edd7f8485d1b1ffb8d5415 Mon Sep 17 00:00:00 2001 From: wangtiantian Date: Mon, 15 Aug 2022 10:05:15 +0800 Subject: [PATCH 3/3] IssueNo: #I5GF2B:add patch check file Description: add patch check file Sig:SIG_ApplicaitonFramework Feature or Bugfix:Feature Binary Source:No Signed-off-by: wangtiantian --- patchcheck/patch.json | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/patchcheck/patch.json b/patchcheck/patch.json index 5c4395e9..a010fff7 100644 --- a/patchcheck/patch.json +++ b/patchcheck/patch.json @@ -70,12 +70,27 @@ "module": { "description": "Indicates the configuration of a patch file", "type": "object", - "required": [ - "name", - "type", - "deviceTypes", - "originalModuleHash" - ], + "if": { + "properties": { + "type": { + "const": "patch" + } + } + }, + "then": { + "required": [ + "name", + "type", + "deviceTypes", + "originalModuleHash" + ] + }, + "else": { + "required": [ + "name", + "type" + ] + }, "propertyNames": { "enum": [ "name", @@ -94,7 +109,8 @@ "description": "Indicates the type of the patch.", "type": "string", "enum": [ - "patch" + "patch", + "hotreload" ] }, "deviceTypes": { -- Gitee