提交 b72adcea 编写于 作者: L lijunru

fixed format

Signed-off-by: Nlijunru <lijunru6@huawei.com>
上级 fe6fbfc9
...@@ -85,251 +85,251 @@ js或ets代码,ace编译后放置在assets/js/default目录下,stage模型 ...@@ -85,251 +85,251 @@ js或ets代码,ace编译后放置在assets/js/default目录下,stage模型
1. 将开发完成的应用example放到applications/standard/目录下。 1. 将开发完成的应用example放到applications/standard/目录下。
2. 配置gn脚本applications/standard/example/BUILD.gn,FA模型简单示例如下(更多BUILD.gn配置见[gn脚本配置示例](#gn脚本配置示例)): 2. 配置gn脚本applications/standard/example/BUILD.gn,FA模型简单示例如下(更多BUILD.gn配置见[gn脚本配置示例](#gn脚本配置示例)):
``` ```
import("//build/ohos.gni") # 引用ohos.gni import("//build/ohos.gni") # 引用ohos.gni
ohos_hap("example") { ohos_hap("example") {
hap_profile = "./src/main/config.json" # config.json hap_profile = "./src/main/config.json" # config.json
js_assets = ["./src/main/js/default"] js_assets = ["./src/main/js/default"]
raw_assets = ["./raw_assets"] raw_assets = ["./raw_assets"]
resources = ["./src/main/resources"] resources = ["./src/main/resources"]
shared_libraries = [ shared_libraries = [
"//third_party/libpng:libpng", # native库 "//third_party/libpng:libpng", # native库
] ]
certificate_profile = "../signature/systemui.p7b" # Cer文件 certificate_profile = "../signature/systemui.p7b" # Cer文件
hap_name = "SystemUI-NavigationBar" # 名字 hap_name = "SystemUI-NavigationBar" # 名字
part_name = "prebuilt_hap" part_name = "prebuilt_hap"
subsystem_name = "applications" subsystem_name = "applications"
} }
``` ```
3. 修改applications/standard/hap/ohos.build,示例如下: 3. 修改applications/standard/hap/ohos.build,示例如下:
``` ```
{ {
"subsystem": "applications", "subsystem": "applications",
"parts": { "parts": {
"prebuilt_hap": { "prebuilt_hap": {
"module_list": [ "module_list": [
... ...
"//applications/standard/example:example" # 添加编译目标 "//applications/standard/example:example" # 添加编译目标
] ]
} }
} }
} }
``` ```
4. 编译命令: 4. 编译命令:
``` ```
# 全量编译 # 全量编译
./build.sh --product-name {product_name} ./build.sh --product-name {product_name}
# 单独编译HAP # 单独编译HAP
./build.sh --product-name {product_name} --build-target applications/standard/example:example ./build.sh --product-name {product_name} --build-target applications/standard/example:example
``` ```
5. 编译产物,FA模型简单例子HAP解压视图如下: 5. 编译产物,FA模型简单例子HAP解压视图如下:
``` ```
Length Date Time Name Length Date Time Name
--------- ---------- ----- ---- --------- ---------- ----- ----
1439 2009-01-01 00:00 assets/raw_assets -----> raw_assets 1439 2009-01-01 00:00 assets/raw_assets -----> raw_assets
354 2009-01-01 00:00 assets/entry/resources.index ------> resources 354 2009-01-01 00:00 assets/entry/resources.index ------> resources
1 2009-01-01 00:00 assets/entry/resources/base/media/attributes.key ------> resources 1 2009-01-01 00:00 assets/entry/resources/base/media/attributes.key ------> resources
1 2009-01-01 00:00 assets/entry/resources/base/media/constants.key ------> resources 1 2009-01-01 00:00 assets/entry/resources/base/media/constants.key ------> resources
1 2009-01-01 00:00 assets/entry/resources/base/media/contents.key ------> resources 1 2009-01-01 00:00 assets/entry/resources/base/media/contents.key ------> resources
6790 2009-01-01 00:00 assets/entry/resources/base/media/icon.png ------> resources 6790 2009-01-01 00:00 assets/entry/resources/base/media/icon.png ------> resources
1 2009-01-01 00:00 assets/entry/resources/base/media/nodes.key ------> resources 1 2009-01-01 00:00 assets/entry/resources/base/media/nodes.key ------> resources
11170 2009-01-01 00:00 assets/js/default/app.js ------> js_assets 11170 2009-01-01 00:00 assets/js/default/app.js ------> js_assets
48 2009-01-01 00:00 assets/js/default/i18n/en-US.json ------> js_assets 48 2009-01-01 00:00 assets/js/default/i18n/en-US.json ------> js_assets
50 2009-01-01 00:00 assets/js/default/i18n/zh-CN.json ------> js_assets 50 2009-01-01 00:00 assets/js/default/i18n/zh-CN.json ------> js_assets
224 2009-01-01 00:00 assets/js/default/manifest.json ------> js_assets 224 2009-01-01 00:00 assets/js/default/manifest.json ------> js_assets
41481 2009-01-01 00:00 assets/js/default/pages/index/index.js ------> js_assets 41481 2009-01-01 00:00 assets/js/default/pages/index/index.js ------> js_assets
909 2009-01-01 00:00 config.json ------> hap_profile 909 2009-01-01 00:00 config.json ------> hap_profile
266248 2009-01-01 00:00 libs/libpng.z.so ------> shared_libraries 266248 2009-01-01 00:00 libs/libpng.z.so ------> shared_libraries
``` ```
### gn脚本配置示例 ### gn脚本配置示例
#### FA模型多ability示例 - FA模型多ability示例
``` ```
import("//build/ohos.gni") import("//build/ohos.gni")
ohos_hap("dataability") { ohos_hap("dataability") {
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
deps = [ deps = [
":dataability_js_assets", ":dataability_js_assets",
":dataability_resources", ":dataability_resources",
] ]
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "dataability" hap_name = "dataability"
part_name = "prebuilt_hap" part_name = "prebuilt_hap"
subsystem_name = "applications" subsystem_name = "applications"
} }
ohos_js_assets("dataability_js_assets") { ohos_js_assets("dataability_js_assets") {
ets2abc = true ets2abc = true
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
} }
ohos_resources("dataability_resources") { ohos_resources("dataability_resources") {
sources = [ sources = [
"entry/src/main/resources", "entry/src/main/resources",
] ]
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
} }
``` ```
#### FA模型Js卡片示例 - FA模型Js卡片示例
``` ```
import("//build/ohos.gni") import("//build/ohos.gni")
ohos_hap("FormOfFaJs") { ohos_hap("FormOfFaJs") {
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
deps = [ deps = [
":FormOfFaJs_js_assets", ":FormOfFaJs_js_assets",
":FormOfFaJs_resources", ":FormOfFaJs_resources",
] ]
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "FormOfFaJs" hap_name = "FormOfFaJs"
part_name = "prebuilt_hap" part_name = "prebuilt_hap"
subsystem_name = "applications" subsystem_name = "applications"
} }
ohos_js_assets("FormOfFaJs_js_assets") { ohos_js_assets("FormOfFaJs_js_assets") {
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
js2abc = true js2abc = true
source_dir = "entry/src/main/js" source_dir = "entry/src/main/js"
} }
ohos_resources("FormOfFaJs_resources") { ohos_resources("FormOfFaJs_resources") {
sources = [ sources = [
"entry/src/main/resources", "entry/src/main/resources",
] ]
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
} }
``` ```
#### FA模型Ets卡片示例 - FA模型Ets卡片示例
``` ```
import("//build/ohos.gni") import("//build/ohos.gni")
ohos_hap("FormOfFaEts") { ohos_hap("FormOfFaEts") {
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
deps = [ deps = [
":FormOfFaEts_js_assets", ":FormOfFaEts_js_assets",
":FormOfFaEts_form_js_assets", ":FormOfFaEts_form_js_assets",
":FormOfFaEts_resources", ":FormOfFaEts_resources",
] ]
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "FormOfFaEts" hap_name = "FormOfFaEts"
part_name = "prebuilt_hap" part_name = "prebuilt_hap"
subsystem_name = "applications" subsystem_name = "applications"
} }
ohos_js_assets("FormOfFaEts_js_assets") { ohos_js_assets("FormOfFaEts_js_assets") {
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
ets2abc = true ets2abc = true
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
} }
ohos_js_assets("FormOfFaEts_form_js_assets") { ohos_js_assets("FormOfFaEts_form_js_assets") {
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
js2abc = true js2abc = true
source_dir = "entry/src/main/js" source_dir = "entry/src/main/js"
} }
ohos_resources("FormOfFaEts_resources") { ohos_resources("FormOfFaEts_resources") {
sources = [ sources = [
"entry/src/main/resources", "entry/src/main/resources",
] ]
hap_profile = "entry/src/main/config.json" hap_profile = "entry/src/main/config.json"
} }
``` ```
#### Stage模型简单示例 - Stage模型简单示例
``` ```
import("//build/ohos.gni") import("//build/ohos.gni")
ohos_hap("actmoduletest") { ohos_hap("actmoduletest") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
deps = [ deps = [
":actmoduletest_js_assets", ":actmoduletest_js_assets",
":actmoduletest_resources", ":actmoduletest_resources",
] ]
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "actmoduletest" hap_name = "actmoduletest"
part_name = "prebuilt_hap" part_name = "prebuilt_hap"
subsystem_name = "applications" subsystem_name = "applications"
} }
ohos_app_scope("actmoduletest_app_profile") { ohos_app_scope("actmoduletest_app_profile") {
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
ohos_js_assets("actmoduletest_js_assets") { ohos_js_assets("actmoduletest_js_assets") {
ets2abc = true ets2abc = true
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
} }
ohos_resources("actmoduletest_resources") { ohos_resources("actmoduletest_resources") {
sources = [ sources = [
"entry/src/main/resources", "entry/src/main/resources",
] ]
deps = [ deps = [
":actmoduletest_app_profile", ":actmoduletest_app_profile",
] ]
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
} }
``` ```
#### Stage模型卡片示例 - Stage模型卡片示例
``` ```
import("//build/ohos.gni") import("//build/ohos.gni")
ohos_hap("FormOfStageEts") { ohos_hap("FormOfStageEts") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
deps = [ deps = [
":FormOfStageEts_js_assets", ":FormOfStageEts_js_assets",
":FormOfStageEts_form_js_assets", ":FormOfStageEts_form_js_assets",
":FormOfStageEts_resources", ":FormOfStageEts_resources",
] ]
js_build_mode = "debug" # 默认release js_build_mode = "debug" # 默认release
certificate_profile = "signature/openharmony_sx.p7b" certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "FormOfStageEts" hap_name = "FormOfStageEts"
part_name = "prebuilt_hap" part_name = "prebuilt_hap"
subsystem_name = "applications" subsystem_name = "applications"
} }
ohos_js_assets("FormOfStageEts_js_assets") { ohos_js_assets("FormOfStageEts_js_assets") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
ets2abc = true ets2abc = true
source_dir = "entry/src/main/ets" source_dir = "entry/src/main/ets"
} }
ohos_js_assets("FormOfStageEts_form_js_assets") { ohos_js_assets("FormOfStageEts_form_js_assets") {
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
js2abc = true js2abc = true
source_dir = "entry/src/main/js" source_dir = "entry/src/main/js"
} }
ohos_app_scope("FormOfStageEts_app_profile") { ohos_app_scope("FormOfStageEts_app_profile") {
app_profile = "AppScope/app.json" app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ] sources = [ "AppScope/resources" ]
} }
ohos_resources("FormOfStageEts_resources") { ohos_resources("FormOfStageEts_resources") {
sources = [ sources = [
"entry/src/main/resources", "entry/src/main/resources",
] ]
deps = [ deps = [
":FormOfStageEts_app_profile", ":FormOfStageEts_app_profile",
] ]
hap_profile = "entry/src/main/module.json" hap_profile = "entry/src/main/module.json"
} }
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册