Skip to content

hvigor-plugin 0.1.4: fix task registration and build-dir resolution - #34

Merged
Fiona2016 merged 3 commits into
mainfrom
feat/hvigor-plugin-0.1.4
Aug 27, 2026
Merged

hvigor-plugin 0.1.4: fix task registration and build-dir resolution#34
Fiona2016 merged 3 commits into
mainfrom
feat/hvigor-plugin-0.1.4

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

What

uploadFlashcatSymbols could not run in 0.1.3, and when it did run it scanned the
wrong directory for every product but default. This fixes both, and removes the
option that made a skipped upload indistinguishable from a successful one.

  • Task registration. The task declared dependencies: ['assembleHap','assembleHar'].
    A module has at most one of those, so the missing one failed task-graph resolution
    and stopped the build. The task now declares no build dependencies — run it as its
    own hvigor invocation after a release build, which works for HAP, HAR and HSP
    modules alike.
  • Build directory. It now follows the product being built (-p product=beta
    build/beta), read from the project's OHOS app context. It previously defaulted to
    build/default and silently scanned the wrong directory for every other product,
    which could upload a stale build's sourcemap under the new version. buildDir
    remains available as an override.
  • Breaking: the enabled option is removed. With no build dependencies the task
    runs only when it is named on the command line, so naming it is already the switch.
    A second gate could only ever skip an upload that was explicitly asked for, and it
    did so without a log line. Drop enabled — and the FLASHCAT_UPLOAD variable that
    fed it — from hvigorfile.ts.
  • Diagnosability. The scanned directory and how it was chosen are logged, and the
    "no sourceMaps.map found" message names the path it searched. Every path that skips
    the upload now states its reason.
  • Tests. plugin.ts had none. Adds coverage for task registration and build-dir
    resolution, plus a gate in scripts/ci-check.sh that runs the task against a real
    hvigor task graph — hosted Linux CI cannot run hvigor, so a regression there is
    invisible to every other check.

Verification

  • npm test in hvigor-plugin: 29 passing, tsc -b clean
  • SDK unit tests: 148 passing
  • Ran hvigorw uploadFlashcatSymbols --no-daemon --mode module -p module=entry@default -p product=default
    against a local DevEco toolchain: it resolves the product directory, finds the ArkTS
    sourcemap and the unstripped libentry.so, logs the upload failure against a
    deliberately unreachable endpoint, and leaves the build successful.

The uploadFlashcatSymbols task declared dependencies on both assembleHap and
assembleHar. A module has at most one of them, so hvigor failed task-graph
resolution with "Cannot find hvigor task 'assembleHar' in module 'entry'" and
the build stopped. The task now declares no build dependencies: run it after a
release build as its own hvigor invocation.

The build directory now follows the product being built, read from the project's
OHOS app context, so -p product=beta scans build/beta. It previously defaulted to
build/default and silently scanned the wrong directory for every other product,
which could upload a stale build's sourcemap under the new version. buildDir
remains available as an override.

The resolved directory is now logged, and the "no sourceMaps.map found" message
names the path it searched, so a wrong directory is visible in the build output
instead of reading as missing sourcemap output.

Wire the plugin into the demo entry module and run its task from the build gate.
Hosted Linux CI cannot run hvigor, so nothing exercised the plugin against a real
task graph, and plugin.ts had no tests at all.

Document that the upload task needs --no-daemon when it is configured from
environment variables: hvigor's daemon copies the environment once when it is
created and afterwards refreshes only a fixed allowlist, so a reused daemon hands
the plugin stale or empty values, silently.
The uploadFlashcatSymbols task declares no build dependencies, so it runs only
when it is named on the command line. Naming it is already the switch: a second
gate could only ever skip an upload that was explicitly asked for, and it did so
without a log line, which is indistinguishable from a successful no-op run.

Every remaining skip path states its reason, so an upload that does nothing now
always says why.
npm install can update package-lock.json as a side effect, which is the wrong
behaviour for a gate that is supposed to check the committed state. The hosted
plugin test job already uses npm ci.
@Fiona2016
Fiona2016 merged commit 23e6b47 into main Aug 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant