standard unix scripts can be used with cygwin

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@5995 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2008-04-08 23:55:58 +00:00
parent e4fa5f88fe
commit e659268f29
7 changed files with 122 additions and 0 deletions

View File

@ -20,6 +20,11 @@ if [ -z "$1" ]; then
exit 1
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
@ -27,6 +32,14 @@ CWD="$PWD"
cd "$SCRIPT_DIR/../lib"
LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
build_dir="$SCRIPT_DIR/../build"
@ -62,4 +75,11 @@ esac
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
classpath=`cygpath --path --windows "$classpath"`
DIRECTORY=`cygpath --windows "$DIRECTORY"`
fi
java $HEAPSIZE -cp $classpath net.sourceforge.pmd.cpd.CPD --minimum-tokens $MINIMUM_TOKENS --files $DIRECTORY --language $LANGUAGE

19
pmd/bin/designer.sh Executable file → Normal file
View File

@ -1,11 +1,25 @@
#!/bin/bash
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
cd "$SCRIPT_DIR/../lib"
LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
build_dir="$SCRIPT_DIR/../build"
@ -31,4 +45,9 @@ RULESETFILES="$@"
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
classpath=`cygpath --path --windows "$classpath"`
fi
java -cp $classpath net.sourceforge.pmd.util.designer.Designer

21
pmd/bin/pmd.sh Executable file → Normal file
View File

@ -7,12 +7,26 @@ if [ -z "$3" ]; then
exit 1
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
cd "$SCRIPT_DIR/../lib"
LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
build_dir="$SCRIPT_DIR/../build"
@ -38,4 +52,11 @@ RULESETFILES="$@"
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
classpath=`cygpath --path --windows "$classpath"`
FILE=`cygpath --windows "$FILE"`
fi
java -Xmx512m -cp $classpath net.sourceforge.pmd.PMD $FILE $FORMAT $RULESETFILES

View File

@ -8,6 +8,7 @@ Update RuleSetWriter to handle non-Apache TRAX implementations, add an option to
bin and java14/bin scripts:
retroweaver version was not correct in java14/bin scripts
support for extra languages in cpd.sh
standard unix scripts can be used with cygwin
March 25, 2008 - 4.2:

View File

@ -24,6 +24,12 @@ fi
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
cd "$SCRIPT_DIR/../../lib"
LIB_DIR=`pwd -P`
@ -31,6 +37,14 @@ cd "$CWD"
cd "$SCRIPT_DIR/../lib"
RW_LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
for jarfile in `ls $RW_LIB_DIR/*.jar`; do
@ -70,4 +84,11 @@ esac
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
classpath=`cygpath --path --windows "$classpath"`
DIRECTORY=`cygpath --windows "$DIRECTORY"`
fi
java $HEAPSIZE -cp $classpath net.sourceforge.pmd.cpd.CPD --minimum-tokens $MINIMUM_TOKENS --files $DIRECTORY --language $LANGUAGE

View File

@ -1,5 +1,11 @@
#!/bin/bash
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
@ -10,6 +16,14 @@ cd "$CWD"
cd "$SCRIPT_DIR/../lib"
RW_LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
for jarfile in `ls $RW_LIB_DIR/*.jar`; do
@ -39,4 +53,9 @@ RULESETFILES="$@"
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
classpath=`cygpath --path --windows "$classpath"`
fi
java -cp $classpath net.sourceforge.pmd.util.designer.Designer

View File

@ -7,6 +7,12 @@ if [ -z "$3" ]; then
exit 1
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
esac
SCRIPT_DIR=`dirname $0`
CWD="$PWD"
@ -17,6 +23,14 @@ cd "$CWD"
cd "$SCRIPT_DIR/../lib"
RW_LIB_DIR=`pwd -P`
# If cygwin, convert to Unix form before manipulating
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
classpath=$CLASSPATH
for jarfile in `ls $RW_LIB_DIR/*.jar`; do
@ -46,4 +60,11 @@ RULESETFILES="$@"
# echo "CLASSPATH: $classpath"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
classpath=`cygpath --path --windows "$classpath"`
FILE=`cygpath --windows "$FILE"`
fi
java -Xmx512m -cp $classpath net.sourceforge.pmd.PMD $FILE $FORMAT $RULESETFILES