Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grails 7 updates: #220

Merged
merged 1 commit into from
Dec 3, 2024
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
7 changes: 4 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ jobs:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }}
MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }}
MAVEN_PUBLISH_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }}
with:
arguments: -Dorg.gradle.internal.publish.checksums.insecure=true publish
arguments: publish
docs:
if: github.event_name == 'push'
needs: build
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
id: publish
uses: gradle/gradle-build-action@v3
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
NEXUS_PUBLISH_NEXUS_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }}
NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SECRING_FILE: ${{ secrets.SECRING_FILE }}
Expand Down Expand Up @@ -86,10 +86,10 @@ jobs:
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
NEXUS_PUBLISH_NEXUS_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }}
NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }}
with:
arguments: |
findSonatypeStagingRepository
Expand Down
54 changes: 7 additions & 47 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ buildscript {
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion"
classpath "org.asciidoctor:asciidoctor-gradle-plugin:$asciidoctorGradlePlugin"
classpath "com.github.erdi:webdriver-binaries-gradle-plugin:$webdriverBinariesVersion"
}
}

Expand All @@ -14,26 +13,15 @@ version project.projectVersion

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin: "com.github.erdi.webdriver-binaries"
apply from:"https://raw.githubusercontent.com/grails/grails-common-build/v2.0.3/common-docs.gradle"
apply from:"./gradle/docs.gradle"
apply plugin:"org.grails.grails-plugin"
apply plugin:"org.grails.internal.grails-plugin-publish"
apply plugin:"org.grails.grails-publish"

repositories {
mavenCentral()
maven { url "https://repo.grails.org/grails/core" }
}

configurations {
all {
resolutionStrategy.eachDependency { DependencyResolveDetails details->
if (details.requested.group == 'org.seleniumhq.selenium') {
details.useVersion(seleniumVersion)
}
}
}
}

