2018-05-23 12:49:08 +10:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# This test checks that all source files correctly have license headers
|
|
|
|
|
|
|
|
INCLUDE_EXTENSIONS="h|cpp|hpp|py|c"
|
2018-06-04 09:36:05 +10:00
|
|
|
EXCLUDE_LIST="(.*\\/(qtermwidget)\\/|.*\\/(auto_additions)\\/|ui_defaults\\.h|qgspluginmanager_texts\\.cpp|src\\/analysis\\/vector\\/mersenne-twister\\.|^[^.]*$|.*\\.(?!($INCLUDE_EXTENSIONS)$))"
|
2018-06-04 09:21:55 +10:00
|
|
|
LICENSE_CHECK="external/licensecheck/licensecheck.pl"
|
2018-05-23 12:49:08 +10:00
|
|
|
|
|
|
|
DIR=$(git rev-parse --show-toplevel)
|
|
|
|
|
2018-06-04 09:36:05 +10:00
|
|
|
pushd "${DIR}" > /dev/null || exit
|
2018-06-04 09:21:55 +10:00
|
|
|
missing=$(! { "$LICENSE_CHECK" -r -i "$EXCLUDE_LIST" src & "$LICENSE_CHECK" -r -i "$EXCLUDE_LIST" python; } | grep UNKNOWN)
|
2018-05-23 12:49:08 +10:00
|
|
|
|
2018-06-04 09:36:05 +10:00
|
|
|
popd > /dev/null || exit
|
2018-05-23 12:49:08 +10:00
|
|
|
|
|
|
|
if [[ $missing ]]; then
|
|
|
|
echo " *** Found source files without valid license headers"
|
|
|
|
echo "$missing"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|