Skip to content
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: clean up a few minor discrepancies in builder.inc.sh #9731

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions resources/build/build-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
# Note: keep changes to version, tier and tag determination in sync with mkver (windows/src/buildutils/mkver)
#

# Note: set -eu and SHLVL are deliberately set both here and in builder.inc.sh,
# because we want them set as early as possible, and because
# builder.inc.sh is shared to other repos, this keeps the usage consistent
# there as well.

# Exit on command failure and when using unset variables:
set -eu

Expand Down
18 changes: 13 additions & 5 deletions resources/builder.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
# builder.inc.sh directly, or, just in the Keyman repo, via build-utils.sh.
#

# Exit on command failure and when using unset variables:
set -eu

#
# Prevents 'clear' on exit of mingw64 bash shell
#
SHLVL=0

# _builder_init is called internally at the bottom of this file after we have
# all function declarations in place.
function _builder_init() {
Expand Down Expand Up @@ -659,14 +667,14 @@ builder_trim() {
# `/` is expected to be relative to repo root, not filesystem root. Otherwise,
# it's relative to current script path, not current working directory. The
# returned path will not have a prefix `/`, and will be relative to
# `$KEYMAN_ROOT`. Assumes realpath is installed (brew coreutils on macOS).
# `$REPO_ROOT`. Assumes realpath is installed (brew coreutils on macOS).
#
_builder_expand_relative_path() {
local path="$1"
if [[ "$path" =~ ^/ ]]; then
echo "${path:1}"
else
realpath --canonicalize-missing --relative-to="$KEYMAN_ROOT" "$THIS_SCRIPT_PATH/$path"
realpath --canonicalize-missing --relative-to="$REPO_ROOT" "$THIS_SCRIPT_PATH/$path"
fi
}

Expand Down Expand Up @@ -1076,7 +1084,7 @@ _builder_add_chosen_action_target_dependencies() {
# If there is a defined output for this dependency
if [[ ! -z ${_builder_dep_path[$dep_output]+x} ]]; then
# If the output for the dependency is missing, or we have --force-deps
if [[ ! -e "$KEYMAN_ROOT/${_builder_dep_path[$dep_output]}" ]] || builder_is_full_dep_build; then
if [[ ! -e "$REPO_ROOT/${_builder_dep_path[$dep_output]}" ]] || builder_is_full_dep_build; then
# Add the dependency to the chosen action:target list
if ! _builder_item_in_array "$dep_output" "${_builder_chosen_action_targets[@]}"; then
_builder_chosen_action_targets+=($dep_output)
Expand Down Expand Up @@ -1591,7 +1599,7 @@ _builder_dep_output_defined() {
}

_builder_dep_output_exists() {
if _builder_dep_output_defined $1 && [[ -e "$KEYMAN_ROOT/${_builder_dep_path[$1]}" ]]; then
if _builder_dep_output_defined $1 && [[ -e "$REPO_ROOT/${_builder_dep_path[$1]}" ]]; then
return 0
else
return 1
Expand Down Expand Up @@ -1670,7 +1678,7 @@ _builder_do_build_deps() {
fi

builder_set_module_has_been_built "$dep"
"$KEYMAN_ROOT/$dep/build.sh" "configure$dep_target" "build$dep_target" \
"$REPO_ROOT/$dep/build.sh" "configure$dep_target" "build$dep_target" \
$builder_verbose \
$builder_debug \
$_builder_build_deps \
Expand Down