]> source.dussan.org Git - vaadin-framework.git/commitdiff
Script for formatting the project using Eclipse
authorArtur Signell <artur@vaadin.com>
Mon, 29 Dec 2014 12:04:45 +0000 (14:04 +0200)
committerVaadin Code Review <review@vaadin.com>
Tue, 30 Dec 2014 10:28:10 +0000 (10:28 +0000)
Change-Id: I9c4f210e29d14db29ea75b172f9b017f91b8bc7c

scripts/format.sh [new file with mode: 0755]

diff --git a/scripts/format.sh b/scripts/format.sh
new file mode 100755 (executable)
index 0000000..540a356
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Find eclipse binary
+if [ "$ECLIPSE" = "" ]
+then
+       ECLIPSE=`which eclipse`
+fi
+
+if [ "$ECLIPSE" = "" ]
+then
+       echo "Could not find 'eclipse' in PATH"
+       echo "Either add it to the PATH or set the ECLIPSE variable to point to the Eclipse binary"
+       echo "e.g. ECLIPSE=\"/some/where/eclipse\" $0"
+       exit 1
+fi
+
+# Resolve project root directory
+basedir=`dirname $0`/..
+pushd "$basedir" > /dev/null
+basedir=`pwd`
+popd > /dev/null
+
+SRC=`ls -d $basedir/*/src $basedir/*/tests/src`
+
+# Use project formatting settings
+config="$basedir/.settings/org.eclipse.jdt.core.prefs"
+
+"$ECLIPSE" -nosplash -application org.eclipse.jdt.core.JavaCodeFormatter -config "$config" $SRC