Ben Clayton | 02e15b2 | 2020-03-26 20:19:56 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # update-spirvtools merges the latest changes from |
| 4 | # the github.com/KhronosGroup/SPIRV-Tools into third_party/SPIRV-Tools. |
| 5 | # This script copies the change descriptions from the squash change into the |
| 6 | # top merge change, along with a standardized description. |
| 7 | REASON=$1 |
| 8 | |
| 9 | if [ ! -z "$REASON" ]; then |
| 10 | REASON="\n$REASON\n" |
| 11 | fi |
| 12 | |
| 13 | THIRD_PARTY_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )" |
| 14 | |
| 15 | GIT_RESULT=`git subtree pull --prefix third_party/SPIRV-Tools https://github.com/KhronosGroup/SPIRV-Tools master --squash -m "Update SPIR-V Tools"` |
| 16 | if [[ $GIT_RESULT == *"CONFLICT"* ]]; then |
| 17 | echo "subtree pull resulted in conflicts. Atempting to automatically resolve..." |
| 18 | # CONFLICT is very likely due to Android.mk being deleted in our third_party. |
| 19 | # Delete it, and try to continue. |
| 20 | git rm ${THIRD_PARTY_DIR}/SPIRV-Tools/Android.mk |
| 21 | git -c core.editor=true merge --continue # '-c core.editor=true' prevents the editor from showing |
| 22 | if [ $? -ne 0 ]; then |
| 23 | echo "Could not automatically resolve conflicts." |
| 24 | exit 1 |
| 25 | fi |
| 26 | fi |
| 27 | |
| 28 | |
| 29 | ALL_CHANGES=`git log -n 1 HEAD^2 | egrep '^(\s{4}[0-9a-f]{9}\s*.*)$'` |
| 30 | HEAD_CHANGE=`echo "$ALL_CHANGES" | egrep '[0-9a-f]{9}' -o -m 1` |
| 31 | LOG_MSG=`echo -e "Update SPIR-V Tools to $HEAD_CHANGE\n${REASON}\nChanges:\n$ALL_CHANGES\n\nCommands:\n ./third_party/update-spirvtools.sh\n\nBug: b/123642959"` |
| 32 | git commit --amend -m "$LOG_MSG" |