Documentation
¶
Overview ¶
Package harmony assembles the HAP the harmonyos target builds: an ArkTS host whose Web serves the app's web build from the HAP's rawfile directory, with module.json and pack.info named for the app. docs/architecture/harmonyos.md holds the plan and what is not built.
A committed host (host/) is compiled with a fixed placeholder bundle, and Package replaces that placeholder byte for byte with an equally long name built from the app's id: the bytecode's length prefixes stay valid, so one host serves every app without an OpenHarmony SDK at build time. When the build machine has the SDK, CompileHost builds a host for the app's own bundle instead, and PackageWithHost assembles from it, keeping the id.
Index ¶
- Variables
- func Boot() []byte
- func BundleName(id string) (string, error)
- func BundleOf(hap string) (string, error)
- func CompileHost(ctx context.Context, bundle string) (string, error)
- func Package(dir, site, name, bundle, version string, code int, perms []string) (string, error)
- func PackageWithHost(dir, site, hostDir, name, bundle, version string, code int, perms []string) (string, error)
- type Signer
- type Signing
Constants ¶
This section is empty.
Variables ¶
var ErrNoSDK = errors.New("no OpenHarmony SDK")
ErrNoSDK reports that the machine has no OpenHarmony SDK to build a host with. A caller that only wants the exact bundle name falls back to the committed host.
Functions ¶
func Boot ¶
func Boot() []byte
Boot returns the page that starts an app's module in the host's Web view: it loads wasm_exec.js and app.wasm from the same directory, and the ArkTS side it talks to is nsgoHarmony.
func BundleName ¶
BundleName returns an equally long, legal bundle name for id: the id, a fixed marker that keeps different ids apart, then zero padding. The result is a valid dot-separated name that never ends in a dot.
func BundleOf ¶
BundleOf returns the bundle a HAP names for its app, as -run needs it to start: Package pads it without the SDK and keeps the id with it.
func CompileHost ¶
CompileHost builds a host for bundle with the SDK and returns the directory holding its files, from the user's cache once it is there. It returns ErrNoSDK when the machine cannot build one.
func Package ¶
Package writes the HAP for an app into dir from the committed host and the web build in site, and returns its path. The committed host's bytecode names each module with the placeholder bundle; Package swaps it for an equally long name derived from the app's id, so one host serves every app without the SDK.
func PackageWithHost ¶
func PackageWithHost(dir, site, hostDir, name, bundle, version string, code int, perms []string) (string, error)
PackageWithHost writes the HAP for an app into dir from a host built for the app's own bundle, as CompileHost builds one with the SDK: its bytecode already names the modules with the app's bundle, so only the app's version and label change and the installed bundle keeps the id.
Types ¶
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer uses the SDK's HAP signing tool with the app's own material.
func OpenSigner ¶
OpenSigner checks the signing configuration and locates the SDK tool. It reads no passwords, so doctor can check the profile without them.
func (*Signer) CheckProfile ¶
CheckProfile verifies the signed profile with the SDK tool and checks its bundle name. It leaves device trust and provisioning checks to HarmonyOS.
type Signing ¶
type Signing struct {
Keystore string `yaml:"keystore"`
KeyAlias string `yaml:"key_alias"`
Certificate string `yaml:"certificate"`
Profile string `yaml:"profile"`
}
Signing names the AppGallery Connect materials for a HarmonyOS HAP. Paths are relative to the app's nsgo.yaml unless absolute.