summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-11-07 18:38:01 +0100
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-11-15 10:07:47 -0800
commit223a95a74fe4a67b97520a4d8ab6383114aa8abd (patch)
tree4427c03f1654682cd6c1a01d27f4456918611630 /scripts
parentc78c97f346989524b84f90c4c72049f84d5346af (diff)
downloadqtlocation-mapboxgl-223a95a74fe4a67b97520a4d8ab6383114aa8abd.tar.gz
[build] add binary size logging to Linux Release builds
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/log_binary_size.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/log_binary_size.sh b/scripts/log_binary_size.sh
new file mode 100755
index 0000000000..45840174e9
--- /dev/null
+++ b/scripts/log_binary_size.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+function filesize {
+ if [ `uname -s` = 'Darwin' ]; then
+ stat -f%z $1
+ else
+ stat --printf=%s $1
+ fi
+}
+
+# Uploads build metrics to CloudWatch
+FILE=$1
+DIMENSIONS=$2
+
+if [ -z "${DIMENSIONS}" ]; then
+ echo "* No dimensions specified for '${FILE}'"
+ exit 1
+fi
+
+if [ -f "${FILE}" ]; then
+ SIZE=`filesize ${FILE}`
+ echo "* Reporting `LC_NUMERIC=en_US printf "%'10.f\n" ${SIZE}` bytes for '${DIMENSIONS}' (${FILE})"
+ if [ ${CLOUDWATCH} ]; then
+ aws --region us-east-1 cloudwatch put-metric-data \
+ --namespace "Mapbox/GL" \
+ --metric-name "BinarySize" \
+ --unit "Bytes" \
+ --value ${SIZE} \
+ --dimensions "${DIMENSIONS}"
+ fi
+else
+ echo "* File '${FILE}' does not exist"
+ exit 1
+fi