Skip to content

Commit

Permalink
removed code related to annotation closures (already in Groovy proper)
Browse files Browse the repository at this point in the history
added first version of transform providing true named parameters
updated build to latest Gradle version
  • Loading branch information
pniederw committed Jan 12, 2012
1 parent 9a38970 commit 05edf7c
Show file tree
Hide file tree
Showing 22 changed files with 383 additions and 665 deletions.
18 changes: 12 additions & 6 deletions README
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
Planned extensions:
This project provides the following Groovy language extensions:

1. True named method parameters
def foo(first, second) {...}
foo(first: "one", second: "two")
1. True named method parameters (first prototype available)
Declare like this:
@org.groovyext.NamedParameters
def foo(first, second = "default value", third) {...}

2. Closures as annotation element values
@MyAnno(value = { println it })
Use like this:
foo(first: "one", third: "third")

2. Closures as annotation element values (already in Groovy proper)
@MyAnno(value = { println it })

Check out the tests to learn more.
50 changes: 0 additions & 50 deletions SelfContainedValidationExample.groovy

This file was deleted.

31 changes: 0 additions & 31 deletions annotation_poc.txt

This file was deleted.

35 changes: 13 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
allprojects {
apply plugin: "idea"

group = "org.groovyext"
version = "0.1-SNAPSHOT"
version = "0.2-SNAPSHOT"
}

usePlugin("groovy")
subprojects {
apply plugin: "groovy"

repositories {
mavenCentral()
maven {
url "http://snapshots.repository.codehaus.org"
}
}

dependencies {
groovy("org.codehaus.groovy:groovy-all:1.7.1") {
exclude module: "jansi"
}
testCompile "junit:junit:4.7"
groovy "org.codehaus.groovy:groovy-all:2.0.0-beta-3-SNAPSHOT"
}
}

project(":groovyext") {
usePlugin 'maven'
apply plugin: "maven"

uploadArchives {
repositories.mavenDeployer {
Expand All @@ -29,23 +33,10 @@ project(":groovyext") {
project(":tests") {
dependencies {
testCompile project(":groovyext")
}
}

task createLibDir << {
def libDir = new File(rootDir, "lib")
libDir.deleteDir()
libDir.mkdir()

configurations.compile.each {
ant.copy(file: it, todir: libDir)
}
configurations.testCompile.each {
ant.copy(file: it, todir: libDir)
testCompile "junit:junit:4.10"
}
}

task wrapper(type: Wrapper) {
gradleVersion = '0.8'
jarPath = 'wrapper'
gradleVersion = '1.0-milestone-7'
}
135 changes: 82 additions & 53 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
#!/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 -Xmx512"
# JAVA_OPTS="$JAVA_OPTS -Xmx512"
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

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

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
echo "${PROGNAME}: $*"
echo "$*"
}

die ( ) {
warn "$*"
echo
echo "$*"
echo
exit 1
}


# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
Expand All @@ -36,57 +42,78 @@ 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.WrapperMain
CLASSPATH=`dirname "$0"`/wrapper/gradle-wrapper.jar
WRAPPER_PROPERTIES=`dirname "$0"`/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
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 [ ! -x "$JAVACMD" ] ; then
die "JAVA_HOME is not defined correctly, can not execute: $JAVACMD"

# 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
if [ -z "$JAVA_HOME" ] ; then
warn "JAVA_HOME environment variable is not set"

# For Darwin, add APP_NAME to the JAVA_OPTS as -Xdock:name
if $darwin; then
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"`
TOOLS_JAR=`cygpath --path --mixed "$TOOLS_JAR"`
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 @@ -113,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 @@ -128,9 +155,11 @@ if $cygwin ; then
esac
fi

"$JAVACMD" $JAVA_OPTS $GRADLE_OPTS \
-classpath "$CLASSPATH" \
-Dtools.jar="$TOOLS_JAR" \
-Dorg.gradle.wrapper.properties="$WRAPPER_PROPERTIES" \
$STARTER_MAIN_CLASS \
"$@"
# 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" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
Loading

0 comments on commit 05edf7c

Please sign in to comment.