Commit graph

95 commits

Author SHA1 Message Date
Eberhard Beilharz
196300a418
fix(common): show description even if child projects specifies path
Previously we didn't show the description for the target if the target
definition specified a an alternate folder, e.g. `:app=src/app`. This
change fixes this.
2024-08-09 12:20:36 +02:00
Marc Durdin
57d4aeef97 feat(common): add top-level build.sh
This top-level builder script will build as many projects as are
possible to build on the current platform. For example, iOS and macOS
projects can only be built on macOS; Windows and parts of Developer can
only be built on Windows.

Relates-to: #6268
2024-08-07 10:46:39 +07:00
Marc Durdin
118a947882 chore(common): add support for build target platform exclusions
Add `builder_describe_platform` function to builder.inc.sh, associated
documentation and unit test, and use it in Developer and Common build
scripts.

Relates-to: #11755
2024-08-07 09:25:56 +07:00
Eberhard Beilharz
0de84b69c1
fix(common): output correct parameter values
Previously with the right number of parameters that take values and the
right order it could happen that a parameter value got replaced by an
action when the script output the parameters. This change fixes this.

Fixes: #11676
2024-06-04 16:34:03 +02:00
Eberhard Beilharz
4190510c65
fix(common): output actual script name instead of build.sh
Until now we always output `build.sh` as script name even when the
actual script was named differently. This change improves this.
2024-06-04 16:33:57 +02:00
Marc Durdin
296d16eb04 fix(common): properly quote builder_run_action call
The call to the command listed for `builder_run_action` was not properly
quoted, which meant that quoted parameters would have been corrupted,
for example:

    builder_run_action clean   rm -rf "temp folder/"

Would have run:

    rm -rf temp folder/
2024-05-20 06:30:16 +07:00
Marc Durdin
a0b15be300 fix(common): calculate already-build dependency targets correctly
When using module:target style dependencies, Builder would not track the
individual targets within the module, causing only the first target to
be built; subsequent dependency targets within that module would be
treated as already built.

This change means that builder will track individual targets within
the dependency. However, it is possible for targets to be built multiple
times if there a dependency listed for the entire module as well as for
the individual target within dependency, as in the following example,
where building project1 and project2 in one command would cause
module:mytarget to be built twice.

    builder_describe project1 \
      @/module

    builder_describe project2 \
      @/module:mytarget

This scenario should not break builds as they any configure+build
actions should be idempotent, but it could cause builds to be a little
slower, so should be corrected if identified. I do not currently plan to
further modify the dependency calculations to cater for this scenario.

Finally, if :mytarget is a child build, it is better to reference the
child module directly than the parent's target, for example:

    builder_describe projec1 \
       @/module/mytarget
2024-05-20 06:20:06 +07:00
Marc Durdin
d7cafae5ed feat(common): improve builder parameter passing for child and dep builds
Fixes #11408.
Fixes #11394.
2024-05-09 13:54:17 +07:00
Eberhard Beilharz
51297f538a
fix(common): Fix colorization of help output of builder script
This fixes the use of colors in the help output when `builder_term` is
used inside of `builder_describe` (e.g. `web/test.sh --help`). Previously
the escape sequences were not interpreted but directly output.
2024-05-02 15:23:20 +02:00
Marc Durdin
6c00656849 chore(common): unify pull-request creation scripts
Fixes #9886.
2023-10-30 06:22:52 +07:00
Marc Durdin
b33f476c8d chore: clean up a few minor discrepancies in builder.inc.sh
- Some uses of `KEYMAN_ROOT` (not cross-repo compatible)
- `set -eu` and `SHLVL` now set there as well
2023-10-10 16:36:24 +07:00
Eberhard Beilharz
1e734a47f5
docs(common): Fix documentation for builder_describe_internal_dependency
Fixes #9581.
2023-09-18 18:49:04 +02:00
Marc Durdin
7fcf9a4d5e fix(common): builder_parse broke on option parameters
If you had an option with a parameter, e.g. "--outfile c,b", then the
"c,b" was being treated as a parameter for expansion, which caused it
to expand to e.g. "configure,build". Oops.
2023-08-18 14:35:28 +07:00
Joshua A. Horton
ca894d0991 chore(web): Merge branch 'master' into chore/web/merge-master-esmodule-a17s13-mid 2023-05-22 13:49:45 +07:00
Marc Durdin
f8535c469e
chore: Update resources/builder.inc.sh 2023-05-22 11:32:45 +10:00
Marc Durdin
be2c0ccf45 fix(common): cleanup logging in builder 2023-05-19 16:36:05 +07:00
Joshua A. Horton
d9425bb1ff chore: Merge branch 'master' into feature-esmodule-as17s12-end-update 2023-05-12 11:53:12 +07:00
Marc Durdin
97837d2021 feat(common): add builder_run_action shorthand function 2023-05-10 12:50:39 +07:00
Joshua A. Horton
e42fa70aa8 chore(web): Merge branch 'feature-esmodule-web-engine' into chore/web/update-feature-esmodule-a17s12-start 2023-05-02 12:59:35 +07:00
Marc Durdin
74f9276695 chore(common): run common and resources tests
This sets us up to run all common/ and resources/ tests from a single
script, common/build.sh. This test will be run on each platform for all
changes made in common/ or resources/.

