未验证 提交 c782733e 编写于 作者: O openharmony_ci 提交者: Gitee

!10907 翻译已完成9990+10024+10025+10028+10054

Merge pull request !10907 from shawn_he/9990-a
......@@ -12,12 +12,10 @@ The following table provides only a brief description of related APIs. For detai
**Table 1** APIs for application event logging
| API | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| write(string eventName, EventType type, object keyValues, AsyncCallback\<void> callback): void | Logs application events in asynchronous mode. This API uses an asynchronous callback to return the result. |
| write(string eventName, EventType type, object keyValues): Promise\<void> | Logs application events in asynchronous mode. This API uses a promise to return the result. |
| write(AppEventInfo info, AsyncCallback\<void> callback): void | Logs application events by domain in asynchronous mode. This API uses an asynchronous callback to return the result.|
| write(AppEventInfo info): Promise\<void> | Logs application events by domain in asynchronous mode. This API uses a promise to return the result.|
| API | Description |
| ------------------------------------------------------------ | ---------------------------------------------------- |
| write(AppEventInfo info, AsyncCallback\<void> callback): void | Logs application events in asynchronous mode. This API uses an asynchronous callback to return the result.|
| write(AppEventInfo info): Promise\<void> | Logs application events in asynchronous mode. This API uses a promise to return the result. |
When an asynchronous callback is used, the return value can be processed directly in the callback.
......@@ -84,6 +82,7 @@ The following uses a one-time event watcher as an example to illustrate the deve
.fontWeight(FontWeight.Bold)
Button("1 writeTest").onClick(()=>{
// Perform event logging based on the input event parameters.
hiAppEvent.write({
domain: "test_domain",
name: "test_event",
......@@ -100,6 +99,7 @@ The following uses a one-time event watcher as an example to illustrate the deve
})
Button("2 addWatcherTest").onClick(()=>{
// Add an event watcher based on the input subscription parameters.
hiAppEvent.addWatcher({
name: "watcher1",
appEventFilters: [{ domain: "test_domain" }],
......@@ -109,17 +109,23 @@ The following uses a one-time event watcher as an example to illustrate the deve
timeOut: 2
},
onTrigger: function (curRow, curSize, holder) {
// If the holder object is null, return an error after recording it in the log.
if (holder == null) {
console.error("HiAppEvent holder is null");
return;
}
// Set the size threshold to 1,000 bytes for obtaining an event package.
holder.setSize(1000);
let eventPkg = null;
// Obtain the event package based on the configured size threshold. If returned event package is null, all event data has been obtained.
while ((eventPkg = holder.takeNext()) != null) {
console.info("HiAppEvent eventPkg.packageId=" + eventPkg.packageId);
console.info("HiAppEvent eventPkg.row=" + eventPkg.row);
console.info("HiAppEvent eventPkg.size=" + eventPkg.size);
// Parse the obtained event package and display the result on the Log page.
console.info('HiAppEvent eventPkg.packageId=' + eventPkg.packageId);
console.info('HiAppEvent eventPkg.row=' + eventPkg.row);
console.info('HiAppEvent eventPkg.size=' + eventPkg.size);
// Traverse and parse event string arrays in the obtained event package.
for (const eventInfo of eventPkg.data) {
console.info("HiAppEvent eventPkg.data=" + eventInfo);
console.info('HiAppEvent eventPkg.data=' + eventInfo);
}
}
}
......@@ -127,6 +133,7 @@ The following uses a one-time event watcher as an example to illustrate the deve
})
Button("3 removeWatcherTest").onClick(()=>{
// Remove the specified event watcher.
hiAppEvent.removeWatcher({
name: "watcher1"
})
......
......@@ -827,7 +827,7 @@ call.reject(1, (error, data) => {
## call.reject<sup>7+</sup>
reject\(callId: number, options: RejectMessageOption, callback: AsyncCallback<void\>\): void
reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void\>\): void
Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result.
......
......@@ -202,8 +202,8 @@ Updates a contact based on the specified contact information and attributes. Thi
contact.updateContact({
name: {fullName: 'xxx'},
phoneNumbers: [{phoneNumber: '138xxxxxxxx'}]
},{
attributes:[contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}, {
attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}, (err) => {
if (err) {
console.log('updateContact callback: err->${JSON.stringify(err)}');
......@@ -432,7 +432,7 @@ Queries my card based on the specified contact attributes. This API uses an asyn
```js
contact.queryMyCard({
attributes:['ATTR_EMAIL', 'ATTR_NAME']
attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}, (err, data) => {
if (err) {
console.log(`queryMyCard callback: err->${JSON.stringify(err)}`);
......@@ -469,7 +469,7 @@ Queries my card based on the specified contact attributes. This API uses a promi
```js
let promise = contact.queryMyCard({
attributes:['ATTR_EMAIL', 'ATTR_NAME']
attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
});
promise.then((data) => {
console.log(`queryMyCard success: data->${JSON.stringify(data)}`);
......@@ -487,7 +487,7 @@ Selects a contact. This API uses an asynchronous callback to return the result.
**Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.ContactsData
**System capability**: SystemCapability.Applications.Contacts
**Parameters**
......@@ -516,7 +516,7 @@ Selects a contact. This API uses a promise to return the result.
**Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.ContactsData
**System capability**: SystemCapability.Applications.Contacts
**Return Value**
......
......@@ -384,6 +384,27 @@ promise.then(data => {
});
```
## radio.isNrSupported<sup>7+</sup>
isNrSupported\(\): boolean
Checks whether the current device supports 5G \(NR\).
**System capability**: SystemCapability.Telephony.CoreService
**Return value**
| Type | Description |
| ------- | -------------------------------- |
| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).|
**Example**
```js
let result = radio.isNrSupported();
console.log("Result: "+ result);
```
## radio.isNrSupported<sup>8+</sup>
......
......@@ -2683,8 +2683,6 @@ getOpKey(slotId: number): Promise<string\>
Obtains the opkey of the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
......@@ -2716,8 +2714,6 @@ getOpName(slotId: number, callback: AsyncCallback<string\>): void
Obtains the OpName of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
......@@ -2742,8 +2738,6 @@ getOpName(slotId: number): Promise<string\>
Obtains the OpName of the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
......
......@@ -63,6 +63,29 @@ promise.then((data) => {
});
```
## data.getDefaultCellularDataSlotIdSync
getDefaultCellularDataSlotIdSync(): number
Obtains the default SIM card used for mobile data synchronously.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Telephony.CellularData
**Return value**
| Type | Description |
| ------ | -------------------------------------------------- |
| number | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|
**Example**
```js
console.log("Result: "+ data.getDefaultCellularDataSlotIdSync())
```
## data.setDefaultCellularDataSlotId
setDefaultCellularDataSlotId(slotId: number,callback: AsyncCallback\<void\>): void
......
......@@ -43,13 +43,13 @@ Obtains an **OnlineUpdater** object.
```ts
try {
var upgradeInfo = {
const upgradeInfo = {
upgradeApp: "com.ohos.ota.updateclient",
businessType: {
vendor: update.BusinessVendor.PUBLIC,
subType: update.BusinessSubType.FIRMWARE
}
}
};
let updater = update.getOnlineUpdater(upgradeInfo);
} catch(error) {
console.error(`Fail to get updater error: ${error}`);
......@@ -233,15 +233,15 @@ Obtains the description file of the new version. This API uses an asynchronous c
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options of the description file
var descriptionOptions = {
const descriptionOptions = {
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
};
updater.getNewVersionDescription(versionDigestInfo, descriptionOptions, (err, info) => {
console.log(`getNewVersionDescription info ${JSON.stringify(info)}`);
......@@ -276,15 +276,15 @@ Obtains the description file of the new version. This API uses a promise to retu
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options of the description file
var descriptionOptions = {
const descriptionOptions = {
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
};
updater.getNewVersionDescription(versionDigestInfo, descriptionOptions).then(info => {
console.log(`getNewVersionDescription promise info ${JSON.stringify(info)}`);
......@@ -368,10 +368,10 @@ Obtains the description file of the current version. This API uses an asynchrono
```ts
// Options of the description file
var descriptionOptions = {
const descriptionOptions = {
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
};
updater.getCurrentVersionDescription(descriptionOptions, (err, info) => {
console.log(`getCurrentVersionDescription info ${JSON.stringify(info)}`);
......@@ -405,10 +405,10 @@ Obtains the description file of the current version. This API uses a promise to
```ts
// Options of the description file
var descriptionOptions = {
const descriptionOptions = {
format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese
}
};
updater.getCurrentVersionDescription(descriptionOptions).then(info => {
console.log(`getCurrentVersionDescription promise info ${JSON.stringify(info)}`);
......@@ -489,15 +489,15 @@ Downloads the new version. This API uses an asynchronous callback to return the
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Download options
var downloadOptions = {
const downloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
order: update.Order.DOWNLOAD // Download
}
};
updater.download(versionDigestInfo, downloadOptions, (err) => {
console.log(`download error ${JSON.stringify(err)}`);
});
......@@ -530,15 +530,15 @@ Downloads the new version. This API uses a promise to return the result.
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Download options
var downloadOptions = {
const downloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
order: update.Order.DOWNLOAD // Download
}
};
updater.download(versionDigestInfo, downloadOptions).then(() => {
console.log(`download start`);
}).catch(err => {
......@@ -568,14 +568,14 @@ Resumes download of the new version. This API uses an asynchronous callback to r
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options for resuming download
var resumeDownloadOptions = {
const resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
}
};
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err) => {
console.log(`resumeDownload error ${JSON.stringify(err)}`);
});
......@@ -608,14 +608,14 @@ Resumes download of the new version. This API uses a promise to return the resul
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options for resuming download
var resumeDownloadOptions = {
const resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
}
};
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(value => {
console.log(`resumeDownload start`);
}).catch(err => {
......@@ -645,14 +645,14 @@ Pauses download of the new version. This API uses an asynchronous callback to re
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options for pausing download
var pauseDownloadOptions = {
const pauseDownloadOptions = {
isAllowAutoResume: true // Whether to allow automatic resuming of download
}
};
updater.pauseDownload(versionDigestInfo, pauseDownloadOptions, (err) => {
console.log(`pauseDownload error ${JSON.stringify(err)}`);
});
......@@ -685,14 +685,14 @@ Resumes download of the new version. This API uses a promise to return the resul
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options for pausing download
var pauseDownloadOptions = {
const pauseDownloadOptions = {
isAllowAutoResume: true // Whether to allow automatic resuming of download
}
};
updater.pauseDownload(versionDigestInfo, pauseDownloadOptions).then(value => {
console.log(`pauseDownload`);
}).catch(err => {
......@@ -722,14 +722,14 @@ Updates the version. This API uses an asynchronous callback to return the result
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Installation options
var upgradeOptions = {
const upgradeOptions = {
order: update.Order.INSTALL // Installation command
}
};
updater.upgrade(versionDigestInfo, upgradeOptions, (err) => {
console.log(`upgrade error ${JSON.stringify(err)}`);
});
......@@ -762,14 +762,14 @@ Updates the version. This API uses a promise to return the result.
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Installation options
var upgradeOptions = {
const upgradeOptions = {
order: update.Order.INSTALL // Installation command
}
};
updater.upgrade(versionDigestInfo, upgradeOptions).then(() => {
console.log(`upgrade start`);
}).catch(err => {
......@@ -799,14 +799,14 @@ Clears errors. This API uses an asynchronous callback to return the result.
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options for clearing errors
var clearOptions = {
const clearOptions = {
status: update.UpgradeStatus.UPGRADE_FAIL,
}
};
updater.clearError(versionDigestInfo, clearOptions, (err) => {
console.log(`clearError error ${JSON.stringify(err)}`);
});
......@@ -839,14 +839,14 @@ Clears errors. This API uses a promise to return the result.
```ts
// Version digest information
var versionDigestInfo = {
const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
}
};
// Options for clearing errors
var clearOptions = {
lconstet clearOptions = {
status: update.UpgradeStatus.UPGRADE_FAIL,
}
};
updater.clearError(versionDigestInfo, clearOptions).then(() => {
console.log(`clearError success`);
}).catch(err => {
......@@ -926,7 +926,7 @@ Sets the update policy. This API uses an asynchronous callback to return the res
**Example**
```ts
let policy = {
const policy = {
downloadStrategy: false,
autoUpgradeStrategy: false,
autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes
......@@ -961,7 +961,7 @@ Sets the update policy. This API uses a promise to return the result.
**Example**
```ts
let policy = {
const policy = {
downloadStrategy: false,
autoUpgradeStrategy: false,
autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes
......@@ -1041,10 +1041,10 @@ Enables listening for update events. This API uses an asynchronous callback to r
**Example**
```ts
var eventClassifyInfo = {
const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: ""
}
};
updater.on(eventClassifyInfo, (eventInfo) => {
console.log("updater on " + JSON.stringify(eventInfo));
......@@ -1068,10 +1068,10 @@ Disables listening for update events. This API uses an asynchronous callback to
**Example**
```ts
var eventClassifyInfo = {
const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: ""
}
};
updater.off(eventClassifyInfo, (eventInfo) => {
console.log("updater off " + JSON.stringify(eventInfo));
......@@ -1153,10 +1153,10 @@ Verifies the update package. This API uses an asynchronous callback to return th
**Example**
```ts
var upgradeFile = {
const upgradeFile = {
fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package
}
};
localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath", (err) => {
console.log(`factoryReset error ${JSON.stringify(err)}`);
......@@ -1189,10 +1189,10 @@ Verifies the update package. This API uses a promise to return the result.
**Example**
```ts
var upgradeFile = {
const upgradeFile = {
fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package
}
};
localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath").then(() => {
console.log(`verifyUpgradePackage success`);
}).catch(err => {
......@@ -1219,10 +1219,10 @@ Installs the update package. This API uses an asynchronous callback to return th
**Example**
```ts
var upgradeFiles = [{
const upgradeFiles = [{
fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package
}]
}];
localUpdater.applyNewVersion(upgradeFiles, (err) => {
console.log(`applyNewVersion error ${JSON.stringify(err)}`);
......@@ -1248,10 +1248,10 @@ Installs the update package. This API uses a promise to return the result.
**Example**
```ts
var upgradeFiles = [{
localUpdater upgradeFiles = [{
fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package
}]
}];
localUpdater.applyNewVersion(upgradeFiles).then(() => {
console.log(`applyNewVersion success`);
}).catch(err => {
......@@ -1276,10 +1276,10 @@ Enables listening for update events. This API uses an asynchronous callback to r
**Example**
```ts
var eventClassifyInfo = {
const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: ""
}
};
function onTaskUpdate(eventInfo) {
console.log(`on eventInfo id `, eventInfo.eventId);
......@@ -1305,10 +1305,10 @@ Disables listening for update events. This API uses an asynchronous callback to
**Example**
```ts
var eventClassifyInfo = {
const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: ""
}
};
function onTaskUpdate(eventInfo) {
console.log(`on eventInfo id `, eventInfo.eventId);
......
......@@ -7,7 +7,7 @@ OpenHarmony provides the following two types of Docker environments for you to q
- Standalone Docker environment: applicable when using Ubuntu or Windows to build a distribution
- HPM-based Docker environment: applicable when using the HarmonyOS Package Manager \(HPM\) to build a distribution
**Table 1** Docker image
**Table 1** Docker image
<a name="table11986917191214"></a>
<table><thead align="left"><tr id="row149861417121215"><th class="cellrowborder" valign="top" width="15.831583158315832%" id="mcps1.2.6.1.1"><p id="p798611714124"><a name="p798611714124"></a><a name="p798611714124"></a>Docker Environment</p>
......@@ -67,11 +67,12 @@ OpenHarmony provides the following two types of Docker environments for you to q
Before using the Docker environment, perform the following operations:
1. Install Docker. For details, see [Install Docker Engine](https://docs.docker.com/engine/install/).
2. Obtain the OpenHarmony source code. For details, see [Source Code Acquisition](sourcecode-acquire.md).
1. Install Docker. For details, see [Install Docker Engine](https://docs.docker.com/engine/install/).
2. Obtain the OpenHarmony source code. For details, see [Source Code Acquisition](sourcecode-acquire.md).
>![](../public_sys-resources/icon-note.gif) **NOTE**<br>
>You do not need to obtain the source code for the HPM-based Docker environment.
> **NOTE**
>
> You do not need to obtain the source code for the HPM-based Docker environment.
## Standalone Docker Environment<a name="section2858536103611"></a>
......@@ -94,7 +95,7 @@ The Docker image of OpenHarmony is hosted on HUAWEI CLOUD SWR. Using the Docker
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
Run the following command in Windows \(assuming that the source code directory is **D:\\OpenHarmony**\):
Run the following command in Windows \(assuming that the source code directory is **D:\\OpenHarmony**\):
```
docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
......@@ -111,17 +112,17 @@ Set the build path to the current path.
hb set
```
**Figure 1** Setting page<a name="fig7947145854013"></a>
**Figure 1** Setting page<a name="fig7947145854013"></a>
![](figure/setting-page.png "setting-page")
>![](../public_sys-resources/icon-note.gif) **NOTE**<br>
>The mapping between the development board and the building GUI:
> **NOTE**<br>
> The mapping between the development board and the building GUI:
>
>- Hi3861: wifiiot\_hispark\_pegasus@hisilicon
>- Hi3516: ipcamera\_hispark\_taurus@hisilicon
>- Hi3518: ipcamera\_hispark\_aries@hisilicon
> - Hi3861: wifiiot\_hispark\_pegasus@hisilicon
> - Hi3516: ipcamera\_hispark\_taurus@hisilicon
> - Hi3518: ipcamera\_hispark\_aries@hisilicon
1. Select **ipcamera\_hispark\_taurus@hisilicon** and press **Enter**.
1. Select **ipcamera\_hispark\_taurus@hisilicon** and press **Enter**.
2. Start building.
```
......@@ -130,7 +131,7 @@ hb set
3. View the build result.
The files will be generated in the **out/hispark\_taurus/ipcamera\_hispark\_taurus** directory.
The files will be generated in the **out/hispark\_taurus/ipcamera\_hispark\_taurus** directory.
### Setting Up the Docker Environment for Standard-System Devices \(reference memory ≥ 128 MB\)<a name="section13585262391"></a>
......@@ -156,17 +157,17 @@ Run the following script to start building for standard-system devices \(referen
./build.sh --product-name {product_name} --ccache
```
**product\_name** indicates the platform supported by the current distribution, for example, hispark_taurus_standard and rk3568.
**product\_name** indicates the platform supported by the current distribution, for example, hispark_taurus_standard and rk3568.
Files generated during building are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
Files generated during building are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
>![](../public_sys-resources/icon-note.gif) **NOTE**<br>
>You can exit Docker by simply running the **exit** command.
>You can exit Docker by simply running the **exit** command.
## HPM-based Docker Environment<a name="section485713518337"></a>
**docker\_dist** is a template component in the [HPM](https://hpm.harmonyos.com/#/en/home) system. It helps to quickly initialize an HPM project and use the Docker image to quickly build a distribution of OpenHarmony, greatly simplifying environment configurations needed for building. After configuring the Ubuntu and hpm-cli development environments, perform the following steps to access the Docker environment:
**docker\_dist** is a template component in the [HPM](https://hpm.harmonyos.com/#/en/home) system. It helps to quickly initialize an HPM project and use the Docker image to quickly build a distribution of OpenHarmony, greatly simplifying environment configurations needed for building. After configuring the Ubuntu and hpm-cli development environments, perform the following steps to access the Docker environment:
### Setting Up the Docker Environment<a name="section3295842510"></a>
......@@ -176,20 +177,20 @@ Files generated during building are stored in the **out/{device_name}/** direc
hpm init -t @ohos/docker_dist
```
2. Modify the **publishAs** field.
2. Modify the **publishAs** field.
The obtained bundle is of the template type. Open the **bundle.json** file in the current directory and change the value of **publishAs** from **template** to **distribution** as needed.
The obtained bundle is of the template type. Open the **bundle.json** file in the current directory and change the value of **publishAs** from **template** to **distribution** as needed.
### Obtaining and Building Source Code<a name="section69141039143518"></a>
Start building. Docker can be automatically installed only in Ubuntu. If you are using any other operating system, manually install Docker before pulling the image.
- **Automatically Installing Docker \(Ubuntu\)**
- **Automatically Installing Docker \(Ubuntu\)**
Running the following command will automatically install Docker, pull the Docker image, and start the pulling and building of the corresponding solution in the container.
**Method 1:**
**Method 1:**
Add a parameter to specify the solution. For example:
......@@ -197,9 +198,9 @@ Start building. Docker can be automatically installed only in Ubuntu. If you are
hpm run docker solution={product}
```
**\{product\}** indicates the solution, for example, **@ohos/hispark\_taurus**, **@ohos/hispark\_aries**, and **@ohos/hispark\_pegasus**.
**\{product\}** indicates the solution, for example, **@ohos/hispark\_taurus**, **@ohos/hispark\_aries**, and **@ohos/hispark\_pegasus**.
**Method 2:**
**Method 2:**
Set an environment variable to specify the solution, and then run the build command.
......@@ -209,7 +210,7 @@ Start building. Docker can be automatically installed only in Ubuntu. If you are
export solution={product}
```
**\{product\}** indicates the solution, for example, **@ohos/hispark\_taurus**, **@ohos/hispark\_aries**, and **@ohos/hispark\_pegasus**.
**\{product\}** indicates the solution, for example, **@ohos/hispark\_taurus**, **@ohos/hispark\_aries**, and **@ohos/hispark\_pegasus**.
2. Obtain and build the source code.
......@@ -217,7 +218,7 @@ Start building. Docker can be automatically installed only in Ubuntu. If you are
hpm run docker
```
This example uses the **@ohos/hispark\_taurus** solution for illustration. If the execution is successful, the output is as follows:
This example uses the **@ohos/hispark\_taurus** solution for illustration. If the execution is successful, the output is as follows:
```
...
......@@ -226,7 +227,7 @@ Start building. Docker can be automatically installed only in Ubuntu. If you are
```
- **Manually Installing Docker \(Non-Ubuntu\)**
- **Manually Installing Docker \(Non-Ubuntu\)**
Perform the following operations to install Docker:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册