• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Integrated HSP
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9The integrated HSP is an intermediate build product of the intra-application HSP. It aims to solve the strong coupling between the bundle name and signature of the user.
10> **NOTE**
11>
12> The HSP can be used only by projects with the same bundle name, but the integrated HSP can be used by projects with different bundle names.
13>
14> When using the integrated HSP, the user needs to re-sign the integrated HSP with the signature file and install the re-signed integrated HSP first.
15
16## Use Scenario
17Multiple applications in a group can use the same dynamic shared package. To reduce development costs and share code and resources, multiple applications can share one infrastructure HSP (integrated HSP).
18
19## Constraints
20- The integrated HSP is only available for the [stage model](application-package-structure-stage.md).
21- Only integrated HSP of API version 12 or later is supported. You should set the **useNormalizedOHMUrl** field to **true** in the project-level [build-profile.json5](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-hvigor-build-profile-app) file.
22
23## Development Instructions
241. Project configuration for creators: Set the **useNormalizedOHMUrl** field to **true** in the project-level **build-profile.json5** file to configure the integrated HSP.
25
26    ```json
27    // created_party_project/build-profile.json5
28    {
29      "app": {
30        "products": [
31          {
32            "name": "default",
33            "signingConfig": "default",
34            "compatibleSdkVersion": "5.0.0(12)",
35            "runtimeOS": "HarmonyOS",
36            "buildOption": {
37              "strictMode": {
38                "useNormalizedOHMUrl": true
39              }
40            }
41            // ...
42          }
43        ]
44        // ...
45      }
46    }
47    ```
482. Module configuration for creators: Set the **integratedHsp** field to **true** in the module-level [build-profile.json5](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-hvigor-build-profile) file to specify an HSP module to be built as the integrated HSP module.
49
50    ```json
51    // created_party_project/library/build-profile.json5
52    {
53      "apiType": "stageMode",
54      "buildOption": {
55        "arkOptions": {
56          "integratedHsp": true
57        }
58      }
59    }
60    ```
61
623. Packaging configuration for creators (.tgz package)
63
64    (1) Configure project signature information. For details, see [Configuring a Debug Signature](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-signing).
65
66    (2) Configure the release mode.
67
68    ![](./figures/ide-release-setting.png)
69
70    (3) Select the **library** directory and choose **Build** > **Make Module 'library'**.
71
724. Directory creation and file copying for users: Create a **libs** directory in the **entry** directory and copy the .tgz file to the created directory.
73
745. Project dependency configuration for users: Add dependencies to the **oh-package.json5** configuration file in the main module.
75
76    ```json
77    // user_project/entry/oh-package.json5
78      "dependencies": {
79        "hsp": "./libs/library-default.tgz"
80      }
81    ```
82
836. Project configuration for users: Set **useNormalizedOHMUrl** to **true** in the project-level **build-profile.json5** file.
84    ```json
85    // user_project/build-profile.json5
86    {
87      "app": {
88        "products": [
89          {
90            "name": "default",
91            "signingConfig": "default",
92            "compatibleSdkVersion": "5.0.0(12)",
93            "runtimeOS": "HarmonyOS",
94            "buildOption": {
95              "strictMode": {
96                "useNormalizedOHMUrl": true
97              }
98            }
99          }
100        ]
101      }
102    }
103    ```
104    > **NOTE**
105    > Before installing and running an application, the user must configure the project signature information. For details, see [Configuring a Debug Signature](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-signing).
106