Skip to content

Commit

Permalink
Improvements for GroovyPageForkCompileTask
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jan 17, 2024
1 parent 2d8418b commit d4dd657
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class GroovyPageForkCompileTask extends AbstractCompile {
String serverpath

@Nested
GspCompileOptions compileOptions = getObjectFactory().newInstance(GspCompileOptions.class)
GspCompileOptions compileOptions = new GspCompileOptions()

@Override
@PathSensitive(PathSensitivity.RELATIVE)
Expand Down Expand Up @@ -114,21 +114,21 @@ class GroovyPageForkCompileTask extends AbstractCompile {
javaExecSpec.getMainClass().set(getCompilerName())
javaExecSpec.setClasspath(getClasspath())

def jvmArgs = compileOptions.forkOptions.jvmArgs
def jvmArgs = getCompileOptions().getForkOptions().getJvmArgs()
if (jvmArgs) {
javaExecSpec.jvmArgs(jvmArgs)
}
javaExecSpec.setMaxHeapSize(compileOptions.forkOptions.memoryMaximumSize)
javaExecSpec.setMinHeapSize(compileOptions.forkOptions.memoryInitialSize)
javaExecSpec.setMaxHeapSize(getCompileOptions().getForkOptions().getMemoryMaximumSize())
javaExecSpec.setMinHeapSize(getCompileOptions().getForkOptions().getMemoryInitialSize())

//This is the OLD Style and seems kinda silly to be hard coded this way. but restores functionality
//for now
def configFiles = [
project.file('grails-app/conf/application.yml').canonicalPath,
project.file('grails-app/conf/application.groovy').canonicalPath
getProject().file('grails-app/conf/application.yml').getCanonicalPath(),
getProject().file('grails-app/conf/application.groovy').getCanonicalPath()
].join(',')

Path path = Paths.get(tmpDirPath)
Path path = Paths.get(getTmpDirPath())
File tmp
if (Files.exists(path)) {
tmp = path.toFile()
Expand All @@ -137,14 +137,14 @@ class GroovyPageForkCompileTask extends AbstractCompile {
tmp = Files.createDirectories(path).toFile()
}
def arguments = [
srcDir.canonicalPath,
destinationDirectory.getAsFile().getOrNull()?.canonicalPath,
tmp.canonicalPath,
targetCompatibility,
packageName,
serverpath,
getSrcDir().getCanonicalPath(),
getDestinationDirectory().getAsFile().getOrNull()?.getCanonicalPath(),
tmp.getCanonicalPath(),
getTargetCompatibility(),
getPackageName(),
getServerpath(),
configFiles,
compileOptions.encoding
getCompileOptions().getEncoding()
]

prepareArguments(arguments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
*/
package org.grails.gradle.plugin.web.gsp

import javax.inject.Inject

import org.gradle.api.model.ObjectFactory
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.compile.AbstractOptions
Expand All @@ -35,11 +32,6 @@ class GspCompileOptions extends AbstractOptions {
String encoding = 'UTF-8'

@Nested
GroovyForkOptions forkOptions = getObjectFactory().newInstance(GroovyForkOptions.class)

@Inject
protected ObjectFactory getObjectFactory() {
throw new UnsupportedOperationException();
}
GroovyForkOptions forkOptions = new GroovyForkOptions()

}

0 comments on commit d4dd657

Please sign in to comment.