Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 0ec11ca

Browse files
authored
Patch for 5.0.x (#70)
* fix: grails-core issue 13324 * chore: Back to snapshot (5.0.1 release failed) * build: update faulty build config * fix: revert removal of deprecated class * build: extend nexus publishing transition check period * build: update faulty build config * build(style): Consistent use of quotes * test: Extend timout in PubSubSpec
1 parent 48e636a commit 0ec11ca

File tree

6 files changed

+98
-26
lines changed

6 files changed

+98
-26
lines changed

build.gradle

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'groovy'
33
id 'io.github.gradle-nexus.publish-plugin'
4-
id "org.asciidoctor.jvm.convert" version "4.0.0-alpha.1"
4+
id 'org.asciidoctor.jvm.convert' version '4.0.0-alpha.1'
55
}
66

77
version = projectVersion
@@ -28,8 +28,8 @@ if(isReleaseVersion) {
2828
}
2929
}
3030
transitionCheckOptions {
31-
maxRetries = 40
32-
delayBetween = java.time.Duration.ofSeconds 2
31+
maxRetries = 50
32+
delayBetween = java.time.Duration.ofSeconds(3)
3333
}
3434
}
3535
}
@@ -47,36 +47,36 @@ dependencies {
4747
}
4848

4949
tasks.withType(Groovydoc).configureEach {
50-
group = "documentation"
50+
group = 'documentation'
5151
docTitle = "${project.title} - ${project.version}"
52-
destinationDir = project.file("build/docs/api")
52+
destinationDir = project.file('build/docs/api')
5353
def files = []
5454
project.rootProject.subprojects
5555
.findAll { !it.name != 'docs' && !it.name.startsWith('examples') }
5656
.each { subproject ->
5757
if(subproject.file('src/main/groovy').exists()) {
58-
files += subproject.files("src/main/groovy")
58+
files += subproject.files('src/main/groovy')
5959
}
6060
}
6161
if(project.file('src/main/groovy').exists()) {
62-
files += project.files("src/main/groovy")
62+
files += project.files('src/main/groovy')
6363
}
6464
source = files
6565
classpath = configurations.documentation
6666
}
6767

