hvigor-plugin 0.1.4: fix task registration and build-dir resolution - #34
Merged
Conversation
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.
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
uploadFlashcatSymbolscould not run in 0.1.3, and when it did run it scanned thewrong directory for every product but
default. This fixes both, and removes theoption that made a skipped upload indistinguishable from a successful one.
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.
-p product=beta→build/beta), read from the project's OHOS app context. It previously defaulted tobuild/defaultand silently scanned the wrong directory for every other product,which could upload a stale build's sourcemap under the new version.
buildDirremains available as an override.
enabledoption is removed. With no build dependencies the taskruns 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 theFLASHCAT_UPLOADvariable thatfed it — from
hvigorfile.ts."no sourceMaps.map found" message names the path it searched. Every path that skips
the upload now states its reason.
plugin.tshad none. Adds coverage for task registration and build-dirresolution, plus a gate in
scripts/ci-check.shthat runs the task against a realhvigor task graph — hosted Linux CI cannot run hvigor, so a regression there is
invisible to every other check.
Verification
npm testinhvigor-plugin: 29 passing,tsc -bcleanhvigorw uploadFlashcatSymbols --no-daemon --mode module -p module=entry@default -p product=defaultagainst a local DevEco toolchain: it resolves the product directory, finds the ArkTS
sourcemap and the unstripped
libentry.so, logs the upload failure against adeliberately unreachable endpoint, and leaves the build successful.