IDEA-135641 fixed & bundled Groovy update & Gant update

This commit is contained in:
Daniil Ovchinnikov
2015-02-09 16:53:46 +03:00
parent 12ed379ede
commit 3a6173e785
16 changed files with 195 additions and 371 deletions
+50 -26
View File
@@ -1,27 +1,30 @@
Gant -- A Groovy way of scripting Ant tasks.
This is Gant, a Groovy way of working with Ant tasks -- no more XML :-)
The method of installation depends on whether you have downloaded a tarball or
zipfile distribution, or you have a Bazaar branch -- or a Subversion checkout,
or even a Git clone -- of the source.
zipfile distribution, or you have a Git clone -- or even a Bazaar branch -- of
the source.
Distribution
------------
The Gant distributions contain a ready-made install directory hierarchy.
Untar the tarball or unzip the zipfile to the location where you want the Gant
installation to reside. A directory with the name structured
installation to reside. A directory with the name structured
gant-<gant-version-number> will be created in the location specified for the
untar or unzip.
There are a number of distinct distributions:
1. Requires a separate Groovy installation. There are builds:
a. compiled against Groovy 1.6.7; and
b. compiled against Groovy 1.7-rc-2.
1. Requires a separate Groovy installation. There are builds:
a. compiled against Groovy 1.7.10; and
b. compiled against Groovy 1.8.6; and
c. compiled against Groovy 2.0.0-beta-2
2. Self-contained, includes all dependent jars.
2. Self-contained, includes all dependent jars.
You might like to set up an environment variable GANT_HOME set to the
directory created by the untar or unzip, though this is not essential, it is
@@ -30,33 +33,31 @@ just an efficiency.
The script $GANT_HOME/bin/gant for systems with a Posix shell, or
$GANT_HOME/bin/gant.bat on Windows is the mechanism for launching a Gant run.
Distributions 1a and 1b only include the direct Gant materials. The Maven
Distributions 1a, 1b and 1c only include the direct Gant materials. The Maven
target set depends on use of the Maven Ant tasks, and the Ivy tool depends on
the Ivy jar, these will have to be downloaded and installed into
$GANT_HOME/lib unless they are already available on on your CLASSPATH.
Using a Bazaar Branch
---------------------
You first need to get a source tree. Bazaar is the version control system
used for developing Gant. For reasons that are unlikely to become apparent
quickly, the master branch is actually held in the Subversion repository at
Codehaus. However the effective mainline is a branch on Launchpad. So to get
a branch:
Using a Git Clone
-----------------
bzr branch lp:gant Gant_Trunk
Gant's mainline is a Git repository on GitHub, see
or
https://github.com/Gant/Gant
bzr branch http://svn.codehaus.org/gant/gant/trunk Gant_Trunk
you should fork this on GitHub and then clone to give you a local repository.
(If you are going to actively develop Gant, you almost certainly want to have
a shared repository in which this mirror branch is kept so that you can then
make feature branches from it.)
The repository on Codehaus at:
git://git.codehaus.org/gant.git
is an administrative clone of the GitHub mainline and should not be used in
normal circumstances.
Gradle is used as the build system for Gant, so you will need to set the
gant_installPath property in ~/.gradle/gradle.properties so you can install
Gant. So for example:
Gant. So for example:
gant_installPath = ${System.properties.'user.home'}/lib/JavaPackages/gant-trunk
@@ -64,22 +65,45 @@ Then you type:
./gradlew :gant:install
and all the necessary magic happens. The first time you use the Gradle
and all the necessary magic happens. The first time you use the Gradle
Wrapper, it will connect to the Internet to download the various jars that
comprise Gradle. This takes a while. However this is only needed the first
comprise Gradle. This takes a while. However this is only needed the first
time, thereafter it uses the version you downloaded.
You probably want to set the GROOVY_HOME environment variable to point at the
Groovy installation that the Gant installation is to work with.
Using a Bazaar Branch
---------------------
For anyone prefering to use Bazaar rather than Git, there is an automated
bridge of the master branch of the Git clone on Launchpad.
To get a branch:
bzr branch lp:gant Gant
or if you want to use bzr-git directly:
bzr branch git://github.com/Gant/Gant.git Gant
(If you are going to actively develop Gant, you almost certainly want to have
a shared repository in which this mirror branch is kept so that you can then
make feature branches from it.)
All the information in the previous section about Gradle and building Gant
apply when using Bazaar.
Contact
-------
If you have any problems using Gant, or have any ideas for improvements,
please make use of the Gant users mailing list: user@gant.codehaus.org
Russel Winder <russel.winder@concertant.com>
Russel Winder <russel@winder.org.uk>
;;; Local Variables: ***
;;; fill-column: 78 ***
+20 -12
View File
@@ -2,7 +2,7 @@
# Gant -- A Groovy way of scripting Ant tasks.
#
# Copyright © 2006-9 Russel Winder
# Copyright © 2006–2010, 2013 Russel Winder
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
@@ -14,12 +14,9 @@
# implied. See the License for the specific language governing permissions and limitations under the
# License.
#
# Author : Russel Winder <russel.winder@concertant.com>
# Author : Russel Winder <russel@winder.org.uk>
# Gant initiation script for Linux and UNIX -- stand alone version.
# This version does not require a GROOVY_HOME to be set since it has all the necessary jars in the
# $GANT_HOME/lib directory.
# Gant initiation script for Linux and UNIX -- requires Groovy version.
# Solaris 10 does not have readlink as standard -- though some people will have the version from
# Sunfreeware which is the same as the version on Ubuntu, Cygwin, MSYS, etc. Mac OS X has a version of
@@ -27,9 +24,9 @@
#
# This function attempts to just do the right thing.
doReadLink ( ) {
doReadLink() {
case `uname` in
Darwin )
Darwin)
gantLocation=`dirname $1`
gantPath=`readlink "$1"`
if [ "$gantPath" = "" ]
@@ -46,7 +43,7 @@ doReadLink ( ) {
cd $currentDirectory
fi
;;
SunOS )
SunOS)
readlinkPath=`which readlink`
if [ `expr "$readlinkPath" : '\([^ ]*\)'` = "no" ]
then
@@ -56,7 +53,7 @@ doReadLink ( ) {
readlinkValue=`readlink -f $1`
fi
;;
* )
*)
readlinkValue=`readlink -f $1`
;;
esac
@@ -77,9 +74,20 @@ then
GANT_HOME=`dirname $GANT_HOME`
fi
# Force GROOVY_HOME to be GANT_HOME so that the startGroovy code does the right thing.
# If GROOVY_HOME is not set, deduce a path -- this is needed in order to discover the location of the
# startGroovy script. Assume the executable is in $GROOVY_HOME/bin.
GROOVY_HOME="$GANT_HOME"
if [ -z "$GROOVY_HOME" ]
then
GROOVY_HOME=`which groovy`
if [ -h $GROOVY_HOME ]
then
doReadLink $GROOVY_HOME GROOVY_HOME
GROOVY_HOME=$readlinkValue
fi
GROOVY_HOME=`dirname "$GROOVY_HOME"`
GROOVY_HOME=`dirname "$GROOVY_HOME"`
fi
# If ANT_HOME is not set, deduce a path -- this is needed in order to discover the location of the jars
# associated with the Ant installation. Assume the executable is in $ANT_HOME/bin.
+15 -7
View File
@@ -14,7 +14,7 @@
@rem implied. See the License for the specific language governing permissions and limitations under the
@rem License.
@rem
@rem Author : Russel Winder <russel.winder@concertant.com>
@rem Author : Russel Winder <russel@winder.org.uk>
@rem Gant initiation script for Windows.
@@ -27,12 +27,20 @@ if "%DIRNAME%" == "" set DIRNAME=.\
@rem If GANT_HOME is not set, deduce a path.
if not "%GANT_HOME%" == "" goto endSetGantHome
set GANT_HOME=%DIRNAME%..
set GANT_HOME="%DIRNAME%.."
:endSetGantHome
@rem Force GROOVY_HOME to be GANT_HOME so that the startGroovy code does the right thing.
@rem If GROOVY_HOME is not set, deduce a path -- this is needed in order to discover the location of the
@rem startGroovy script.
set GROOVY_HOME=%GANT_HOME%
if not "%GROOVY_HOME%" == "" goto endSetGroovyHome
for %%P in ( %PATH% ) do if exist %%P\groovy.exe set GROOVY_HOME=%%P\..
if not "%GROOVY_HOME%" == "" goto endSetGroovyHome
for %%P in ( %PATH% ) do if exist %%P\groovy.bat set GROOVY_HOME=%%P\..
if not "%GROOVY_HOME%" == "" goto endSetGroovyHome
call :environmentVariableError GROOVY_HOME
goto :EOF
:endSetGroovyHome
@rem If ANT_HOME is not set, deduce a path -- this is needed in order to discover the location of the jars
@rem asscoiated with the Ant installation.
@@ -46,15 +54,15 @@ if not "%ANT_HOME%" == "" goto endSetAntHome
set PROGNAME=gant.bat
set GROOVY_SCRIPT_NAME=gant.bat
set STARTER_CONF=%GANT_HOME%\conf\gant-starter.conf
set STARTER_CONF="%GANT_HOME%\conf\gant-starter.conf"
set JAVA_OPTS=%JAVA_OPTS% -Dgant.home="%GANT_HOME%" -Dant.home="%ANT_HOME%"
%GANT_HOME%\bin\startGroovy.bat %DIRNAME% gant.Gant lib %*
"%GANT_HOME%\bin\startGroovy.bat" "%DIRNAME%" gant.Gant %*
@rem End local scope for the variables with windows NT shell
if "%OS%" == "Windows_NT" endlocal
exit /B %ERRORLEVEL%
%COMSPEC% /C exit /B %ERRORLEVEL%
:environmentVariableError
echo.
-272
View File
@@ -1,272 +0,0 @@
# -*- mode:sh -*-
##############################################################################
## ##
## Groovy JVM Bootstrap for UN*X ##
## ##
##############################################################################
##
## $Revision$
## $Date$
##
PROGNAME=`basename "$0"`
#DIRNAME=`dirname "$0"`
SCRIPT_PATH="$0"
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "${PROGNAME}: $*"
}
die ( ) {
warn "$*"
exit 1
}
earlyInit ( ) {
return
}
lateInit ( ) {
return
}
GROOVY_STARTUP="$HOME/.groovy/startup"
if [ -r "$GROOVY_STARTUP" ] ; then
. "$GROOVY_STARTUP"
fi
earlyInit
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
if [ "$1" = "-cp" -o "$1" = "-classpath" ] ; then
CP=$2
shift 2
fi
# Attempt to set JAVA_HOME if it's not already set.
if [ -z "$JAVA_HOME" ] ; then
if $darwin ; then
[ -z "$JAVA_HOME" -a -d "/Library/Java/Home" ] && export JAVA_HOME="/Library/Java/Home"
[ -z "$JAVA_HOME" -a -d "/System/Library/Frameworks/JavaVM.framework/Home" ] && export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Home"
else
javaExecutable="`which javac`"
[ -z "$javaExecutable" -o "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ] && die "JAVA_HOME not set and cannot find javac to deduce location, please set JAVA_HOME."
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
[ `expr "$readLink" : '\([^ ]*\)'` = "no" ] && die "JAVA_HOME not set and readlink not available, please set JAVA_HOME."
javaExecutable="`readlink -f \"$javaExecutable\"`"
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$GROOVY_HOME" ] && GROOVY_HOME=`cygpath --unix "$GROOVY_HOME"`
[ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CP" ] && CP=`cygpath --path --unix "$CP"`
else
if [ -n "$GROOVY_HOME" -a `expr "$GROOVY_HOME":'\/$'` ] ; then
GROOVY_HOME=`echo $GROOVY_HOME | sed -e 's/\/$//'`
fi
fi
# For MSYS, ensure paths are in appropriate format.
if $msys
then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`( cd "$JAVA_HOME" ; pwd )`
fi
# Attempt to set GROOVY_HOME if it is not already set.
if [ -z "$GROOVY_HOME" -o ! -d "$GROOVY_HOME" ] ; then
# Resolve links: $0 may be a link to groovy's home.
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/.."
GROOVY_HOME="`pwd -P`"
cd "$SAVED"
fi
# Set the default Groovy config if no specific one is mentioned.
if [ -z "$GROOVY_CONF" ] ; then
GROOVY_CONF="$GROOVY_HOME/conf/groovy-starter.conf"
fi
STARTER_CLASSPATH="$GROOVY_HOME/lib/groovy-all-2.2.1.jar"
# Create the final classpath. Setting a classpath using the -cp or -classpath option means not to use the
# global classpath. Groovy behaves then the same as the java interpreter
if [ -n "$CP" ] ; then
CP="$CP":.
elif [ -n "$CLASSPATH" ] ; then
CP="$CLASSPATH":.
else
CP=.
fi
# Determine the Java command to use to start the JVM.
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="java"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
die "JAVA_HOME is not defined correctly, can not execute: $JAVACMD"
fi
if [ -z "$JAVA_HOME" ] ; then
warn "JAVA_HOME environment variable is not set"
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query businessSystem maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# Setup Profiler
useprofiler=false
if [ "$PROFILER" != "" ] ; then
if [ -r "$PROFILER" ] ; then
. $PROFILER
useprofiler=true
else
die "Profiler file not found: $PROFILER"
fi
fi
# For Darwin, use classes.jar for TOOLS_JAR
TOOLS_JAR="$JAVA_HOME/lib/tools.jar"
#if $darwin; then
# TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar"
#fi
# For Darwin, add GROOVY_APP_NAME to the JAVA_OPTS as -Xdock:name
if $darwin; then
JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GROOVY_APP_NAME"
# we may also want to set -Xdock:image
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
GROOVY_HOME=`cygpath --mixed "$GROOVY_HOME"`
JAVA_HOME=`cygpath --mixed "$JAVA_HOME"`
GROOVY_CONF=`cygpath --mixed "$GROOVY_CONF"`
CP=`cygpath --path --mixed "$CP"`
TOOLS_JAR=`cygpath --mixed "$TOOLS_JAR"`
STARTER_CLASSPATH=`cygpath --path --mixed "$STARTER_CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GROOVY_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GROOVY_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
if [ $CHECK -ne 0 ] ; then
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
startGroovy ( ) {
CLASS=$1
shift
# Start the Profiler or the JVM
if $useprofiler ; then
runProfiler
else
exec "$JAVACMD" $JAVA_OPTS \
-classpath "$STARTER_CLASSPATH" \
-Dscript.name="$SCRIPT_PATH" \
-Dprogram.name="$PROGNAME" \
-Dgroovy.starter.conf="$GROOVY_CONF" \
-Dgroovy.home="$GROOVY_HOME" \
-Dtools.jar="$TOOLS_JAR" \
$STARTER_MAIN_CLASS \
--main $CLASS \
--conf "$GROOVY_CONF" \
--classpath "$CP" \
"$@"
fi
}
STARTER_MAIN_CLASS=org.codehaus.groovy.tools.GroovyStarter
lateInit
+30 -17
View File
@@ -10,7 +10,7 @@
@rem
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
if "%OS%"=="Windows_NT" setlocal enabledelayedexpansion
set DIRNAME=%~1
shift
@@ -18,9 +18,6 @@ shift
set CLASS=%~1
shift
set JARSPATH=%~1
shift
if exist "%USERPROFILE%/.groovy/preinit.bat" call "%USERPROFILE%/.groovy/preinit.bat"
@rem Determine the command interpreter to execute the "CD" later
@@ -36,7 +33,24 @@ if exist "%SystemRoot%\command\find.exe" set FIND_EXE="%SystemRoot%\command\find
:check_JAVA_HOME
@rem Make sure we have a valid JAVA_HOME
if not "%JAVA_HOME%" == "" goto have_JAVA_HOME
for %%P in (%PATH%) do if exist %%P\..\bin\java.exe set JAVA_HOME=%%P\..
set PATHTMP=%PATH%
:loop
for /f "delims=; tokens=1*" %%i in ("!PATHTMP!") do (
if exist "%%i\..\bin\java.exe" (
set "JAVA_HOME=%%i\.."
goto found_JAVA_HOME
)
set PATHTMP=%%j
goto loop
)
goto check_default_JAVA_EXE
:found_JAVA_HOME
@rem Remove trailing \bin\.. from JAVA_HOME
if "%JAVA_HOME:~-7%"=="\bin\.." SET "JAVA_HOME=%JAVA_HOME:~0,-7%"
set JAVA_EXE=%JAVA_HOME%\bin\java.exe
:check_default_JAVA_EXE
if not "%JAVA_HOME%" == "" goto valid_JAVA_HOME
java -version 2>NUL
if not ERRORLEVEL 1 goto default_JAVA_EXE
@@ -170,8 +184,8 @@ if "x1" == "x%_SKIP%" goto skip_1
rem now unescape -q, -s, -d
set _ARG=%_ARG:-s=*%
set _ARG=%_ARG:-d=-%
set _ARG=%_ARG:-q="%
set _ARG=%_ARG:-d=-%
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %_ARG%
set _ARG=
@@ -203,7 +217,7 @@ set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set STARTER_CLASSPATH=%GROOVY_HOME%\%JARSPATH%\groovy-all-2.2.1.jar;%STARTER_CLASSPATH%
set STARTER_CLASSPATH=%GROOVY_HOME%\lib\groovy-all-2.3.0.jar
if exist "%USERPROFILE%/.groovy/init.bat" call "%USERPROFILE%/.groovy/init.bat"
@@ -221,19 +235,19 @@ set CP=%CLASSPATH%;%CP%
:after_cp
set STARTER_MAIN_CLASS=org.codehaus.groovy.tools.GroovyStarter
if "%STARTER_CONF%" == "" set STARTER_CONF=%GROOVY_HOME%\conf\groovy-starter.conf
set STARTER_CONF=%GROOVY_HOME%\conf\groovy-starter.conf
if "%JAVA_OPTS%" == "" set JAVA_OPTS="-Xmx128m"
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name="%PROGNAME%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.home="%GROOVY_HOME%"
if not "%TOOLS_JAR%" == "" set JAVA_OPTS=%JAVA_OPTS% -Dtools.jar="%TOOLS_JAR%"
set JAVA_OPTS=%JAVA_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"
set JAVA_OPTS=%JAVA_OPTS% -Dscript.name="%GROOVY_SCRIPT_NAME%"
set GROOVY_OPTS="-Xmx128m"
set GROOVY_OPTS=%GROOVY_OPTS% -Dprogram.name="%PROGNAME%"
set GROOVY_OPTS=%GROOVY_OPTS% -Dgroovy.home="%GROOVY_HOME%"
if not "%TOOLS_JAR%" == "" set GROOVY_OPTS=%GROOVY_OPTS% -Dtools.jar="%TOOLS_JAR%"
set GROOVY_OPTS=%GROOVY_OPTS% -Dgroovy.starter.conf="%STARTER_CONF%"
set GROOVY_OPTS=%GROOVY_OPTS% -Dscript.name="%GROOVY_SCRIPT_NAME%"
if exist "%USERPROFILE%/.groovy/postinit.bat" call "%USERPROFILE%/.groovy/postinit.bat"
@rem Execute Groovy
"%JAVA_EXE%" %JAVA_OPTS% -classpath "%STARTER_CLASSPATH%" %STARTER_MAIN_CLASS% --main %CLASS% --conf "%STARTER_CONF%" --classpath "%CP%" %CMD_LINE_ARGS%
"%JAVA_EXE%" %GROOVY_OPTS% %JAVA_OPTS% -classpath "%STARTER_CLASSPATH%" %STARTER_MAIN_CLASS% --main %CLASS% --conf "%STARTER_CONF%" --classpath "%CP%" %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
@@ -241,5 +255,4 @@ if "%OS%"=="Windows_NT" endlocal
@rem Optional pause the batch file
if "%GROOVY_BATCH_PAUSE%" == "on" pause
exit /B %ERRORLEVEL%
%COMSPEC% /C exit /B %ERRORLEVEL%
+5 -5
View File
@@ -1,6 +1,6 @@
# Gant -- A Groovy way of scripting Ant tasks.
#
# Copyright © 2008 Russel Winder
# Copyright © 2008, 2010, 2013 Russel Winder
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
@@ -12,17 +12,17 @@
# implied. See the License for the specific language governing permissions and limitations under the
# License.
#
# Author : Russel Winder <russel.winder@concertant.com>
# Author : Russel Winder <russel@winder.org.uk>
# Load user specific libraries that are Gant specific.
load !{user.home}/.gant/lib/*.jar
# Load user specific libraries that are Ant specific.
load !{user.home}/.ant/lib/*.jar
# Load user specific libraries that are for Groovy.
load !{user.home}/.groovy/lib/*.jar
# Load required libraries
load !{gant.home}/lib/*.jar
Binary file not shown.
@@ -16,7 +16,7 @@
<orderEntry type="module-library" scope="PROVIDED">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../build/lib/gant/lib/gant_groovy2.1-1.9.10.jar!/" />
<root url="jar://$MODULE_DIR$/../../build/lib/gant/lib/gant-1.9.11_groovy-2.3.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -15,7 +15,7 @@ fluent-hc-4.3.6.jar
freemarker.jar
httpmime-4.3.6.jar
ecj-4.4.jar
groovy-all-2.2.1.jar
groovy-all-2.3.7.jar
gson-2.3.jar
guava-17.0.jar
hamcrest-core-1.3.jar
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTraitTypeDefinition;
import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.imports.GrImportStatement;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.ClosureSyntheticParameter;
@@ -122,14 +123,20 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
":\\\\d+\\\\), (\\\\1[A-Za-z0-9]{8}\\\\2\\\\(Unknown Source\\\\), $OR$.+(?:com$OR$org)\\\\.springsource\\\\.loaded\\\\.).+\")) {\n");
javaText.append(" |thiz0 = thiz;\n");
javaText.append(" } else {\n");
javaText.append(" |thiz0 = this;\n");
if (contextClass instanceof GrTraitTypeDefinition) {
javaText.append(" |thiz0 = $self;\n");
}
else {
javaText.append(" |thiz0 = this;\n");
}
javaText.append(" }\n");
}
if (!isStatic) {
javaText.append("|clazz = |thiz0.getClass();\n");
javaText.append("|mc = |thiz0.getMetaClass();\n");
} else {
}
else {
assert contextClass != null;
javaText.append("|clazz = java.lang.Class.forName(\"").append(ClassUtil.getJVMClassName(contextClass)).append("\");\n");
javaText.append("|mc = groovy.lang.GroovySystem.getMetaClassRegistry().getMetaClass(|clazz);\n");
@@ -151,24 +158,33 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
if (!isStatic) {
javaText.append("|closure.setDelegate(|thiz0);\n");
javaText.append("|emc.setProperty(\"").append(EVAL_NAME).append("\", |closure);\n");
} else {
}
else {
javaText.append("|emc.getProperty(\"static\").setProperty(\"").append(EVAL_NAME).append("\", |closure);\n");
}
javaText.append("|emc.initialize();\n");
javaText.append(unwrapVals(values));
if (!isStatic) {
javaText.append("java.lang.Object |res = ((groovy.lang.MetaClassImpl)|emc).invokeMethod(|thiz0, \"").append(EVAL_NAME).append("\", |resVals);\n");
} else {
javaText.append("java.lang.Object |res = ((groovy.lang.MetaClassImpl)|emc).invokeStaticMethod(|clazz, \"").append(EVAL_NAME).append("\", |resVals);\n");
javaText.append(
"java.lang.Object |res = ((groovy.lang.MetaClassImpl)|emc).invokeMethod(|thiz0, \""
).append(EVAL_NAME).append("\", |resVals);\n");
}
else {
javaText.append(
"java.lang.Object |res = ((groovy.lang.MetaClassImpl)|emc).invokeStaticMethod(|clazz, \""
).append(EVAL_NAME).append("\", |resVals);\n");
}
javaText.append("if (|res instanceof java.lang.Boolean) ((java.lang.Boolean) |res).booleanValue() else |res");
final PsiElementFactory factory = JavaPsiFacade.getInstance(toEval.getProject()).getElementFactory();
String hiddenJavaVars = StringUtil.replace(javaText.toString(), "|", "_$_" + new Random().nextInt(42));
hiddenJavaVars = hiddenJavaVars.replaceAll("\\$OR\\$", "|");
final String finalText = StringUtil.replace(StringUtil.replace(hiddenJavaVars, TEXT, groovyText), IMPORTS, textWithImports.getImports());
JavaCodeFragment result = JavaCodeFragmentFactory.getInstance(project).createCodeBlockCodeFragment(finalText, null, true);
final String hiddenJavaVars = StringUtil.replace(
javaText.toString(), "|", "_$_" + new Random().nextInt(42)
).replaceAll("\\$OR\\$", "|");
final String finalText = StringUtil.replace(
StringUtil.replace(hiddenJavaVars, TEXT, groovyText), IMPORTS, textWithImports.getImports()
);
final JavaCodeFragment result = JavaCodeFragmentFactory.getInstance(project).createCodeBlockCodeFragment(finalText, null, true);
if (contextClass != null) {
result.setThisType(factory.createType(contextClass));
}
@@ -193,7 +209,8 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
}
PsiElement resolved = referenceExpression.resolve();
if (resolved instanceof PsiMember && (resolved instanceof PsiClass || ((PsiMember)resolved).hasModifierProperty(PsiModifier.STATIC))) {
if (resolved instanceof PsiMember
&& (resolved instanceof PsiClass || ((PsiMember)resolved).hasModifierProperty(PsiModifier.STATIC))) {
String qName = com.intellij.psi.util.PsiUtil.getMemberQualifiedName((PsiMember)resolved);
if (qName != null && qName.contains(".") && !referenceExpression.isQualified()) {
replaceWithReference(referenceExpression, qName);
@@ -208,7 +225,8 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
if (resolved instanceof GrVariable && !(resolved instanceof GrField) && !PsiTreeUtil.isAncestor(toEval, resolved, false)) {
final String name = ((GrVariable)resolved).getName();
if (resolved instanceof ClosureSyntheticParameter && PsiTreeUtil.isAncestor(toEval, ((ClosureSyntheticParameter) resolved).getClosure(), false)) {
if (resolved instanceof ClosureSyntheticParameter
&& PsiTreeUtil.isAncestor(toEval, ((ClosureSyntheticParameter)resolved).getClosure(), false)) {
return;
}
@@ -223,12 +241,12 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
// Evaluating inside closure for outer variable definitions
// All non-local variables are accessed by references
value = "this." + name;
} else {
}
else {
value = name;
}
parameters.put(name, value);
}
}
private boolean shouldDelegate(GrReferenceExpression referenceExpression, @Nullable PsiElement resolved) {
@@ -240,7 +258,7 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
return true;
}
if (resolved instanceof PsiMethod && !referenceExpression.isQualified()) {
if (resolved instanceof PsiMethod) {
String methodName = ((PsiMethod)resolved).getName();
if (closure != null && "getDelegate".equals(methodName) || "call".equals(methodName)) {
return true;
@@ -275,7 +293,7 @@ public class GroovyCodeFragmentFactory extends CodeFragmentFactory {
for (GrExpression expression : replacements.keySet()) {
expression.replaceWithExpression(factory.createExpressionFromText(replacements.get(expression)), false);
}
return Pair.create(parameters, toEval);
}
@@ -14,6 +14,7 @@
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.compiler
import com.intellij.debugger.DebuggerManagerEx
import com.intellij.debugger.SourcePosition
import com.intellij.debugger.engine.ContextUtil
@@ -55,6 +56,7 @@ import com.intellij.util.ExceptionUtil
import com.intellij.util.SystemProperties
import com.intellij.util.concurrency.Semaphore
import org.jetbrains.annotations.NotNull
/**
* @author peter
*/
@@ -93,7 +95,7 @@ class GroovyDebuggerTest extends GroovyCompilerTestCase {
def configuration = createScriptConfiguration(script.virtualFile.path, myModule)
edt {
ProgramRunner runner = ProgramRunner.PROGRAM_RUNNER_EP.extensions.find { it.class == GenericDebuggerRunner }
def listener = [onTextAvailable: { ProcessEvent evt, type -> /*println evt.text*/}] as ProcessAdapter
def listener = [onTextAvailable: { ProcessEvent evt, type -> /*println evt.text*/ }] as ProcessAdapter
runConfiguration(DefaultDebugExecutor, listener, runner, configuration);
}
try {
@@ -105,7 +107,8 @@ class GroovyDebuggerTest extends GroovyCompilerTestCase {
if (!handler.waitFor(ourTimeout)) {
if (handler instanceof OSProcessHandler) {
OSProcessManager.instance.killProcessTree(handler.process)
} else {
}
else {
println "can't terminate $handler"
}
fail('too long waiting for process termination')
@@ -202,7 +205,6 @@ println 2 //4
eval 'call(2)', '-1'
eval 'call(foo)', '-1'
}
}
public void testStaticContext() {
@@ -230,7 +232,6 @@ class B {
eval 'owner.name', 'B'
eval 'this.name', 'B'
}
}
public void "test closures in instance context with delegation"() {
@@ -253,7 +254,6 @@ def getFoo() { 13 }
eval 'this.foo', '13'
eval 'foo', '13'
}
}
public void testClassOutOfSourceRoots() {
@@ -336,7 +336,7 @@ foo()
}
}
public void "test_navigation_outside_source"() {
public void "test navigation outside source"() {
def module1 = addModule("module1", false)
def module2 = addModule("module2", true)
addGroovyLibrary(module1)
@@ -388,6 +388,32 @@ public static void main(String[] args) {
}
}
public void "test evaluation within trait method"() {
def file = myFixture.addFileToProject 'Foo.groovy', '''
trait Introspector { // 1
def whoAmI() {
this // 3
}
}
class FooT implements Introspector {
def a = 1
def b = 3
String toString() { 'fooInstance' }
}
new FooT().whoAmI()
'''
addBreakpoint 'Foo.groovy', 3
runDebugger file, {
waitForBreakpoint()
eval 'a', '1'
eval 'b', '3'
eval 'this', 'fooInstance'
}
}
private def addBreakpoint(String fileName, int line) {
VirtualFile file = null
edt {
@@ -417,16 +443,16 @@ public static void main(String[] args) {
}
});
def finished = semaphore.waitFor(ourTimeout);
assert finished : 'Too long debugger actions'
assert finished: 'Too long debugger actions'
int i = 0
def suspendManager = debugProcess.suspendManager
while (i++ < ourTimeout/10 && !suspendManager.pausedContext && !debugProcess.processHandler.processTerminated) {
while (i++ < ourTimeout / 10 && !suspendManager.pausedContext && !debugProcess.processHandler.processTerminated) {
Thread.sleep(10)
}
def context = suspendManager.pausedContext
assert context : "too long process, terminated=$debugProcess.processHandler.processTerminated"
assert context: "too long process, terminated=$debugProcess.processHandler.processTerminated"
return context
}
@@ -460,7 +486,7 @@ public static void main(String[] args) {
}
})
def finished = semaphore.waitFor(ourTimeout)
assert finished : 'Too long debugger action'
assert finished: 'Too long debugger action'
return result
}
@@ -473,10 +499,10 @@ public static void main(String[] args) {
managed {
ctx = evaluationContext()
item.setContext(ctx)
item.updateRepresentation(ctx, { } as DescriptorLabelListener)
item.updateRepresentation(ctx, {} as DescriptorLabelListener)
semaphore.up()
}
assert semaphore.waitFor(ourTimeout): "too long evaluation: $item.label $item.evaluateException"
assert semaphore.waitFor(ourTimeout): "too long evaluation: $item.label $item.evaluateException"
String result = managed {
def e = item.evaluateException
@@ -492,5 +518,4 @@ public static void main(String[] args) {
final SuspendContextImpl suspendContext = debugProcess.suspendManager.pausedContext
new EvaluationContextImpl(suspendContext, suspendContext.frameProxy, suspendContext.frameProxy.thisObject())
}
}