Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions grace-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies {

testImplementation project(":grace-test")
testImplementation project(":grace-plugin-domain-class")
testImplementation project(":grace-plugin-taglibs")
testImplementation libs.jakarta.servlet
testImplementation libs.spring.jdbc
testImplementation libs.spring.test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class Post {
def clazz = gcl.parseClass('''
class PostTagLib {
}
''', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglib', 'org', 'demo', 'PostTagLib.groovy'].join(File.separator))
''', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglibs', 'org', 'demo', 'PostTagLib.groovy'].join(File.separator))

def classNode = gcl.getClassNode('PostTagLib')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2025 the original author or authors.
* Copyright 2014-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,9 +43,9 @@ class GrailsExtension {

/**
* The default app source directories,
* eg. 'boot', 'commands', 'controllers', 'domain', 'services', 'taglib', 'util'.
* eg. 'boot', 'commands', 'controllers', 'domain', 'services', 'taglibs', 'util'.
*/
String[] appSourceDirs = ['boot', 'commands', 'controllers', 'domain', 'services', 'taglib', 'util']
String[] appSourceDirs = ['boot', 'commands', 'controllers', 'domain', 'services', 'taglibs', 'util']

/**
* The default app resource directories,
Expand Down
2 changes: 1 addition & 1 deletion grace-plugin-cache/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ dependencies {
api project(":grace-cache-core")
api project(":grace-core")
compileOnly project(":grace-plugin-api")
implementation project(":grace-plugin-taglibs")
implementation project(":grace-web-gsp")
implementation project(":grace-web-taglib")

api libs.spring.boot.autoconfigure
annotationProcessor libs.spring.boot.autoconfigureProcessor
Expand Down
2 changes: 1 addition & 1 deletion grace-plugin-fields/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
dependencies {
compileOnly project(":grace-plugin-api")
api project(":grace-plugin-databinding")
implementation project(":grace-plugin-taglibs")
api project(":grace-plugin-validation")
api project(":grace-scaffolding-core")
api project(":grace-web")
api project(":grace-web-gsp")
api project(":grace-web-taglib")
implementation libs.grace.datastore.core
implementation libs.grace.datastore.gorm
implementation libs.grace.datastore.gorm.support
Expand Down
2 changes: 1 addition & 1 deletion grace-plugin-gsp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies {
api project(":grace-core")
compileOnly project(":grace-plugin-api")
api project(":grace-plugin-codecs")
implementation project(":grace-plugin-taglibs")
api project(":grace-plugin-taglibs")
api project(":grace-web-gsp")
api project(":grace-web-mvc")
api project(":grace-web-url-mappings")
Expand Down
9 changes: 9 additions & 0 deletions grace-plugin-taglibs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ dependencies {
testImplementation libs.spring.test
testImplementation project(":grace-test-support")
}

configure([compileGroovy, compileTestGroovy]) {
groovyOptions.encoding = "UTF-8"
options.encoding = "UTF-8"
options.compilerArgs << '-parameters'
options.forkOptions.memoryInitialSize = '128M'
options.forkOptions.memoryMaximumSize = '1G'
classpath += project.files("src/main/resources")
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2025 the original author or authors.
* Copyright 2004-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,7 +44,7 @@ public class TagLibArtefactHandler extends ArtefactHandlerAdapter {

public static final String TYPE = ArtefactTypes.TAG_LIBRARY;

public static final String PATH = "taglib";
public static final String PATH = "taglibs";

private Map<String, GrailsTagLibClass> tag2libMap = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
grails.core.ArtefactHandler=\
org.grails.core.artefact.gsp.TagLibArtefactHandler

grails.compiler.traits.TraitInjector=\
grails.compiler.traits.TagLibraryTraitInjector,\
grails.compiler.traits.ControllerTagLibraryTraitInjector

grails.compiler.ast.ClassInjector=\
org.grails.compiler.web.taglib.TagLibraryTransformer

org.grails.taglib.TagInvocationContextCustomizer=\
org.grails.plugins.web.taglib.ApplicationTagInvocationContextCustomizer,\
org.grails.plugins.web.taglib.RenderTagInvocationContextCustomizer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022-2025 the original author or authors.
* Copyright 2022-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class StaticallyCompiledTagLib implements grails.artefact.TagLibrary {
def closureTagWithOneArg = { attrs -> }
def closureTagWithTwoArgs = { attrs, body -> }
}
''', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglib', 'org', 'demo', 'StaticallyCompiledTagLib.groovy'].join(File.separator))
''', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglibs', 'org', 'demo', 'StaticallyCompiledTagLib.groovy'].join(File.separator))
}

void 'Test that a tag library injected method "$getTagLibNamespace", "tagOne"'() {
Expand All @@ -64,7 +64,7 @@ class DemoTagLib {
static namespace = 'demo'
def tagOne = { attrs -> }
}
''', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglib', 'org', 'demo', 'DemoTagLib.groovy'].join(File.separator))
''', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglibs', 'org', 'demo', 'DemoTagLib.groovy'].join(File.separator))

def taglibMethodNames = taglibClass.getDeclaredMethods()*.name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TestTagLib {
moduleNode.putNodeMetaData('PROJECT_DIR', ['', 'Users', 'grails', 'grails-demo-project'].join(File.separator))
moduleNode.putNodeMetaData('GRAILS_APP_DIR', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app'].join(File.separator))
sourceUnit.getAST() >> moduleNode
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglib', 'org', 'grails', 'demo', 'TestTagLib.groovy'].join(File.separator)
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglibs', 'org', 'grails', 'demo', 'TestTagLib.groovy'].join(File.separator)

ClassNode classNode = new ClassNode(clazz)
classNode.setModule(moduleNode)
Expand All @@ -82,7 +82,7 @@ class TestTagLib {
moduleNode.putNodeMetaData('PROJECT_DIR', ['', 'Users', 'grails', 'grails-demo-project'].join(File.separator))
moduleNode.putNodeMetaData('GRAILS_APP_DIR', ['', 'Users', 'grails', 'grails-demo-project', 'app'].join(File.separator))
sourceUnit.getAST() >> moduleNode
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'app', 'taglib', 'org', 'grails', 'demo', 'TestTagLib.groovy'].join(File.separator)
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'app', 'taglibs', 'org', 'grails', 'demo', 'TestTagLib.groovy'].join(File.separator)

ClassNode classNode = new ClassNode(clazz)
classNode.setModule(moduleNode)
Expand Down Expand Up @@ -128,7 +128,7 @@ class TestTag {
moduleNode.putNodeMetaData('PROJECT_DIR', ['', 'Users', 'grails', 'grails-demo-project'].join(File.separator))
moduleNode.putNodeMetaData('GRAILS_APP_DIR', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app'].join(File.separator))
sourceUnit.getAST() >> moduleNode
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglib', 'org', 'grails', 'demo', 'TestTag.groovy'].join(File.separator)
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglibs', 'org', 'grails', 'demo', 'TestTag.groovy'].join(File.separator)

ClassNode classNode = new ClassNode(clazz)
classNode.setModule(moduleNode)
Expand Down Expand Up @@ -176,7 +176,7 @@ abstract class TestTagLib {
moduleNode.putNodeMetaData('PROJECT_DIR', ['', 'Users', 'grails', 'grails-demo-project'].join(File.separator))
moduleNode.putNodeMetaData('GRAILS_APP_DIR', ['', 'Users', 'grails', 'grails-demo-project', 'grails-app'].join(File.separator))
sourceUnit.getAST() >> moduleNode
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglib', 'org', 'grails', 'demo', 'TestTagLib.groovy'].join(File.separator)
sourceUnit.getName() >> ['', 'Users', 'grails', 'grails-demo-project', 'grails-app', 'taglibs', 'org', 'grails', 'demo', 'TestTagLib.groovy'].join(File.separator)

ClassNode classNode = new ClassNode(clazz)
classNode.setModule(moduleNode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import spock.lang.Specification
class ControllerTagLibMethodDispatchSpec extends Specification implements ControllerUnitTest<TestController> {

void setupSpec() {
mockTagLibs(MyTagLib, TwoTagLib)
mockTagLibs(MyTagLib, MyTwoTagLib)
}

void testControllerTagLibMethodDispatch() {
Expand Down Expand Up @@ -46,7 +46,7 @@ class MyTagLib {
}

@Artefact('TagLib')
class TwoTagLib {
class MyTwoTagLib {
static namespace = "two"

Closure test1 = { attrs, body ->
Expand Down
1 change: 1 addition & 0 deletions grace-taglib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dependencies {
api project(":grace-api")
api project(":grace-core")
api project(":grace-encoder")
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2023 the original author or authors.
* Copyright 2004-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,10 +27,10 @@
import groovy.lang.GroovySystem;
import groovy.lang.MetaProperty;

import grails.artefact.ArtefactTypes;
import grails.core.gsp.GrailsTagLibClass;

import org.grails.core.AbstractInjectableGrailsClass;
import org.grails.core.artefact.gsp.TagLibArtefactHandler;

/**
* Default implementation of a tag lib class.
Expand All @@ -40,7 +40,7 @@
*/
public class DefaultGrailsTagLibClass extends AbstractInjectableGrailsClass implements GrailsTagLibClass {

protected static final String TAG_LIB = TagLibArtefactHandler.TYPE;
protected static final String TAG_LIB = ArtefactTypes.TAG_LIBRARY;

private final Set<String> tags = new HashSet<>();

Expand All @@ -59,7 +59,7 @@ public class DefaultGrailsTagLibClass extends AbstractInjectableGrailsClass impl
*/
@SuppressWarnings("rawtypes")
public DefaultGrailsTagLibClass(Class<?> clazz) {
super(clazz, TagLibArtefactHandler.TYPE);
super(clazz, TAG_LIB);

for (MetaProperty prop : GroovySystem.getMetaClassRegistry().getMetaClass(clazz).getProperties()) {
int modifiers = prop.getModifiers();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2025 the original author or authors.
* Copyright 2004-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,12 +29,12 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import grails.artefact.ArtefactTypes;
import grails.core.GrailsApplication;
import grails.core.GrailsClass;
import grails.core.gsp.GrailsTagLibClass;
import grails.core.support.GrailsApplicationAware;

import org.grails.core.artefact.gsp.TagLibArtefactHandler;
import org.grails.core.exceptions.GrailsConfigurationException;
import org.grails.io.support.GrailsFactoriesLoader;
import org.grails.taglib.encoder.WithCodecHelper;
Expand Down Expand Up @@ -117,7 +117,7 @@ protected void registerNamespaceDispatcher(String namespace, NamespacedTagDispat
}

protected void registerTagLibraries() {
GrailsClass[] taglibs = this.grailsApplication.getArtefacts(TagLibArtefactHandler.TYPE);
GrailsClass[] taglibs = this.grailsApplication.getArtefacts(ArtefactTypes.TAG_LIBRARY);
for (GrailsClass grailsClass : taglibs) {
registerTagLib((GrailsTagLibClass) grailsClass, true);
}
Expand Down
1 change: 0 additions & 1 deletion grace-taglib/src/main/resources/META-INF/grails.factories

This file was deleted.

1 change: 1 addition & 0 deletions grace-web-gsp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dependencies {
api project(":grace-api")
api project(":grace-gsp")
compileOnly project(":grace-plugin-api")
api project(":grace-web")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2023 the original author or authors.
* Copyright 2004-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,12 +40,12 @@
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.context.ApplicationContext;

import grails.artefact.ArtefactTypes;
import grails.core.GrailsApplication;
import grails.core.gsp.GrailsTagLibClass;
import grails.util.Holders;

import org.grails.buffer.FastStringPrintWriter;
import org.grails.core.artefact.gsp.TagLibArtefactHandler;
import org.grails.gsp.GroovyPage;
import org.grails.taglib.GrailsTagException;

Expand Down Expand Up @@ -147,7 +147,7 @@ private GroovyObject getTagLib(String name) {
this.pageContext.setAttribute(TAG_LIBS_ATTRIBUTE, tagLibs);
}
GrailsTagLibClass tagLibClass = (GrailsTagLibClass) this.application.getArtefactForFeature(
TagLibArtefactHandler.TYPE, GroovyPage.DEFAULT_NAMESPACE + ':' + name);
ArtefactTypes.TAG_LIBRARY, GroovyPage.DEFAULT_NAMESPACE + ':' + name);

GroovyObject tagLib;
if (tagLibs.containsKey(tagLibClass.getFullName())) {
Expand Down
1 change: 1 addition & 0 deletions grace-web-taglib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dependencies {
compileOnly libs.jakarta.annotation.api
compileOnlyApi libs.jakarta.servlet
api project(":grace-api")
api project(":grace-taglib")
api project(":grace-web")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2023 the original author or authors.
* Copyright 2014-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,10 +20,10 @@
import org.codehaus.groovy.control.SourceUnit;
import org.codehaus.groovy.transform.GroovyASTTransformation;

import grails.artefact.ArtefactTypes;
import grails.gsp.TagLib;

import org.grails.compiler.injection.ArtefactTypeAstTransformation;
import org.grails.core.artefact.gsp.TagLibArtefactHandler;

/**
* A transformation that makes an Artefact on a {@link grails.gsp.TagLib}
Expand All @@ -37,7 +37,7 @@ public class TagLibArtefactTypeAstTransformation extends ArtefactTypeAstTransfor

@Override
protected String resolveArtefactType(SourceUnit sourceUnit, AnnotationNode annotationNode, ClassNode classNode) {
return TagLibArtefactHandler.TYPE;
return ArtefactTypes.TAG_LIBRARY;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2023 the original author or authors.
* Copyright 2011-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,12 +43,12 @@
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.SourceUnit;

import grails.artefact.ArtefactTypes;
import grails.artefact.TagLibrary;
import grails.compiler.ast.AstTransformer;
import grails.compiler.ast.GrailsArtefactClassInjector;

import org.grails.compiler.injection.GrailsASTUtils;
import org.grails.core.artefact.gsp.TagLibArtefactHandler;
import org.grails.taglib.TagOutput;
import org.grails.taglib.encoder.OutputContextLookupHelper;

Expand Down Expand Up @@ -104,7 +104,7 @@ public String[] getArtefactTypes() {
}

protected String getArtefactType() {
return TagLibArtefactHandler.TYPE;
return ArtefactTypes.TAG_LIBRARY;
}

@Override
Expand Down
6 changes: 0 additions & 6 deletions grace-web-taglib/src/main/resources/META-INF/grails.factories
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
grails.compiler.traits.TraitInjector=\
grails.compiler.traits.TagLibraryTraitInjector

org.grails.taglib.encoder.OutputContextLookup=\
org.grails.web.taglib.encoder.WebOutputContextLookup

grails.compiler.ast.ClassInjector=\
org.grails.compiler.web.taglib.TagLibraryTransformer