From 42f03916ad6b707e06cd97e467b5732388f21281 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 23 Feb 2023 16:18:18 +0700 Subject: [PATCH 1/3] feat(common): adds warning if described output does not exist when finishing action --- resources/builder.inc.sh | 28 +++++++++++++++++++++++++--- resources/shellHelperFunctions.sh | 18 ------------------ 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/resources/builder.inc.sh b/resources/builder.inc.sh index d550ba3906..a4ae3fbbbd 100755 --- a/resources/builder.inc.sh +++ b/resources/builder.inc.sh @@ -402,6 +402,23 @@ builder_has_action() { fi } +_builder_dep_output_defined() { + if [[ ! -z ${_builder_dep_path[$1]+x} ]]; then + return 0 + else + echo "${_builder_dep_path[*]}" + return 1 + fi +} + +_builder_dep_output_exists() { + if _builder_dep_output_defined $1 && [[ -e "$KEYMAN_ROOT/${_builder_dep_path[$1]}" ]]; then + return 0 + else + return 1 + fi +} + # # Returns `0` if the user has asked to perform action on target on the command # line, and then starts the action. Should be paired with @@ -433,8 +450,7 @@ builder_start_action() { # verify whether a target output is present. if builder_is_dep_build && ! builder_is_full_dep_build && - [[ ! -z ${_builder_dep_path[$_builder_matched_action]+x} ]] && - [[ -e "$KEYMAN_ROOT/${_builder_dep_path[$_builder_matched_action]}" ]]; then + _builder_dep_output_exists $_builder_matched_action; then echo "$scope skipping $_builder_matched_action_name, up-to-date" return 1 fi @@ -1190,9 +1206,15 @@ builder_finish_action() { fi local scope="[$THIS_SCRIPT_IDENTIFIER] " + local matched_action="$action$target" - if [[ "$action$target" == "${_builder_current_action}" ]]; then + if [[ "$matched_action" == "${_builder_current_action}" ]]; then if [[ $result == success ]]; then + # Sanity check: if there is a described output for this action, does the corresponding + # file or directory exist now? + if _builder_dep_output_defined $matched_action && ! _builder_dep_output_exists "$matched_action"; then + builder_warn "## $scope$action_name's described output does not exist" + fi echo "${COLOR_GREEN}## $scope$action_name completed successfully${COLOR_RESET}" elif [[ $result == failure ]]; then echo "${COLOR_RED}## $scope$action_name failed${COLOR_RESET}" diff --git a/resources/shellHelperFunctions.sh b/resources/shellHelperFunctions.sh index a973cf23bd..d7612c74f5 100755 --- a/resources/shellHelperFunctions.sh +++ b/resources/shellHelperFunctions.sh @@ -26,24 +26,6 @@ verify_project() { fi } -# The list of valid platforms that our build scripts ought expect. -platforms=("android" "ios" "linux" "lmlayer" "mac" "web" "desktop" "developer") - -# Used to validate a specified 'platform' parameter. -verify_platform() { - match=false - for proj in ${platforms[@]} - do - if [ $proj = $1 ]; then - match=true - fi - done - - if [ $match = false ]; then - builder_die "Invalid platform specified!" - fi -} - displayInfo() { if [ "$QUIET" != true ]; then while [[ $# -gt 0 ]] ; do From c4ff8a5da3d7121a9a8d4b03ecaebc4fc63f8bd9 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Fri, 24 Feb 2023 08:01:42 +0700 Subject: [PATCH 2/3] chore(common): fix + enhancement per review --- resources/builder.inc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/builder.inc.sh b/resources/builder.inc.sh index a4ae3fbbbd..dca3b0ccac 100755 --- a/resources/builder.inc.sh +++ b/resources/builder.inc.sh @@ -406,7 +406,6 @@ _builder_dep_output_defined() { if [[ ! -z ${_builder_dep_path[$1]+x} ]]; then return 0 else - echo "${_builder_dep_path[*]}" return 1 fi } @@ -1214,6 +1213,7 @@ builder_finish_action() { # file or directory exist now? if _builder_dep_output_defined $matched_action && ! _builder_dep_output_exists "$matched_action"; then builder_warn "## $scope$action_name's described output does not exist" + builder_warn "## ${scope}Expected output: '${_builder_dep_path[$matched_action]}'." fi echo "${COLOR_GREEN}## $scope$action_name completed successfully${COLOR_RESET}" elif [[ $result == failure ]]; then From 6695c03ed7204bec1708bace582c4f284f0bc53d Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Fri, 24 Feb 2023 08:02:55 +0700 Subject: [PATCH 3/3] change(common): missed part of the suggested tweak --- resources/builder.inc.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/builder.inc.sh b/resources/builder.inc.sh index dca3b0ccac..caed5bea9d 100755 --- a/resources/builder.inc.sh +++ b/resources/builder.inc.sh @@ -1212,10 +1212,11 @@ builder_finish_action() { # Sanity check: if there is a described output for this action, does the corresponding # file or directory exist now? if _builder_dep_output_defined $matched_action && ! _builder_dep_output_exists "$matched_action"; then - builder_warn "## $scope$action_name's described output does not exist" + builder_warn "## $scope$action_name was successful, but output does not exist" builder_warn "## ${scope}Expected output: '${_builder_dep_path[$matched_action]}'." + else + echo "${COLOR_GREEN}## $scope$action_name completed successfully${COLOR_RESET}" fi - echo "${COLOR_GREEN}## $scope$action_name completed successfully${COLOR_RESET}" elif [[ $result == failure ]]; then echo "${COLOR_RED}## $scope$action_name failed${COLOR_RESET}" else