create-size-graph.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. set -eu
  3. OUTPUT="$(pwd)/sizes.csv"
  4. echo "Tag;Date;Parser;Generator" > $OUTPUT
  5. cd $(dirname $(dirname $0))
  6. git tag | while read TAG
  7. do
  8. git checkout -q tags/$TAG
  9. DATE=$(git log -1 --date=short --pretty=format:%cd)
  10. PARSER_SIZE=$(arduino --verify examples/JsonParserExample/JsonParserExample.ino 2>/dev/null | grep -e 'Sketch uses' | sed 's/.*uses \([0-9]*\).\([0-9]\+\).*/\1\2/')
  11. if [ -e 'examples/JsonGeneratorExample/JsonGeneratorExample.ino' ]; then
  12. GENERATOR_SIZE=$(arduino --verify examples/JsonGeneratorExample/JsonGeneratorExample.ino 2>/dev/null | grep -e 'Sketch uses' | sed 's/.*uses \([0-9]*\).\([0-9]\+\).*/\1\2/')
  13. else
  14. GENERATOR_SIZE=""
  15. fi
  16. echo $TAG
  17. if [ ! -z "$PARSER_SIZE" ]
  18. then
  19. echo "JsonParserExample = $PARSER_SIZE bytes"
  20. else
  21. echo "JsonParserExample compilation failed."
  22. fi
  23. if [ ! -z "$GENERATOR_SIZE" ]
  24. then
  25. echo "JsonGeneratorExample = $GENERATOR_SIZE bytes"
  26. else
  27. echo "JsonGeneratorExample compilation failed."
  28. fi
  29. echo "$TAG;$DATE;$PARSER_SIZE;$GENERATOR_SIZE" >> $OUTPUT
  30. done