1 Star 0 Fork 4.9K

fish / docs

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

Bundle Composition

A bundle contains the following contents:

  • src directory for storing code files or code library

  • ohos_bundles folder for storing dependent bundles (It is automatically generated during bundle installation, without the need to submit to the code library.)

  • README.md file for describing the bundle

  • bundle.json file for declaring metadata of the bundle

  • LICENSE file for open-source code

    my-bundle
       |_ohos_bundles
       |_src
       |_bundle.json
       |_README.md
       |_LICENSE

Code files

Bundle code files are the same as those in a common code directory. The only difference lies in the open APIs (declared in header files) of a bundle, which are likely to be referenced by other bundles and need to be declared in the dirs of bundle.json.

README File

README.md is a bundle self-description file using the markdown syntax. For details, see Syntax Reference.

To help you easily find and use the desired bundle on the HarmonyOS Package Manager (HPM) platform, a README file is provided in the root directory of each bundle.

The README file may include instructions on how to install, configure, and use the instance code in the bundle, as well as any other information helpful to you.

The README file is available in the bundle details page of the HPM platform.

Metadata Description File

A bundle.json file describes the metadata of a bundle. Each bundle has its own bundle.json file.

{
  "name": "@myorg/demo-bundle",
  "version": "1.0.0",
  "license": "MIT",
  "description": "bundle description",
  "keywords": ["hos"],
  "tags": ["applications", "drivers"],
  "author": {"name":"","email":"","url":""},
  "contributors":[{"name":"","email":"","url":""},{"name":"","email":"","url":""}],
  "homepage": "http://www.foo.bar.com",
  "repository": "https://git@gitee.com:foo/bar.git",
  "publishAs": "source",
  "dirs": {
    "src": ["src/**/*.c"],
    "headers": ["headers/**/*.h"],
    "bin": ["bin/**/*.o"]
  },
  "scripts": {
    "build": "make"
  },
  "envs": {},
  "ohos": {
    "os": "2.0.0",
    "board": "hi3516",
    "kernel": "liteos-a"
  },
 "rom": "10240",
 "ram": "1024",
 "dependencies": {
    "@myorg/net":"1.0.0"
 }
}

Each bundle.json file has the following fields:

  • name: a bundle name, which starts with @ and is separated by /, for example, @myorg/mybundle

  • version: a bundle version number, for example, 1.0.0. The version number must comply with the Semantic Versioning Specification (SemVer) standards.

  • description: a brief description of a bundle

  • dependencies: bundles that a bundle depends on

  • envs: parameters required for bundle compilation, including global parameters and dependency parameters.

  • scripts: commands executable to a bundle, such as those for compiling, building, testing, and burning

  • publishAs: bundle publishing type, which can be source, binary, distribution, or code-segment

  • dirs: directory structure (such as the header file) generated for publishing

  • ram&rom: statistical information about the estimated read-only memory (ROM) and random access memory (RAM) usage

  • ohos: mappings among OpenHarmony versions, development boards, and kernels, separated by commas (,).

  • Extended information: author, home page, code repository, license, tags, and keywords

  • base (only for a distribution): a base distribution which others inherit from.

1
https://gitee.com/fish_neil/docs.git
git@gitee.com:fish_neil/docs.git
fish_neil
docs
docs
master

搜索帮助