Bootstrap

#HarmonyOS篇:build-profile.json5里面配置products&&oh-package.json5里面dependencies依赖引入

oh-package.json5

用于描述包名、版本、入口文件和依赖项等信息。

{
  "license": "",
  "devDependencies": {},
  "author": "",
  "name": "entry",
  "description": "Please describe the basic information.",
  "main": "",
  "version": "1.0.0",
  "dependencies": {
    "@hw-agconnect/api-ohos": "^1.1.2",
    "@hw-agconnect/core-ohos": "^1.1.2",
    "@hw-agconnect/auth-ohos": "^1.1.2",
    "@ohos/common": "file:../common"
  }
}

oh-package-lock.json5

文件记录了项目中所有依赖包的确切版本号,确保在不同环境中安装的依赖版本一致,避免因版本差异导致的问题。

build-profile.json5

工程配置信息,包括签名signingConfigs、产品配置Products等。其中products中可配置当前运行环境,默认HarmonyOS.

modules 节点的配置决定了这些模块如何被构建和集成到最终的应用中。
{
  "app": {
    "signingConfigs": [
    ],
    "products": [
      {
        "name": "default",
        "signingConfig": "default",
        "compatibleSdkVersion": "4.0.0(10)",
        "runtimeOS": "HarmonyOS"
      }
    ]
  },
  "modules": [
    {
      "name": "entry",
      "srcPath": "./entry",
      "targets": [
        {
          "name": "default",
          "applyToProducts": [
            "default"
          ]
        }
      ]
    },
    {
      "name": "common",
      "srcPath": "./common"
    }
  ]
}
;