From c102594f743245c1238817fd4308ab021260f7c5 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Tue, 9 Oct 2012 08:28:27 -0500 Subject: [PATCH 1/5] minor grammar fix --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index d5914f66da5..9485d19d499 100644 --- a/LICENSE +++ b/LICENSE @@ -208,7 +208,7 @@ Grails 2.2.0 includes a number of subcomponents with separate copyright notices and license terms. The product that includes this file does not necessarily use all the open source subcomponents referred to below. Your use of the source -code for the these subcomponents is subject to the terms and +code for these subcomponents is subject to the terms and conditions of the following licenses. From 7241873d16c38bcf4c3edc3e542cefb902f0365c Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Tue, 9 Oct 2012 09:09:55 -0500 Subject: [PATCH 2/5] update commons-beanutiles version in dependencies.txt --- dependencies.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dependencies.txt b/dependencies.txt index c45ad7242e4..7c59bb56ce1 100644 --- a/dependencies.txt +++ b/dependencies.txt @@ -22,8 +22,8 @@ The following libraries are included in Grails because they are required either - required for building Grails core - required for running Grails applications -* commons-beanutils-1.8.0.jar -- Commons BeanUtils 1.8.0 (http://commons.apache.org/beanutils/) Apache 2.0 License +* commons-beanutils-1.8.3.jar +- Commons BeanUtils 1.8.3 (http://commons.apache.org/beanutils/) Apache 2.0 License - required for running Grails applications * commons-codec-1.4.jar From 83b12f4d73f48c8aed5adc8e8411eee45f455bdd Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Mon, 8 Oct 2012 10:27:46 -0500 Subject: [PATCH 3/5] GRAILS-9470 - Improve annotation handling for action methods If a controller action method accepts arguments and has annotations applied to it, those annotations should also be applied to the generated no-arg action method. --- .../web/ControllerActionTransformer.java | 1 + .../ControllerActionTransformerSpec.groovy | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java b/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java index 3f1db68fc7d..d56b4ca0e5c 100644 --- a/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java +++ b/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java @@ -241,6 +241,7 @@ private MethodNode convertToMethodAction(ClassNode classNode, MethodNode methodN EMPTY_CLASS_ARRAY, addOriginalMethodCall(methodNode, initializeActionParameters( classNode, methodNode, methodNode.getName(), parameters, source, context))); + method.addAnnotations(methodNode.getAnnotations()); annotateActionMethod(parameters, method); } else { annotateActionMethod(parameters, methodNode); diff --git a/grails-plugin-controllers/src/test/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformerSpec.groovy b/grails-plugin-controllers/src/test/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformerSpec.groovy index 38b3e4587fa..ff59e0bd156 100644 --- a/grails-plugin-controllers/src/test/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformerSpec.groovy +++ b/grails-plugin-controllers/src/test/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformerSpec.groovy @@ -2,6 +2,7 @@ package org.codehaus.groovy.grails.compiler.web import grails.util.BuildSettings import grails.util.GrailsWebUtil +import grails.web.Action import org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext import org.codehaus.groovy.grails.compiler.injection.ClassInjector @@ -57,6 +58,39 @@ class ControllerActionTransformerSpec extends Specification { controller.getClass().getMethod("action", [] as Class[]) != null } + void 'Test that user applied annotations are applied to generated action methods'() { + given: + def cls = gcl.parseClass(''' + class SomeController { + @Deprecated + def action1(){} + @Deprecated + def action2(String paramName){} +} +''') + + when: + def action1NoArgMethod = cls.getMethod('action1') + + then: + action1NoArgMethod.getAnnotation(Action) + action1NoArgMethod.getAnnotation(Deprecated) + + when: + def action2MethodWithStringArg = cls.getMethod('action2', [String] as Class[]) + + then: + !action2MethodWithStringArg.getAnnotation(Action) + action2MethodWithStringArg.getAnnotation(Deprecated) + + when: + def action2NoArgMethod = cls.getMethod('action2') + + then: + action2NoArgMethod.getAnnotation(Action) + action2NoArgMethod.getAnnotation(Deprecated) + } + void 'Test action overiding'() { given: def superControllerClass = gcl.parseClass(''' From f1149e134712104df5133b0425dc6de04755dc48 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Mon, 8 Oct 2012 11:43:13 -0500 Subject: [PATCH 4/5] GRAILS-9470 - minor improvement to how annotations are copied --- .../compiler/web/ControllerActionTransformer.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java b/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java index d56b4ca0e5c..cbf0f436f5f 100644 --- a/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java +++ b/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/compiler/web/ControllerActionTransformer.java @@ -241,7 +241,7 @@ private MethodNode convertToMethodAction(ClassNode classNode, MethodNode methodN EMPTY_CLASS_ARRAY, addOriginalMethodCall(methodNode, initializeActionParameters( classNode, methodNode, methodNode.getName(), parameters, source, context))); - method.addAnnotations(methodNode.getAnnotations()); + copyAnnotations(methodNode, method); annotateActionMethod(parameters, method); } else { annotateActionMethod(parameters, methodNode); @@ -250,6 +250,18 @@ private MethodNode convertToMethodAction(ClassNode classNode, MethodNode methodN return method; } + protected void copyAnnotations(final MethodNode from, final MethodNode to) { + final List annotationsToCopy = from.getAnnotations(); + for(final AnnotationNode node : annotationsToCopy) { + final AnnotationNode copyOfAnnotationNode = new AnnotationNode(node.getClassNode()); + final Map members = node.getMembers(); + for(final Map.Entry entry : members.entrySet()) { + copyOfAnnotationNode.addMember(entry.getKey(), entry.getValue()); + } + to.addAnnotation(copyOfAnnotationNode); + } + } + private Statement addOriginalMethodCall(MethodNode methodNode, BlockStatement blockStatement) { if (blockStatement == null) { From 2a6955fbd11ef5cfbfe65a413534a6f871ea003d Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 10 Oct 2012 08:15:37 -0500 Subject: [PATCH 5/5] remove dependencies.txt --- dependencies.txt | 177 ----------------------------------------- gradle/assemble.gradle | 2 +- 2 files changed, 1 insertion(+), 178 deletions(-) delete mode 100644 dependencies.txt diff --git a/dependencies.txt b/dependencies.txt deleted file mode 100644 index 7c59bb56ce1..00000000000 --- a/dependencies.txt +++ /dev/null @@ -1,177 +0,0 @@ -The following libraries are included in Grails because they are required either for building the framework or for running the command line tools or for running Grails applications themselves. - -* ant.jar, ant-junit.jar, ant-launcher.jar, ant-trax.jar -- Ant 1.8.2 (http://ant.apache.org) Apache 2.0 License -- used to build the framework and for the command line tools (Gant) -- required for running Grails applications when using AntBuilder - -* antlr-2.7.7.jar -- ANTLR 2.7.7 (http://www.antlr.org) BSD License -- required for running Grails applications (Hibernate) - -* aspectjrt-1.6.8.jar, aspectjweaver-1.6.8.jar -- AspectJ 1.6.8 (http://www.eclipse.org/aspectj/) Eclipse Public License (EPL) -- required for running Grails applications - -* cglib-nodep-2.1_3.jar -- CGLIB 2.1_3 with ObjectWeb ASM 1.5.3 (http://cglib.sourceforge.net) Apache 1.1 License -- required for running Grails applications (Spring AOP & Hibernate) - -* concurrentlinkedhashmap-lru-1.0_jdk5.jar -- ConcurrentLinkedHashMap policy: least-recently-used, jdk: 5 (https://code.google.com/p/concurrentlinkedhashmap) Apache License 2.0 -- required for building Grails core -- required for running Grails applications - -* commons-beanutils-1.8.3.jar -- Commons BeanUtils 1.8.3 (http://commons.apache.org/beanutils/) Apache 2.0 License -- required for running Grails applications - -* commons-codec-1.4.jar -- Commons Codec 1.4 (http://commons.apache.org/codec/) Apache 2.0 License -- required for running Grails applications - -* commons-cli-1.0.jar -- Commons CLI 1.0 (http://commons.apache.org/cli/) Apache 2.0 License -- required for the command line tools (Gant) - -* commons-collections-3.2.1.jar -- Commons Collections 3.2.1 (http://commons.apache.org/collections/) Apache 2.0 License -- required for building Grails core -- required for running Grails applications - -* commons-dbcp-1.3.jar -- Commons DBCP 1.3 (http://commons.apache.org/dbcp/) Apache 2.0 License -- required for building Grails core -- required for running Grails applications - -* commons-el-1.0.jar -- Commons Expression Language 1.0 (http://commons.apache.org/el/) Apache 2.0 License -- required for running Grails applications - -* commons-fileupload-1.2.1.jar -- Commons File Upload 1.2.1 (http://commons.apache.org/fileupload/) Apache 2.0 License -- required for running Grails applications (When using file uploads) - -* commons-io-1.4.jar -- Commons I/O 1.4 (http://commons.apache.org/io/) Apache 2.0 License -- required for running Grails applications - -* commons-lang-2.4.jar -- Commons Lang 2.4 (http://commons.apache.org/lang/) Apache 2.0 License -- required for building Grails core -- required for running Grails application - -* commons-pool-1.5.5.jar -- Commons Pool 1.5.5 (http://commons.apache.org/pool/) Apache 2.0 License -- required for running Grails applications - -* commons-validator-1.3.1.jar -- Commons Validator 1.3.1 (http://commons.apache.org/validator/) Apache 2.0 License -- required for building Grails core -- required for running Grails applications - -* dom4j-1.6.1.jar -- Dom4J 1.6.1 (http://dom4j.org/) BSD Style License (see http://www.dom4j.org/license.html) -- required for building Grails core -- required for running Grails applications - -* ejb3-persistence-1.0.2.GA.jar -- EJB 3.0 Final Release -- required for running Grails applications (When using Hibernate EJB3 annotations) - -* ehcache-1.5.0.jar -- EHCache 1.5.0 (http://ehcache.sourceforge.net/) Apache 2.0 License -- required if you want to use EHCache as your second-level cache -- optional otherwise - -* gant_groovy1.8-1.9.5.jar -- Gant 1.9.5 (http://gant.codehaus.org) Apache 2.0 License -- required for the command line tools (Gant) - -* groovy-all-2.0.5.jar -- Groovy 2.0.5 (http://groovy.codehaus.org) Apache 2.0 License -- required for the command line tools (Gant) -- required for building Grails core -- required for running Grails applications - -* hibernate-commons-annotations-3.2.0.Final.jar -- Hibernate Annotations 3.2.0 GA (http://annotations.hibernate.org) LGPL License -- required for running Grails applications (When using Hibernate EJB3 annotations) - -* hibernate-core-3.6.10.Final.jar -- Hibernate 3.6.8 GA (http://www.hibernate.org) LGPL License -- required for building Grails core -- required for running Grails applications - -* hsqldb-1.8.0.10.jar -- HSQLDB 1.8.0.10 (http://hsqldb.org/) HSQLDB License (see http://hsqldb.org/web/hsqlLicense.html) -- required for building Grails core -- required for running Grails applications (With an in-memory database) - -* h2-1.3.164.jar -- H2 1.3.164 (http://www.h2database.com/) H2 License (see http://www.h2database.com/html/license.html) -- required for building Grails core -- required for running Grails applications (With an in-memory database) - -* javassist-3.12.0.GA.jar -- Javassist 3.12.0 (http://www.jboss.org/javassist/) MPL or LGPL License -- required for running Grails applications - -* jline-0.9.94.jar -- JLine 0.9.94 (http://jline.sourceforge.net/) -- required for the Grails shell - -* jsp-api-2.1.jar -- Java Server Pages 2.1 Spec -- required for building Grails core -- required for running Grails applications - -* jta-1.1.jar -- Java Transaction API -- required for running Grails applications - -* junit-4.8.1.jar -- JUnit 4.8.1 (http://junit.org) CPL 1.0 License -- required for building Grails core -- required for the command line tools (Gant) - -* log4j-1.2.16.jar -- Log4J 1.2.16 (http://logging.apache.org/log4j/) Apache 2.0 License -- required for running Grails applications - -* ognl-2.7.3.jar -- OGNL 2.7.3 (http://www.ognl.org/) OGNL License (http://www.ognl.org/copyright.html) -- required for running Grails applications (When using Web Flows) - -* oro-2.0.8.jar -- Jakarta ORO 2.0.8 (http://jakarta.apache.org/oro/) Apache 2.0 License -- required for running Grails applications - -* protobuf-java-2.4.1.jar -- Google's language-neutral, platform-neutral, extensible mechanism or serializing structured data - -* sitemesh-2.4.jar -- Sitemesh 2.4 (http://www.opensymphony.com/sitemesh) OpenSymphony Software License (see http://www.opensymphony.com/sitemesh/license.action) -- required for building Grails core -- required for running Grails applications - -* slf4j-api-1.5.6.jar, slf4j-log4j12-1.5.6.jar -- Simple Logging Facade for Java 1.5.6 (http://www.slf4j.org/) MIT License (http://www.slf4j.org/license.html) -- required for building Grails core -- required for running Grails applications - -* org.springframework.*.jar -- Spring Framework 3.1.2.RELEASE (http://www.springframework.org) Apache 2.0 License -- required for building Grails core -- required for the command line tools (Gant) -- required for running Grails applications - -* org.springframework.webflow-2.0.8.RELEASE.jar, org.springframework.binding-2.0.8.RELEASE.jar, org.springframework.js-2.0.8.RELEASE.jar -- Spring Web Flow 2.0.8 (http://www.springframework.org) Apache 2.0 License -- required for building Grails core -- required for running Grails applications (When using Web flows) - -* xpp3_min-1.1.3.4.O.jar -- XML Pull Parser (XPP) 1.1.3.4.O (http://www.extreme.indiana.edu/xgws/xsoap/xpp/) Indiana University Extreme! Lab Software License (see http://www.extreme.indiana.edu/viewcvs/~checkout~/XPP3/java/LICENSE.txt) -- required for running Grails applications (dependency of XStream 1.2.1) - diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle index 7983347099d..03f34080928 100644 --- a/gradle/assemble.gradle +++ b/gradle/assemble.gradle @@ -187,7 +187,7 @@ task zipDist(type: Zip, dependsOn: [sourcesJars, install]) { into("grails-$grailsVersion") { from(projectDir) { - include 'lib/', 'gradle/', 'media/', 'samples/', 'scripts/', 'build.gradle', 'build.properties', 'dependencies.txt', + include 'lib/', 'gradle/', 'media/', 'samples/', 'scripts/', 'build.gradle', 'build.properties', 'LICENSE', 'INSTALL', "src/", "gradlew.bat","gradle.properties" exclude 'ant/bin', 'src/grails', 'src/war' }