summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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