鸿蒙开发(二)-项目结构
上篇文章我们讲了如何配置鸿蒙开发的基础环境,以及创建了第一个鸿蒙程序。
这篇我们讲述了鸿蒙应用的项目目录结构。
如图所示:我们切换项目project可以看到。
另一种则是Ohos模式:
-
AppScope->app.json5 应用的全局配置
{"app": {"bundleName": "com.zh.test","vendor": "example","versionCode": 1000000,"versionName": "1.0.0","icon": "$media:app_icon","label": "$string:app_name"} }
包含包名,icon,label等信息。
vendor 为应用程序的供应商,默认如上为example
-
entry: 应用/服务模块,编译构建生成一个HAP.
entry->src->main->ets: 存放ArkTsUI源码,包含entryability以及pages
entry->src->main->resources:资源文件,如icon,字符串,布局文件等。
entry->src->main->module.json5:模块配置文件,包含abilities以及pages的配置
entry->src->build-profile.json5 :模块信息,taget等
entry->src->hvigorfile.ts :
entry->src->oh-package.json5 :配置三方依赖
{"name": "entry","version": "1.0.0","description": "Please describe the basic information.","main": "","author": "","license": "","dependencies": {} }
-
build.profile.json5:应用级配置,如签名,产品配置等信息
默认配置如下:
{"app": {"signingConfigs": [],"compileSdkVersion": 9,"compatibleSdkVersion": 9,"products": [{"name": "default","signingConfig": "default",}]},"modules": [{"name": "entry","srcPath": "./entry","targets": [{"name": "default","applyToProducts": ["default"]}]}] }
-
hvigorfile.ts:应用级编译构建任务脚本.
默认配置如下:
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. export { appTasks } from '@ohos/hvigor-ohos-plugin';
-
local.properties :
# This file is automatically generated by DevEco Studio. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file should *NOT* be checked into Version Control Systems, # as it contains information specific to your local configuration. # # For customization when using a Version Control System, please read the header note. hwsdk.dir=E:/harmony_os_sdk nodejs.dir=C:/Users/zj/nodejs
这里配置了OpenHarmony SDK的路径, 以及node.js的路径。
-
oh-package.json5