Skip to content

Instantly share code, notes, and snippets.

@rrika
Created March 31, 2017 06:14
Show Gist options
  • Save rrika/6b0948a4b7310e1ef39143364aa44c07 to your computer and use it in GitHub Desktop.
Save rrika/6b0948a4b7310e1ef39143364aa44c07 to your computer and use it in GitHub Desktop.
while ! ./_/build.sh 2> _/build.log; do
if [[ $(grep "No such file or directory" _/build.log) =~ .*error..(.*)..No.such.* ]]; then
missing=${BASH_REMATCH[1]}
echo "Adding file" $missing
mkdir -p $(dirname _missing/$missing)
touch _missing/$missing
elif [[ $(grep "was not declared in this scope" _/build.log) =~ .*error..‘([A-Z0-9_]*)’.was.not.* ]]; then
missing=${BASH_REMATCH[1]}
echo "Adding constant" $missing
echo "#define $missing $(wc -l < _missing/constants.h)" >> _missing/constants.h
elif [[ $(grep "does not name a type" _/build.log) =~ .*error..‘(.*)’.does.not.* ]]; then
missing=${BASH_REMATCH[1]}
echo "Adding struct" $missing
echo "struct $missing {};" >> _missing/structs.h
elif [[ $(grep "use of enum" _/build.log) =~ .*enum.‘(.*)’.without.* ]]; then
missing=${BASH_REMATCH[1]}
echo "Adding enum" $missing
echo "enum $missing {};" >> _missing/enums.h
else
echo "Can't continue"
exit 0
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment