diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 29055297..fc98ed01 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -12,91 +12,82 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - env: - WORKSPACE: ${{ github.workspace }} - GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 + packages: read steps: - - uses: actions/checkout@v4 - - name: Set up JDK + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' java-version: '17' - - name: Run Build - if: success() + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "πŸ”¨ Run Build" id: build - uses: gradle/gradle-build-action@v3 env: - 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - with: - arguments: build -Dgeb.env=chromeHeadless - - name: Upload Distribution - if: success() - uses: actions/upload-artifact@v4 - with: - name: grails-gsp-SNAPSHOT - path: ./**/build/libs/* + run: ./gradlew build --refresh-dependencies publish: if: github.event_name == 'push' needs: build runs-on: ubuntu-latest permissions: contents: read + packages: read steps: - - uses: actions/checkout@v4 - - name: Set up JDK + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' java-version: '17' - - name: Publish to repo.grails.org - id: publish - uses: gradle/gradle-build-action@v3 - if: success() + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "πŸ“€ Publish Snapshot to repo.grails.org" env: - 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 }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + GRADLE_PUBLISH_RELEASE: 'false' MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} MAVEN_PUBLISH_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }} - with: - arguments: publish + run: ./gradlew publish docs: if: github.event_name == 'push' needs: build runs-on: ubuntu-latest permissions: contents: write + packages: read steps: - - uses: actions/checkout@v4 - - name: Set up JDK + - name: "πŸ“₯ Checkout the repository" + uses: actions/checkout@v4 + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' java-version: '17' - - name: Build Docs + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "πŸ”¨ Build Docs" id: docs - if: success() - uses: gradle/gradle-build-action@v3 env: - 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 }} - with: - arguments: docs - - name: Publish to Github Pages - if: success() + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew docs:docs --refresh-dependencies + - name: "πŸ“€ Publish docs to Github Pages" + if: steps.docs.outcome == 'success' uses: grails/github-pages-deploy-action@v2 env: - SKIP_SNAPSHOT: true TARGET_REPOSITORY: ${{ github.repository }} GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages - FOLDER: build/docs - DOC_FOLDER: gh-pages - COMMIT_EMAIL: 'grails-build@users.noreply.github.com' - COMMIT_NAME: 'grails-build' + FOLDER: docs/build/docs + COMMIT_EMAIL: grails-build@users.noreply.github.com + COMMIT_NAME: grails-build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 55fda979..49d3e6f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,9 @@ name: Release on: release: types: [published] +env: + GIT_USER_NAME: 'grails-build' + GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' jobs: publish: outputs: @@ -9,143 +12,113 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - env: - GIT_USER_NAME: 'grails-build' - GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' + packages: read steps: - name: Checkout repository uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_TOKEN }} - - uses: gradle/wrapper-validation-action@v2 - - name: Set up JDK + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' java-version: '17' - - name: Set the current release version + - name: "πŸ“ Store the current release version" id: release_version run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - - name: Run pre-release - uses: grails/github-actions/pre-release@main + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run Assemble + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "βš™ Run pre-release" + uses: grails/github-actions/pre-release@main + - name: "🧩 Run Assemble" if: success() - id: assemble - uses: gradle/gradle-build-action@v3 - with: - arguments: assemble + run: ./gradlew assemble env: - 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Upload Distribution - if: success() - uses: actions/upload-artifact@v4 - with: - name: grails-gsp-${{ steps.release_version.outputs.value }} - path: ./**/build/libs/* - - name: Generate secring file + - name: "πŸ” Generate key file for artifact signing" env: SECRING_FILE: ${{ secrets.SECRING_FILE }} run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg - - name: Publish to Sonatype OSSRH + - name: "πŸ“€ Publish to and close Sonatype staging repository" id: publish - uses: gradle/gradle-build-action@v3 env: - NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} - NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} - NEXUS_PUBLISH_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} - NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} SECRING_FILE: ${{ secrets.SECRING_FILE }} - 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 }} - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - with: - arguments: | - -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg - publishToSonatype - closeSonatypeStagingRepository + GRADLE_PUBLISH_RELEASE: 'true' + run: > + ./gradlew + -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg + publishToSonatype + closeSonatypeStagingRepository release: needs: publish runs-on: ubuntu-latest permissions: contents: read steps: - - name: Checkout repository + - name: "πŸ“₯ Checkout repository" uses: actions/checkout@v4 with: - token: ${{ secrets.GH_TOKEN }} ref: v${{ needs.publish.outputs.release_version }} - - name: Set up JDK + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' java-version: '17' - - name: Nexus Staging Close And Release - uses: gradle/gradle-build-action@v3 + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 + with: + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "πŸš€ Release Sonatype Staging Repository" env: - 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 }} - NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} - NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} - NEXUS_PUBLISH_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} - NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - with: - arguments: | - findSonatypeStagingRepository - releaseSonatypeStagingRepository - - name: Run post-release + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + run: > + ./gradlew + findSonatypeStagingRepository + releaseSonatypeStagingRepository + - name: "βš™οΈ Run post-release" if: success() uses: grails/github-actions/post-release@main - with: - token: ${{ secrets.GITHUB_TOKEN }} - env: - SNAPSHOT_SUFFIX: -SNAPSHOT docs: needs: publish runs-on: ubuntu-latest permissions: contents: write + packages: read steps: - - name: Checkout repository + - name: "πŸ“₯ Checkout repository" uses: actions/checkout@v4 with: - token: ${{ secrets.GH_TOKEN }} ref: v${{ needs.publish.outputs.release_version }} - - name: Set up JDK + - name: "β˜•οΈ Setup JDK" uses: actions/setup-java@v4 with: distribution: 'liberica' java-version: '17' - - name: Publish Documentation - id: docs - if: success() - uses: gradle/gradle-build-action@v3 + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 with: - arguments: docs + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "πŸ“– Generate documentation" env: - 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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Publish to Github Pages - if: steps.docs.outcome == 'success' - uses: grails/github-pages-deploy-action@v2 + run: ./gradlew docs:docs + - name: "πŸ“€ Publish documentation to Github Pages" + if: success() + uses: grails/github-pages-deploy-action@grails env: - SKIP_LATEST: ${{ contains(steps.release_version.outputs.release_version, 'M') }} - TARGET_REPOSITORY: ${{ github.repository }} + BETA: ${{ contains(needs.publish.outputs.release_version, 'M') || contains(needs.publish.outputs.release_version, 'RC') }} GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages - FOLDER: build/docs - DOC_FOLDER: gh-pages + FOLDER: docs/build/docs + VERSION: ${{ needs.publish.outputs.release_version }} COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} - COMMIT_NAME: ${{ env.GIT_USER_NAME }} - VERSION: ${{ steps.release_version.outputs.release_version }} \ No newline at end of file + COMMIT_NAME: ${{ env.GIT_USER_NAME }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 736ad6a9..d29a3380 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,6 @@ target-eclipse/ *.zip *.sha1 .DS_Store -/docs plugin.xml target build diff --git a/.sdkmanrc b/.sdkmanrc new file mode 100644 index 00000000..2de58fe2 --- /dev/null +++ b/.sdkmanrc @@ -0,0 +1,2 @@ +java=17.0.13-librca +gradle=8.10.2 diff --git a/build.gradle b/build.gradle index efcb5db6..e62e86b2 100644 --- a/build.gradle +++ b/build.gradle @@ -3,108 +3,46 @@ buildscript { maven { url "https://repo.grails.org/grails/core" } } dependencies { - classpath "org.grails:grails-gradle-plugin:$grailsGradlePluginVersion" - classpath "org.asciidoctor:asciidoctor-gradle-plugin:$asciidoctorGradlePlugin" + classpath platform("org.grails:grails-bom:${grailsVersion}") + classpath "org.grails:grails-gradle-plugin" } } -group "org.grails.plugins" -version project.projectVersion - -apply plugin:"eclipse" -apply plugin:"idea" -apply from:"./gradle/docs.gradle" -apply plugin:"org.grails.grails-plugin" -apply plugin:"org.grails.grails-publish" - -repositories { - mavenCentral() - maven { url "https://repo.grails.org/grails/core" } - if (System.getenv("GITHUB_MAVEN_PASSWORD") && !grailsVersion.endsWith('-SNAPSHOT')) { - System.out.println("Adding Grails Core Repo") - maven { - url = 'https://maven.pkg.github.com/grails/grails-core' - credentials { - username = 'DOES_NOT_MATTER' - password = System.getenv("GITHUB_MAVEN_PASSWORD") +allprojects { + repositories { + mavenCentral() + maven { url "https://repo.grails.org/grails/core" } + if (System.getenv("GITHUB_MAVEN_PASSWORD") && !grailsVersion.endsWith('-SNAPSHOT')) { + System.out.println("Adding Grails Core Repo") + maven { + url = 'https://maven.pkg.github.com/grails/grails-core' + credentials { + username = 'DOES_NOT_MATTER' + password = System.getenv("GITHUB_MAVEN_PASSWORD") + } } } } } -dependencies { - api "org.springframework.boot:spring-boot-starter-logging" - api "org.springframework.boot:spring-boot-autoconfigure" - api "org.grails:grails-core" - api "org.springframework.boot:spring-boot-starter-actuator" - api "org.springframework.boot:spring-boot-starter-tomcat" - api "org.grails:grails-web-boot" - api "org.grails:grails-logging" - api "org.grails:grails-plugin-rest" - api "org.grails:grails-plugin-databinding" - api "org.grails:grails-plugin-i18n" - api "org.grails:grails-plugin-services" - api "org.grails:grails-plugin-url-mappings" - api "org.grails:grails-plugin-interceptors" - api "org.grails.plugins:async" - api "org.grails.plugins:scaffolding" - api "org.codehaus.gpars:gpars:$gparsVersion" - api "org.grails.plugins:gsp" - - runtimeOnly "org.grails.plugins:async" - console "org.grails:grails-console" - profile "org.grails.profiles:web-plugin" - compileOnly "org.grails:grails-plugin-services" - compileOnly "org.grails:grails-plugin-domain-class" - testImplementation "org.grails:grails-gorm-testing-support" - testImplementation "org.grails:grails-web-testing-support" - testImplementation "org.mockito:mockito-core" - - integrationTestImplementation testFixtures("org.grails.plugins:geb") - api "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:$concurrentlinkedhashmapLruVersion" -} - -apply from: rootProject.file('gradle/testVerbose.gradle') +group = "org.grails.plugins" +version = project.projectVersion -//tasks.withType(Test) { -// systemProperty 'grails.geb.recording.mode', 'RECORD_FAILING' -//} - -bootRun { - jvmArgs( - '-Dspring.output.ansi.enabled=always', - '-noverify', - '-XX:TieredStopAtLevel=1', - '-Xmx1024m') - sourceResources sourceSets.main - String springProfilesActive = 'spring.profiles.active' - systemProperty springProfilesActive, System.getProperty(springProfilesActive) -} +subprojects { + if(project.name == 'plugin') { + version = projectVersion + group = "org.grails.plugins" -grailsPublish { - githubSlug = project.githubSlug - license { - name = 'Apache-2.0' - } - title = project.title - desc = project.projectDesc - developers = [jeffbrown: "Jeff Scott Brown", "puneetbehl": "Puneet Behl"] -} - -integrationTest { - testLogging { - exceptionFormat = 'full' + apply plugin:"org.grails.grails-publish" + grailsPublish { + artifactId = 'cache' + githubSlug = "grails/grails-cache" + license { + name = 'Apache-2.0' + } + title = "Grails Cache Plugin" + desc = "Provides AST transformations for caching method calls" + developers = [jeffbrown: "Jeff Scott Brown", "puneetbehl": "Puneet Behl"] + } } } - -// exclude demo code from jar artifact -jar { - includeEmptyDirs = false - exclude 'com/demo/**' -} - -tasks.named("publishGuide") { - it.dependsOn = ["compileAstGroovy", "copyAstClasses", "compileGroovy", - "compileAstJava", "compileJava", "compileAstJava", - "groovydoc", "processResources", "copyCommands", "copyLocalDocResources"] -} diff --git a/docs/build.gradle b/docs/build.gradle new file mode 100644 index 00000000..6681aea9 --- /dev/null +++ b/docs/build.gradle @@ -0,0 +1,124 @@ +import grails.doc.gradle.PublishGuide + +buildscript { + repositories { + maven { url = 'https://repo.grails.org/grails/core' } + } + dependencies { + classpath "org.grails:grails-docs:$grailsVersion" + } +} + +apply plugin: 'groovy' + +dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") + implementation 'org.apache.groovy:groovy-groovydoc' + implementation 'org.apache.groovy:groovy-ant' + implementation 'org.springframework:spring-core' +} + +tasks.register('resolveSpringVersion') { + group = 'documentation' + description = 'Resolve Spring Version from the BOM' + + ext.resolved = configurations.compileClasspath + .resolvedConfiguration + .resolvedArtifacts + .find { + it.moduleVersion.id.group == 'org.springframework' && + it.moduleVersion.id.name.contains('spring-core') + }.moduleVersion.id.version + + logger.lifecycle('Resolved Spring Framework version for Guide links: {}', resolved) +} + +tasks.register('cleanDocs', Delete) { + group = 'documentation' + delete(project.layout.buildDirectory.dir('docs')) +} + +tasks.register('aggregateGroovydoc', Groovydoc) { + group = 'documentation' + description = 'Copies Groovy API Documentation for all supporting projects' + + Set groovyDocProjects = rootProject.subprojects.findAll { + it.name != 'docs' && !it.name.startsWith('example') + } + dependsOn(['cleanDocs'] + groovyDocProjects.collect { ":${it.name}:classes" as String }) + + source = groovyDocProjects.collectMany { prj -> + def dirs = [] + // Always include main/groovy. + dirs += prj.sourceSets.main.groovy.srcDirs + + // If this subproject defines an β€œast” source set, include it. + def astSourceSet = prj.sourceSets.findByName('ast') + if (astSourceSet != null) { + dirs += astSourceSet.groovy.srcDirs + } + dirs + } + + def groovydocClasspath = files(configurations.compileClasspath + groovyDocProjects.configurations.compileClasspath) + classpath = groovydocClasspath + groovyClasspath = groovydocClasspath + + docTitle = "Grails Cache Plugin - ${project.version}" + access = GroovydocAccess.PROTECTED + includeAuthor = true + includeMainForScripts = false + processScripts = false + + destinationDir = project.layout.buildDirectory.dir('docs/api').get().asFile + + doLast { delete(project.layout.buildDirectory.dir('tmp')) } + + inputs.files(source) + outputs.dir(destinationDir) +} + +tasks.register('publishGuide', PublishGuide) { + group = 'documentation' + description = 'Generate Guide' + dependsOn('aggregateGroovydoc', 'resolveSpringVersion') + + targetDir = project.layout.buildDirectory.dir('docs').get().asFile + outputs.dir(targetDir) // ensure gradle understands what this task generates + sourceRepo = "https://github.com/grails/grails-cache/edit/${githubBranch}/src/main/docs" + sourceDir = project.layout.projectDirectory.dir('src/main/docs').getAsFile() + inputs.dir(sourceDir) // ensure gradle understands what this task creates from + propertiesFiles = [rootProject.layout.projectDirectory.file('gradle.properties').asFile] + asciidoc = true + resourcesDir = project.file('src/main/docs/resources') + properties = [ + 'safe' : 'UNSAFE', // Make sure any asciidoc security is disabled + 'version' : projectVersion, + 'title' : 'Grails Cache Plugin', + 'subtitle' : 'Provides AST transformations for caching method calls', + 'api' : '../api', + 'exampleSourcedir': rootProject.layout.projectDirectory.dir('example').asFile.absolutePath, + 'springapi' : "https://docs.spring.io/spring/docs/${resolveSpringVersion.resolved}/javadoc-api/", + 'tags' : '../ref/Tags' + ] as Properties + + doLast { + File destination = project.layout.buildDirectory.file('docs/guide/index.html').get().asFile + destination.delete() + project.layout.buildDirectory.file('docs/guide/single.html').get().asFile.renameTo(destination) + project.layout.buildDirectory.file('docs/index.html').get().asFile.text = ''' + + + Redirecting... + + + + + '''.stripIndent(8) + } +} + +tasks.register('docs') { + group = 'documentation' + dependsOn('aggregateGroovydoc', 'publishGuide') +} \ No newline at end of file diff --git a/src/main/docs/guide/cacheTags.adoc b/docs/src/main/docs/guide/cacheTags.adoc similarity index 100% rename from src/main/docs/guide/cacheTags.adoc rename to docs/src/main/docs/guide/cacheTags.adoc diff --git a/src/main/docs/guide/grailsCacheAdminService.adoc b/docs/src/main/docs/guide/grailsCacheAdminService.adoc similarity index 100% rename from src/main/docs/guide/grailsCacheAdminService.adoc rename to docs/src/main/docs/guide/grailsCacheAdminService.adoc diff --git a/src/main/docs/guide/grailsCacheAdminService/clearingCaches.adoc b/docs/src/main/docs/guide/grailsCacheAdminService/clearingCaches.adoc similarity index 100% rename from src/main/docs/guide/grailsCacheAdminService/clearingCaches.adoc rename to docs/src/main/docs/guide/grailsCacheAdminService/clearingCaches.adoc diff --git a/src/main/docs/guide/implementation.adoc b/docs/src/main/docs/guide/implementation.adoc similarity index 100% rename from src/main/docs/guide/implementation.adoc rename to docs/src/main/docs/guide/implementation.adoc diff --git a/src/main/docs/guide/introduction.adoc b/docs/src/main/docs/guide/introduction.adoc similarity index 61% rename from src/main/docs/guide/introduction.adoc rename to docs/src/main/docs/guide/introduction.adoc index a56fdecf..ccab4826 100644 --- a/src/main/docs/guide/introduction.adoc +++ b/docs/src/main/docs/guide/introduction.adoc @@ -1,3 +1,3 @@ The Grails Cache plugin provides powerful and easy to use caching functionality to Grails applications and plugins. -IMPORTANT: Cache version 4.0.0 and higher requires GORM 6.1.x or higher +IMPORTANT: Cache version 8.0.0 and higher requires Grails 7 or later. diff --git a/src/main/docs/guide/introduction/changeLog.adoc b/docs/src/main/docs/guide/introduction/changeLog.adoc similarity index 86% rename from src/main/docs/guide/introduction/changeLog.adoc rename to docs/src/main/docs/guide/introduction/changeLog.adoc index a7280383..f13bd24b 100644 --- a/src/main/docs/guide/introduction/changeLog.adoc +++ b/docs/src/main/docs/guide/introduction/changeLog.adoc @@ -1,7 +1,7 @@ [[changeLog]] === Change log -For recent versions please check the release notes https://github.com/grails-plugins/grails-cache/releases[here] +For later versions please check the release notes https://github.com/grails-plugins/grails-cache/releases[here] === Version 4.0.0 diff --git a/src/main/docs/guide/toc.yml b/docs/src/main/docs/guide/toc.yml similarity index 100% rename from src/main/docs/guide/toc.yml rename to docs/src/main/docs/guide/toc.yml diff --git a/src/main/docs/guide/usage.adoc b/docs/src/main/docs/guide/usage.adoc similarity index 100% rename from src/main/docs/guide/usage.adoc rename to docs/src/main/docs/guide/usage.adoc diff --git a/src/main/docs/guide/usage/annotations.adoc b/docs/src/main/docs/guide/usage/annotations.adoc similarity index 100% rename from src/main/docs/guide/usage/annotations.adoc rename to docs/src/main/docs/guide/usage/annotations.adoc diff --git a/src/main/docs/guide/usage/cacheManager.adoc b/docs/src/main/docs/guide/usage/cacheManager.adoc similarity index 77% rename from src/main/docs/guide/usage/cacheManager.adoc rename to docs/src/main/docs/guide/usage/cacheManager.adoc index d8dd4878..0a301225 100644 --- a/src/main/docs/guide/usage/cacheManager.adoc +++ b/docs/src/main/docs/guide/usage/cacheManager.adoc @@ -1,3 +1,3 @@ -The plugin registers an instance of the link:{springApi}/org/springframework/cache/CacheManager.html[CacheManager] interface as the `grailsCacheManager` Spring bean, so it's easy to access using dependency injection. +The plugin registers an instance of the link:{springapi}/org/springframework/cache/CacheManager.html[CacheManager] interface as the `grailsCacheManager` Spring bean, so it's easy to access using dependency injection. -The most common method you would call on the `grailsCacheManager` is `getCache(String name)` to access a link:{springApi}/org/springframework/cache/Cache.html[Cache] instance programmatically. This shouldn't be needed often however. From the `Cache` instance you can also access the underlying cache implementation using `cache.getNativeCache()`. +The most common method you would call on the `grailsCacheManager` is `getCache(String name)` to access a link:{springapi}/org/springframework/cache/Cache.html[Cache] instance programmatically. This shouldn't be needed often however. From the `Cache` instance you can also access the underlying cache implementation using `cache.getNativeCache()`. diff --git a/src/main/docs/guide/usage/dsl.adoc b/docs/src/main/docs/guide/usage/dsl.adoc similarity index 100% rename from src/main/docs/guide/usage/dsl.adoc rename to docs/src/main/docs/guide/usage/dsl.adoc diff --git a/src/main/docs/guide/usage/unittests.adoc b/docs/src/main/docs/guide/usage/unittests.adoc similarity index 62% rename from src/main/docs/guide/usage/unittests.adoc rename to docs/src/main/docs/guide/usage/unittests.adoc index 04954497..5e86b502 100644 --- a/src/main/docs/guide/usage/unittests.adoc +++ b/docs/src/main/docs/guide/usage/unittests.adoc @@ -5,12 +5,12 @@ method is invoked. [source,groovy] ---- -include::{sourcedir}/grails-app/services/com/demo/BasicCachingService.groovy[tags=get_data,indent=0] +include::{exampleSourcedir}/grails-app/services/com/demo/BasicCachingService.groovy[tags=get_data,indent=0] ---- [source,groovy] ---- -include::{sourcedir}/src/test/groovy/com/demo/BasicCachingServiceNoCacheManagerSpec.groovy[] +include::{exampleSourcedir}/src/test/groovy/com/demo/BasicCachingServiceNoCacheManagerSpec.groovy[] ---- In order for caching to be active when the unit test is running, cache manager @@ -19,5 +19,5 @@ test. [source,groovy] ---- -include::{sourcedir}/src/test/groovy/com/demo/BasicCachingServiceSpec.groovy[] +include::{exampleSourcedir}/src/test/groovy/com/demo/BasicCachingServiceSpec.groovy[] ---- diff --git a/src/main/docs/ref/Tags/block.adoc b/docs/src/main/docs/ref/Tags/block.adoc similarity index 100% rename from src/main/docs/ref/Tags/block.adoc rename to docs/src/main/docs/ref/Tags/block.adoc diff --git a/src/main/docs/ref/Tags/render.adoc b/docs/src/main/docs/ref/Tags/render.adoc similarity index 100% rename from src/main/docs/ref/Tags/render.adoc rename to docs/src/main/docs/ref/Tags/render.adoc diff --git a/src/main/docs/resources/style/layout.html b/docs/src/main/docs/resources/style/layout.html similarity index 100% rename from src/main/docs/resources/style/layout.html rename to docs/src/main/docs/resources/style/layout.html diff --git a/example/build.gradle b/example/build.gradle new file mode 100644 index 00000000..b52ec7ee --- /dev/null +++ b/example/build.gradle @@ -0,0 +1,79 @@ +buildscript { + repositories { + maven { url = 'https://repo.grails.org/grails/core' } + } + dependencies { + classpath platform("org.grails:grails-bom:$grailsVersion") + classpath 'org.grails:grails-gradle-plugin' + } +} + + +plugins { + id "groovy" + id "idea" + id "eclipse" +} + +version = projectVersion +group = "com.demo" + +apply plugin: "org.grails.grails-web" +apply plugin: "org.grails.grails-gsp" + +compileJava.options.release = 17 + +dependencies { + implementation "org.grails:grails-bom:${grailsVersion}" + + implementation project(':plugin') + + implementation "org.grails:grails-core" + implementation "org.grails:grails-logging" + implementation "org.grails:grails-plugin-databinding" + implementation "org.grails:grails-plugin-i18n" + implementation "org.grails:grails-plugin-interceptors" + implementation "org.grails:grails-plugin-rest" + implementation "org.grails:grails-plugin-services" + implementation "org.grails:grails-plugin-url-mappings" + implementation "org.grails:grails-web-boot" + implementation "org.grails.plugins:gsp" + implementation "org.springframework.boot:spring-boot-autoconfigure" + implementation "org.springframework.boot:spring-boot-starter" + implementation "org.springframework.boot:spring-boot-starter-actuator" + implementation "org.springframework.boot:spring-boot-starter-logging" + implementation "org.springframework.boot:spring-boot-starter-tomcat" + implementation "org.springframework.boot:spring-boot-starter-validation" + + console "org.grails:grails-console" + + runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails" + runtimeOnly "com.h2database:h2" + runtimeOnly "org.apache.tomcat:tomcat-jdbc" + runtimeOnly "org.fusesource.jansi:jansi" + + integrationTestImplementation testFixtures("org.grails.plugins:geb") + + testImplementation "org.grails:grails-gorm-testing-support" + testImplementation "org.grails:grails-web-testing-support" + testImplementation "org.spockframework:spock-core" +} + +bootRun { + jvmArgs( + '-Dspring.output.ansi.enabled=always', + '-noverify', + '-XX:TieredStopAtLevel=1', + '-Xmx1024m') + sourceResources sourceSets.main + String springProfilesActive = 'spring.profiles.active' + systemProperty springProfilesActive, System.getProperty(springProfilesActive) +} + +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle') + +// no groovy doc for example +tasks.withType(Groovydoc).configureEach { + enabled = false +} \ No newline at end of file diff --git a/grails-app/conf/application.yml b/example/grails-app/conf/application.yml similarity index 100% rename from grails-app/conf/application.yml rename to example/grails-app/conf/application.yml diff --git a/grails-app/conf/logback.xml b/example/grails-app/conf/logback.xml similarity index 100% rename from grails-app/conf/logback.xml rename to example/grails-app/conf/logback.xml diff --git a/grails-app/controllers/com/demo/DemoController.groovy b/example/grails-app/controllers/com/demo/DemoController.groovy similarity index 100% rename from grails-app/controllers/com/demo/DemoController.groovy rename to example/grails-app/controllers/com/demo/DemoController.groovy diff --git a/example/grails-app/init/com/demo/Application.groovy b/example/grails-app/init/com/demo/Application.groovy new file mode 100644 index 00000000..7b9ca99d --- /dev/null +++ b/example/grails-app/init/com/demo/Application.groovy @@ -0,0 +1,12 @@ +package com.demo + +import grails.boot.* +import grails.boot.config.GrailsAutoConfiguration +import grails.plugins.metadata.* + +@PluginSource +class Application extends GrailsAutoConfiguration { + static void main(String[] args) { + GrailsApp.run(Application, args) + } +} diff --git a/grails-app/services/com/demo/BasicCachingService.groovy b/example/grails-app/services/com/demo/BasicCachingService.groovy similarity index 100% rename from grails-app/services/com/demo/BasicCachingService.groovy rename to example/grails-app/services/com/demo/BasicCachingService.groovy diff --git a/grails-app/views/demo/_counterTemplate.gsp b/example/grails-app/views/demo/_counterTemplate.gsp similarity index 100% rename from grails-app/views/demo/_counterTemplate.gsp rename to example/grails-app/views/demo/_counterTemplate.gsp diff --git a/grails-app/views/demo/blockCache.gsp b/example/grails-app/views/demo/blockCache.gsp similarity index 100% rename from grails-app/views/demo/blockCache.gsp rename to example/grails-app/views/demo/blockCache.gsp diff --git a/grails-app/views/demo/blockCacheTTL.gsp b/example/grails-app/views/demo/blockCacheTTL.gsp similarity index 100% rename from grails-app/views/demo/blockCacheTTL.gsp rename to example/grails-app/views/demo/blockCacheTTL.gsp diff --git a/grails-app/views/demo/renderTag.gsp b/example/grails-app/views/demo/renderTag.gsp similarity index 100% rename from grails-app/views/demo/renderTag.gsp rename to example/grails-app/views/demo/renderTag.gsp diff --git a/grails-app/views/demo/renderTagTTL.gsp b/example/grails-app/views/demo/renderTagTTL.gsp similarity index 100% rename from grails-app/views/demo/renderTagTTL.gsp rename to example/grails-app/views/demo/renderTagTTL.gsp diff --git a/grails-app/views/layouts/main.gsp b/example/grails-app/views/layouts/main.gsp similarity index 100% rename from grails-app/views/layouts/main.gsp rename to example/grails-app/views/layouts/main.gsp diff --git a/grails-app/views/notFound.gsp b/example/grails-app/views/notFound.gsp similarity index 100% rename from grails-app/views/notFound.gsp rename to example/grails-app/views/notFound.gsp diff --git a/src/integration-test/groovy/com/demo/CacheTagIntegrationSpec.groovy b/example/src/integration-test/groovy/com/demo/CacheTagIntegrationSpec.groovy similarity index 99% rename from src/integration-test/groovy/com/demo/CacheTagIntegrationSpec.groovy rename to example/src/integration-test/groovy/com/demo/CacheTagIntegrationSpec.groovy index b5d127ba..0a0d541c 100644 --- a/src/integration-test/groovy/com/demo/CacheTagIntegrationSpec.groovy +++ b/example/src/integration-test/groovy/com/demo/CacheTagIntegrationSpec.groovy @@ -2,6 +2,7 @@ package com.demo import grails.plugin.geb.ContainerGebSpec import grails.testing.mixin.integration.Integration + import java.util.concurrent.TimeUnit @Integration diff --git a/src/integration-test/groovy/com/demo/CachingServiceIntegrationSpec.groovy b/example/src/integration-test/groovy/com/demo/CachingServiceIntegrationSpec.groovy similarity index 100% rename from src/integration-test/groovy/com/demo/CachingServiceIntegrationSpec.groovy rename to example/src/integration-test/groovy/com/demo/CachingServiceIntegrationSpec.groovy diff --git a/src/integration-test/groovy/com/demo/MaxCapacityCacheSpec.groovy b/example/src/integration-test/groovy/com/demo/MaxCapacityCacheSpec.groovy similarity index 86% rename from src/integration-test/groovy/com/demo/MaxCapacityCacheSpec.groovy rename to example/src/integration-test/groovy/com/demo/MaxCapacityCacheSpec.groovy index af99947e..9ab2334c 100644 --- a/src/integration-test/groovy/com/demo/MaxCapacityCacheSpec.groovy +++ b/example/src/integration-test/groovy/com/demo/MaxCapacityCacheSpec.groovy @@ -18,7 +18,7 @@ class MaxCapacityCacheSpec extends Specification { @Unroll void "Verify max capacities set for configured caches"() { when: - GrailsConcurrentLinkedMapCache cache = grailsCacheManager.getCache(cacheName) as GrailsConcurrentLinkedMapCache + GrailsConcurrentLinkedMapCache cache = grailsCacheManager.getCache(cacheName) as GrailsConcurrentLinkedMapCache then: cache.capacity == expectedCapacity diff --git a/src/test/groovy/com/demo/BasicCachingServiceNoCacheManagerSpec.groovy b/example/src/test/groovy/com/demo/BasicCachingServiceNoCacheManagerSpec.groovy similarity index 100% rename from src/test/groovy/com/demo/BasicCachingServiceNoCacheManagerSpec.groovy rename to example/src/test/groovy/com/demo/BasicCachingServiceNoCacheManagerSpec.groovy diff --git a/src/test/groovy/com/demo/BasicCachingServiceSpec.groovy b/example/src/test/groovy/com/demo/BasicCachingServiceSpec.groovy similarity index 100% rename from src/test/groovy/com/demo/BasicCachingServiceSpec.groovy rename to example/src/test/groovy/com/demo/BasicCachingServiceSpec.groovy diff --git a/src/test/groovy/com/demo/ClassMarkedCacheableSpec.groovy b/example/src/test/groovy/com/demo/ClassMarkedCacheableSpec.groovy similarity index 100% rename from src/test/groovy/com/demo/ClassMarkedCacheableSpec.groovy rename to example/src/test/groovy/com/demo/ClassMarkedCacheableSpec.groovy diff --git a/gradle.properties b/gradle.properties index 1f48395e..a9de27b1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,20 +1,11 @@ projectVersion=8.0.0-SNAPSHOT +grailsVersion=7.0.0-SNAPSHOT -asciidoctorGradlePlugin=1.6.1 concurrentlinkedhashmapLruVersion=1.4.2 -grailsVersion=7.0.0-M1 -grailsDocsVersion=7.0.0-SNAPSHOT -grailsGradlePluginVersion=7.0.0-SNAPSHOT gparsVersion=1.2.1 -groovyVersion=4.0.24 -guide=../../guide -tags=../ref/Tags +javaVersion=17 -# 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 diff --git a/gradle/docs.gradle b/gradle/docs.gradle deleted file mode 100644 index f296c282..00000000 --- a/gradle/docs.gradle +++ /dev/null @@ -1,157 +0,0 @@ -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, - 'jakartaee': "https://jakarta.ee/specifications/platform/10/apidocs/", - 'javase' : "https://docs.oracle.com/en/java/javase/17/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 = ''' - - - - - - - - -''' - } -} - -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") - } -} diff --git a/gradle/java-config.gradle b/gradle/java-config.gradle new file mode 100644 index 00000000..7c2c0520 --- /dev/null +++ b/gradle/java-config.gradle @@ -0,0 +1,6 @@ +compileJava.options.release = javaVersion.toInteger() + +java { + withSourcesJar() + withJavadocJar() +} \ No newline at end of file diff --git a/gradle/testVerbose.gradle b/gradle/test-config.gradle similarity index 89% rename from gradle/testVerbose.gradle rename to gradle/test-config.gradle index 7030a969..7ddc44cc 100644 --- a/gradle/testVerbose.gradle +++ b/gradle/test-config.gradle @@ -27,4 +27,12 @@ tasks.withType(Test) { } } } + + // systemProperty 'grails.geb.recording.mode', 'RECORD_FAILING' +} + +integrationTest { + testLogging { + exceptionFormat = 'full' + } } \ No newline at end of file diff --git a/plugin/build.gradle b/plugin/build.gradle new file mode 100644 index 00000000..cf773101 --- /dev/null +++ b/plugin/build.gradle @@ -0,0 +1,47 @@ +buildscript { + repositories { + maven { url = 'https://repo.grails.org/grails/core' } + } + dependencies { + classpath platform("org.grails:grails-bom:$grailsVersion") + classpath 'org.grails:grails-gradle-plugin' + } +} + +version = projectVersion +group = "org.grails.plugins" + +apply plugin: 'groovy' +apply plugin: 'java-library' +apply plugin: 'org.grails.grails-plugin' + +dependencies { + implementation "org.grails:grails-bom:${grailsVersion}" + + api "org.grails:grails-core" + api "org.grails:grails-web-boot" + api "org.grails:grails-plugin-services" + + api "org.grails.plugins:gsp" + api "org.codehaus.gpars:gpars:$gparsVersion" + api "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:$concurrentlinkedhashmapLruVersion" + + compileOnly "org.grails:grails-plugin-domain-class" + + console "org.grails:grails-console" + + testImplementation "org.grails:grails-gorm-testing-support" + testImplementation "org.grails:grails-web-testing-support" + testImplementation "org.spockframework:spock-core", { + exclude group: 'org.apache.groovy' + } + testImplementation "org.mockito:mockito-core" // to allow for correct mocking with Mock() +} + +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle') + +// groovy docs will be generated by the docs project +tasks.withType(Groovydoc).configureEach { + enabled = false +} \ No newline at end of file diff --git a/plugin/grails-app/conf/application.yml b/plugin/grails-app/conf/application.yml new file mode 100644 index 00000000..05860d38 --- /dev/null +++ b/plugin/grails-app/conf/application.yml @@ -0,0 +1,99 @@ +--- +grails: + profile: web-plugin + codegen: + defaultPackage: cache + gorm: + reactor: + # Whether to translate GORM events into Reactor events + # Disabled by default for performance reasons + events: false +info: + app: + name: '@info.app.name@' + version: '@info.app.version@' + grailsVersion: '@info.app.grailsVersion@' +spring: + jmx: + unique-names: true + main: + banner-mode: "off" + groovy: + template: + check-template-location: false + devtools: + restart: + exclude: + - grails-app/views/** + - grails-app/i18n/** + - grails-app/conf/** +management: + endpoints: + enabled-by-default: false + +--- +grails: + mime: + disable: + accept: + header: + userAgents: + - Gecko + - WebKit + - Presto + - Trident + types: + all: '*/*' + atom: application/atom+xml + css: text/css + csv: text/csv + form: application/x-www-form-urlencoded + html: + - text/html + - application/xhtml+xml + js: text/javascript + json: + - application/json + - text/json + multipartForm: multipart/form-data + pdf: application/pdf + rss: application/rss+xml + text: text/plain + hal: + - application/hal+json + - application/hal+xml + xml: + - text/xml + - application/xml + urlmapping: + cache: + maxsize: 1000 + controllers: + defaultScope: singleton + converters: + encoding: UTF-8 + views: + default: + codec: html + gsp: + encoding: UTF-8 + htmlcodec: xml + codecs: + expression: html + scriptlets: html + taglib: none + staticparts: none +endpoints: + jmx: + unique-names: true +--- +environments: + test: + grails: + cache: + cacheManager: GrailsConcurrentLinkedMapCacheManager + caches: + foo: + maxCapacity: 100 + bar: + maxCapacity: 200 diff --git a/plugin/grails-app/conf/logback.xml b/plugin/grails-app/conf/logback.xml new file mode 100644 index 00000000..f4e77836 --- /dev/null +++ b/plugin/grails-app/conf/logback.xml @@ -0,0 +1,17 @@ + + + + + + + + + UTF-8 + '%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex' + + + + + + + \ No newline at end of file diff --git a/grails-app/init/cache/Application.groovy b/plugin/grails-app/init/cache/Application.groovy similarity index 100% rename from grails-app/init/cache/Application.groovy rename to plugin/grails-app/init/cache/Application.groovy diff --git a/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy b/plugin/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy similarity index 100% rename from grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy rename to plugin/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy diff --git a/src/ast/groovy/grails/plugin/cache/CacheEvict.java b/plugin/src/ast/groovy/grails/plugin/cache/CacheEvict.java similarity index 100% rename from src/ast/groovy/grails/plugin/cache/CacheEvict.java rename to plugin/src/ast/groovy/grails/plugin/cache/CacheEvict.java diff --git a/src/ast/groovy/grails/plugin/cache/CacheOperation.java b/plugin/src/ast/groovy/grails/plugin/cache/CacheOperation.java similarity index 100% rename from src/ast/groovy/grails/plugin/cache/CacheOperation.java rename to plugin/src/ast/groovy/grails/plugin/cache/CacheOperation.java diff --git a/src/ast/groovy/grails/plugin/cache/CachePut.java b/plugin/src/ast/groovy/grails/plugin/cache/CachePut.java similarity index 100% rename from src/ast/groovy/grails/plugin/cache/CachePut.java rename to plugin/src/ast/groovy/grails/plugin/cache/CachePut.java diff --git a/src/ast/groovy/grails/plugin/cache/Cacheable.java b/plugin/src/ast/groovy/grails/plugin/cache/Cacheable.java similarity index 100% rename from src/ast/groovy/grails/plugin/cache/Cacheable.java rename to plugin/src/ast/groovy/grails/plugin/cache/Cacheable.java diff --git a/src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy b/plugin/src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy similarity index 100% rename from src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy rename to plugin/src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy diff --git a/src/ast/groovy/grails/plugin/cache/GrailsCacheKeyGenerator.groovy b/plugin/src/ast/groovy/grails/plugin/cache/GrailsCacheKeyGenerator.groovy similarity index 100% rename from src/ast/groovy/grails/plugin/cache/GrailsCacheKeyGenerator.groovy rename to plugin/src/ast/groovy/grails/plugin/cache/GrailsCacheKeyGenerator.groovy diff --git a/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java b/plugin/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java similarity index 100% rename from src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java rename to plugin/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java diff --git a/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManagerAware.groovy b/plugin/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManagerAware.groovy similarity index 100% rename from src/ast/groovy/org/grails/plugin/cache/GrailsCacheManagerAware.groovy rename to plugin/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManagerAware.groovy diff --git a/src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy b/plugin/src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy similarity index 100% rename from src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy rename to plugin/src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy diff --git a/src/ast/groovy/org/grails/plugin/cache/compiler/CacheEvictTransformation.groovy b/plugin/src/ast/groovy/org/grails/plugin/cache/compiler/CacheEvictTransformation.groovy similarity index 100% rename from src/ast/groovy/org/grails/plugin/cache/compiler/CacheEvictTransformation.groovy rename to plugin/src/ast/groovy/org/grails/plugin/cache/compiler/CacheEvictTransformation.groovy diff --git a/src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy b/plugin/src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy similarity index 100% rename from src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy rename to plugin/src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy diff --git a/src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy b/plugin/src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy similarity index 100% rename from src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy rename to plugin/src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy diff --git a/src/main/groovy/grails/plugin/cache/CacheException.groovy b/plugin/src/main/groovy/grails/plugin/cache/CacheException.groovy similarity index 100% rename from src/main/groovy/grails/plugin/cache/CacheException.groovy rename to plugin/src/main/groovy/grails/plugin/cache/CacheException.groovy diff --git a/src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy b/plugin/src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy similarity index 100% rename from src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy rename to plugin/src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy diff --git a/src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy b/plugin/src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy similarity index 100% rename from src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy rename to plugin/src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy diff --git a/src/main/groovy/grails/plugin/cache/GrailsCache.java b/plugin/src/main/groovy/grails/plugin/cache/GrailsCache.java similarity index 100% rename from src/main/groovy/grails/plugin/cache/GrailsCache.java rename to plugin/src/main/groovy/grails/plugin/cache/GrailsCache.java diff --git a/src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy b/plugin/src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy similarity index 100% rename from src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy rename to plugin/src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy diff --git a/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java b/plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java similarity index 100% rename from src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java rename to plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java diff --git a/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy b/plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy similarity index 100% rename from src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy rename to plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy diff --git a/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java b/plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java similarity index 100% rename from src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java rename to plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java diff --git a/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy b/plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy similarity index 100% rename from src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy rename to plugin/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy diff --git a/src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java b/plugin/src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java similarity index 100% rename from src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java rename to plugin/src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java diff --git a/src/main/groovy/grails/plugin/cache/util/ClassUtils.java b/plugin/src/main/groovy/grails/plugin/cache/util/ClassUtils.java similarity index 100% rename from src/main/groovy/grails/plugin/cache/util/ClassUtils.java rename to plugin/src/main/groovy/grails/plugin/cache/util/ClassUtils.java diff --git a/src/test/groovy/grails/plugin/cache/CacheEvictParseSpec.groovy b/plugin/src/test/groovy/grails/plugin/cache/CacheEvictParseSpec.groovy similarity index 100% rename from src/test/groovy/grails/plugin/cache/CacheEvictParseSpec.groovy rename to plugin/src/test/groovy/grails/plugin/cache/CacheEvictParseSpec.groovy diff --git a/src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy b/plugin/src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy similarity index 100% rename from src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy rename to plugin/src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy diff --git a/src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy b/plugin/src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy similarity index 100% rename from src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy rename to plugin/src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy diff --git a/src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManagerTests.groovy b/plugin/src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManagerTests.groovy similarity index 100% rename from src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManagerTests.groovy rename to plugin/src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManagerTests.groovy diff --git a/src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheTests.groovy b/plugin/src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheTests.groovy similarity index 100% rename from src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheTests.groovy rename to plugin/src/test/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheTests.groovy diff --git a/src/test/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManagerTests.groovy b/plugin/src/test/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManagerTests.groovy similarity index 100% rename from src/test/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManagerTests.groovy rename to plugin/src/test/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManagerTests.groovy diff --git a/src/test/groovy/grails/plugin/cache/util/ClassUtilsSpec.groovy b/plugin/src/test/groovy/grails/plugin/cache/util/ClassUtilsSpec.groovy similarity index 100% rename from src/test/groovy/grails/plugin/cache/util/ClassUtilsSpec.groovy rename to plugin/src/test/groovy/grails/plugin/cache/util/ClassUtilsSpec.groovy diff --git a/settings.gradle b/settings.gradle index cd8bf6b3..fa6cdbf7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,26 +1,32 @@ plugins { - id "com.gradle.enterprise" version "3.16.2" - id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.13' + id 'com.gradle.develocity' version '3.19' + 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 + +develocity { server = 'https://ge.grails.org' buildScan { - publishAlwaysIf(System.getenv('CI') == 'true') - publishIfAuthenticated() - uploadInBackground = System.getenv("CI") == null - capture { - taskInputFiles = true - } + tag('grails') + tag('grails-gsp') + 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 && isAuthenticated enabled = true - }} + } +} + +rootProject.name = 'grails-cache' -rootProject.name = 'cache' \ No newline at end of file +include 'docs' +include 'example' +include 'plugin'