From 47bd73dd3e30da44127d7666334f9e7a5dba4cdb Mon Sep 17 00:00:00 2001 From: sunjiakun Date: Tue, 19 Nov 2024 10:35:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0preloadHint=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AF=B9har/hsp=E7=9A=84=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sunjiakun --- modulecheck/BUILD.gn | 5 ++ modulecheck/appStartup.json | 66 ++++++++++++++++- modulecheck/hspStartup.json | 140 ++++++++++++++++++++++++++++++++++++ modulecheck/module.json | 6 +- 4 files changed, 213 insertions(+), 4 deletions(-) create mode 100644 modulecheck/hspStartup.json diff --git a/modulecheck/BUILD.gn b/modulecheck/BUILD.gn index 828ff8af..ce6cc75a 100644 --- a/modulecheck/BUILD.gn +++ b/modulecheck/BUILD.gn @@ -77,3 +77,8 @@ ohos_prebuilt_etc("configurationSchema_json") { source = "configuration.json" install_enable = false } + +ohos_prebuilt_etc("hspStartupSchema_json") { + source = "hspStartup.json" + install_enable = false +} diff --git a/modulecheck/appStartup.json b/modulecheck/appStartup.json index 238efcd8..cf3e2ce6 100644 --- a/modulecheck/appStartup.json +++ b/modulecheck/appStartup.json @@ -4,13 +4,13 @@ "type": "object", "additionalProperties": false, "required": [ - "startupTasks", "configEntry" ], "propertyNames": { "enum": [ "startupTasks", - "configEntry" + "configEntry", + "appPreloadHintStartupTasks" ] }, "properties": { @@ -80,6 +80,68 @@ "description": "Indicates the js code path corresponding to the startup config.", "type": "string", "maxLength": 127 + }, + "appPreloadHintStartupTasks": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "propertyNames": { + "enum": [ + "name", + "srcEntry", + "dependencies", + "excludeFromAutoStart", + "runOnThread", + "waitOnMainThread" + ] + }, + "required": [ + "name", + "srcEntry" + ], + "properties": { + "name": { + "description": "Indicates the name of the preload task.", + "type": "string", + "pattern": "^[a-zA-Z][0-9a-zA-Z_.]+$", + "maxLength": 127 + }, + "srcEntry": { + "description": "Indicates the js code path corresponding to the preload task.", + "type": "string", + "maxLength": 127 + }, + "dependencies": { + "description": "Indicates the dependencies of the preload task.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "default": [] + }, + "excludeFromAutoStart": { + "description": "Indicates whether the preload task is excluded from automatic start.", + "type": "boolean", + "default": false + }, + "runOnThread": { + "description": "Indicates the running thread of the preload task.", + "type": "string", + "enum": [ + "mainThread", + "taskPool" + ], + "default": "mainThread" + }, + "waitOnMainThread": { + "description": "Indicates whether the preload task block the main thread.", + "type": "boolean", + "default": true + } + } + } } } } \ No newline at end of file diff --git a/modulecheck/hspStartup.json b/modulecheck/hspStartup.json new file mode 100644 index 00000000..08b44b10 --- /dev/null +++ b/modulecheck/hspStartup.json @@ -0,0 +1,140 @@ +{ + "title": "JSON schema for hsp_startup.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "propertyNames": { + "enum": [ + "hspStartupTasks", + "hspPreloadHintStartupTasks" + ] + }, + "properties": { + "hspStartupTasks": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "propertyNames": { + "enum": [ + "name", + "srcEntry", + "dependencies", + "excludeFromAutoStart", + "runOnThread", + "waitOnMainThread" + ] + }, + "required": [ + "name", + "srcEntry" + ], + "properties": { + "name": { + "description": "Indicates the name of the har/hsp startup task.", + "type": "string", + "pattern": "^[a-zA-Z][0-9a-zA-Z_.]+$", + "maxLength": 127 + }, + "srcEntry": { + "description": "Indicates the js code path corresponding to the har/hsp startup task.", + "type": "string", + "maxLength": 127 + }, + "dependencies": { + "description": "Indicates the dependencies of the har/hsp startup task.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "default": [] + }, + "excludeFromAutoStart": { + "description": "Har/hsp startup task does not support automatic start, excludeFromAutoStart can only be set to true.", + "type": "boolean", + "enum": [true], + "default": true + }, + "runOnThread": { + "description": "Indicates the running thread of the har/hsp startup task.", + "type": "string", + "enum": [ + "mainThread", + "taskPool" + ], + "default": "mainThread" + }, + "waitOnMainThread": { + "description": "Indicates whether the har/hsp startup task block the main thread.", + "type": "boolean", + "default": true + } + } + } + }, + "hspPreloadHintStartupTasks": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "object", + "propertyNames": { + "enum": [ + "name", + "srcEntry", + "dependencies", + "excludeFromAutoStart", + "runOnThread", + "waitOnMainThread" + ] + }, + "required": [ + "name", + "srcEntry" + ], + "properties": { + "name": { + "description": "Indicates the name of the har/hsp preload task.", + "type": "string", + "pattern": "^[a-zA-Z][0-9a-zA-Z_.]+$", + "maxLength": 127 + }, + "srcEntry": { + "description": "Indicates the js code path corresponding to the har/hsp preload task.", + "type": "string", + "maxLength": 127 + }, + "dependencies": { + "description": "Indicates the dependencies of the har/hsp preload task.", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "default": [] + }, + "excludeFromAutoStart": { + "description": "Har/hsp preload task does not support automatic start, excludeFromAutoStart can only be set to true.", + "type": "boolean", + "enum": [true], + "default": true + }, + "runOnThread": { + "description": "Indicates the running thread of the har/hsp preload task.", + "type": "string", + "enum": [ + "mainThread", + "taskPool" + ], + "default": "mainThread" + }, + "waitOnMainThread": { + "description": "Indicates whether the har/hsp preload task block the main thread.", + "type": "boolean", + "default": true + } + } + } + } + } +} \ No newline at end of file diff --git a/modulecheck/module.json b/modulecheck/module.json index 39621512..76dc0492 100644 --- a/modulecheck/module.json +++ b/modulecheck/module.json @@ -44,7 +44,8 @@ "targetModuleName", "targetPriority", "generateBuildHash", - "routerMap" + "routerMap", + "appStartup" ] }, "required": [ @@ -85,7 +86,8 @@ "testRunner", "dependencies", "libIsolation", - "routerMap" + "routerMap", + "appStartup" ] }, "required": [ -- Gitee