68-
tasks.register("publishGuide", grails.doc.gradle.PublishGuide) {
69-
group = "documentation"
68+
tasks.register('publishGuide', grails.doc.gradle.PublishGuide) {
69+
group = 'documentation'
7070
description = 'Generate Guide'
71-
dependsOn = ["groovydoc"]
72-
mustRunAfter = ["jar"]
71+
dependsOn = ['groovydoc']
72+
mustRunAfter = ['jar']
7373

7474
targetDir = project.file("${buildDir}/docs")
7575
sourceRepo = "https://github.com/${githubSlug}/edit/${githubBranch}/src/main/docs"
76-
sourceDir = new File(projectDir, "src/main/docs")
77-
propertiesFiles = [new File(rootProject.projectDir, "gradle.properties")]
76+
sourceDir = new File(projectDir, 'src/main/docs')
77+
propertiesFiles = [new File(rootProject.projectDir, 'gradle.properties')]
7878
asciidoc = true
79-
resourcesDir = project.layout.projectDirectory.dir("src/main/docs/resources").asFile
79+
resourcesDir = project.layout.projectDirectory.dir('src/main/docs/resources').asFile
8080
properties = [
8181
'safe' : 'UNSAFE',
8282
'version' : project.version,
@@ -94,7 +94,7 @@ tasks.register("publishGuide", grails.doc.gradle.PublishGuide) {
9494
doLast {
9595
ant.move(file: "${project.buildDir}/docs/guide/single.html",
9696
tofile: "${project.buildDir}/docs/guide/index.html", overwrite: true)
97-
new File(project.buildDir, "docs/index.html").text = '''
97+
new File(project.buildDir, 'docs/index.html').text = '''
9898
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
9999
<html lang="en">
100100
<head>
@@ -107,13 +107,13 @@ tasks.register("publishGuide", grails.doc.gradle.PublishGuide) {
107107
}
108108
}
109109

110-
tasks.register("docs") {
111-
group = "documentation"
112-
dependsOn = ["groovydoc", "publishGuide"]
110+
tasks.register('docs') {
111+
group = 'documentation'
112+
dependsOn = ['groovydoc', 'publishGuide']
113113
}
114114

115-
tasks.named("build").configure {
116-
finalizedBy("docs")
115+
tasks.named('build') {
116+
finalizedBy('docs')
117117
}
118118

119119
subprojects {

examples/pubsub-demo/src/integration-test/groovy/pubsub/demo/PubSubSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class PubSubSpec extends Specification {
2424
sumService.sum(1, 2)
2525

2626
then: 'the subscriber should receive the events'
27-
new PollingConditions(timeout: 2).eventually {
27+
new PollingConditions(timeout: 5).eventually {
2828
totalService.accumulatedTotal == 6
2929
}
3030
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
projectVersion=5.0.1
1+
projectVersion=5.0.1-SNAPSHOT
22

33
# These versions have to be defined here for usage in settings.gradle
44
# (versions in settings.gradle cannot be set from the version catalog)

gradle/grails-plugin-config.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
group = 'org.grails.plugins'
22

3-
tasks.named('bootJar').configure {
3+
tasks.named('bootJar') {
44
enabled = false // Grails plugins shouldn't produce a boot jar
55
}
6-
tasks.named('jar').configure {
6+
tasks.named('jar') {
77
enabled = true
88
archiveClassifier = '' // Skip the '-plain' suffix on the jar file name
99
}

grails-plugin-async/build.gradle

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,19 @@ plugins {
1414
dependencies {
1515

1616
api project(':grails-async-core')
17-
api project(':grails-events-compat')
18-
api project(':grails-events-core')
17+
18+
// This project does not really depend on the events plugin
19+
// but rather on the events-core and events-compat modules.
20+
// This is a workaround because without this, plugins created with
21+
// pre-Grails 3.3 will not get the events plugin automatically
22+
// on the classpath and will get an error.
23+
// (The async plugin is automatically added to the classpath by
24+
// grails-core/grails-dependencies and now also the events plugin
25+
// should be pulled in)
26+
// https://github.com/grails/grails-core/issues/13324
27+
api project(':grails-plugin-events')
28+
//api project(':grails-events-compat')
29+
//api project(':grails-events-core')
1930

2031
implementation 'org.grails:grails-core'
2132
implementation 'org.grails:grails-plugin-controllers'
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright 2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package grails.artefact
17+
18+
import grails.async.web.AsyncGrailsWebRequest
19+
import grails.events.Events
20+
import org.grails.web.util.GrailsApplicationAttributes
21+
import groovy.transform.CompileStatic
22+
import org.springframework.web.context.request.async.AsyncWebRequest
23+
import org.springframework.web.context.request.async.WebAsyncManager
24+
import org.springframework.web.context.request.async.WebAsyncUtils
25+
26+
import javax.servlet.AsyncContext
27+
import javax.servlet.http.HttpServletRequest
28+
29+
import org.grails.plugins.web.async.GrailsAsyncContext
30+
import org.grails.web.servlet.mvc.GrailsWebRequest
31+
import org.springframework.web.context.request.RequestContextHolder
32+
33+
/**
34+
*
35+
* @author Jeff Brown
36+
* @since 3.0
37+
* @deprecated Use {@link grails.async.web.AsyncController} instead
38+
*/
39+
@CompileStatic
40+
@Deprecated
41+
trait AsyncController extends Events {
42+
43+
/**
44+
* Raw access to the Servlet 3.0 startAsync method
45+
*
46+
* @return a new {@link javax.servlet.AsyncContext}
47+
*/
48+
AsyncContext startAsync() {
49+
GrailsWebRequest webRequest = (GrailsWebRequest)RequestContextHolder.currentRequestAttributes()
50+
51+
HttpServletRequest request = webRequest.currentRequest
52+
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request)
53+
54+
AsyncWebRequest asyncWebRequest = new AsyncGrailsWebRequest(request, webRequest.currentResponse, webRequest.servletContext)
55+
asyncManager.setAsyncWebRequest(asyncWebRequest)
56+
57+
asyncWebRequest.startAsync()
58+
request.setAttribute(GrailsApplicationAttributes.ASYNC_STARTED, true)
59+
new GrailsAsyncContext(asyncWebRequest.asyncContext, webRequest)
60+
}
61+
}

0 commit comments

Comments
 (0)