-
Notifications
You must be signed in to change notification settings - Fork 43
Address post-merge comments on PR #71 #74
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,24 +24,21 @@ if [[ -z "$JAVA_RUNFILES" ]]; then | |
| fi | ||
| fi | ||
|
|
||
| root_path=$(pwd) | ||
| tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/war.XXXXXXXX) | ||
| trap "{ cd ${root_path}; rm -rf ${tmp_dir}; }" EXIT | ||
| cd ${tmp_dir} | ||
| root_path="$(pwd)" | ||
| tmp_dir=$(mktemp -d "${TMPDIR:-/tmp}/war.XXXXXXXX") | ||
| trap "{ cd "${root_path}"; rm -rf "${tmp_dir}"; }" EXIT | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these double quotes aren't having their intended effect, since they're nested inside more double quotes. Ideally, this should look like: That's a tad bit more complicated though, so I'll leave this up to your discretion. |
||
| cd "${tmp_dir}" | ||
|
|
||
| ${JAVA_RUNFILES}/%{zipper} x ${JAVA_RUNFILES}/%{war} | ||
| cd ${root_dir} | ||
| "${JAVA_RUNFILES}/%{zipper}" x "${JAVA_RUNFILES}/%{war}" | ||
| cd "${root_dir}" | ||
|
|
||
| APP_ENGINE_ROOT=${JAVA_RUNFILES}/%{appengine_sdk} | ||
| APP_ENGINE_ROOT="${JAVA_RUNFILES}/%{appengine_sdk}" | ||
| if [ -n "${1-}" ]; then | ||
| ${APP_ENGINE_ROOT}/bin/appcfg.sh -A "$1" update ${tmp_dir} | ||
| retCode=$? | ||
| "${APP_ENGINE_ROOT}/bin/appcfg.sh" -A "$1" update "${tmp_dir}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a question: why is |
||
| retCode="$?" | ||
| else | ||
| ${APP_ENGINE_ROOT}/bin/appcfg.sh update ${tmp_dir} | ||
| retCode=$? | ||
| "${APP_ENGINE_ROOT}/bin/appcfg.sh" update "${tmp_dir}" | ||
| retCode="$?" | ||
| fi | ||
|
|
||
| rm -rf ${tmp_dir} | ||
| trap - EXIT | ||
|
|
||
| exit $retCode | ||
| exit "$retCode" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optional: |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,37 +19,34 @@ case "$0" in | |
| esac | ||
| if [[ -e "$self.runfiles/%{workspace_name}" ]]; then | ||
| RUNFILES="$self.runfiles/%{workspace_name}" | ||
| cd $RUNFILES | ||
| cd "$RUNFILES" | ||
| fi | ||
|
|
||
| ROOT=$PWD | ||
| tmp_dir=$(mktemp -d ${{TMPDIR:-/tmp}}/war.XXXXXXXX) | ||
| cp -R $ROOT $tmp_dir | ||
| trap "{{ cd ${{root_path}}; rm -rf $tmp_dir; }}" EXIT | ||
| rm -Rf $tmp_dir/%{workspace_name}/external/com_google_appengine_py | ||
| if [ -n "${{1-}}" ]; then | ||
| has_app_yaml=$(echo ${{@:2}} | grep -E "^([^ ]+ +)*app.yaml") | ||
| other_mod_cfgs=$(echo ${{@:2}} | xargs printf "%s\n" | grep -v "^app\.yaml$" | xargs echo) | ||
| ROOT="$PWD" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
| tmp_dir="$(mktemp -d "${TMPDIR:-/tmp}/war.XXXXXXXX")" | ||
| cp -R "$ROOT" "$tmp_dir" | ||
| trap "{ cd "$ROOT"; rm -rf "$tmp_dir"; }}" EXIT | ||
| rm -Rf "$tmp_dir/%{workspace_name}/external/com_google_appengine_py" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: lowercase |
||
| if [ -n "${1-}" ]; then | ||
| has_app_yaml="$(echo "${@:2}" | grep -E "^([^ ]+ +)*app.yaml")" | ||
| other_mod_cfgs="$(echo "${@:2}" | xargs printf "%s\n" | grep -v "^app\.yaml$" | xargs echo)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optional: Some of this code is brittle against paths with spaces in them, but users probably shouldn't be using those anyway. If you really care, there's probably a way to do all this in just bash. Maybe something like: has_app_yaml=false
other_mod_cfgs=()
for p in "${@:2}"; do
if [[ "$p" == "app.yaml" ]]; then
has_app_yaml=true
else
modules+=("$p")
fi
doneAnd then you can use |
||
| ret_code=0 | ||
| # Secondary modules need to be uploaded first because if any of them are | ||
| # referenced in dispatch.yaml, App Engine must have a version of that module | ||
| # prior to the app.yaml upload. | ||
| if [ -n "$other_mod_cfgs" ]; then | ||
| (cd $tmp_dir/%{workspace_name} && $ROOT/%{appcfg} -A "$1" update $other_mod_cfgs) | ||
| ret_code=$? | ||
| (cd "$tmp_dir/%{workspace_name}" && "$ROOT/%{appcfg}" -A "$1" update "$other_mod_cfgs") | ||
| ret_code="$?" | ||
| fi | ||
| if [ $ret_code -eq 0 ] && [ -n "$has_app_yaml" ] || [ -z "$other_mod_cfgs" ]; then | ||
| $ROOT/%{appcfg} -A "$1" update $tmp_dir/%{workspace_name} | ||
| ret_code=$? | ||
| if [ "$ret_code" -eq 0 ] && [ -n "$has_app_yaml" ] || [ -z "$other_mod_cfgs" ]; then | ||
| "$ROOT/%{appcfg}" -A "$1" update "$tmp_dir/%{workspace_name}" | ||
| ret_code="$?" | ||
| fi | ||
|
|
||
| else | ||
| echo "\033[1;31mERROR:\033[0m Application ID must be provided as first argument | ||
| echo -e "\033[1;31mERROR:\033[0m Application ID must be provided as first argument | ||
| USAGE: bazel run path/to/my/gae_binary_target.deploy -- my-project-id [module.yaml files ...]" | ||
| ret_code=-1 | ||
| fi | ||
|
|
||
| rm -Rf $tmp_dir | ||
| trap - EXIT | ||
|
|
||
| exit $ret_code | ||
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.
I don't think quotes are needed for the right-hand side of assignments. Also, this could be simplified to
root_path=$PWD, right?