Also renamed files and paths for consistency in resources/ and updated
tests accordingly.
2023-04-28 14:07:34 +07:00
Marc Durdin
a90b045016 fix(common): builder parse multi-param order
If a build script specified, e.g. :kmc-keyboard, :kmc-package, :kmc as
three targets, in that order, then passing :kmc as a parameter would
fail, because :kmc-keyboard, :kmc-package would be emitted to the match
result before finding :kmc.
2023-04-25 14:50:24 +07:00
Marc Durdin
cb0c39f1aa fix(common): builder - pass deps flags to child scripts 2023-04-24 09:52:22 +07:00
Marc Durdin
787b32ba34
Revert "chore(web): merge master into feature-esmodule-web-engine (A17S9 end) 🧩" 2023-03-31 14:17:37 +11:00
Joshua A. Horton
b85087f392 chore(web): Merge branch 'master' into chore/web/update-feature-esmodule-for-configure-fix 2023-03-23 15:15:07 +07:00
Marc Durdin
549a8e009e chore(common): define BUILDER_CONFIGURATION env var 2023-03-23 09:21:55 +07:00
Marc Durdin
7cd6b00946 chore(common): prevent multiple npm ci runs in child scripts
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.
2023-03-21 11:08:22 +07:00
Marc Durdin
958f12386d chore(common): add win/mac/linux common build.sh parent scripts
Currently, there are no tests that will run but these scripts will at
least give us a starting point for future code.
2023-03-14 13:10:06 +07:00
Marc Durdin
0811282ccf chore(common): add common/web/build.sh, small cleanup 2023-03-14 13:05:27 +07:00
Joshua A. Horton
a9f28138a4 chore(web): Merge branch 'feature-esmodule-web-engine' into change/web/child-script-pattern 2023-03-14 12:24:10 +07:00
Marc Durdin
534bd2a54b
Merge pull request #8416 from keymanapp/chore/common/build-script-performance
chore(common): build script performance improvements
2023-03-14 15:41:32 +11:00
Marc Durdin
3302abaf73 chore(common): use builder_trim instead of trim, _builder_trim 2023-03-13 09:53:43 +07:00
Marc Durdin
350808bd5d chore(common): fixup tests and various typo tweaks
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.
2023-03-13 09:43:09 +07:00
Marc Durdin
fbd41c0a74
chore: fix typo
Co-authored-by: Darcy Wong <darcy_wong@sil.org>
2023-03-13 12:45:11 +11:00
Marc Durdin
de0580f436 chore(common): fix another typo 2023-03-13 08:16:45 +07:00
Marc Durdin
92ed99c4d6 chore(common): build script performance improvements
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
2023-03-13 07:18:09 +07:00
Marc Durdin
22930be045 chore(common): minor cleanup 2023-03-13 06:20:28 +07:00
Marc Durdin
339cff11cf chore(common): support shorthand for build.sh
Fixes #8396
2023-03-13 06:15:43 +07:00
Marc Durdin
660e98a430 feat(common): support single target for a dependency
Fixes #8397.
2023-03-09 14:54:27 +07:00
Darcy Wong
099900ea51 feat(common): builder.inc.sh inheritable options
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
2023-03-08 10:33:35 +07:00
Marc Durdin
00017350d3 chore(common): clean up --debug usage in build scripts
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!)
2023-03-08 05:40:40 +07:00
Marc Durdin
f1985ad7a5
chore: address review comments 2023-03-07 09:54:22 +11:00
Marc Durdin
1bc31c8792 chore(common): handle pre-init builder_echo 2023-03-02 05:56:24 +07:00
Marc Durdin
06afdd262b chore(common): cleanup build.inc.sh echo
Makes the output of log messages from builder scripts more consistent,
and uses color more effectively to highlight specific parts of lines.
2023-03-01 14:51:08 +07:00
Marc Durdin
3c175bfc63 feat(core): run tests for current arch 2023-03-01 13:41:23 +07:00
Marc Durdin
e85bbaa069 feat(core): build both archs for mac 2023-03-01 13:02:48 +07:00
Marc Durdin
78f18c38ee feat(core): mac fat library -- testing 2023-03-01 11:00:15 +07:00
Marc Durdin
572bd74783 fix(common): builder: skip dependency build for clean action
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!
2023-03-01 08:26:30 +07:00
Marc Durdin
b809a60936
Merge pull request #7054 from keymanapp/feature-ldml
epic: LDML keyboard support 🙀
2023-02-28 20:38:00 +11:00
Marc Durdin
b96e863885 chore: Merge branch 'feature-ldml' into chore/merge-master-into-feature-ldml-A17S7 2023-02-28 05:49:05 +07:00
Marc Durdin
e6ea381aba chore(common): fix child build error handling
Fixes #8322.

This issue was arising due to subshells masking the exit code.

set -e is not really to be trusted.
2023-02-27 15:09:42 +07:00