Skip to content

Commit c80a7c6

Browse files
Merge branch '3.1.x' into 3.2.x
2 parents 94a1833 + 721289b commit c80a7c6

File tree

33 files changed

+352
-34
lines changed

33 files changed

+352
-34
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ subprojects { project ->
472472
}
473473

474474
}
475-
compileGroovy.dependsOn processResources
475+
476476
}
477477

478478

grails-core/src/main/groovy/org/grails/compiler/injection/EnhancesTraitTransformation.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class EnhancesTraitTransformation extends AbstractArtefactTypeAstTransformation
8686

8787
ast.classes.add transformerNode
8888

89-
def resourcesTargetDirectory = GlobalGrailsClassInjectorTransformation.resolveResourcesTargetDirectory(source)
90-
GlobalGrailsClassInjectorTransformation.updateGrailsFactoriesWithType(transformerNode, GlobalGrailsClassInjectorTransformation.TRAIT_INJECTOR_CLASS, resourcesTargetDirectory)
89+
def compilationTargetDirectory = GlobalGrailsClassInjectorTransformation.resolveCompilationTargetDirectory(source)
90+
GlobalGrailsClassInjectorTransformation.updateGrailsFactoriesWithType(transformerNode, GlobalGrailsClassInjectorTransformation.TRAIT_INJECTOR_CLASS, compilationTargetDirectory)
9191

9292
}
9393

grails-core/src/main/groovy/org/grails/compiler/injection/GlobalGrailsClassInjectorTransformation.groovy

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import grails.compiler.ast.ClassInjector
55
import grails.core.ArtefactHandler
66
import grails.io.IOUtils
77
import grails.plugins.metadata.GrailsPlugin
8-
import grails.util.BuildSettings
98
import grails.util.GrailsNameUtils
109
import groovy.transform.CompilationUnitAware
1110
import groovy.transform.CompileDynamic
@@ -65,7 +64,7 @@ class GlobalGrailsClassInjectorTransformation implements ASTTransformation, Comp
6564
Set<String> transformedClasses = []
6665
String pluginVersion = null
6766
ClassNode pluginClassNode = null
68-
def compilationTargetDirectory = resolveResourcesTargetDirectory(source)
67+
def compilationTargetDirectory = resolveCompilationTargetDirectory(source)
6968
def pluginXmlFile = new File(compilationTargetDirectory, "META-INF/grails-plugin.xml")
7069

7170
for (ClassNode classNode : classes) {
@@ -143,10 +142,6 @@ class GlobalGrailsClassInjectorTransformation implements ASTTransformation, Comp
143142
generatePluginXml(pluginClassNode, pluginVersion, transformedClasses, pluginXmlFile)
144143
}
145144

146-
static File resolveResourcesTargetDirectory(SourceUnit source) {
147-
BuildSettings.RESOURCES_DIR ?: new File(resolveCompilationTargetDirectory(source), '../../resources/main/')
148-
}
149-
150145
static File resolveCompilationTargetDirectory(SourceUnit source) {
151146
File targetDirectory = source.configuration.targetDirectory
152147
if(targetDirectory==null && source.getClass().name == 'org.codehaus.jdt.groovy.control.EclipseSourceUnit') {
@@ -155,14 +150,13 @@ class GlobalGrailsClassInjectorTransformation implements ASTTransformation, Comp
155150
return targetDirectory
156151
}
157152

158-
static boolean updateGrailsFactoriesWithType(ClassNode classNode, ClassNode superType, File targetDirectory) {
153+
static boolean updateGrailsFactoriesWithType(ClassNode classNode, ClassNode superType, File compilationTargetDirectory) {
159154
if (GrailsASTUtils.isSubclassOfOrImplementsInterface(classNode, superType)) {
160155
if(Modifier.isAbstract(classNode.getModifiers())) return false
161156

162157
def classNodeName = classNode.name
163158
// generate META-INF/grails.factories
164-
165-
def factoriesFile = new File(targetDirectory, "META-INF/grails.factories")
159+
def factoriesFile = new File(compilationTargetDirectory, "META-INF/grails.factories")
166160
factoriesFile.parentFile.mkdirs()
167161
def props = new Properties()
168162
def superTypeName = superType.getName()

grails-gradle-plugin/src/main/groovy/org/grails/gradle/plugin/core/GrailsGradlePlugin.groovy

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ class GrailsGradlePlugin extends GroovyPlugin {
127127
configureRunCommand(project)
128128

129129
configurePathingJar(project)
130-
131-
configureResourceProcessing(project)
132130
}
133131

134132
protected void configureProfile(Project project) {
@@ -233,14 +231,6 @@ class GrailsGradlePlugin extends GroovyPlugin {
233231
System.setProperty(BuildSettings.APP_BASE_DIR, project.projectDir.absolutePath)
234232
}
235233

236-
protected void configureResourceProcessing(Project project) {
237-
def tasks = project.tasks
238-
def resourcesTask = tasks.findByName('processResources')
239-
if (resourcesTask) {
240-
tasks.findByName('compileGroovy')?.dependsOn resourcesTask
241-
}
242-
}
243-
244234
protected void configureApplicationCommands(Project project) {
245235
def applicationContextCommands = FactoriesLoaderSupport.loadFactoryNames(APPLICATION_CONTEXT_COMMAND_CLASS)
246236
for (ctxCommand in applicationContextCommands) {

grails-plugin-async/src/main/groovy/grails/artefact/AsyncController.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import org.springframework.web.context.request.RequestContextHolder
3737
*
3838
*/
3939
@CompileStatic
40-
@Enhances('Controller')
4140
trait AsyncController extends Events {
4241

4342
/**
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package grails.compiler.traits
17+
18+
import grails.artefact.AsyncController
19+
20+
/**
21+
*
22+
* @author Jeff Brown
23+
* @since 3.0
24+
*
25+
*/
26+
class AsyncControllerTraitInjector extends ControllerTraitInjector {
27+
28+
@Override
29+
Class getTrait() {
30+
AsyncController
31+
}
32+
33+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
grails.compiler.traits.TraitInjector=grails.compiler.traits.AsyncControllerTraitInjector

grails-plugin-controllers/src/main/groovy/grails/artefact/Controller.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ import java.lang.reflect.Method
6666
*
6767
*/
6868
@CompileStatic
69-
@Enhances('Controller')
7069
trait Controller implements ResponseRenderer, ResponseRedirector, RequestForwarder, DataBinder, WebAttributes, ServletAttributes {
7170

7271
private MimeTypesApiSupport mimeTypesSupport = new MimeTypesApiSupport()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package grails.compiler.traits
17+
18+
import grails.artefact.Controller
19+
import groovy.transform.CompileStatic
20+
21+
/**
22+
*
23+
* A {@link TraitInjector} that injects controllers with the {@link Controller} trait
24+
*
25+
* @author Jeff Brown
26+
* @author Graeme Rocher
27+
*
28+
* @since 3.0
29+
*
30+
*/
31+
@CompileStatic
32+
class ControllerTraitInjector implements TraitInjector {
33+
34+
@Override
35+
Class getTrait() {
36+
Controller
37+
}
38+
39+
@Override
40+
String[] getArtefactTypes() {
41+
['Controller'] as String[]
42+
}
43+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
grails.compiler.traits.TraitInjector=grails.compiler.traits.ControllerTraitInjector

0 commit comments

Comments
 (0)