1 Star 0 Fork 4.9K

fish / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
environment-variables.md 1.99 KB
一键复制 编辑 原始数据 按行查看 历史
NEEN 提交于 2021-03-12 17:59 . !197 Docs Update version 1.0.1

Environment Variables

During bundle compilation, system-provided environment variables are required to define the output and link the required binary files. These variables are injected into the context for executing scripts based on service requirements. Therefore, their values can be directly obtained from the scripts. Currently, there are global and fixed environment variables in the system.

Global variables are defined by the envs attribute in bundle.json. All dependent bundles can obtain the values of global variables.

{
    "envs": {
        "compileEnv": "arm"
    }
}

Different parameters can be passed to bundles when introducing dependencies so that the compilation of dependent bundles can meet the requirements of the current bundle. The parameters defined in the dependencies can be obtained from the context for executing the corresponding scripts.

{
    "dependencies": {
        "my-bundle": {
            "version": "1.0.0",
            "mode": "debug"
        }
    }
}

When linking to a binary file, the bundle needs to know the file path regarding the dependencies. Therefore, the path (as an environment variable) is passed to the bundle for compiling.

The passed environment variable is in DEP_BundleName format, where BundleName indicates the name of the dependent bundle, for example, DEP_first-bundle.

Tags can be defined to group dependent bundles. You can obtain the path of a group of dependent bundles based on their tag. A tag starts with a number sign (#) and is defined as follows:

{
    "dependencies": {
        "#tool": {
            "first-bundle": "1.0.0",
            "second-bundle": "1.0.0"
        },
        "#drivers": {
            "xx-bundle": "1.0.0",
            "yy-bundle": "1.0.0"
        }
    }
}

There are two fixed environment variables:

  • DEP_OHOS_BUNDLES: path of the ohos_bundles folder
  • DEP_BUNDLE_BASE: path of the outermost bundle
1
https://gitee.com/fish_neil/docs.git
git@gitee.com:fish_neil/docs.git
fish_neil
docs
docs
master

搜索帮助