Add the core connectivity tools directory and a first tool
The first tool is useful to check style manually for repos
where the check can't be enforced automatically yet.
Test: ran this
Change-Id: Ic67daa5df2d60d25e6f48e3d614b5b8cc9bd2210
diff --git a/tools/core_connectivity/check_style.sh b/tools/core_connectivity/check_style.sh
new file mode 100755
index 0000000..29614e0
--- /dev/null
+++ b/tools/core_connectivity/check_style.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+#VERSION=1
+
+SELFNAME=$0
+
+function getAbsolutePath() {
+ readlink -e $1
+}
+
+function printUsage() {
+ echo " $SELFNAME check coding style for HEAD in this git"
+ echo " $SELFNAME -h show this message"
+}
+
+function main() {
+ test "$1" == "-h" && printUsage && exit
+ test "$ANDROID_BUILD_TOP" == "" && echo "please run env setup" && exit
+ GITROOTDIR=`git rev-parse --show-toplevel`
+ test "$GITROOTDIR" == "" && echo "not inside a git repository" && exit
+ MODIFIED=`git status -s --untracked-files=no | wc -l`
+ test $MODIFIED -ne 0 && echo "please commit first" && exit
+
+ cd $GITROOTDIR
+
+ #basic check
+ local PARAMS=" --config_xml $ANDROID_BUILD_TOP/prebuilts/checkstyle/android-style.xml"
+ $ANDROID_BUILD_TOP/prebuilts/checkstyle/checkstyle.py $PARAMS
+
+ #commit message equal or less then 65 char for each line (suggested by lorenzo@20180625)
+ local MSG=`git rev-list --format=%B --max-count=1 HEAD`
+ local i=1
+ while read -r line; do
+ test `echo $line | wc -c` -gt 65 && echo "FAILED: Line $i exceed 65 chars limit: $line"
+ i=$((i+1))
+ done < <(echo "$MSG")
+
+ cd -
+}
+
+main $*