提交 b72adcea 编写于 作者: L lijunru

fixed format

Signed-off-by: Nlijunru <lijunru6@huawei.com>
上级 fe6fbfc9
...@@ -85,10 +85,10 @@ js或ets代码,ace编译后放置在assets/js/default目录下,stage模型 ...@@ -85,10 +85,10 @@ 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"]
...@@ -100,12 +100,12 @@ ohos_hap("example") { ...@@ -100,12 +100,12 @@ ohos_hap("example") {
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": {
...@@ -115,22 +115,22 @@ ohos_hap("example") { ...@@ -115,22 +115,22 @@ ohos_hap("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
...@@ -145,15 +145,15 @@ ohos_hap("example") { ...@@ -145,15 +145,15 @@ ohos_hap("example") {
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",
...@@ -163,29 +163,29 @@ ohos_hap("dataability") { ...@@ -163,29 +163,29 @@ ohos_hap("dataability") {
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",
...@@ -195,28 +195,28 @@ ohos_hap("FormOfFaJs") { ...@@ -195,28 +195,28 @@ ohos_hap("FormOfFaJs") {
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",
...@@ -227,34 +227,34 @@ ohos_hap("FormOfFaEts") { ...@@ -227,34 +227,34 @@ ohos_hap("FormOfFaEts") {
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",
...@@ -264,19 +264,19 @@ ohos_hap("actmoduletest") { ...@@ -264,19 +264,19 @@ ohos_hap("actmoduletest") {
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",
] ]
...@@ -284,15 +284,15 @@ ohos_resources("actmoduletest_resources") { ...@@ -284,15 +284,15 @@ ohos_resources("actmoduletest_resources") {
":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",
...@@ -304,26 +304,26 @@ ohos_hap("FormOfStageEts") { ...@@ -304,26 +304,26 @@ ohos_hap("FormOfStageEts") {
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",
] ]
...@@ -331,5 +331,5 @@ ohos_resources("FormOfStageEts_resources") { ...@@ -331,5 +331,5 @@ ohos_resources("FormOfStageEts_resources") {
":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.
先完成此消息的编辑!
想要评论请 注册