Commit graph

125 commits

Author SHA1 Message Date
Marc Durdin
e7090ff207
Merge pull request #13882 from keymanapp/maint/common/builder-error-to-stderr
maint(common): report builder errors to stderr
2025-05-14 15:57:52 +07:00
Eberhard Beilharz
7d33ff7ffa
maint(common): move build_is_ci_* functions
This change moves the `build_is_ci_*` functions from
`resources/build/build-utils-ci.inc.sh` → `resources/builder.inc.sh`.

Fixes: #13885
Test-bot: skip
2025-05-12 18:16:07 +02:00
Eberhard Beilharz
d307051836
Merge pull request #13854 from keymanapp/maint/common/versionvars
Previously the builder scripts defined a readonly `VERSION` environment variable for the Keyman version. That caused problems when another (external) script tried to define a `VERSION` variable. We encountered this problem when trying to move the TC build steps of a configuration into a single script (#13399) when we tried to source `~/.nvm/nvm.sh`.

This change uses a Keyman specific prefix for the version variables and renames `VERSION` → `KEYMAN_VERSION` etc. as well as `TIER` → `KEYMAN_TIER`. Unfortunately these variables are used in a lot of places, so this turned out to be a bit of a yak shave.
2025-05-12 08:58:19 +02:00
Eberhard Beilharz
da7c598d80
Merge pull request #13869 from keymanapp/maint/common/cifuncs 2025-05-12 08:56:56 +02:00
Marc Durdin
5b1e969c23 maint(common): report builder errors to stderr
Sometimes a builder script can be redirected internally and then error
messages are lost in the redirect if the script fails. This sidesteps
that problem by reporting errors to stderr instead of stdout.
2025-05-12 06:28:42 +02:00
Eberhard Beilharz
7f12f904eb
maint(common): address code review comments
- remove `builder_is_running_on_ci` function since there already is a
  similar `builder_is_ci_build` function
- use `GITHUB_ACTIONS` environment variable instead of `GITHUB_RUN_ID`
  to detect if we're run be GitHub Actions
2025-05-09 11:39:57 +02:00
Eberhard Beilharz
3634dd1702
maint(common): add three more functions to detect if running on CI
This adds the three additional functions `builder_is_running_on_ci`,
`builder_is_running_on_docker`, and `builder_is_running_on_gha` to be
able to detect if the build is running in a CI or CI-like container
environment.
2025-05-08 17:44:40 +02:00
Eberhard Beilharz
907a16012c
maint(common): output start/end messages if not running on TC
If we're not running on TC we should output the start/end messages as
headings unless it's a child build. This was the previous behavior
before we added support for TC blocks.
2025-05-08 17:01:00 +02:00
Eberhard Beilharz
4d81589f48
maint(common): use unique names for Keyman version variables
Previously the builder scripts defined a readonly `VERSION` environment
variable for the Keyman version. That caused problems when another
(external) script tried to define a `VERSION` variable. We encountered
this problem when trying to move the TC build steps of a configuration
into a single script (#13399) when we tried to source `~/.nvm/nvm.sh`.

This change uses a Keyman specific prefix for the version variables and
renames `VERSION` → `KEYMAN_VERSION` etc. Unfortunately these variables
are used in a lot of places, so this turned out to be a bit of a yak
shave.

Test-bot: skip
2025-05-07 18:46:51 +02:00
Joshua Horton
849014687b
Merge pull request #13827 from keymanapp/maint/common/local-builds-as-debug
maint(common): automatically set --debug option for local-environment builder-script uses
2025-05-07 10:17:59 +07:00
Joshua Horton
c389267a22
docs(common): comment removed per PR review
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-07 08:29:35 +07:00
Eberhard Beilharz
b83002ca85
maint(common): add builder_is_running_on_teamcity function
Addresses code review comments.

Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-06 16:26:22 +02:00
Joshua Horton
9b2d21ff2d maint(common): use booleans, not strings for is_release
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-06 13:58:36 +07:00
Joshua Horton
e2fe3861aa maint(common): builder_release -> is_release, other review concerns
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-06 13:56:02 +07:00
Eberhard Beilharz
c95cb5f0c2
maint(common): output script identifier in front of block name 2025-05-05 20:00:55 +02:00
Joshua Horton
51649bb8d3 maint(common): builder_release var should be local 2025-05-05 12:50:05 +07:00
Joshua Horton
ab9ed717aa maint(common): add --release option to force release builds in local environment
Co-authored-by: Marc Durdin <marc@durdin.net>
2025-05-05 12:48:55 +07:00
Joshua Horton
5af26297d9 maint(common): automatically set --debug option in local-environment builder scripts
Fixes: #11106
2025-05-02 15:02:04 +07:00
Eberhard Beilharz
92a903ddd8
maint(common): add support for TC blocks
This change adds support for TC blocks of service messages
(https://www.jetbrains.com/help/teamcity/service-messages.html#Blocks+of+Service+Messages)
and starts/ends a block in the `builder_start_action`/`builder_finish_action`
functions. We output the TC block service messages only if we're running
on TC, i.e. if the `TEAMCITY_GIT_PATH` environment variable is set.

Part-of:  #13399
Test-bot: skip
2025-04-30 20:39:09 +02:00
Joshua Horton
da5152f509
Merge pull request #12296 from keymanapp/feat/builder-autocomplete
feat: add builder tab-completion script
2025-01-15 11:46:41 +07:00
Joshua Horton
1ffae64dfb chore: apply suggestions from code review 2025-01-14 10:40:38 +07:00
Marc Durdin
dad1df3194 fix(developer): ensure license parameter is required and add tests
Some additional items arose from this:

* Adds a command-line-tests unit test which does some basic sanity tests
  on `kmc`.
* Cleans up some of the error reporting infrastructure in `kmc` to
  ensure that thrown errors are handled better.
* Removes redundant subshell from `builder_run_action`.

Fixes: #12846
2025-01-13 15:10:31 +07:00
Joshua Horton
7ebad957b9 fix: now autocompletes default options 2025-01-08 10:03:44 +07:00
Joshua Horton
9dfe83f3cf docs: for + suffix cleanup 2025-01-08 09:18:50 +07:00
Joshua Horton
73268f8d7f Merge branch 'master' into feat/builder-autocomplete 2025-01-08 09:15:50 +07:00
Eberhard Beilharz
3232c2a1a1
chore(common): allow to run build.sh scripts in bashdb debugger
One of the traps prevents debugging a build script in
the `bashdb` debugger. This change skips trapping `err` and `exit`
when run under a debugger and so allows to debug the script with `bashdb`.
2024-10-09 15:46:37 +02:00
Eberhard Beilharz
389fb4f9ee
chore(common): Allow to build offline
A lot of the `configure` actions rely on node dependencies and so call
`npm install`. Without a internet connection this hangs forever, even
if you had successfully installed the dependencies before and nothing
changed since then. This change adds a `--offline` parameter that passes
`--prefer-offline` to npm, which causes npm to use the cached
dependencies.

Also sets the `MESON_PACKAGE_CACHE_DIR` environment variable so that all
(sub-)projects share the same package cache dir. This will speed up regular
builds a bit (e.g. `developer/src/kmcmplib` and `core` both have `icu4c`
as a dependency), but will also help with offline builds.

`MESON_PACKAGE_CACHE_DIR` requires Meson 1.3, however older Meson
versions ignore this environment variable and simply continue to use a
cache per subproject, so will continue to work (minus offline builds).
2024-09-18 22:40:20 +02:00
Joshua A. Horton
e6fb213fa2 fix: revert unintended change outside of new func 2024-08-27 13:23:10 +07:00
Joshua A. Horton
b589aed4c0 chore: builder.inc.sh cleanup in new method 2024-08-27 13:14:57 +07:00
Joshua A. Horton
f07eba115d feat: add builder autocompletion script 2024-08-27 12:53:18 +07:00
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