-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(common): maintenance on build scripts - cd #11329
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
@@ -5,13 +5,10 @@ | |||
THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")" | |||
. "${THIS_SCRIPT%/*}/../../../resources/build/build-utils.sh" | |||
## END STANDARD BUILD SCRIPT INCLUDE | |||
EX_USAGE=64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused legacy cruft!
Okay, one problem here is that build-utils.sh is used for both builder scripts and other utility scripts, some of which are supposed to not change folder (e.g. mkver.inc.sh). Two ways to fix:
|
It took me a while to even understand the problem you are solving. |
Yep.
I kinda started to go this way then realised I'd need to fixup all the random scripts that include build-utils.sh to do this, and it would still leave us in the spot where api contract for builder scripts is vague. So I ended up:
|
Yes I think that needs to happen, something that helps reflect what it does the |
I think resources/builder.inc.sh should become resources/build/builder.implementation.inc.sh or something like that (better not to have it in resources/ directly). |
959137a
to
e1e7448
Compare
Fixes #11324. * Always `cd "$THIS_SCRIPT_PATH"` * Remove unnecessary `cd` from all build.sh * Remove unnecessary `set -eu` from all build.sh (and `# set -x`) * Replace old build-utils.sh incantation in a few build.sh scripts
Note: there is a bit of potential confusion about the difference between /resources/builder.inc.sh (the full implementation for builder scripts), and /resources/build/builder.inc.sh (the source script that builder scripts should always use). This allows us to make assumptions that will always be true for builder scripts that may not be true for other scripts, such as setting base folder.
builder_describe and builder_parse should come before other tests, so that (a) scripts can return --help details, and (b) so that builder.inc.sh can tell that the script is a valid builder script, even if environment means that the script will not otherwise run.
This prevents issues where Windows-style path pollutes path strings with $KEYMAN_ROOT variable. It typically will only be readonly if we are setting the variable in our own scripts
e1e7448
to
41af900
Compare
@@ -23,6 +18,11 @@ builder_describe "Keyman common Linux modules" \ | |||
|
|||
builder_parse "$@" | |||
|
|||
if [[ $BUILDER_OS != linux ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A builder script must always call builder_describe
and builder_parse
, so do our platform checks after that. This allows the script to be called with --help
even when on the wrong platform, so user can get info about it.
if [[ $BUILDER_OS != mac ]]; then | ||
builder_echo grey "Platform is not macOS; skipping common/mac" | ||
exit 0 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A builder script must always call builder_describe
and builder_parse
, so do our platform checks after that. This allows the script to be called with --help
even when on the wrong platform, so user can get info about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting some of the previous conversation and the documentation I saw in the file-changes, I think we have a few removals of change-directory that need to get restored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Changes in this pull request will be available for download in Keyman version 18.0.28-alpha |
Fixes #11324.
cd "$THIS_SCRIPT_PATH"
cd
from all build.shset -eu
from all build.sh (and# set -x
)builder_describe
andbuilder_parse
, then you are not a builder script!@keymanapp-test-bot skip