Skip to content

Commit d6031be

Browse files
committed
Integrate grails-gsp
1 parent f438f76 commit d6031be

File tree

519 files changed

+366
-4252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

519 files changed

+366
-4252
lines changed

.sdkmanrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Enable auto-env through the sdkman_auto_env config - https://sdkman.io/usage#env
22
java=17.0.12-librca
3+
gradle=8.13

README.md

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
# Grails Views
1+
# grails-views repo
22

33
[![Maven Central](https://img.shields.io/maven-central/v/org.grails/views-core.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/org.grails/views-core)
44
[![Java CI](https://github.com/grails/grails-views/actions/workflows/gradle.yml/badge.svg?event=push)](https://github.com/grails/grails-views/actions/workflows/gradle.yml)
55

6-
Additional View Technologies for Grails.
6+
This project contains view related technologies for the [Grails framework](https://grails.org).
77

8-
Initial implementation includes JSON views powered by Groovy's JsonBuilder.\
9-
However, this project provides the basis for implementing other view types.
8+
## Grails Server Pages (GSP)
9+
See [Grails Server Pages (GSP)](/gsp) for more information.
1010

11-
View [the latest documentation](https://views.grails.org/latest/views/guide/index.html) for details.
11+
## Additional Grails View Technologies
12+
See [grails-views](/views) for more information.
1213

13-
# Fields
14+
## Fields Plugin
15+
See [fields](/fields) for more information.
1416

15-
View [the latest documentation](https://views.grails.org/latest/fields/guide/index.html) for details.
17+
## Scaffolding
18+
See [scaffolding](/scaffolding) for more information.

build.gradle

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ buildscript {
1111
}
1212
}
1313

14+
ext {
15+
isCI = System.getenv('CI') != null
16+
}
17+
1418
String customGroovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION')
1519
if (customGroovyVersion) {
1620
logger.warn("Using custom Groovy version: $customGroovyVersion")
@@ -70,7 +74,16 @@ def publishedProjects = [
7074
'views-json-testing-support',
7175
'views-markup',
7276
'scaffolding',
73-
'fields-plugin'
77+
'fields-plugin',
78+
'grails-gsp',
79+
'grails-plugin-gsp',
80+
'grails-plugin-sitemesh3',
81+
'grails-taglib',
82+
'grails-web-gsp',
83+
'grails-web-gsp-taglib',
84+
'grails-web-jsp',
85+
'grails-web-taglib',
86+
'grails-web-testing-support'
7487
]
7588
subprojects {
7689
if (name in publishedProjects) {

buildSrc/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies {
2929
exclude group: 'org.grails.plugins', module: 'views-gradle'
3030
exclude group: 'org.grails.plugins', module: 'views-json'
3131
}
32-
implementation "org.asciidoctor:asciidoctor-gradle-jvm:${gradleProperties.asciidoctorVersion}"
3332
implementation "org.grails:grails-gradle-plugin"
3433
implementation "org.grails.plugins:views-gradle"
34+
implementation "org.grails:grails-docs"
3535
}
+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
# Grails Fields plugin
1+
# Grails Fields Plugin
22

33
The grails fields plugin simplifies working with forms in Grails by offering convenient and customizable ways to manage
44
field rendering, validation, and interactions. It provides an easy-to-use API that reduces the boilerplate code for
55
generating form fields, allowing developers to focus on building their applications rather than managing repetitive UI
66
logic.
77

8-
## Documentation
9-
For further information please see the full [Grails fields plugin documentation](https://grails.github.io/grails-views/latest/fields/guide).
8+
## Documentation
9+
10+
* Latest Guide - https://views.grails.org/latest/fields/guide
11+
* Latest API - https://views.grails.org/latest/fields/api
12+
13+
* Snapshot Guide - https://views.grails.org/snapshot/fields/guide
14+
* Snapshot API - https://views.grails.org/snapshot/fields/api

fields/docs/build.gradle

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
plugins {
2-
id 'groovy' // For groovydoc task
3-
}
4-
51
ext {
2+
guideTitle = 'Grails Fields Plugin'
3+
guideSubtitle = 'Grails Fields Plugin - customize the rendering of input fields for Grails artifacts'
4+
65
apiDocsProjects = [
76
'fields': [
87
docTitle : 'Grails Fields Plugin - ' + projectVersion,
@@ -26,11 +25,8 @@ ext {
2625
revnumber : projectVersion,
2726
setanchors : true,
2827
'source-highlighter': 'prettify',
29-
toc : 'left',
30-
toc2 : '',
31-
toclevels : '2',
3228
'version' : projectVersion,
33-
'sourcedir' : rootProject.layout.projectDirectory.dir('fields/src/main/groovy')
29+
'sourcedir' : rootProject.layout.projectDirectory.dir('fields/src/main/groovy').asFile.toString()
3430
]
3531
}
3632

fields/plugin/build.gradle

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ ext {
1313
pomTitle = 'Grails Fields Plugin'
1414
pomDescription = 'Customizable form-field rendering based on overrideable GSP template'
1515
pomDevelopers = [robfletcher: 'Rob Fletcher', graemerocher: "Graeme Rocher", sdelamo: "Sergio del Amo", sbglasius: 'Søren Berg Glasius']
16+
mavenSnapshotPublishUrl = 'https://repo.grails.org/grails/plugins3-snapshots-local'
1617
}
1718

1819
dependencies {
19-
implementation platform("org.grails:grails-bom:${grailsVersion}")
20+
implementation platform("org.grails:grails-bom:${grailsVersion}"), {
21+
exclude group: 'org.grails.plugins', module: 'gsp'
22+
}
2023

21-
compileOnly "org.grails.plugins:gsp"
24+
implementation project(':grails-plugin-gsp')
2225
compileOnly "org.grails:grails-plugin-controllers"
2326
compileOnly "org.springframework.boot:spring-boot-autoconfigure"
2427
compileOnly "org.springframework.boot:spring-boot-starter-actuator"
@@ -40,4 +43,4 @@ dependencies {
4043

4144
apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
4245
apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
43-
apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle')
46+
apply from: rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')

gradle.properties

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
projectVersion=7.0.0-SNAPSHOT
2-
2+
githubBranch = 7.0.x
33
javaVersion=17
44

5-
# when updating grails version, be sure to update the functional-tests-plugin as well
5+
# when updating grails version, be sure to update the views/gradle-plugin as well
66
grailsVersion=7.0.0-M3
7-
asciidoctorVersion=4.0.3
87
joddWotVersion=3.3.8
8+
commonsTextVersion=1.13.0
9+
elApiVersion=6.0.1
10+
jspApiVersion=4.0.0
11+
sitemeshVersion=3.2.2
12+
javassistVersion=3.30.2-GA
913

1014
micronautVersion=4.6.5
1115

gradle/docs-config.gradle

+85-21
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import org.asciidoctor.gradle.jvm.AsciidoctorTask
2-
3-
apply plugin: 'org.asciidoctor.jvm.convert'
4-
5-
configurations.register('documentation')
1+
apply plugin: 'groovy'
2+
apply plugin: 'org.grails.grails-doc'
63

74
dependencies {
8-
add('documentation', platform("org.grails:grails-bom:$grailsVersion"))
9-
add('documentation', 'com.github.javaparser:javaparser-core')
10-
add('documentation', 'org.apache.groovy:groovy-groovydoc')
5+
implementation platform("org.grails:grails-bom:$grailsVersion")
6+
implementation 'org.apache.groovy:groovy'
7+
implementation 'org.apache.groovy:groovy-groovydoc'
8+
implementation 'com.github.javaparser:javaparser-core'
119
}
1210

1311
tasks.register('pluginName') {
@@ -18,12 +16,18 @@ tasks.withType(Groovydoc).configureEach {
1816
def firstDocTitle
1917
def firstWindowTitle
2018
def sources = []
19+
def projectClasspath = [configurations.compileClasspath]
2120
rootProject.subprojects
2221
.findAll { it.name in (project.findProperty('apiDocsProjects') ?: []) }
2322
.each {
2423
firstDocTitle = firstDocTitle ?: (project.findProperty('apiDocsProjects') as Map)[it.name]['docTitle']
2524
firstWindowTitle = firstWindowTitle ?: (project.findProperty('apiDocsProjects') as Map)[it.name]['windowTitle']
2625
sources += it.files('src/main/groovy')
26+
if(it.file('src/ast/groovy').exists()) {
27+
sources += it.files('src/ast/groovy')
28+
}
29+
//TODO: FIXME: compileClasspath isn't detected
30+
//projectClasspath += it.configurations.compileClasspath
2731
}
2832
docTitle = firstDocTitle
2933
windowTitle = firstWindowTitle
@@ -33,26 +37,86 @@ tasks.withType(Groovydoc).configureEach {
3337
processScripts = false
3438
includeMainForScripts = false
3539
includeAuthor = false
36-
classpath = configurations.documentation
37-
groovyClasspath += configurations.documentation
40+
classpath = files(projectClasspath)
41+
groovyClasspath += files(projectClasspath)
42+
}
43+
44+
tasks.register('resolveGroovyVersion') {
45+
group = 'documentation'
46+
description = 'Resolve Groovy Version from the BOM'
47+
ext.resolved = configurations.compileClasspath
48+
.resolvedConfiguration
49+
.resolvedArtifacts
50+
.find {
51+
it.moduleVersion.id.group == 'org.apache.groovy' &&
52+
it.moduleVersion.id.name.contains('groovy')
53+
}.moduleVersion.id.version
54+
logger.lifecycle('Resolved Groovy version for Guide links: {}', resolved)
55+
}
56+
57+
// TODO: PublishGuide should eventually ensure the build directory exists
58+
tasks.register('docsBuild') {
59+
doFirst {
60+
project.layout.buildDirectory.get().asFile.mkdirs()
61+
}
62+
// Do not cache this task since the directory must exist if publishGuide is going to run
63+
outputs.upToDateWhen { false }
3864
}
3965

40-
tasks.named('asciidoctor', AsciidoctorTask) {
41-
sourceDir layout.projectDirectory.file('src/docs')
42-
sources { include 'index.adoc' }
43-
outputDir = layout.buildDirectory.file('docs')
44-
attributes findProperty('asciidoctorAttributes') as Map ?: [:]
45-
baseDirFollowsSourceDir()
46-
jvm {
47-
jvmArgs '--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED', '--add-opens', 'java.base/java.io=ALL-UNNAMED'
66+
tasks.register('publishGuide', grails.doc.gradle.PublishGuide) {
67+
group = 'documentation'
68+
description = 'Generate Guide'
69+
dependsOn('docsBuild', 'resolveGroovyVersion')
70+
71+
targetDir = project.layout.buildDirectory.dir('docs').get().asFile
72+
outputs.dir(targetDir) // ensure gradle understands what this task generates
73+
74+
String relativeProjectPath = rootProject.projectDir.toPath().relativize(project.projectDir.toPath()).toString()
75+
logger.lifecycle("${project.name} Relative project path: {}", relativeProjectPath)
76+
sourceRepo = "https://github.com/grails/grails-views/edit/${githubBranch}/${relativeProjectPath}/src/docs"
77+
sourceDir = project.layout.projectDirectory.dir('src/docs').getAsFile()
78+
inputs.dir(sourceDir) // ensure gradle understands what this task creates from
79+
propertiesFiles = [rootProject.layout.projectDirectory.file('gradle.properties').asFile]
80+
asciidoc = true
81+
resourcesDir = rootProject.layout.projectDirectory.dir('etc/layout').asFile
82+
properties = ([
83+
'safe' : 'UNSAFE', // Make sure any asciidoc security is disabled
84+
'version' : projectVersion,
85+
'title' : project.findProperty('guideTitle'),
86+
'subtitle' : project.findProperty('guideSubtitle'),
87+
// TODO: The javaee documentation has not been updated to jakarta
88+
'javaee' : 'https://docs.oracle.com/javaee/7/api/',
89+
'jakartaee' : 'https://jakarta.ee/specifications/platform/10/apidocs/',
90+
'javase' : 'https://docs.oracle.com/en/java/javase/17/docs/api/index.html',
91+
'groovyapi' : "https://docs.groovy-lang.org/${resolveGroovyVersion.resolved}/html/gapi/",
92+
'groovyjdk' : "https://docs.groovy-lang.org/${resolveGroovyVersion.resolved}/html/groovy-jdk/",
93+
'grailsapi' : "https://docs.grails.org/$grailsVersion/api/",
94+
'grailsdocs' : "https://docs.grails.org/$grailsVersion/",
95+
'gormapi' : 'https://gorm.grails.org/latest/api/',
96+
'springapi' : 'https://docs.spring.io/spring/docs/current/javadoc-api/',
97+
'commandLineRef': "https://docs.grails.org/$grailsVersion/ref/Command%20Line",
98+
'controllersRef': "https://docs.grails.org/$grailsVersion/ref/Controllers"
99+
] + project.findProperty('asciidoctorAttributes') as Map<String, String>) as Properties
100+
101+
doLast {
102+
File destination = project.layout.buildDirectory.file('docs/guide/index.html').get().asFile
103+
destination.delete()
104+
project.layout.buildDirectory.file('docs/guide/single.html').get().asFile.renameTo(destination)
105+
project.layout.buildDirectory.file('docs/index.html').get().asFile.text = '''
106+
<html lang="en">
107+
<head>
108+
<title>Redirecting...</title>
109+
<meta http-equiv="refresh" content="0; url=guide/index.html" />
110+
</head>
111+
<body></body>
112+
</html>
113+
'''.stripIndent(8)
48114
}
49-
inputs.dir(sourceDir)
50-
outputs.dir(outputDir)
51115
}
52116

53117
tasks.register('guideDocs', Copy) {
54118
group = 'documentation'
55-
dependsOn 'asciidoctor'
119+
dependsOn 'publishGuide'
56120
def sourceDir = layout.projectDirectory.dir('src/docs')
57121
def targetDir = layout.buildDirectory.dir('docs')
58122
outputs.dir(targetDir)
File renamed without changes.

gradle/test-config.gradle

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
tasks.withType(Test).configureEach {
22
useJUnitPlatform()
3-
testLogging { events 'passed', 'skipped', 'failed', 'standardOut', 'standardError' }
3+
testLogging {
4+
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
5+
showStandardStreams = true
6+
exceptionFormat = 'full'
7+
}
8+
if (isCI) {
9+
maxParallelForks = findProperty('testMaxParallelFork') ?: 2
10+
forkEvery = findProperty('testForkEvery') ?: 0
11+
} else {
12+
maxParallelForks = findProperty('testMaxParallelFork') ?: 4
13+
forkEvery = findProperty('testForkEvery') ?: 0
14+
}
15+
if (findProperty('testJvmArgs')) {
16+
jvmArgs = findProperty('testJvmArgs')
17+
}
418
}

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

grails-gsp/.gitignore

-8
This file was deleted.

grails-gsp/.sdkmanrc

-3
This file was deleted.

grails-gsp/ISSUE_TEMPLATE.md

-37
This file was deleted.

0 commit comments

Comments
 (0)