aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2016-08-17 15:04:28 +0300
committerVaadin Code Review <review@vaadin.com>2016-08-18 08:24:55 +0000
commit7f80616bec4874b70e6fc5245925d7ca0b0cfd98 (patch)
tree8c5a3958c6c2baab424eb617b6c3c3f263e2a879 /scripts
parent78c6ab1852f18b142390b8852e5c10e1f017dd8f (diff)
downloadvaadin-framework-7f80616bec4874b70e6fc5245925d7ca0b0cfd98.tar.gz
vaadin-framework-7f80616bec4874b70e6fc5245925d7ca0b0cfd98.zip
Scripts for removing trailing whitespace
Change-Id: I938c57509bf6be34ee8a6f22edd7f8e0a43ee3bd
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cleanWhitespace.sh14
-rw-r--r--scripts/sed.sh15
2 files changed, 29 insertions, 0 deletions
diff --git a/scripts/cleanWhitespace.sh b/scripts/cleanWhitespace.sh
new file mode 100755
index 0000000000..43d717ced0
--- /dev/null
+++ b/scripts/cleanWhitespace.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+. `dirname $0`/sed.sh
+
+rootdir=`dirname $0`/..
+
+for javaFile in `find $rootdir -name "*.java"`
+do
+ # Remove whitespace from empty rows
+ $SED -i "s/^ [ ]*$//g" $javaFile
+
+ # Remove trailing whitespace in javadoc
+ $SED -i "s/^ \\([ ]*\\)\* $/\\1 \*/g" $javaFile
+done
diff --git a/scripts/sed.sh b/scripts/sed.sh
new file mode 100644
index 0000000000..99aa640b0f
--- /dev/null
+++ b/scripts/sed.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Must use gsed on Mac
+if [[ "$OSTYPE" == "darwin"* ]]
+then
+ export SED=`which gsed`
+else
+ export SED=`which sed`
+fi
+
+if [ ! -x "$SED" ]
+then
+ echo "Sed not found, install gsed on Mac or sed on Linux"
+ exit 1
+fi