Fix bug with compileUnit not seeing all ssg-gradle found classpath.
This commit is contained in:
parent
82a8be76b5
commit
ab5b678920
@ -71,7 +71,7 @@ class DefaultStaticSiteGenerator implements StaticSiteGenerator {
|
||||
}
|
||||
|
||||
protected WvcCompiler getWvcCompiler() {
|
||||
new WvcCompiler(new SimpleComponentTemplateClassFactory(this.groovyClassLoader))
|
||||
new WvcCompiler(this.groovyClassLoader, new SimpleComponentTemplateClassFactory(this.groovyClassLoader))
|
||||
}
|
||||
|
||||
protected WebViewComponentContext makeContext(
|
||||
|
@ -12,6 +12,22 @@ import groowt.view.component.web.compiler.DefaultWebViewComponentTemplateCompile
|
||||
@TupleConstructor
|
||||
class WvcCompiler {
|
||||
|
||||
private static class SsgWvcTemplateCompileUnit extends DefaultWebViewComponentTemplateCompileUnit {
|
||||
|
||||
SsgWvcTemplateCompileUnit(
|
||||
String descriptiveName,
|
||||
Class<? extends ViewComponent> forClass,
|
||||
ComponentTemplateSource source,
|
||||
String defaultPackageName,
|
||||
GroovyClassLoader groovyClassLoader
|
||||
) {
|
||||
super(descriptiveName, forClass, source, defaultPackageName)
|
||||
this.groovyCompilationUnit.setClassLoader(groovyClassLoader)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final GroovyClassLoader groovyClassLoader
|
||||
final ComponentTemplateClassFactory templateClassFactory
|
||||
|
||||
Either<Diagnostic, ComponentTemplate> compileTemplate(
|
||||
@ -25,11 +41,12 @@ class WvcCompiler {
|
||||
))
|
||||
}
|
||||
def source = ComponentTemplateSource.of(templateUrl)
|
||||
def compileUnit = new DefaultWebViewComponentTemplateCompileUnit(
|
||||
def compileUnit = new SsgWvcTemplateCompileUnit(
|
||||
source.descriptiveName,
|
||||
componentClass,
|
||||
source,
|
||||
componentClass.packageName
|
||||
componentClass.packageName,
|
||||
this.groovyClassLoader
|
||||
)
|
||||
def compileResult = compileUnit.compile()
|
||||
def templateClass = templateClassFactory.getTemplateClass(compileResult)
|
||||
|
Loading…
Reference in New Issue
Block a user