diff --git a/test/sceneProject/unittest/test_bundle/backupTest/AppScope/app.json b/test/sceneProject/unittest/test_bundle/backupTest/AppScope/app.json5 old mode 100755 new mode 100644 similarity index 34% rename from test/sceneProject/unittest/test_bundle/backupTest/AppScope/app.json rename to test/sceneProject/unittest/test_bundle/backupTest/AppScope/app.json5 index 81ae9eac43d137810fc17219dfea682cf64ed681..fa0fdb66e3de28cb3b9fab980f12b3c5117aefa1 --- a/test/sceneProject/unittest/test_bundle/backupTest/AppScope/app.json +++ b/test/sceneProject/unittest/test_bundle/backupTest/AppScope/app.json5 @@ -1,12 +1,25 @@ +/* + * Copyright (c) 2025 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. + */ + { "app": { - "apiReleaseType": "Release", + "apiReleaseType": "Release1", "bundleName": "com.example.backuptest", "debug": true, "icon": "$media:app_icon", - "iconId": 16777217, "label": "$string:app_name", - "labelId": 16777216, "minAPIVersion": 9, "targetAPIVersion": 9, "vendor": "example", diff --git a/test/sceneProject/unittest/test_bundle/backupTest/AppScope/resources/base/media/app_icon.png b/test/sceneProject/unittest/test_bundle/backupTest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/test/sceneProject/unittest/test_bundle/backupTest/AppScope/resources/base/media/app_icon.png differ diff --git a/test/sceneProject/unittest/test_bundle/backupTest/BUILD.gn b/test/sceneProject/unittest/test_bundle/backupTest/BUILD.gn index 0ce8b07302dda7bc27826ee07350aba4316d36a6..6ff43e2c3241401f1cada287d61886307f49ea87 100755 --- a/test/sceneProject/unittest/test_bundle/backupTest/BUILD.gn +++ b/test/sceneProject/unittest/test_bundle/backupTest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2025 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 @@ -14,30 +14,18 @@ import("//build/ohos.gni") import("../../../../../appexecfwk.gni") -ohos_hap("backupTest") { - hap_profile = "entry/src/main/module.json" - hap_name = "backup" - subsystem_name = "bundlemanager" - final_hap_path = "$root_out_dir/tests/unittest/bundle_framework/bundle_framework/resource/test_bundle/${hap_name}.hap" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] +ohos_app("backupTest") { certificate_profile = "${bundle_framework_path}/test/sceneProject/signature/com.example.backuptest.p7b" -} - -ohos_app_scope("bmsstagedemoone_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} + hap_name = "backup" + hap_out_dir = "$root_out_dir/tests/unittest/bundle_framework/bundle_framework/resource/test_bundle" -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "entry/src/main/ets" -} + subsystem_name = "bundlemanager" + part_name = "bundle_framework" -ohos_resources("hjs_demo_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":bmsstagedemoone_app_profile" ] - hap_profile = "entry/src/main/module.json" + js_build_mode = "release" + sdk_home = "//prebuilts/ohos-sdk/linux" + sdk_type_name = [ "sdk.dir" ] + assemble_type = "assembleHar" + build_level = "module" + build_modules = [ "entry" ] } diff --git a/test/sceneProject/unittest/test_bundle/backupTest/build-profile.json5 b/test/sceneProject/unittest/test_bundle/backupTest/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1e93473f16bb80fb9432a95c4a845b6021a01638 --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/build-profile.json5 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2025 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. + */ + +{ + "app": { + "signingConfigs": [], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": 20, + "compileSdkVersion": 20, + "targetSdkVersion": 20, + "runtimeOS": "OpenHarmony" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/test/sceneProject/unittest/test_bundle/backupTest/entry/build-profile.json5 b/test/sceneProject/unittest/test_bundle/backupTest/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..b4d65d490ef6cbe22d933b9231555210f1555786 --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/entry/build-profile.json5 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2025 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. + */ + +{ + "apiType": "stageMode", + "buildOption": { + }, + "buildOptionSet": [ + { + "name": "release", + "arkOptions": { + "obfuscation": { + "ruleOptions": { + "enable": false, + "files": [ + "./obfuscation-rules.txt" + ] + } + } + } + }, + ], + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/test/sceneProject/unittest/test_bundle/backupTest/entry/hvigorfile.ts b/test/sceneProject/unittest/test_bundle/backupTest/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54 --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/entry/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 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 { hapTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/test/sceneProject/unittest/test_bundle/backupTest/entry/obfuscation-rules.txt b/test/sceneProject/unittest/test_bundle/backupTest/entry/obfuscation-rules.txt new file mode 100644 index 0000000000000000000000000000000000000000..c1d419bdc6fa72c5914cc864ede925c53a2b01c5 --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/entry/obfuscation-rules.txt @@ -0,0 +1,36 @@ +# Copyright (c) 2025 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. + +# Define project specific obfuscation rules here. +# You can include the obfuscation configuration files in the current module's build-profile.json5. +# +# For more details, see +# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5 + +# Obfuscation options: +# -disable-obfuscation: disable all obfuscations +# -enable-property-obfuscation: obfuscate the property names +# -enable-toplevel-obfuscation: obfuscate the names in the global scope +# -compact: remove unnecessary blank spaces and all line feeds +# -remove-log: remove all console.* statements +# -print-namecache: print the name cache that contains the mapping from the old names to new names +# -apply-namecache: reuse the given cache file + +# Keep options: +# -keep-property-name: specifies property names that you want to keep +# -keep-global-name: specifies names that you want to keep in the global scope + +-enable-property-obfuscation +-enable-toplevel-obfuscation +-enable-filename-obfuscation +-enable-export-obfuscation \ No newline at end of file diff --git a/test/sceneProject/unittest/test_bundle/backupTest/entry/oh-package.json5 b/test/sceneProject/unittest/test_bundle/backupTest/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..7b482743397196f393514984fd1aad2aba41f34d --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/entry/oh-package.json5 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 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. + */ + +{ + "name": "entry", + "version": "1.0.0", + "description": "Please describe the basic information.", + "main": "", + "author": "", + "license": "", + "dependencies": {} +} diff --git a/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/ets/pages/index.ets b/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/ets/pages/index.ets index ae327f852a407ce22fd6270757a04a3bf19ca7f8..68b30e0dc94d5c5217d5f0bd46f6cc1f81e05b9b 100755 --- a/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/ets/pages/index.ets +++ b/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/ets/pages/index.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 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 @@ -12,10 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import file from '@system.file'; - -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" -import testsuite from "../../test/List.test.ets" @Entry @Component diff --git a/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/module.json b/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/module.json5 old mode 100755 new mode 100644 similarity index 82% rename from test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/module.json rename to test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/module.json5 index 949b2856259f4c7d577eed52c448944b2aa6762a..dd408a907b4694e7bfe08a5c423522dc70c32783 --- a/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/module.json +++ b/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/module.json5 @@ -1,14 +1,28 @@ +/* + * Copyright (c) 2025 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. + */ + { "module": { "abilities": [ { "description": "$string:MainAbility_desc", - "descriptionId": 16777218, "icon": "$media:icon", - "iconId": 16777221, "label": "$string:MainAbility_label", - "labelId": 16777219, "name": "MainAbility", + "startWindowBackground": "$color:white", + "startWindowIcon": "$media:icon", "skills": [ { "actions": [ @@ -24,12 +38,11 @@ }, { "description": "$string:MainAbility_desc", - "descriptionId": 16777218, "icon": "$media:icon", - "iconId": 16777221, "label": "$string:MainAbility_label", - "labelId": 16777219, "name": "SecondAbility", + "startWindowBackground": "$color:white", + "startWindowIcon": "$media:icon", "skills": [ { "actions": [ @@ -55,12 +68,11 @@ }, { "description": "$string:MainAbility_desc", - "descriptionId": 16777218, "icon": "$media:icon", - "iconId": 16777221, "label": "$string:MainAbility_label", - "labelId": 16777219, "name": "ThirdAbility", + "startWindowBackground": "$color:white", + "startWindowIcon": "$media:icon", "skills": [ { "actions": [ @@ -87,12 +99,12 @@ ], "deliveryWithInstall": true, "description": "$string:entry_desc", - "descriptionId": 16777220, "deviceTypes": [ "2in1", "default", - "phone", - "tablet" + "tablet", + "tv", + "wearable" ], "extensionAbilities": [ { diff --git a/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/resources/base/element/color.json b/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..7327b0c203e79ba06ca494dc3fa0419bbe2ce9ad --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#16777221" + } + ] +} diff --git a/test/sceneProject/unittest/test_bundle/backupTest/hvigor/hvigor-config.json5 b/test/sceneProject/unittest/test_bundle/backupTest/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..c61d3eed60978a00d9a67b754ec36c0c9dcde929 --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/hvigor/hvigor-config.json5 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2025 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. + */ + +{ + "modelVersion": "5.0.0", + "dependencies": { + }, + "execution": { + // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */ + // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */ + // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */ + // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */ + // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */ + }, + "logging": { + // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */ + }, + "debugging": { + // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */ + }, + "nodeOptions": { + // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/ + // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/ + } +} diff --git a/test/sceneProject/unittest/test_bundle/backupTest/hvigorfile.ts b/test/sceneProject/unittest/test_bundle/backupTest/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156 --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/hvigorfile.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2025 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 { appTasks } from '@ohos/hvigor-ohos-plugin'; + +export default { + system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */ + plugins:[] /* Custom plugin to extend the functionality of Hvigor. */ +} diff --git a/test/sceneProject/unittest/test_bundle/backupTest/oh-package.json5 b/test/sceneProject/unittest/test_bundle/backupTest/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..15ec86a73e760904339e9269d493e3015429d8a2 --- /dev/null +++ b/test/sceneProject/unittest/test_bundle/backupTest/oh-package.json5 @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2025 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. + */ + +{ + "modelVersion": "5.0.0", + "description": "Please describe the basic information.", + "dependencies": { + }, + "devDependencies": { + "@ohos/hypium": "1.0.21" + } +}