Skip to content

Commit

Permalink
add groovy-xml module
Browse files Browse the repository at this point in the history
  • Loading branch information
paulk-asert committed Jan 7, 2012
1 parent 96a59de commit dc83a64
Show file tree
Hide file tree
Showing 213 changed files with 2,195 additions and 2,034 deletions.
12 changes: 5 additions & 7 deletions build.gradle
Expand Up @@ -59,21 +59,18 @@ dependencies {
compile("org.apache.ivy:ivy:2.2.0") {
transitive = false
}
runtime "org.apache.ant:ant-junit:1.8.2"
runtime "org.apache.ant:ant-launcher:1.8.2"
runtime "org.apache.ant:ant-antlr:1.8.2"
runtime("commons-logging:commons-logging:1.1.1") {
exclude(group: 'log4j', module: 'log4j')
exclude(group: 'logkit', module: 'logkit')
exclude(group: 'avalon-framework', module: 'avalon-framework')
}
testCompile "jmock:jmock:1.2.0"
testCompile "jmock:jmock-cglib:1.2.0"
testCompile "xmlunit:xmlunit:1.3"
// testCompile "xmlunit:xmlunit:1.3"
testCompile "ch.qos.logback:logback-classic:0.9.21"
testCompile "log4j:log4j:1.2.16"
testCompile "org.slf4j:jcl-over-slf4j:1.6.0"
testCompile "com.thoughtworks.qdox:qdox:1.12"
// testCompile "com.thoughtworks.qdox:qdox:1.12"
testCompile "org.apache.ant:ant-testutil:1.8.2"
runtime "org.codehaus.gpars:gpars:0.12"

Expand All @@ -88,7 +85,6 @@ dependencies {
exclude(module: 'ant')
}
tools "asm:asm:3.3.1"
tools "com.thoughtworks.qdox:qdox:1.12"
tools "biz.aQute:bnd:0.0.401"

examplesCompile "lucene:lucene:1.4.3"
Expand All @@ -109,6 +105,8 @@ dependencies {

antlr "org.apache.ant:ant-antlr:1.8.2"

// groovy project(':subprojects:groovy-ant')
groovy localGroovy()
testCompile project(':subprojects:groovy-bsf')
testCompile project(':subprojects:groovy-jsr223')
testCompile project(':subprojects:groovy-jmx')
Expand Down Expand Up @@ -284,5 +282,5 @@ apply from: "$projectDir/gradle/upload.gradle"
task wrapper(type: Wrapper) {
// gradleVersion = '1.0-milestone-5-20110929000016+0200'
// distributionUrl = "http://repo.gradle.org/gradle/distributions-snapshots/gradle-${gradleVersion}-bin.zip"
gradleVersion = '1.0-milestone-6'
gradleVersion = '1.0-milestone-7'
}
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -836,7 +836,7 @@ $Date$
footer="${docFooter}"
overview="src/main/overview.html">
<link packages="javax.servlet.,javax.management." href="http://java.sun.com/j2ee/1.4/docs/api"/>
<link packages="java.,org.xml.,javax.,org.xml." href="http://java.sun.com/javase/6/docs/api"/>
<link packages="java.,org.xml.,javax.,org.w3c." href="http://java.sun.com/javase/6/docs/api"/>
<link packages="org.apache.ant.,org.apache.tools.ant." href="http://www.dpml.net/api/ant/1.7.0"/>
<link packages="org.junit.,junit." href="http://junit.sourceforge.net/junit3.8.1/javadoc"/>
<link packages="org.apache.commons.cli." href="http://commons.apache.org/cli/api-release"/>
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Sat Dec 10 20:34:52 EST 2011
#Fri Jan 06 21:23:31 EST 2012
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://gradle.artifactoryonline.com/gradle/distributions/gradle-1.0-milestone-6-bin.zip
distributionUrl=http\://repo.gradle.org/gradle/distributions/gradle-1.0-milestone-7-bin.zip
107 changes: 52 additions & 55 deletions gradlew
@@ -1,16 +1,16 @@
#!/bin/bash

##############################################################################
## ##
## Gradle wrapper script for UN*X ##
## ##
##
## Gradle start up script for UN*X
##
##############################################################################

# Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
# GRADLE_OPTS="$GRADLE_OPTS -Xmx512m"
# JAVA_OPTS="$JAVA_OPTS -Xmx512m"
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

GRADLE_APP_NAME=Gradle
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -42,54 +42,51 @@ case "`uname`" in
;;
esac

# 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'`
export JAVA_HOME="$javaHome"
fi
fi

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVACMD" ] && JAVACMD=`cygpath --unix "$JAVACMD"`
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
CLASSPATH=`dirname "$0"`/gradle/wrapper/gradle-wrapper.jar
WRAPPER_PROPERTIES=`dirname "$0"`/gradle/wrapper/gradle-wrapper.properties
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
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\"`/"
APP_HOME="`pwd -P`"
cd "$SAVED"

CLASSPATH=$APP_HOME/gradle\wrapper\gradle-wrapper.jar

# 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
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"
JAVACMD="$JAVA_HOME/bin/java"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
if [ -z "$JAVA_HOME" ] ; then
warn "JAVA_HOME environment variable is not set"
fi

# Increase the maximum file descriptors if we can.
Expand All @@ -108,15 +105,15 @@ if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
fi
fi

# For Darwin, add GRADLE_APP_NAME to the JAVA_OPTS as -Xdock:name
# For Darwin, add APP_NAME to the JAVA_OPTS as -Xdock:name
if $darwin; then
JAVA_OPTS="$JAVA_OPTS -Xdock:name=$GRADLE_APP_NAME"
JAVA_OPTS="$JAVA_OPTS -Xdock:name=$APP_NAME"
# we may also want to set -Xdock:image
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
JAVA_HOME=`cygpath --path --mixed "$JAVA_HOME"`
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -143,7 +140,7 @@ if $cygwin ; then
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
Expand All @@ -158,11 +155,11 @@ if $cygwin ; then
esac
fi

GRADLE_APP_BASE_NAME=`basename "$0"`
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \
-classpath "$CLASSPATH" \
-Dorg.gradle.appname="$GRADLE_APP_BASE_NAME" \
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
$STARTER_MAIN_CLASS \
"$@"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
52 changes: 30 additions & 22 deletions gradlew.bat
@@ -1,24 +1,37 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem ##
@rem Gradle startup script for Windows ##
@rem ##
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Uncomment those lines to set JVM options. GRADLE_OPTS and JAVA_OPTS can be used together.
@rem set GRADLE_OPTS=%GRADLE_OPTS% -Xmx512m
@rem set JAVA_OPTS=%JAVA_OPTS% -Xmx512m
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.\
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
if not defined JAVA_HOME goto init
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

Expand All @@ -29,14 +42,14 @@ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo.
goto end

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%eval[2+2]" == "4" goto 4NT_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -56,27 +69,22 @@ set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line

set STARTER_MAIN_CLASS=org.gradle.wrapper.GradleWrapperMain
set CLASSPATH=%DIRNAME%\gradle\wrapper\gradle-wrapper.jar
set WRAPPER_PROPERTIES=%DIRNAME%\gradle\wrapper\gradle-wrapper.properties

set GRADLE_OPTS=%JAVA_OPTS% %GRADLE_OPTS% -Dorg.gradle.wrapper.properties="%WRAPPER_PROPERTIES%"
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %GRADLE_OPTS% -classpath "%CLASSPATH%" %STARTER_MAIN_CLASS% %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

if not "%OS%"=="Windows_NT" echo 1 > nul | choice /n /c:1

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit "%ERRORLEVEL%"
exit /b "%ERRORLEVEL%"
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
8 changes: 4 additions & 4 deletions settings.gradle
@@ -1,4 +1,4 @@
include 'subprojects:groovy-bsf', 'subprojects:groovy-console', 'subprojects:groovy-jmx',
'subprojects:groovy-json', 'subprojects:groovy-jsr223', 'subprojects:groovy-servlet',
'subprojects:groovy-shell', 'subprojects:groovy-sql', 'subprojects:groovy-swing',
'subprojects:groovy-test'
include 'subprojects:groovy-ant', 'subprojects:groovy-bsf', 'subprojects:groovy-console', 'subprojects:groovy-docgenerator',
'subprojects:groovy-groovydoc', 'subprojects:groovy-jmx', 'subprojects:groovy-json', 'subprojects:groovy-jsr223',
'subprojects:groovy-servlet', 'subprojects:groovy-shell', 'subprojects:groovy-sql', 'subprojects:groovy-swing',
'subprojects:groovy-templates', 'subprojects:groovy-test', 'subprojects:groovy-xml'
Expand Up @@ -133,9 +133,9 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
public static final Class[] DGM_LIKE_CLASSES = new Class[]{
DefaultGroovyMethods.class,
// TODO provide alternative way for these to be registered
//SwingGroovyMethods.class,
// SwingGroovyMethods.class,
// SqlGroovyMethods.class,
XmlGroovyMethods.class,
// XmlGroovyMethods.class,
EncodingGroovyMethods.class,
DateGroovyMethods.class,
ProcessGroovyMethods.class
Expand Down
16 changes: 14 additions & 2 deletions src/main/org/codehaus/groovy/runtime/InvokerHelper.java
Expand Up @@ -16,7 +16,6 @@
package org.codehaus.groovy.runtime;

import groovy.lang.*;
import groovy.xml.XmlUtil;
import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl;
import org.codehaus.groovy.runtime.metaclass.MissingMethodExecutionFailed;
import org.codehaus.groovy.runtime.powerassert.PowerAssertionError;
Expand All @@ -26,6 +25,8 @@

import java.beans.Introspector;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
Expand Down Expand Up @@ -522,7 +523,18 @@ public static String format(Object arguments, boolean verbose, int maxSize) {
return formatMap((Map) arguments, verbose, maxSize);
}
if (arguments instanceof Element) {
return XmlUtil.serialize((Element) arguments);
try {
Method serialize = Class.forName("groovy.xml.XmlUtil").getMethod("serialize", Element.class);
return (String) serialize.invoke(null, arguments);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
if (arguments instanceof String) {
if (verbose) {
Expand Down

0 comments on commit dc83a64

Please sign in to comment.