文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

跟着小白一起学鸿蒙—如何编译Hap程序(十七)

2024-12-01 01:49

关注

想了解更多关于开源的内容,请访问:

​51CTO 开源基础软件社区​

​https://ost.51cto.com​

安装使用说明(Open-Harmony)

在开源鸿蒙系统下

.
├── example
├── BluetoothTest
├── build-profile.json5
├── hvigorfile.js
├── package.json
├── package-lock.json
├── BUILD.gn
├── entry/src/main
├── config.json
├── ets
├── Component
├── MainAbility
├── app.ets
├── controller
├── model
├── pages
└── res
└── image
├── MainAbility2
└── Utils
└── resources
└── base
├── element
└── media
└── signature
├── fuzztest
├── moduletest
└── unittest
路径为:foundation/communication/bluetooth/bundle.json
命令为:
"test": [
...
"//foundation/communication/bluetooth/test/example/example_btTest:BluetoothTest"
]
foundation/communication/bluetooth/test/example/BluetoothTest/BUILD.gn
import("//test/xts/tools/build/suite.gni")
ohos_hap("BluetoothTest") {
hap_profile = "entry/src/main/config.json"
hap_name = "BluetoothTest"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
deps = [
":bluetooth_resources",
":bluetooth_ts_assets",
]
certificate_profile = "signature/auto_ohos_default_com.ohos.bttest.p7b"
}

ohos_js_assets("bluetooth_ts_assets") {
source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json"
ets2abc = true
}

ohos_resources("bluetooth_resources") {
sources = [ "entry/src/main/resources" ]
hap_profile = "entry/src/main/config.json"
}

路径为:foundation/communication/bluetooth/test/example/example_btTest/signature
签名文件为:Dev-Eco自动签名生成的文件:auto_ohos_default_com.ohos.bttest.p7b

{
"app": {
"vendor": "samples",
"bundleName": "ohos.samples.bttest",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 8,
"target": 8
}
},
"deviceConfig": {},
"module": {
"mainAbility": ".MainAbility",
"deviceType": [
"default",
"phone"
],
"reqPermissions": [
{
"reason": "",
"name": "ohos.permission.DISCOVER_BLUETOOTH"
},
{
"reason": "",
"name": "ohos.permission.USE_BLUETOOTH"
},
{
"name": "ohos.permission.LOCATION"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"formsEnabled": false,
"label": "$string:MainAbility_label",
"type": "page",
"launchType": "singleton"
},
{
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility2",
"name": ".MainAbility2",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:MainAbility2_desc",
"formsEnabled": false,
"label": "$string:MainAbility2_label",
"type": "page",
"launchType": "singleton"
}
],
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.samples.bttest",
"srcPath": "",
"name": ".entry",
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/homePage",
"pages/manualApiTestPage",
...
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".MainAbility2",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}

# 全量编译
./build.sh --product-name {product_name}

# 单独编译HAP
./build.sh --product-name {product_name} --build-target BluetoothTest

想了解更多关于开源的内容,请访问:

​51CTO 开源基础软件社区​

​https://ost.51cto.com​​。

来源:51CTO开源基础软件社区内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