Fixes#8471.
Ensures that `npm take-forever` (aka `npm ci`, `npm install`) only runs
once during a parent/child build script run.
Note that this also works even where build scripts manually call other
build scripts (e.g. input-processor as it is currently calling kmc
build manually) -- though this is not a recommended practice.
When running tests, discovered a number of typos in builder.inc.sh.
Also fixup pathing for builder include for all scripts under resources/
to ensure that we can maximize performance.
Improves build script performance by:
* using built-ins wherever possible (e.g. string splitting)
* eliminating redundant code
* using absolute (to $KEYMAN_ROOT) rather than relative paths to avoid realpath
* removing unnecessary `npm run` calls
BEFORE | AFTER
-------------------------------|----------------------
time ./core/build.sh --help |
real 0m2.116s | real 0m0.874s
user 0m0.578s | user 0m0.198s
sys 0m0.984s | sys 0m0.289s
-------------------------------|----------------------
time ./web/build.sh --help |
real 0m3.523s | real 0m0.757s
user 0m1.166s | user 0m0.320s
sys 0m2.273s | sys 0m0.455s
-------------------------------|----------------------
time ./web/build.sh -d |
real 1m34.750s | real 0m59.974s
user 0m9.721s | user 0m6.284s
sys 0m19.652s | sys 0m13.202s
@keymanapp-test-bot skip
Appending a `+` to a builder option will automatically pass that option to child scripts.
Applying #8371 to master branch and @darcywong00 will then re-apply to #7407
Fixes#8373.
Note that the core functionality requested in #8373 is already in place;
this commit just does some cleanup to make this easier to maintain in
the future:
* Uses `builder_is_debug_build` function to test for debug build
(instead of `builder_has_option --debug`, which would also work but
using the other function avoids typo issues with the option name).
* Renames `$_builder_debug` to `$_builder_debug_internal` to reduce
naming confusion
* Documents `$builder_debug`, `builder_is_debug_build`, and clarifies
usage of `--debug` option.
* Logs command line for dep builds (we could hide this in the future,
but it certainly doesn't hurt for now!)
We should not attempt to build dependencies when running `clean`. Note:
if your `clean` action requires dependencies, then something is very,
very wrong and you should fix that!