diff --git a/pmd/bin/cpd.sh b/pmd/bin/cpd.sh index 8e78e93d7b..eec53e3a06 100644 --- a/pmd/bin/cpd.sh +++ b/pmd/bin/cpd.sh @@ -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 diff --git a/pmd/bin/designer.sh b/pmd/bin/designer.sh old mode 100755 new mode 100644 index fccbb65859..076007e338 --- a/pmd/bin/designer.sh +++ b/pmd/bin/designer.sh @@ -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 diff --git a/pmd/bin/pmd.sh b/pmd/bin/pmd.sh old mode 100755 new mode 100644 index 63fc814f9e..67006ade61 --- a/pmd/bin/pmd.sh +++ b/pmd/bin/pmd.sh @@ -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 diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index 56bb4912e4..c01f194bce 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -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: diff --git a/pmd/java14/bin/cpd.sh b/pmd/java14/bin/cpd.sh index 1ee8a28833..c64031f70f 100644 --- a/pmd/java14/bin/cpd.sh +++ b/pmd/java14/bin/cpd.sh @@ -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 diff --git a/pmd/java14/bin/designer.sh b/pmd/java14/bin/designer.sh index a3b2b5151c..dfa9f548c2 100644 --- a/pmd/java14/bin/designer.sh +++ b/pmd/java14/bin/designer.sh @@ -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 diff --git a/pmd/java14/bin/pmd.sh b/pmd/java14/bin/pmd.sh index 159f9c4498..44d2af51ff 100644 --- a/pmd/java14/bin/pmd.sh +++ b/pmd/java14/bin/pmd.sh @@ -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