#!/bin/bash # This script is to be used in .travis.yaml from the project root directory, do not use it from somewhere else. set -e # Read arguments while [[ "$@" ]]; do case "$1" in '--format') CHECK_FORMAT=1 shift ;; '--install') MAKE_INSTALL=1 shift ;; '--package') MAKE_PACKAGE=1 shift if [[ $1 != -* ]]; then PACKAGE_NAME="$1" shift fi ;; '--server') MAKE_SERVER=1 shift ;; '--test') MAKE_TEST=1 shift ;; '--debug') BUILDTYPE="Debug" shift ;; '--release') BUILDTYPE="Release" shift ;; *) if [[ $1 == -* ]]; then echo "unrecognized option: $1" exit 3 fi BUILDTYPE="$1" shift ;; esac done # Check formatting using clang-format if [[ $CHECK_FORMAT ]]; then echo "Checking your code using clang-format..." if ! diff="$(./clangify.sh --diff --cf-version)"; then [[ $? == 1 ]] && cat <&2 exit 1 fi mv "$path/$file" "$path/${file%%.*}-$PACKAGE_NAME.${file#*.}" fi fi