forked from phoedos/pmd
Nicer version cpd.sh from Jarkko
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4345 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -3,10 +3,14 @@
|
||||
## This will work in the majority of shells out there...
|
||||
|
||||
## This will parse a directory named on the command line and produce a
|
||||
## cut and paste report for c++ files in that directory.
|
||||
## cut and paste report for c++ files in that directory (or 'c', if you
|
||||
## set the environment variable LANGUAGE to 'c').
|
||||
|
||||
## Note that other rules are only for Java code not C source.
|
||||
|
||||
## If you run into java.lang.OutOfMemoryError, try setting the environment
|
||||
## variable HEAPSIZE to e.g. 512m
|
||||
|
||||
DIRECTORY=$1
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@ -39,10 +43,23 @@ for jarfile in `ls $LIB_DIR/*.jar`; do
|
||||
classpath=$classpath:$jarfile
|
||||
done
|
||||
|
||||
HEAPSIZE=${HEAPSIZE:-512m}
|
||||
LANGUAGE=${LANGUAGE:-cpp}
|
||||
MINIMUM_TOKENS=${MINIMUM_TOKENS:-100}
|
||||
|
||||
MINIMUM_SIZE=100
|
||||
LANGUAGE=cpp
|
||||
case "$HEAPSIZE" in
|
||||
[1-9]*[mgMG]) HEAPSIZE=-Xmx$HEAPSIZE ;;
|
||||
'') ;;
|
||||
*) echo "HEAPSIZE '$HEAPSIZE' unknown (try: 512m)"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
case "$LANGUAGE" in
|
||||
cpp|c) ;;
|
||||
*) echo "Language '$LANGUAGE' unknown (try: cpp, c)"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
# echo "CLASSPATH: $classpath"
|
||||
|
||||
java -cp $classpath net.sourceforge.pmd.cpd.CPD --minimum-tokens $MINIMUM_SIZE --files $DIRECTORY --language $LANGUAGE
|
||||
java $HEAPSIZE -cp $classpath net.sourceforge.pmd.cpd.CPD --minimum-tokens $MINIMUM_TOKENS --files $DIRECTORY --language $LANGUAGE
|
||||
|
Reference in New Issue
Block a user