dependencies {
api "org.springframework.boot:spring-boot-starter-logging"
api "org.springframework.boot:spring-boot-autoconfigure"
Expand Down Expand Up @@ -61,43 +49,16 @@ dependencies {
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.grails:grails-web-testing-support"
testImplementation "org.mockito:mockito-core"
testImplementation("org.grails.plugins:geb") {
exclude group: 'org.gebish', module: 'geb-spock'
}

testImplementation "org.gebish:geb-spock:$gebVersion"

testRuntimeOnly "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion"
testRuntimeOnly "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion"
testRuntimeOnly "org.seleniumhq.selenium:selenium-safari-driver:$seleniumSafariDriverVersion"

testImplementation "org.seleniumhq.selenium:selenium-remote-driver:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-api:$seleniumVersion"
testImplementation "org.seleniumhq.selenium:selenium-support:$seleniumVersion"

integrationTestImplementation testFixtures("org.grails.plugins:geb:5.0.0-SNAPSHOT")
api "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:$concurrentlinkedhashmapLruVersion"
}

apply from: rootProject.file('gradle/testVerbose.gradle')

webdriverBinaries {
if (!System.getenv().containsKey('CI')) {
chromedriver "$chromeDriverVersion"
geckodriver "$geckodriverVersion"
}
}

tasks.withType(Test) {
systemProperty "geb.env", System.getProperty('geb.env')
systemProperty "geb.build.reportsDir", reporting.file("geb/integrationTest")
if (!System.getenv().containsKey('CI')) {
systemProperty 'webdriver.chrome.driver', System.getProperty('webdriver.chrome.driver')
systemProperty 'webdriver.gecko.driver', System.getProperty('webdriver.gecko.driver')
} else {
systemProperty 'webdriver.chrome.driver', "${System.getenv('CHROMEWEBDRIVER')}/chromedriver"
systemProperty 'webdriver.gecko.driver', "${System.getenv('GECKOWEBDRIVER')}/geckodriver"
}
}
//tasks.withType(Test) {
// systemProperty 'grails.geb.recording.mode', 'RECORD_FAILING'
//}

bootRun {
jvmArgs(
Expand All @@ -111,8 +72,7 @@ bootRun {
}

grailsPublish {
userOrg = 'grails'
githubSlug = 'grails/grails-cache'
githubSlug = project.githubSlug
license {
name = 'Apache-2.0'
}
Expand Down
17 changes: 6 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,15 @@ grailsVersion=7.0.0-SNAPSHOT
grailsGradlePluginVersion=7.0.0-SNAPSHOT
gormVersion=9.0.0-SNAPSHOT
gparsVersion=1.2.1
groovyVersion=4.0.23
githubSlug=grails/grails-cache
githubBranch=8.0.x
title=Cache Plugin
projectDesc=Provides AST transformations for caching method calls
groovyVersion=4.0.24
guide=../../guide
tags=../ref/Tags
gebVersion=7.0
seleniumVersion=4.25.0

webdriverBinariesVersion=3.2
chromeDriverVersion=126.0.6478.126
geckodriverVersion=0.32.2
seleniumSafariDriverVersion=4.25.0
# Docs
title=Grails Cache Plugin
githubSlug=grails/grails-cache
githubBranch=8.0.x
projectDesc="Provides AST transformations for caching method calls"

org.gradle.daemon=true
org.gradle.caching=true
Expand Down
158 changes: 158 additions & 0 deletions gradle/docs.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
buildscript {
repositories {
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-docs:${project.ext.properties.grailsDocsVersion ?: grailsVersion}"
}
}

apply plugin: 'java-library'
apply plugin: 'groovy'

def DOCUMENTATION_GROUP = 'Documentation'

def commonGithubOrg = 'grails'
def commonGithubSlug = 'grails-common-build'
def commonBranch = 'master'
def docResourcesDir = "${buildDir}/resources/${commonGithubSlug}-${commonBranch}/src/main/resources"

task prepareDocResources {
group = DOCUMENTATION_GROUP
description = 'Downloads common documentation resoruces and unzips them to build folder'
doLast {
ant.mkdir(dir:buildDir)
ant.get(src:"https://github.com/${commonGithubOrg}/${commonGithubSlug}/archive/${commonBranch}.zip", dest:"${buildDir}/resources.zip")
ant.unzip(src:"${buildDir}/resources.zip", dest:"${buildDir}/resources")
}
}

task copyLocalDocResources(type: Copy, dependsOn:prepareDocResources) {
group = DOCUMENTATION_GROUP
description = 'Copy local resources to build folder'
mustRunAfter prepareDocResources
from ('src/main/docs/resources')
into docResourcesDir
}

configurations {
documentation
}

dependencies {
if (configurations.find { it.name == 'documentation' }) {
documentation 'info.picocli:picocli:3.8.0'
documentation "org.fusesource.jansi:jansi:1.18"
documentation "jline:jline:2.14.6"
documentation "com.github.javaparser:javaparser-core:3.15.14"
documentation "org.codehaus.groovy:groovy:${groovyVersion}"
documentation "org.codehaus.groovy:groovy-ant:$groovyVersion"
documentation "org.codehaus.groovy:groovy-cli-picocli:$groovyVersion"
}
}

subprojects {

configurations {
documentation
}

dependencies {
if (configurations.find { it.name == 'documentation' }) {
documentation "org.fusesource.jansi:jansi:1.18"
documentation "jline:jline:2.14.6"
documentation "com.github.javaparser:javaparser-core:3.15.14"
documentation "org.codehaus.groovy:groovy:${groovyVersion}"
documentation "org.codehaus.groovy:groovy-ant:$groovyVersion"
documentation "org.codehaus.groovy:groovy-dateutil:$groovyVersion"
documentation "org.codehaus.groovy:groovy-cli-picocli:$groovyVersion"
}
}

groovydoc.classpath += configurations.documentation
}

def cleanTask = project.tasks.findByName("clean")
if(cleanTask == null) {
task clean(type: Delete) {
delete(buildDir)
}
}
else {
cleanTask.doLast {
ant.delete(dir:"build/docs")
}
}

tasks.withType(Groovydoc) {
group = DOCUMENTATION_GROUP
docTitle = "${project.title} - ${project.version}"
destinationDir = project.file("build/docs/api")
def files = []
project.rootProject.subprojects
.findAll { !it.name != 'docs' && !it.name.startsWith('examples') }
.each { subproject ->
if(subproject.file('src/main/groovy').exists()) {
files += subproject.files("src/main/groovy")
}
}
if(project.file('src/main/groovy').exists()) {
files += project.files("src/main/groovy")
}
source = files
classpath += configurations.documentation
}

task publishGuide(type: grails.doc.gradle.PublishGuide) {
group = DOCUMENTATION_GROUP
description = 'Generate Guide'
dependsOn copyLocalDocResources

targetDir = project.file("${buildDir}/docs")
sourceRepo = "https://github.com/${githubSlug}/edit/${githubBranch}/src/main/docs"
sourceDir = new File(projectDir, "src/main/docs")
propertiesFiles = [ new File(rootProject.projectDir, "gradle.properties") ]
asciidoc = true
resourcesDir = project.file(docResourcesDir)
properties = [
'safe':'UNSAFE',
'version': project.version,
'subtitle': project.projectDesc,
'api': '../api',
'sourceDir':rootProject.projectDir.absolutePath,
'sourcedir':rootProject.projectDir.absolutePath,
'javaee': 'https://docs.oracle.com/javaee/7/api/',
'javase': 'https://docs.oracle.com/javase/7/docs/api/',
'groovyapi': 'http://docs.groovy-lang.org/latest/html/gapi/',
'grailsapi': 'http://docs.grails.org/latest/api/',
'gormapi': 'http://gorm.grails.org/latest/api/',
'springapi': 'https://docs.spring.io/spring/docs/current/javadoc-api/'
]
doLast {
ant.move(file:"${project.buildDir}/docs/guide/single.html",
tofile:"${project.buildDir}/docs/guide/index.html", overwrite:true)
new File(project.buildDir, "docs/index.html").text = '''
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="refresh" content="0; url=guide/index.html" />
</head>

</body>
</html>
'''
}
}

task docs(dependsOn:[groovydoc, publishGuide]) {
group = DOCUMENTATION_GROUP
}

def assembleTask = project.tasks.findByName("assemble")
if(assembleTask == null) {
task assemble(dependsOn: docs, type:Zip) {
baseName = "${project.name}-${project.version}"
destinationDir = new File(project.buildDir, "distributions")
from project.files("${buildDir}/docs")
}
}
2 changes: 1 addition & 1 deletion grails-app/views/demo/blockCache.gsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta name="layout" content="grails-cache"/>
<meta name="layout" content="main"/>
</head>
<body>
<cache:block>
Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/demo/blockCacheTTL.gsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta name="layout" content="grails-cache"/>
<meta name="layout" content="main"/>
</head>
<body>
<cache:block ttl="$ttl">
Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/demo/renderTag.gsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta name="layout" content="grails-cache"/>
<meta name="layout" content="main"/>
</head>
<body>

Expand Down
2 changes: 1 addition & 1 deletion grails-app/views/demo/renderTagTTL.gsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<meta name="layout" content="grails-cache"/>
<meta name="layout" content="main"/>
</head>
<body>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.demo

import geb.spock.GebSpec
import grails.plugin.geb.ContainerGebSpec
import grails.testing.mixin.integration.Integration
import spock.lang.Requires
import java.util.concurrent.TimeUnit

@Integration
class CacheTagIntegrationSpec extends GebSpec {
class CacheTagIntegrationSpec extends ContainerGebSpec {

@Requires({sys['geb.env']})
void 'test clear cache'() {
when:
go '/demo/clearBlocksCache'
Expand All @@ -23,7 +21,6 @@ class CacheTagIntegrationSpec extends GebSpec {
browser.driver.pageSource.contains 'cleared templates cache'
}

@Requires({sys['geb.env']})
void 'test block tag'() {
when:
go '/demo/blockCache?counter=5'
Expand Down
Loading
Loading