From acba56d5c21b3c46c3f2ee7a05d37ad2005b134a Mon Sep 17 00:00:00 2001 From: aaron Date: Tue, 15 Oct 2024 14:46:33 -0400 Subject: [PATCH 01/15] grails-156: Commit paritally working code for help --- .github/workflows/gradle.yml | 12 +- .github/workflows/release.yml | 12 +- build.gradle | 44 +++--- buildSrc/build.gradle | 10 ++ examples/redis-demo/build.gradle | 84 +++++++----- .../redis-demo/grails-app/conf/logback.groovy | 28 ---- .../redis-demo/grails-app/conf/logback.xml | 13 ++ .../init/com/example/Application.groovy | 2 + gradle.properties | 17 ++- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 3 +- plugin/build.gradle | 125 +++--------------- plugin/grails-app/conf/logback.groovy | 28 ---- plugin/grails-app/conf/logback.xml | 13 ++ .../groovy/redis/RedisGrailsPlugin.groovy | 2 +- .../plugins/redis/RedisTagLibSpec.groovy | 2 +- settings.gradle | 45 ++++--- 17 files changed, 189 insertions(+), 253 deletions(-) create mode 100644 buildSrc/build.gradle delete mode 100644 examples/redis-demo/grails-app/conf/logback.groovy create mode 100644 examples/redis-demo/grails-app/conf/logback.xml delete mode 100644 plugin/grails-app/conf/logback.groovy create mode 100644 plugin/grails-app/conf/logback.xml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 26f4c672..35d71982 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -19,8 +19,8 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: 11 + distribution: 'liberica' + java-version: 17 - name: Setup Redis uses: supercharge/redis-github-action@1.8.0 with: @@ -42,8 +42,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: 11 + distribution: 'liberica' + java-version: 17 - name: Publish Artifacts (repo.grails.org) id: publish uses: gradle/gradle-build-action@v2 @@ -70,5 +70,5 @@ jobs: BRANCH: gh-pages FOLDER: plugin/build/docs DOC_FOLDER: gh-pages - COMMIT_EMAIL: behlp@unityfoundation.io - COMMIT_NAME: Puneet Behl \ No newline at end of file + COMMIT_EMAIL: 'grails-build@users.noreply.github.com' + COMMIT_NAME: 'grails-build' \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5aab3efc..a2178aae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,8 +6,8 @@ jobs: release: runs-on: ubuntu-latest env: - GIT_USER_NAME: puneetbehl - GIT_USER_EMAIL: behlp@unityfoundation.io + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' steps: - name: Checkout repository uses: actions/checkout@v4 @@ -16,8 +16,8 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - distribution: 'adopt' - java-version: '11' + distribution: 'liberica' + java-version: '17' - name: Set the current release version id: release_version run: echo ::set-output name=release_version::${GITHUB_REF:11} @@ -60,8 +60,8 @@ jobs: BRANCH: gh-pages FOLDER: plugin/build/docs DOC_FOLDER: gh-pages - COMMIT_EMAIL: behlp@unityfoundation.io - COMMIT_NAME: Puneet Behl + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} VERSION: ${{ steps.release_version.outputs.release_version }} - name: Run post-release if: success() diff --git a/build.gradle b/build.gradle index 1e6bd7ed..827276d6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,13 @@ + plugins { - id 'io.github.gradle-nexus.publish-plugin' version '1.3.0' + id "java-library" + id "org.grails.internal.grails-plugin-publish" + id "org.grails.grails-gsp" + id "org.grails.grails-plugin" } -ext.isSnapshot = project.projectVersion.endsWith('-SNAPSHOT') -ext.isReleaseVersion = !isSnapshot -ext."signing.keyId" = project.hasProperty("signing.keyId") ? project.getProperty('signing.keyId') : System.getenv('SIGNING_KEY') -ext."signing.secretKeyRingFile" = project.hasProperty("signing.secretKeyRingFile") ? project.getProperty('signing.secretKeyRingFile') : "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg" -ext."signing.password" = project.hasProperty("signing.password") ? project.getProperty('signing.password') : System.getenv('SIGNING_PASSPHRASE') - version = project.projectVersion +group = 'org.grails.plugins' allprojects { @@ -24,21 +23,20 @@ allprojects { } } -if (isReleaseVersion) { - apply plugin: "io.github.gradle-nexus.publish-plugin" - - nexusPublishing { - repositories { - sonatype { - def ossUser = System.getenv("SONATYPE_USERNAME") ?: project.hasProperty("sonatypeOssUsername") ? project.sonatypeOssUsername : '' - def ossPass = System.getenv("SONATYPE_PASSWORD") ?: project.hasProperty("sonatypeOssPassword") ? project.sonatypeOssPassword : '' - def ossStagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID") ?: project.hasProperty("sonatypeOssStagingProfileId") ? project.sonatypeOssStagingProfileId : '' - nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") - snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") - username = ossUser - password = ossPass - stagingProfileId = ossStagingProfileId - } - } +dependencyManagement { + imports { + mavenBom "org.grails:grails-bom:$grailsVersion" } + applyMavenExclusions false } + +grailsPublish { + userOrg = 'grails' + githubSlug = 'grails/redis' + license { + name = 'Apache-2.0' + } + title = 'Grails Redis Plugin' + desc = 'This Plugin provides access to Redis and various utilities(service, annotations, etc) for caching.' + developers = [puneetbehl: 'Puneet Behl'] +} \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000..634c55dd --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,10 @@ +repositories { + mavenCentral() + maven { url "https://repo.grails.org/grails/core" } + gradlePluginPortal() +} +dependencies { + //Trying to pull the property from grailsGradlePluginVersion threw an error + implementation "com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0" + implementation "org.grails:grails-gradle-plugin:7.0.0-SNAPSHOT" +} \ No newline at end of file diff --git a/examples/redis-demo/build.gradle b/examples/redis-demo/build.gradle index ebf23cb5..39509ec3 100644 --- a/examples/redis-demo/build.gradle +++ b/examples/redis-demo/build.gradle @@ -1,28 +1,39 @@ -buildscript { - repositories { - maven { url "https://repo.grails.org/grails/core" } - } - dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" - classpath "com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0" - } -} - -version "0.1" -group "com.example" -apply plugin: "war" -apply plugin: 'eclipse' -apply plugin: 'idea' -apply plugin: "org.grails.grails-web" -apply plugin:"com.bertramlabs.asset-pipeline" -apply plugin: "org.grails.grails-gsp" +plugins { + id "war" + id 'eclipse' + id 'idea' + id "org.grails.grails-web" + id "com.bertramlabs.asset-pipeline" + id "org.grails.grails-gsp" +} +version = "0.1" +group = "com.example" assets { minifyJs = true minifyCss = true } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } +} + +configurations.configureEach { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if ((details.requested.group == 'org.codehaus.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.name != 'groovy-bom') { + String groovyVersion = findProperty('groovyVersion') ?: libs.versions.groovy.get() + details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: groovyVersion) + details.because "The dependency coordinates are changed in Apache Groovy 4, plus ensure version" + } + } + resolutionStrategy.dependencySubstitution { + substitute(module("org.codehaus.groovy:groovy-bom:3.0.8")).using(module("org.apache.groovy:groovy-bom:$groovyVersion")) + } +} + repositories { mavenCentral() maven { url "https://repo.grails.org/grails/core" } @@ -31,33 +42,34 @@ repositories { dependencies { implementation "org.springframework.boot:spring-boot-starter-logging" implementation "org.springframework.boot:spring-boot-autoconfigure" - implementation "org.grails:grails-core" implementation "org.springframework.boot:spring-boot-starter-actuator" implementation "org.springframework.boot:spring-boot-starter-tomcat" - implementation "org.grails:grails-web-boot" - implementation "org.grails:grails-logging" - implementation "org.grails:grails-plugin-rest" - implementation "org.grails:grails-plugin-databinding" - implementation "org.grails:grails-plugin-i18n" - implementation "org.grails:grails-plugin-services" - implementation "org.grails:grails-plugin-url-mappings" - implementation "org.grails:grails-plugin-interceptors" + implementation "org.grails:grails-core:$grailsVersion" - implementation "org.grails.plugins:cache:5.0.1" - implementation "org.grails.plugins:async" - implementation "org.grails.plugins:scaffolding" + implementation "org.grails:grails-web-boot:$grailsVersion" + implementation "org.grails:grails-logging:$grailsVersion" + implementation "org.grails:grails-plugin-rest:$grailsVersion" + implementation "org.grails:grails-plugin-databinding:$grailsVersion" + implementation "org.grails:grails-plugin-i18n:$grailsVersion" + implementation "org.grails:grails-plugin-services:$grailsVersion" + implementation "org.grails:grails-plugin-url-mappings:$grailsVersion" + implementation "org.grails:grails-plugin-interceptors:$grailsVersion" + + implementation "org.grails.plugins:cache:$cacheVersion" + implementation "org.grails.plugins:async:$asyncVersion" + implementation "org.grails.plugins:scaffolding:$scaffoldingVersion" implementation "org.grails.plugins:events" - implementation "org.grails.plugins:hibernate5" - implementation "org.hibernate:hibernate-core:5.4.18.Final" + implementation "org.grails.plugins:hibernate5:$grailHibernateVersion" + implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" implementation project(':grails-redis') implementation "org.grails.plugins:gsp" console "org.grails:grails-console" profile "org.grails.profiles:web" - runtimeOnly "org.glassfish.web:el-impl:2.1.2-b03" + runtimeOnly "org.glassfish.expressly:expressly:5.0.0" runtimeOnly "com.h2database:h2" runtimeOnly "org.apache.tomcat:tomcat-jdbc" - runtimeOnly "javax.xml.bind:jaxb-api:2.3.1" + runtimeOnly 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2' runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:4.3.0" @@ -82,3 +94,7 @@ assets { minifyJs = true minifyCss = true } + +test { + useJUnitPlatform() +} diff --git a/examples/redis-demo/grails-app/conf/logback.groovy b/examples/redis-demo/grails-app/conf/logback.groovy deleted file mode 100644 index 5b2d1e35..00000000 --- a/examples/redis-demo/grails-app/conf/logback.groovy +++ /dev/null @@ -1,28 +0,0 @@ -import grails.util.BuildSettings -import grails.util.Environment - - -// See http://logback.qos.ch/manual/groovy.html for details on configuration -appender('STDOUT', ConsoleAppender) { - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } -} - -root(ERROR, ['STDOUT']) - -if(Environment.current == Environment.DEVELOPMENT) { - def targetDir = BuildSettings.TARGET_DIR - if(targetDir) { - - appender("FULL_STACKTRACE", FileAppender) { - - file = "${targetDir}/stacktrace.log" - append = true - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } - } - logger("StackTrace", ERROR, ['FULL_STACKTRACE'], false ) - } -} diff --git a/examples/redis-demo/grails-app/conf/logback.xml b/examples/redis-demo/grails-app/conf/logback.xml new file mode 100644 index 00000000..725d75e9 --- /dev/null +++ b/examples/redis-demo/grails-app/conf/logback.xml @@ -0,0 +1,13 @@ + + + + + UTF-8 + %level %logger - %msg%n + + + + + + + \ No newline at end of file diff --git a/examples/redis-demo/grails-app/init/com/example/Application.groovy b/examples/redis-demo/grails-app/init/com/example/Application.groovy index 1c6520d1..f88e4caf 100644 --- a/examples/redis-demo/grails-app/init/com/example/Application.groovy +++ b/examples/redis-demo/grails-app/init/com/example/Application.groovy @@ -2,7 +2,9 @@ package com.example import grails.boot.GrailsApp import grails.boot.config.GrailsAutoConfiguration +import groovy.transform.CompileStatic +@CompileStatic class Application extends GrailsAutoConfiguration { static void main(String[] args) { GrailsApp.run(Application) diff --git a/gradle.properties b/gradle.properties index 9c9a35dc..bfe6e151 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,19 @@ projectVersion=5.0.0-SNAPSHOT -grailsVersion=6.1.1 -grailsGradlePluginVersion=6.1.1 + +asyncVersion=6.0.0-SNAPSHOT +cacheVersion=8.0.0-SNAPSHOT +commonsPool2Version=2.12.0 +grailsGradlePluginVersion=7.0.0-SNAPSHOT +grailHibernateVersion=9.0.0-SNAPSHOT +grailsVersion=7.0.0-SNAPSHOT +groovyVersion=4.0.23 +gsonVersion=2.11.0 +hibernate5Version=5.6.15.Final +javaparserVersion=3.26.2 +jredisVersion=5.2.0 +scaffoldingVersion=6.0.0-SNAPSHOT + org.gradle.caching=true org.gradle.daemon=true org.gradle.parallel=true org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M -commons-pool2.version=2.11.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b1624c47..5c40527d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d..f2670460 100755 --- a/gradlew +++ b/gradlew @@ -15,7 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # - +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # # Gradle start up script for POSIX generated by Gradle. diff --git a/plugin/build.gradle b/plugin/build.gradle index 1cbcaaa0..955026e6 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -1,33 +1,17 @@ -buildscript { - repositories { - maven { url "https://repo.grails.org/grails/core" } - } - dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" - } -} - plugins { - id 'maven-publish' - id 'idea' - id 'eclipse' - id 'signing' - id 'java-library' + id "java-library" + id "eclipse" + id "idea" + id "org.grails.grails-plugin" } -apply plugin: 'signing' -apply plugin: "org.grails.grails-plugin" -apply plugin: "org.grails.grails-gsp" - -version project.projectVersion -group "org.grails.plugins" +version = project.projectVersion +group = "org.grails.plugins" -sourceCompatibility = 1.11 -targetCompatibility = 1.11 - -repositories { - mavenCentral() - maven { url "https://repo.grails.org/grails/core" } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(17) + } } dependencyManagement { @@ -41,11 +25,16 @@ configurations { documentation.extendsFrom compileClasspath all { resolutionStrategy { - force 'org.apache.commons:commons-pool2:2.12.0' + force "org.apache.commons:commons-pool2:$commonsPool2Version" } } } +repositories { + mavenCentral() + maven { url "https://repo.grails.org/grails/core" } +} + dependencies { implementation 'org.springframework.boot:spring-boot-starter-logging' implementation "org.springframework.boot:spring-boot-starter-actuator" @@ -56,91 +45,21 @@ dependencies { testImplementation 'org.grails:grails-web-testing-support' - console "org.grails:grails-console" + implementation "org.grails:grails-console" - api 'redis.clients:jedis:5.1.0' - api 'com.google.code.gson:gson:2.10.1' + api "redis.clients:jedis:$jredisVersion" + api "com.google.code.gson:gson:$gsonVersion" - documentation('com.github.javaparser:javaparser-core:3.25.7') { + documentation("com.github.javaparser:javaparser-core:$javaparserVersion") { transitive = false } } -groovydoc { - groovyClasspath += configurations.documentation +test { + useJUnitPlatform() } jar { exclude "application.groovy" exclude "src/test/projects/**" } - -publishing { - - if (isSnapshot) { - repositories { - maven { - credentials { - def u = System.getenv("ARTIFACTORY_USERNAME") ?: project.hasProperty("artifactoryPublishUsername") ? project.artifactoryPublishUsername : '' - def p = System.getenv("ARTIFACTORY_PASSWORD") ?: project.hasProperty("artifactoryPublishPassword") ? project.artifactoryPublishPassword : '' - username = u - password = p - } - url "https://repo.grails.org/grails/plugins3-snapshots-local" - } - } - } - - publications { - maven(MavenPublication) { - - groupId = project.group - version = project.version - - from components.java - - artifact sourcesJar - artifact javadocJar - - pom { - name = 'Grails Redis Plugin' - description = 'This Plugin provides access to Redis and various utilities(service, annotations, etc) for caching.' - url = 'https://github.com/grails/grails-redis' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id = 'ctoestreich' - name = 'Christian Oestreich' - } - developer { - id = 'puneetbehl' - name = 'Puneet Behl' - email = 'behlp@unityfoundation.io' - } - } - scm { - connection = 'scm:git:git://github.com/grails/grails-redis.git' - developerConnection = 'scm:git:ssh://github.com:/grails/grails-redis.git' - url = 'https://github.com/grails/grails-redis/' - } - } - } - } -} - -if (isReleaseVersion) { - afterEvaluate { - signing { - sign publishing.publications.maven - } - } -} - -tasks.withType(Sign) { - onlyIf { isReleaseVersion } -} diff --git a/plugin/grails-app/conf/logback.groovy b/plugin/grails-app/conf/logback.groovy deleted file mode 100644 index 5b2d1e35..00000000 --- a/plugin/grails-app/conf/logback.groovy +++ /dev/null @@ -1,28 +0,0 @@ -import grails.util.BuildSettings -import grails.util.Environment - - -// See http://logback.qos.ch/manual/groovy.html for details on configuration -appender('STDOUT', ConsoleAppender) { - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } -} - -root(ERROR, ['STDOUT']) - -if(Environment.current == Environment.DEVELOPMENT) { - def targetDir = BuildSettings.TARGET_DIR - if(targetDir) { - - appender("FULL_STACKTRACE", FileAppender) { - - file = "${targetDir}/stacktrace.log" - append = true - encoder(PatternLayoutEncoder) { - pattern = "%level %logger - %msg%n" - } - } - logger("StackTrace", ERROR, ['FULL_STACKTRACE'], false ) - } -} diff --git a/plugin/grails-app/conf/logback.xml b/plugin/grails-app/conf/logback.xml new file mode 100644 index 00000000..725d75e9 --- /dev/null +++ b/plugin/grails-app/conf/logback.xml @@ -0,0 +1,13 @@ + + + + + UTF-8 + %level %logger - %msg%n + + + + + + + \ No newline at end of file diff --git a/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy b/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy index 46d2abe6..37be3b17 100644 --- a/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy +++ b/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy @@ -10,7 +10,7 @@ import redis.clients.jedis.Protocol class RedisGrailsPlugin extends Plugin { - def grailsVersion = "3.0.0 > *" + def grailsVersion = "7.0.0 > *" def pluginExcludes = [ "codenarc.properties", "grails-app/conf/**", diff --git a/plugin/src/test/groovy/grails/plugins/redis/RedisTagLibSpec.groovy b/plugin/src/test/groovy/grails/plugins/redis/RedisTagLibSpec.groovy index d1395529..c5ee188b 100644 --- a/plugin/src/test/groovy/grails/plugins/redis/RedisTagLibSpec.groovy +++ b/plugin/src/test/groovy/grails/plugins/redis/RedisTagLibSpec.groovy @@ -21,7 +21,7 @@ class RedisTagLibSpec extends Specification { def setup() { redisService.flushDB() - tagLib = grailsApplication.mainContext.getBean(RedisTagLib) + tagLib= grailsApplication.mainContext.getBean(RedisTagLib) } @Ignore diff --git a/settings.gradle b/settings.gradle index d517cfcc..284801ed 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,35 +1,44 @@ plugins { - id "com.gradle.enterprise" version "3.16.1" - id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1' + id "com.gradle.develocity" version "3.18.1" + id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2' } -gradleEnterprise { +def isCI = System.getenv('CI') != null +def isLocal = !isCI +def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null +def isBuildCacheAuthenticated = + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') != null && + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') != null + +develocity { server = 'https://ge.grails.org' buildScan { - publishAlways() - publishIfAuthenticated() - uploadInBackground = System.getenv("CI") == null - capture { - taskInputFiles = true - } + publishing.onlyIf { isAuthenticated } + uploadInBackground = isLocal } - } buildCache { - local { enabled = System.getenv('CI') != 'true' } - remote(gradleEnterprise.buildCache) { - def isAuthenticated = System.getenv('GRADLE_ENTERPRISE_ACCESS_KEY') - push = System.getenv('CI') == 'true' && isAuthenticated + local { enabled = isLocal } + remote(develocity.buildCache) { + push = isCI && isBuildCacheAuthenticated enabled = true - }} + usernameAndPassword( + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: '', + System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: '' + ) + } +} +rootProject.name = "grails-redis" include "examples-redis-demo" -project(":examples-redis-demo").projectDir = new File(settingsDir, "examples/redis-demo") - include 'plugin' + +project(":examples-redis-demo").projectDir = [settingsDir, 'examples/redis-demo'] as File + + findProject(':plugin').name = 'grails-redis' -rootProject.name = "grails-redis" + From d5b03080fa155288349f6a22227cc8f9c3a27a39 Mon Sep 17 00:00:00 2001 From: aaron Date: Tue, 15 Oct 2024 15:06:41 -0400 Subject: [PATCH 02/15] grails-156: Commit paritally working code for help --- examples/redis-demo/grails-app/conf/application.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/redis-demo/grails-app/conf/application.yml b/examples/redis-demo/grails-app/conf/application.yml index dac862cb..27c8b83e 100644 --- a/examples/redis-demo/grails-app/conf/application.yml +++ b/examples/redis-demo/grails-app/conf/application.yml @@ -87,21 +87,22 @@ dataSource: jmxExport: true driverClassName: org.h2.Driver username: sa - password: + password: '' + dialect: org.hibernate.dialect.H2Dialect environments: development: dataSource: dbCreate: create-drop - url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE test: dataSource: dbCreate: update - url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:mem:testDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE production: dataSource: dbCreate: update - url: jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + url: jdbc:h2:prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE properties: jmxEnabled: true initialSize: 5 From 9da6685cd82117630c61414312c96ec6d7d23c27 Mon Sep 17 00:00:00 2001 From: aaron Date: Tue, 15 Oct 2024 15:10:47 -0400 Subject: [PATCH 03/15] grails-156: Commit partially working code for help --- examples/redis-demo/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/redis-demo/build.gradle b/examples/redis-demo/build.gradle index 39509ec3..ae7e3baa 100644 --- a/examples/redis-demo/build.gradle +++ b/examples/redis-demo/build.gradle @@ -82,7 +82,6 @@ bootRun { ignoreExitValue true jvmArgs( '-Dspring.output.ansi.enabled=always', - '-noverify', '-XX:TieredStopAtLevel=1', '-Xmx1024m') sourceResources sourceSets.main From 8ee5b6adf6287542878109c9bf4d5badf7840d9c Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 14:58:31 -0400 Subject: [PATCH 04/15] grails-156: Fix the example application so it runs and all the test are passing. Add back some test that were previously ignored. --- buildSrc/build.gradle | 8 +-- buildSrc/loadProps.gradle | 8 +++ examples/redis-demo/build.gradle | 55 ++++++----------- .../grails-app/conf/application.yml | 4 +- .../com/example/IndexController.groovy | 11 ++++ .../com/example/UrlMappings.groovy | 2 +- .../grails-app/domain/com/example/Book.groovy | 59 +++++-------------- .../com/example/BookCreateService.groovy | 12 ++++ .../services/com/example/BookService.groovy | 4 +- .../redis-demo/grails-app/views/error.gsp | 4 +- .../redis-demo/grails-app/views/index.gsp | 4 -- .../com/example/MemoizeAnnotationSpec.groovy | 4 +- .../groovy/com/example/ProxyAwareSpec.groovy | 5 +- .../com/example/RedisMemoizeDomainSpec.groovy | 7 +-- .../example/RedisMemoizeServiceSpec.groovy | 12 ++-- gradle.properties | 8 ++- gradlew | 32 ++++++---- plugin/build.gradle | 2 +- .../groovy/redis/RedisGrailsPlugin.groovy | 2 +- 19 files changed, 117 insertions(+), 126 deletions(-) create mode 100644 buildSrc/loadProps.gradle create mode 100644 examples/redis-demo/grails-app/controllers/com/example/IndexController.groovy create mode 100644 examples/redis-demo/grails-app/services/com/example/BookCreateService.groovy diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 634c55dd..bcd5257f 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -1,10 +1,10 @@ +apply from: "./loadProps.gradle" + repositories { mavenCentral() maven { url "https://repo.grails.org/grails/core" } - gradlePluginPortal() } dependencies { - //Trying to pull the property from grailsGradlePluginVersion threw an error - implementation "com.bertramlabs.plugins:asset-pipeline-gradle:4.3.0" - implementation "org.grails:grails-gradle-plugin:7.0.0-SNAPSHOT" + implementation "com.bertramlabs.plugins:asset-pipeline-gradle:${assetPipelineGrailVersion}" + implementation "org.grails:grails-gradle-plugin:${grailsVersion}" } \ No newline at end of file diff --git a/buildSrc/loadProps.gradle b/buildSrc/loadProps.gradle new file mode 100644 index 00000000..dd52697c --- /dev/null +++ b/buildSrc/loadProps.gradle @@ -0,0 +1,8 @@ +Properties properties = new Properties() +FileInputStream input = new FileInputStream(file("${rootDir.parentFile}/gradle.properties")) +properties.load(input) +input.close() + +for (String key : properties.stringPropertyNames()) { + ext.set(key, properties.getProperty(key)) +} diff --git a/examples/redis-demo/build.gradle b/examples/redis-demo/build.gradle index ae7e3baa..34dd4105 100644 --- a/examples/redis-demo/build.gradle +++ b/examples/redis-demo/build.gradle @@ -6,6 +6,7 @@ plugins { id "org.grails.grails-web" id "com.bertramlabs.asset-pipeline" id "org.grails.grails-gsp" + id "application" } version = "0.1" @@ -21,19 +22,6 @@ java { } } -configurations.configureEach { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - if ((details.requested.group == 'org.codehaus.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.name != 'groovy-bom') { - String groovyVersion = findProperty('groovyVersion') ?: libs.versions.groovy.get() - details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: groovyVersion) - details.because "The dependency coordinates are changed in Apache Groovy 4, plus ensure version" - } - } - resolutionStrategy.dependencySubstitution { - substitute(module("org.codehaus.groovy:groovy-bom:3.0.8")).using(module("org.apache.groovy:groovy-bom:$groovyVersion")) - } -} - repositories { mavenCentral() maven { url "https://repo.grails.org/grails/core" } @@ -44,33 +32,31 @@ dependencies { implementation "org.springframework.boot:spring-boot-autoconfigure" implementation "org.springframework.boot:spring-boot-starter-actuator" implementation "org.springframework.boot:spring-boot-starter-tomcat" - implementation "org.grails:grails-core:$grailsVersion" + implementation "org.grails:grails-core" - implementation "org.grails:grails-web-boot:$grailsVersion" - implementation "org.grails:grails-logging:$grailsVersion" - implementation "org.grails:grails-plugin-rest:$grailsVersion" - implementation "org.grails:grails-plugin-databinding:$grailsVersion" - implementation "org.grails:grails-plugin-i18n:$grailsVersion" - implementation "org.grails:grails-plugin-services:$grailsVersion" - implementation "org.grails:grails-plugin-url-mappings:$grailsVersion" - implementation "org.grails:grails-plugin-interceptors:$grailsVersion" + implementation "org.grails:grails-web-boot" + implementation "org.grails:grails-logging" + implementation "org.grails:grails-plugin-rest" + implementation "org.grails:grails-plugin-databinding" + implementation "org.grails:grails-plugin-i18n" + implementation "org.grails:grails-plugin-services" + implementation "org.grails:grails-plugin-url-mappings" + implementation "org.grails:grails-plugin-interceptors" implementation "org.grails.plugins:cache:$cacheVersion" implementation "org.grails.plugins:async:$asyncVersion" - implementation "org.grails.plugins:scaffolding:$scaffoldingVersion" - implementation "org.grails.plugins:events" - implementation "org.grails.plugins:hibernate5:$grailHibernateVersion" + implementation "org.grails.plugins:hibernate5:$gormVersion" implementation "org.hibernate:hibernate-core-jakarta:$hibernate5Version" implementation project(':grails-redis') implementation "org.grails.plugins:gsp" console "org.grails:grails-console" profile "org.grails.profiles:web" - runtimeOnly "org.glassfish.expressly:expressly:5.0.0" - runtimeOnly "com.h2database:h2" + runtimeOnly "org.glassfish.expressly:expressly:$expresslyVersion" + runtimeOnly "com.h2database:h2:$h2Version" runtimeOnly "org.apache.tomcat:tomcat-jdbc" - runtimeOnly 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2' - runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:4.3.0" + runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:$xmlBindApiVersion" + runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineGrailVersion" testImplementation "org.grails:grails-gorm-testing-support" @@ -78,15 +64,8 @@ dependencies { testImplementation "org.grails:grails-web-testing-support" } -bootRun { - ignoreExitValue true - jvmArgs( - '-Dspring.output.ansi.enabled=always', - '-XX:TieredStopAtLevel=1', - '-Xmx1024m') - sourceResources sourceSets.main - String springProfilesActive = 'spring.profiles.active' - systemProperty springProfilesActive, System.getProperty(springProfilesActive) +application { + mainClass.set("com.example.Application") } assets { diff --git a/examples/redis-demo/grails-app/conf/application.yml b/examples/redis-demo/grails-app/conf/application.yml index 27c8b83e..9ef6b14f 100644 --- a/examples/redis-demo/grails-app/conf/application.yml +++ b/examples/redis-demo/grails-app/conf/application.yml @@ -93,8 +93,8 @@ dataSource: environments: development: dataSource: - dbCreate: create-drop - url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE + dbCreate: create-drop + url: jdbc:h2:mem:devDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE test: dataSource: dbCreate: update diff --git a/examples/redis-demo/grails-app/controllers/com/example/IndexController.groovy b/examples/redis-demo/grails-app/controllers/com/example/IndexController.groovy new file mode 100644 index 00000000..8ba8a11f --- /dev/null +++ b/examples/redis-demo/grails-app/controllers/com/example/IndexController.groovy @@ -0,0 +1,11 @@ +package com.example + +class IndexController { + + BookCreateService bookCreateService + + def index() { + render view: "/index", model: [book:bookCreateService.createOrGetBook()] + } + +} diff --git a/examples/redis-demo/grails-app/controllers/com/example/UrlMappings.groovy b/examples/redis-demo/grails-app/controllers/com/example/UrlMappings.groovy index 9979bfb5..efc2a2b4 100644 --- a/examples/redis-demo/grails-app/controllers/com/example/UrlMappings.groovy +++ b/examples/redis-demo/grails-app/controllers/com/example/UrlMappings.groovy @@ -9,7 +9,7 @@ class UrlMappings { } } - "/"(view:"/index") + "/"(controller: "index", action: "index") "500"(view:'/error') } } diff --git a/examples/redis-demo/grails-app/domain/com/example/Book.groovy b/examples/redis-demo/grails-app/domain/com/example/Book.groovy index b217b2fd..2178b69a 100644 --- a/examples/redis-demo/grails-app/domain/com/example/Book.groovy +++ b/examples/redis-demo/grails-app/domain/com/example/Book.groovy @@ -1,55 +1,28 @@ package com.example +import grails.plugins.redis.RedisService import groovy.transform.ToString +import java.time.LocalDate -@ToString(includes = "id") +@ToString(includes = "id,createDate") class Book { - transient redisService + RedisService redisService String title = '' - Date createDate = new Date() + LocalDate createDate = LocalDate.now() + static transients = ['redisService'] + + static mapping = { + autowire true + } //todo: FIX THESE ASAP! // @Memoize(key = '#{title}') - def getMemoizedTitle(Date date) { - "$title $date" + def getMemoizedTitle(LocalDate date) { + redisService?.memoize(title) { + println 'cache miss' + "$title $date" + } } -} - -//todo: get the ast to do this because this seems to work. -//import grails.plugins.redis.RedisService -//import grails.util.Holders -// -//class Book { -// -// RedisService redisService -// -// static transients = ['redisService', 'redisTitle'] -// -// String title = '' -// Date createDate = new Date() -// String redisTitle = getMemoizedTitle(createDate) -// -// def getMemoizedTitle(Date date) { -// getRedisService()?.memoize(title) { -// println 'cache miss' -// "$title $date" -// } -// } -// -// def getRedisService() { -// return Holders?.findApplicationContext()?.getBean('redisService') -// } -// -// -// @Override -// public String toString() { -// return "Book{" + -// "redisTitle='" + redisTitle + '\'' + -// ", createDate=" + createDate + -// ", title='" + title + '\'' + -// ", id=" + id + -// '}'; -// } -//} +} \ No newline at end of file diff --git a/examples/redis-demo/grails-app/services/com/example/BookCreateService.groovy b/examples/redis-demo/grails-app/services/com/example/BookCreateService.groovy new file mode 100644 index 00000000..3ebd051d --- /dev/null +++ b/examples/redis-demo/grails-app/services/com/example/BookCreateService.groovy @@ -0,0 +1,12 @@ +package com.example + +import grails.gorm.transactions.Transactional + +@Transactional +class BookCreateService { + Book createOrGetBook() { + Book b = Book.findOrCreateByTitle('some title') + b.save(flush:true) + } + +} diff --git a/examples/redis-demo/grails-app/services/com/example/BookService.groovy b/examples/redis-demo/grails-app/services/com/example/BookService.groovy index cf1fc3c0..d62f0cd8 100644 --- a/examples/redis-demo/grails-app/services/com/example/BookService.groovy +++ b/examples/redis-demo/grails-app/services/com/example/BookService.groovy @@ -1,6 +1,7 @@ package com.example import grails.plugins.redis.* +import java.time.LocalDate class BookService { @@ -32,12 +33,13 @@ class BookService { @MemoizeDomainObject(key = '#{title}', clazz = Book.class) - def createDomainObject(String title, Date date) { + def createDomainObject(String title, LocalDate date) { println 'cache miss createDomainObject' def book = new Book(title: title, createDate: date).save(flush: true) book } + @MemoizeDomainList(key = 'getDomainListWithKeyClass:#{title}', clazz = Book.class) def getDomainListWithKeyClass(String title, Date date) { redisService.domainListWithKeyClassKey = "$title $date" diff --git a/examples/redis-demo/grails-app/views/error.gsp b/examples/redis-demo/grails-app/views/error.gsp index e95a7203..a1011560 100644 --- a/examples/redis-demo/grails-app/views/error.gsp +++ b/examples/redis-demo/grails-app/views/error.gsp @@ -10,8 +10,8 @@ - - + +
    diff --git a/examples/redis-demo/grails-app/views/index.gsp b/examples/redis-demo/grails-app/views/index.gsp index 19b6e45f..4b31dce8 100644 --- a/examples/redis-demo/grails-app/views/index.gsp +++ b/examples/redis-demo/grails-app/views/index.gsp @@ -6,10 +6,6 @@ Welcome to Grails - <% - def book = new Book(title: 'some title') - book.save(flush: true) - %> ${book.toString()} diff --git a/examples/redis-demo/src/test/groovy/com/example/MemoizeAnnotationSpec.groovy b/examples/redis-demo/src/test/groovy/com/example/MemoizeAnnotationSpec.groovy index d3502d97..ded28b6e 100644 --- a/examples/redis-demo/src/test/groovy/com/example/MemoizeAnnotationSpec.groovy +++ b/examples/redis-demo/src/test/groovy/com/example/MemoizeAnnotationSpec.groovy @@ -36,10 +36,10 @@ class TestClass{ String testExpire = "1000" when: - def testInstance = testClass.newInstance() + def testInstance = testClass.getDeclaredConstructor().newInstance() // inject redis service -// testInstance.redisService = redisService + testInstance.redisService = redisService testInstance.key = testKey testInstance.expire = testExpire diff --git a/examples/redis-demo/src/test/groovy/com/example/ProxyAwareSpec.groovy b/examples/redis-demo/src/test/groovy/com/example/ProxyAwareSpec.groovy index c23193ab..c0a6ac02 100644 --- a/examples/redis-demo/src/test/groovy/com/example/ProxyAwareSpec.groovy +++ b/examples/redis-demo/src/test/groovy/com/example/ProxyAwareSpec.groovy @@ -1,13 +1,10 @@ package com.example -import grails.core.support.proxy.ProxyHandler - trait ProxyAwareSpec { - ProxyHandler proxyHandler Serializable getEntityId(Object obj) { - Serializable identifier = proxyHandler.getIdentifier(obj) + Serializable identifier = proxyHandler.unwrapIfProxy(obj)?.ident() identifier ?: obj?.id } diff --git a/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeDomainSpec.groovy b/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeDomainSpec.groovy index 76797504..885e3c8b 100644 --- a/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeDomainSpec.groovy +++ b/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeDomainSpec.groovy @@ -4,12 +4,11 @@ import grails.gorm.transactions.Rollback import grails.plugins.redis.RedisService import grails.testing.mixin.integration.Integration import org.springframework.beans.factory.annotation.Autowired -import spock.lang.Ignore import spock.lang.Specification +import java.time.LocalDate @Integration @Rollback -@Ignore class RedisMemoizeDomainSpec extends Specification { @Autowired RedisService redisService @@ -21,8 +20,8 @@ class RedisMemoizeDomainSpec extends Specification { def "get AST transformed domain object method"() { given: def title = 'all the things' - def date1 = new Date() - def date2 = new Date() + 1 + LocalDate date1 = LocalDate.now() + LocalDate date2 = date1.plusDays(1) Book book = new Book(title: title).save(flush: true) when: diff --git a/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeServiceSpec.groovy b/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeServiceSpec.groovy index de79371b..e4207d92 100644 --- a/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeServiceSpec.groovy +++ b/examples/redis-demo/src/test/groovy/com/example/RedisMemoizeServiceSpec.groovy @@ -4,9 +4,9 @@ import grails.gorm.transactions.Rollback import grails.plugins.redis.RedisService import grails.testing.mixin.integration.Integration import groovy.time.TimeCategory -import groovy.transform.CompileStatic import org.springframework.beans.factory.annotation.Autowired import spock.lang.Specification +import java.time.LocalDate @Integration @Rollback @@ -126,7 +126,7 @@ class RedisMemoizeServiceSpec extends Specification { def "get AST transformed domain object using title"() { given: String title = 'ted' - Date date = new Date() + LocalDate date = LocalDate.now() when: Book book = bookService.createDomainObject(title, date) @@ -183,8 +183,8 @@ class RedisMemoizeServiceSpec extends Specification { def "get AST transformed method using object property key"() { given: def title = 'narwhals' - Date date = new Date() - Book book = new Book(title: title, createDate: date).save(flush: true) + LocalDate date = LocalDate.now() + Book book = new Book(title: title, createDate: date).save(flush: true, failOnError:true) def bookString1 = book.toString() when: 'get the initial value and cache it' @@ -269,6 +269,10 @@ class RedisMemoizeServiceSpec extends Specification { value2 != "$text $date2" } + private LocalDate plusDays(LocalDate date, Integer number) { + date.plusDays(number) + } + private Date plusDays(Date date, Integer number) { use(TimeCategory) { return (date + number.days) diff --git a/gradle.properties b/gradle.properties index bfe6e151..37855310 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,21 @@ projectVersion=5.0.0-SNAPSHOT +assetPipelineGrailVersion=5.0.1 asyncVersion=6.0.0-SNAPSHOT cacheVersion=8.0.0-SNAPSHOT commonsPool2Version=2.12.0 +expresslyVersion=5.0.0 grailsGradlePluginVersion=7.0.0-SNAPSHOT -grailHibernateVersion=9.0.0-SNAPSHOT grailsVersion=7.0.0-SNAPSHOT +gormVersion=9.0.0-SNAPSHOT groovyVersion=4.0.23 gsonVersion=2.11.0 +h2Version=1.4.200 hibernate5Version=5.6.15.Final -javaparserVersion=3.26.2 +javaParserCoreVersion=3.25.10 jredisVersion=5.2.0 scaffoldingVersion=6.0.0-SNAPSHOT +xmlBindApiVersion=4.0.2 org.gradle.caching=true org.gradle.daemon=true diff --git a/gradlew b/gradlew index f2670460..b218effb 100755 --- a/gradlew +++ b/gradlew @@ -56,7 +56,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,10 +84,9 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -134,10 +133,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -145,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,11 +200,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/plugin/build.gradle b/plugin/build.gradle index 955026e6..cdfd0992 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -50,7 +50,7 @@ dependencies { api "redis.clients:jedis:$jredisVersion" api "com.google.code.gson:gson:$gsonVersion" - documentation("com.github.javaparser:javaparser-core:$javaparserVersion") { + documentation("com.github.javaparser:javaparser-core:$javaParserCoreVersion") { transitive = false } } diff --git a/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy b/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy index 37be3b17..bf4e0fa9 100644 --- a/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy +++ b/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy @@ -44,7 +44,7 @@ class RedisGrailsPlugin extends Plugin { Closure doWithSpring() { { -> - def redisConfigMap = grailsApplication.config.grails.redis ?: [:] + def redisConfigMap = grailsApplication.config.getProperty('grails.redis') ?: [:] RedisConfigurationUtil.configureService(delegate, redisConfigMap, "", RedisService) redisConfigMap?.connections?.each { connection -> From b3d19179fb2b26af417bb174eb52b69805709b0e Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 15:03:08 -0400 Subject: [PATCH 05/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- examples/redis-demo/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/redis-demo/build.gradle b/examples/redis-demo/build.gradle index 34dd4105..38788f63 100644 --- a/examples/redis-demo/build.gradle +++ b/examples/redis-demo/build.gradle @@ -9,7 +9,7 @@ plugins { id "application" } -version = "0.1" +version = project.projectVersion group = "com.example" assets { minifyJs = true From e3d46efd1a7e0187162a5d85adcc6f28e3684077 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 15:44:18 -0400 Subject: [PATCH 06/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle b/build.gradle index 827276d6..b2a5f896 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,15 @@ allprojects { maven { url "https://repo.grails.org/grails/core" } } + configurations.configureEach { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if ((details.requested.group == 'org.codehaus.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.name != 'groovy-bom') { + details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: "$groovyVersion") + details.because "The dependency coordinates are changed in Apache Groovy 4, plus ensure version" + } + } + } + tasks.withType(GroovyCompile) { configure(groovyOptions) { forkOptions.jvmArgs = ['-Xmx1024m'] From fbd180e33027c10f19aaabc4115db7ae1b526fdb Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 15:47:23 -0400 Subject: [PATCH 07/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- examples/redis-demo/build.gradle | 2 +- plugin/build.gradle | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/redis-demo/build.gradle b/examples/redis-demo/build.gradle index 38788f63..419babe1 100644 --- a/examples/redis-demo/build.gradle +++ b/examples/redis-demo/build.gradle @@ -57,7 +57,7 @@ dependencies { runtimeOnly "org.apache.tomcat:tomcat-jdbc" runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:$xmlBindApiVersion" runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineGrailVersion" - + implementation "org.grails:grails-shell:7.0.0-SNAPSHOT" testImplementation "org.grails:grails-gorm-testing-support" testImplementation "org.mockito:mockito-core" diff --git a/plugin/build.gradle b/plugin/build.gradle index cdfd0992..63574554 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -45,6 +45,7 @@ dependencies { testImplementation 'org.grails:grails-web-testing-support' + implementation "org.grails:grails-shell:7.0.0-SNAPSHOT" implementation "org.grails:grails-console" api "redis.clients:jedis:$jredisVersion" From b85897c2e3b0b4967b966d2b4995b821d9bc9142 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 15:58:58 -0400 Subject: [PATCH 08/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index b2a5f896..1b04921f 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,10 @@ allprojects { repositories { mavenCentral() maven { url "https://repo.grails.org/grails/core" } + maven { + url = 'https://repo.gradle.org/gradle/libs-releases' + description = 'Needed for Gradle Tooling API' + } } configurations.configureEach { From bf1df8cf2dc4cdf2db1ebd8baf3942ec893a7227 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 16:11:53 -0400 Subject: [PATCH 09/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- .github/workflows/gradle.yml | 6 +++--- .github/workflows/release.yml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 35d71982..aee87c6e 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -31,7 +31,7 @@ jobs: env: REDIS_HOST: redis REDIS_PORT: 6379 - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} with: arguments: build -Dgeb.env=chromeHeadless publish: @@ -48,7 +48,7 @@ jobs: id: publish uses: gradle/gradle-build-action@v2 env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} with: @@ -60,7 +60,7 @@ jobs: with: arguments: :grails-redis:groovydoc env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Publish to Github Pages if: success() uses: grails/github-pages-deploy-action@v2.0.2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2178aae..9d55e57b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: id: publish uses: gradle/gradle-build-action@v2 env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }} @@ -49,7 +49,7 @@ jobs: with: arguments: :grails-redis:groovydoc env: - GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Publish to Github Pages if: success() uses: grails/github-pages-deploy-action@v2.0.2 From efc9cb764d58b715e4b15f2d31a6e6ba359210c1 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 16:15:19 -0400 Subject: [PATCH 10/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- buildSrc/build.gradle | 5 +++++ plugin/build.gradle | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index bcd5257f..93bb16fe 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -3,8 +3,13 @@ apply from: "./loadProps.gradle" repositories { mavenCentral() maven { url "https://repo.grails.org/grails/core" } + maven { + url = 'https://repo.gradle.org/gradle/libs-releases' + description = 'Needed for Gradle Tooling API' + } } dependencies { implementation "com.bertramlabs.plugins:asset-pipeline-gradle:${assetPipelineGrailVersion}" implementation "org.grails:grails-gradle-plugin:${grailsVersion}" + implementation "org.grails:grails-shell:7.0.0-SNAPSHOT" } \ No newline at end of file diff --git a/plugin/build.gradle b/plugin/build.gradle index 63574554..cdfd0992 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -45,7 +45,6 @@ dependencies { testImplementation 'org.grails:grails-web-testing-support' - implementation "org.grails:grails-shell:7.0.0-SNAPSHOT" implementation "org.grails:grails-console" api "redis.clients:jedis:$jredisVersion" From a567995a2ec654895476e3492a533b5556a9a299 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 16:16:10 -0400 Subject: [PATCH 11/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- buildSrc/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 93bb16fe..df87f851 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -11,5 +11,5 @@ repositories { dependencies { implementation "com.bertramlabs.plugins:asset-pipeline-gradle:${assetPipelineGrailVersion}" implementation "org.grails:grails-gradle-plugin:${grailsVersion}" - implementation "org.grails:grails-shell:7.0.0-SNAPSHOT" + implementation "org.gradle:gradle-tooling-api:8.10.2" } \ No newline at end of file From 97d0c4f4ae4e1ab8433a3bf40c6b10b7cba20a84 Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 16:20:04 -0400 Subject: [PATCH 12/15] grails-156: Update Project Version of the example to be the same as the version of the plugin. --- buildSrc/build.gradle | 2 +- examples/redis-demo/build.gradle | 1 - gradle.properties | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index df87f851..672c1a82 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -11,5 +11,5 @@ repositories { dependencies { implementation "com.bertramlabs.plugins:asset-pipeline-gradle:${assetPipelineGrailVersion}" implementation "org.grails:grails-gradle-plugin:${grailsVersion}" - implementation "org.gradle:gradle-tooling-api:8.10.2" + implementation "org.gradle:gradle-tooling-api:${gradleToolingApiVersion}" } \ No newline at end of file diff --git a/examples/redis-demo/build.gradle b/examples/redis-demo/build.gradle index 419babe1..415ea086 100644 --- a/examples/redis-demo/build.gradle +++ b/examples/redis-demo/build.gradle @@ -57,7 +57,6 @@ dependencies { runtimeOnly "org.apache.tomcat:tomcat-jdbc" runtimeOnly "jakarta.xml.bind:jakarta.xml.bind-api:$xmlBindApiVersion" runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:$assetPipelineGrailVersion" - implementation "org.grails:grails-shell:7.0.0-SNAPSHOT" testImplementation "org.grails:grails-gorm-testing-support" testImplementation "org.mockito:mockito-core" diff --git a/gradle.properties b/gradle.properties index 37855310..00f7f0a6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,6 +5,7 @@ asyncVersion=6.0.0-SNAPSHOT cacheVersion=8.0.0-SNAPSHOT commonsPool2Version=2.12.0 expresslyVersion=5.0.0 +gradleToolingApiVersion=8.10.2 grailsGradlePluginVersion=7.0.0-SNAPSHOT grailsVersion=7.0.0-SNAPSHOT gormVersion=9.0.0-SNAPSHOT From 83d5d6ece0403305f78752aebdfbdfd9e23a15bc Mon Sep 17 00:00:00 2001 From: aaron Date: Wed, 16 Oct 2024 21:16:47 -0400 Subject: [PATCH 13/15] grails-156: Put the Keys back --- .github/workflows/gradle.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index aee87c6e..fe4c0c7d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -48,7 +48,7 @@ jobs: id: publish uses: gradle/gradle-build-action@v2 env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} with: @@ -60,7 +60,7 @@ jobs: with: arguments: :grails-redis:groovydoc env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Publish to Github Pages if: success() uses: grails/github-pages-deploy-action@v2.0.2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d55e57b..a2178aae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: id: publish uses: gradle/gradle-build-action@v2 env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }} @@ -49,7 +49,7 @@ jobs: with: arguments: :grails-redis:groovydoc env: - DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - name: Publish to Github Pages if: success() uses: grails/github-pages-deploy-action@v2.0.2 From df8c7fcdf4fd364db3aa47b77e92f83101dd5ae4 Mon Sep 17 00:00:00 2001 From: Aaron Date: Wed, 16 Oct 2024 21:30:43 -0400 Subject: [PATCH 14/15] grails-156: Update H2 version to latest (#2) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 00f7f0a6..3009bca9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ grailsVersion=7.0.0-SNAPSHOT gormVersion=9.0.0-SNAPSHOT groovyVersion=4.0.23 gsonVersion=2.11.0 -h2Version=1.4.200 +h2Version=2.3.232 hibernate5Version=5.6.15.Final javaParserCoreVersion=3.25.10 jredisVersion=5.2.0 From 767557cfebef487844be31087105548f017d39dd Mon Sep 17 00:00:00 2001 From: Aaron Date: Fri, 18 Oct 2024 09:29:07 -0400 Subject: [PATCH 15/15] Grails 156 (#3) * grails-156: Update H2 version to latest * grails-156: Fix Comments from Code Review --- build.gradle | 20 ------------------- .../conf/{logback.xml => logback-spring.xml} | 0 .../conf/{logback.xml => logback-spring.xml} | 0 .../groovy/redis/RedisGrailsPlugin.groovy | 2 +- 4 files changed, 1 insertion(+), 21 deletions(-) rename examples/redis-demo/grails-app/conf/{logback.xml => logback-spring.xml} (100%) rename plugin/grails-app/conf/{logback.xml => logback-spring.xml} (100%) diff --git a/build.gradle b/build.gradle index 1b04921f..53ffbde6 100644 --- a/build.gradle +++ b/build.gradle @@ -14,19 +14,6 @@ allprojects { repositories { mavenCentral() maven { url "https://repo.grails.org/grails/core" } - maven { - url = 'https://repo.gradle.org/gradle/libs-releases' - description = 'Needed for Gradle Tooling API' - } - } - - configurations.configureEach { - resolutionStrategy.eachDependency { DependencyResolveDetails details -> - if ((details.requested.group == 'org.codehaus.groovy' || details.requested.group == 'org.apache.groovy') && details.requested.name != 'groovy-bom') { - details.useTarget(group: 'org.apache.groovy', name: details.requested.name, version: "$groovyVersion") - details.because "The dependency coordinates are changed in Apache Groovy 4, plus ensure version" - } - } } tasks.withType(GroovyCompile) { @@ -36,13 +23,6 @@ allprojects { } } -dependencyManagement { - imports { - mavenBom "org.grails:grails-bom:$grailsVersion" - } - applyMavenExclusions false -} - grailsPublish { userOrg = 'grails' githubSlug = 'grails/redis' diff --git a/examples/redis-demo/grails-app/conf/logback.xml b/examples/redis-demo/grails-app/conf/logback-spring.xml similarity index 100% rename from examples/redis-demo/grails-app/conf/logback.xml rename to examples/redis-demo/grails-app/conf/logback-spring.xml diff --git a/plugin/grails-app/conf/logback.xml b/plugin/grails-app/conf/logback-spring.xml similarity index 100% rename from plugin/grails-app/conf/logback.xml rename to plugin/grails-app/conf/logback-spring.xml diff --git a/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy b/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy index bf4e0fa9..1872099e 100644 --- a/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy +++ b/plugin/src/main/groovy/redis/RedisGrailsPlugin.groovy @@ -10,7 +10,7 @@ import redis.clients.jedis.Protocol class RedisGrailsPlugin extends Plugin { - def grailsVersion = "7.0.0 > *" + def grailsVersion = "7.0.0-SNAPSHOT > *" def pluginExcludes = [ "codenarc.properties", "grails-app/conf/**",