Browse Source

Scripts for removing trailing whitespace

Change-Id: I938c57509bf6be34ee8a6f22edd7f8e0a43ee3bd
tags/8.0.0.alpha1
Artur Signell 7 years ago
parent
commit
7f80616bec
2 changed files with 29 additions and 0 deletions
  1. 14
    0
      scripts/cleanWhitespace.sh
  2. 15
    0
      scripts/sed.sh

+ 14
- 0
scripts/cleanWhitespace.sh View File

@@ -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

+ 15
- 0
scripts/sed.sh View File

@@ -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

Loading…
Cancel
Save