Installation
Install the plugin as a dev dependency of the HarmonyOS project:
sh
npm install -D osslibraries-hvigor-pluginsh
pnpm add -D osslibraries-hvigor-pluginsh
yarn add -D osslibraries-hvigor-pluginsh
bun add -D osslibraries-hvigor-pluginsh
deno add --dev npm:osslibraries-hvigor-pluginsh
vp add -D osslibraries-hvigor-pluginsh
vlt install -D osslibraries-hvigor-pluginRegister
Open the hvigorfile.ts of the module whose rawfile should receive the output — typically entry — and add the plugin:
ts
import { hapTasks } from "@ohos/hvigor-ohos-plugin";
import { ossScanPlugin } from "osslibraries-hvigor-plugin";
export default {
system: hapTasks,
plugins: [ossScanPlugin()],
};The plugin registers a task named ossScanLicenses; via postDependencies it runs after the module's CompileArkTS, ahead of resource packaging. On every build it scans oh_modules/ and writes the metadata to src/main/resources/rawfile/osslibraries.json.
Verify
Run a build and look for the plugin's log lines:
text
[osslibraries] scanning OHPM dependencies at /path/to/project
[osslibraries] wrote 128 libraries to .../rawfile/osslibraries.json (JSON)The file appears in the module's rawfile directory. From here, install a UI package or the core package to render it — see Quick Start.
