Skip to content

Commit 1c8c92d

Browse files
Reverting recent changes related to #10238.
1 parent 841f4df commit 1c8c92d

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ subprojects { project ->
450450
}
451451

452452
}
453-
compileGroovy.dependsOn processResources
453+
454454
}
455455

456456

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
@@ -122,8 +122,6 @@ class GrailsGradlePlugin extends GroovyPlugin {
122122
createBuildPropertiesTask(project)
123123

124124
configurePathingJar(project)
125-
126-
configureResourceProcessing(project)
127125
}
128126

129127
protected void configureProfile(Project project) {
@@ -223,14 +221,6 @@ class GrailsGradlePlugin extends GroovyPlugin {
223221
System.setProperty(BuildSettings.APP_BASE_DIR, project.projectDir.absolutePath)
224222
}
225223

226-
protected void configureResourceProcessing(Project project) {
227-
def tasks = project.tasks
228-
def resourcesTask = tasks.findByName('processResources')
229-
if (resourcesTask) {
230-
tasks.findByName('compileGroovy')?.dependsOn resourcesTask
231-
}
232-
}
233-
234224
protected void configureApplicationCommands(Project project) {
235225
def applicationContextCommands = FactoriesLoaderSupport.loadFactoryNames(APPLICATION_CONTEXT_COMMAND_CLASS)
236226
for (ctxCommand in applicationContextCommands) {

0 commit comments

Comments
 (0)