From 2096c7a7dac97973e4019ff9fbc1f1cf1163efaa Mon Sep 17 00:00:00 2001 From: Guillermo Calvo Date: Thu, 22 Feb 2024 07:46:40 -0800 Subject: [PATCH 01/56] Generate documentation files in `/docs` instead of `/docs/asciidoc` (#521) --- docs/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/build.gradle b/docs/build.gradle index ef9181383..0955edccd 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -20,6 +20,8 @@ tasks.withType(AsciidoctorTask).configureEach { 'icons' : 'font', 'version' : version //'sourcedir' : coreSourceDir + + outputDir layout.buildDirectory.dir('docs') } // Groovydoc task requires the Groovy version of Gradle From 2ce73681382eb1c8d4c6045c0a51b71579294853 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Tue, 27 Feb 2024 08:47:25 +0100 Subject: [PATCH 02/56] Minor build updates (#523) * build: Remove redundant config The class configured as springBoot mainClass was deleted in a previous commit so this configuration is no longer necessary. * build: Use setter syntax for signing.required Use setter syntax as that provides better IDE support. * ci: Improve Github workflows - Split project testing and building in CI to be able to run the former with a matrix of java versions. - Improve job and step names to reflect what is actually done in the steps. - Order env vars alphabetically. - Centralize user name and email handling. - Remove some redundant env vars that were set to the same as the default values. --- .github/workflows/gradle.yml | 68 ++++++++++++++++------------------- .github/workflows/release.yml | 29 +++++++-------- gradle-plugin/build.gradle | 2 +- json/build.gradle | 5 --- 4 files changed, 44 insertions(+), 60 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 7edf67f01..9c14bc3f3 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -2,26 +2,22 @@ name: Java CI on: push: branches: - - master - '[2-9]+.[0-9]+.x' pull_request: branches: - - master - '[2-9]+.[0-9]+.x' +env: + GIT_USER_NAME: puneetbehl + GIT_USER_EMAIL: behlp@unityfoundation.io + jobs: - build: + test_project: runs-on: ubuntu-latest - + if: github.event_name == 'pull_request' strategy: - fail-fast: false - matrix: - java: [11, 17] - - env: - WORKSPACE: ${{ github.workspace }} - GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 - + fail-fast: false + matrix: { java: [11, 17] } steps: - uses: actions/checkout@v4 - uses: gradle/wrapper-validation-action@v2 @@ -29,7 +25,6 @@ jobs: with: distribution: temurin java-version: ${{ matrix.java }} - - name: Run Tests if: github.event_name == 'pull_request' id: tests @@ -39,56 +34,55 @@ jobs: 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: | - check - -Dgeb.env=chromeHeadless + arguments: check -Dgeb.env=chromeHeadless + build_project: + runs-on: ubuntu-latest + if: github.event_name == 'push' + steps: + - uses: actions/checkout@v4 + - uses: gradle/wrapper-validation-action@v2 + - uses: actions/setup-java@v4 + with: { java-version: 11, distribution: temurin } - name: Run Build - if: github.event_name == 'push' - id: build uses: gradle/actions/setup-gradle@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: | - build - -Dgeb.env=chromeHeadless + arguments: build -Dgeb.env=chromeHeadless - - name: Publish Snapshot to repo.grails.org - id: publish + - name: Publish Snapshot artifacts to Artifactory (repo.grails.org) + if: success() uses: gradle/actions/setup-gradle@v3 - if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '11' env: - ORG_GRADLE_PROJECT_artifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }} - ORG_GRADLE_PROJECT_artifactoryPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} 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 }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} + ORG_GRADLE_PROJECT_artifactoryPublishUsername: ${{ secrets.ARTIFACTORY_USERNAME }} + ORG_GRADLE_PROJECT_artifactoryPublishPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} with: arguments: | -Dorg.gradle.internal.publish.checksums.insecure=true publish - - name: Build Docs - id: docs - if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '11' + - name: Generate Snapshot Documentation + if: success() uses: gradle/actions/setup-gradle@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 }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} with: arguments: views-docs:docs - - name: Publish Snapshot docs to Github Pages - if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '11' + - name: Publish Snapshot Documentation to Github Pages + if: success() uses: micronaut-projects/github-pages-deploy-action@grails env: - TARGET_REPOSITORY: ${{ github.repository }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages + COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} + COMMIT_NAME: ${{ env.GIT_USER_NAME }} FOLDER: docs/build/docs - COMMIT_EMAIL: behlp@unityfoundation.io - COMMIT_NAME: Puneet Behl + GH_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 628d57dad..011fddaf8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,34 +4,32 @@ on: types: [published] jobs: - release: runs-on: ubuntu-latest - env: GIT_USER_NAME: puneetbehl GIT_USER_EMAIL: behlp@unityfoundation.io - steps: - - uses: actions/checkout@v4 - uses: gradle/wrapper-validation-action@v2 - uses: actions/setup-java@v4 with: { java-version: 11, distribution: temurin } - - name: Set the current release version + - name: Get the current release version id: release_version - run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT + run: | + echo "Release version: ${GITHUB_REF:11}" + echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - - name: Run pre-release + - name: Set projectVersion to the release version uses: micronaut-projects/github-actions/pre-release@master - - 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 + - name: Publish release artifacts to Sonatype id: publish_to_sonatype uses: gradle/actions/setup-gradle@v3 env: @@ -60,21 +58,18 @@ jobs: with: arguments: views-docs:docs - - name: Export Gradle Properties - uses: micronaut-projects/github-actions/export-gradle-properties@master - - - name: Publish to Github Pages + - name: Publish Documentation to Github Pages if: success() uses: micronaut-projects/github-pages-deploy-action@grails env: BETA: ${{ contains(steps.release_version.outputs.release_version, 'M') || contains(steps.release_version.outputs.release_version, 'RC') }} - GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages - FOLDER: docs/build/docs - VERSION: ${{ steps.release_version.outputs.release_version }} COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} COMMIT_NAME: ${{ env.GIT_USER_NAME }} + FOLDER: docs/build/docs + GH_TOKEN: ${{ secrets.GH_TOKEN }} + VERSION: ${{ steps.release_version.outputs.release_version }} - - name: Run post-release + - name: Set projectVersion to the next snapshot version if: success() uses: micronaut-projects/github-actions/post-release@master \ No newline at end of file diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index 374a75714..9f90ba6c3 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -53,7 +53,7 @@ gradlePlugin { afterEvaluate { signing { - required { isReleaseVersion && gradle.taskGraph.hasTask('publish') } + required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } Publication[] publications = new Publication[publishing.publications.size() - 1] publishing.publications.findAll { it.name != 'pluginMaven' }.toArray(publications) sign(publications) diff --git a/json/build.gradle b/json/build.gradle index 2e9a09b52..6c945214a 100644 --- a/json/build.gradle +++ b/json/build.gradle @@ -31,11 +31,6 @@ java { withSourcesJar() } -springBoot { - // Project has 2 classes with main methods, so we need to specify which one to select - mainClass = 'grails.plugin.json.view.Application' -} - tasks.named('bootJar') { enabled = false // Don't need a bootJar for plugin } From 6b6ee94da740314caeabf547e017a84823524079 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 27 Feb 2024 13:17:40 +0530 Subject: [PATCH 03/56] chore(deps): update plugin com.gradle.enterprise to v3.16.2 (#505) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 937467559..1bf61e330 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradle.enterprise' version '3.16.1' + id 'com.gradle.enterprise' version '3.16.2' id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1' } From 621fde4883f3f14fde2dfc122295a063f6e21761 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Tue, 27 Feb 2024 13:18:41 +0530 Subject: [PATCH 04/56] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index faa637f4b..962d89c35 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.1.3-SNAPSHOT +projectVersion=3.2.0-SNAPSHOT # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From e851ea67bfe07f660ff3049ed138a6cb843ffa39 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 10:36:59 +0530 Subject: [PATCH 05/56] fix(deps): update dependency com.bertramlabs.plugins:asset-pipeline-gradle to v4.4.0 (#530) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/buildsrc.libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/buildsrc.libs.versions.toml b/gradle/buildsrc.libs.versions.toml index f64815544..cb439083c 100644 --- a/gradle/buildsrc.libs.versions.toml +++ b/gradle/buildsrc.libs.versions.toml @@ -1,6 +1,6 @@ [versions] asciidoctor-gradle-jvm = '4.0.1' -assetpipeline = '4.3.0' +assetpipeline = '4.4.0' grails-gradle-plugin = '6.1.2' grails-views = '3.1.2' groovy-doc = '1.0.1' From 1f2835cdfa085467d465039563d25a3784331969 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 12:10:46 +0530 Subject: [PATCH 06/56] fix(deps): update dependency io.micronaut:micronaut-http-client to v3.10.3 (#531) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7863c79e7..7632624a8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ grails-gradle-plugin = '6.1.2' grails-testing-support = '3.1.2' groovy = '3.0.11' java-baseline = '11' -micronaut = '3.8.7' +micronaut = '3.10.3' slf4j = '1.7.36' spock = '2.3-groovy-3.0' spring-boot = '2.7.18' From 4cc4d537b718f1f51fc91c95e53e76dc0a55c0d7 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Sat, 2 Mar 2024 10:13:05 +0100 Subject: [PATCH 07/56] fix(ci): Fix problem with reading versions (#533) Gradle Enterprise Plugins can publish versions without the patch version. This commit takes that into account. --- .github/workflows/groovy-joint-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index 19f271233..620ec928e 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -41,8 +41,8 @@ jobs: - name: Get version of Gradle Enterprise plugin id: gradle_enterprise_version run: | - GE_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.enterprise\"\|'"'com.gradle.enterprise'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+\.[0-9]+)['\"]?.*/\1/" | tr -d [:space:]) - GE_USER_DATA_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.common-custom-user-data-gradle-plugin\"\|'"'com.gradle.common-custom-user-data-gradle-plugin'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+\.[0-9]+)['\"]?.*/\1/" | tr -d [:space:]) + GE_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.enterprise\"\|'"'com.gradle.enterprise'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:]) + GE_USER_DATA_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.common-custom-user-data-gradle-plugin\"\|'"'com.gradle.common-custom-user-data-gradle-plugin'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:]) echo "Project uses Gradle Enterprise Plugin version: $GE_PLUGIN_VERSION" echo "Project uses Gradle Common Custom User Data Plugin version: $GE_USER_DATA_PLUGIN_VERSION" echo "ge_plugin_version=$GE_PLUGIN_VERSION" >> $GITHUB_OUTPUT From 148d3abd8b588d4885130bdd703c30223ab3cec5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:43:13 +0530 Subject: [PATCH 08/56] fix(deps): update gorm to v8.1.0 (#532) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7632624a8..cba992d89 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] assetpipeline = '4.3.0' caffeine = '2.9.3' -gorm = '8.0.4' +gorm = '8.1.0' gorm-hibernate5 = '8.0.3' gorm-mongodb = '8.1.2' grails = '6.1.2' From aeb548377a8c5c49fb133385d1ca6403a43ac5ba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:43:22 +0530 Subject: [PATCH 09/56] chore(deps): update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.13 (#528) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 1bf61e330..81d961c8f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ plugins { id 'com.gradle.enterprise' version '3.16.2' - id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.13' } gradleEnterprise { From 9c01ca5b79b0d6a41fb77bb104de34c1f5826191 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 14:43:33 +0530 Subject: [PATCH 10/56] fix(deps): update dependency org.asciidoctor:asciidoctor-gradle-jvm to v4.0.2 (#514) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/buildsrc.libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/buildsrc.libs.versions.toml b/gradle/buildsrc.libs.versions.toml index cb439083c..a65976859 100644 --- a/gradle/buildsrc.libs.versions.toml +++ b/gradle/buildsrc.libs.versions.toml @@ -1,5 +1,5 @@ [versions] -asciidoctor-gradle-jvm = '4.0.1' +asciidoctor-gradle-jvm = '4.0.2' assetpipeline = '4.4.0' grails-gradle-plugin = '6.1.2' grails-views = '3.1.2' From 4d9c0080ccfcfdeba268e0a8518dc22ff3c875d9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 22:36:56 +0530 Subject: [PATCH 11/56] fix(deps): update groovy monorepo to v3.0.21 (#529) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cba992d89..6d2476205 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ gorm-mongodb = '8.1.2' grails = '6.1.2' grails-gradle-plugin = '6.1.2' grails-testing-support = '3.1.2' -groovy = '3.0.11' +groovy = '3.0.21' java-baseline = '11' micronaut = '3.10.3' slf4j = '1.7.36' From 7a023eae58a9ba5438f3d4cdfe2294787dc693bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Hron?= Date: Fri, 16 Dec 2022 14:53:10 +0100 Subject: [PATCH 12/56] Added support for multi-template inheritance. --- .../views/_child2MultipleParents.gson | 9 +++++ .../views/_child3MultipleParents.gson | 9 +++++ .../views/_child4MultipleParents.gson | 11 ++++++ json/grails-app/views/_parent4.gson | 7 ++++ .../json/view/JsonViewWritableScript.groovy | 34 ++++++++++++++----- .../plugin/json/view/api/JsonView.groovy | 19 ++++------- .../json/view/api/internal/ParentInfo.groovy | 17 ++++++++++ .../json/view/TemplateInheritanceSpec.groovy | 27 +++++++++++++++ 8 files changed, 112 insertions(+), 21 deletions(-) create mode 100644 json/grails-app/views/_child2MultipleParents.gson create mode 100644 json/grails-app/views/_child3MultipleParents.gson create mode 100644 json/grails-app/views/_child4MultipleParents.gson create mode 100644 json/grails-app/views/_parent4.gson create mode 100644 json/src/main/groovy/grails/plugin/json/view/api/internal/ParentInfo.groovy diff --git a/json/grails-app/views/_child2MultipleParents.gson b/json/grails-app/views/_child2MultipleParents.gson new file mode 100644 index 000000000..90b4610ef --- /dev/null +++ b/json/grails-app/views/_child2MultipleParents.gson @@ -0,0 +1,9 @@ +import grails.plugin.json.view.Player +import groovy.transform.Field + +inherits(template: 'parent2') +inherits(template: 'parent4') + +@Field Player player + +json g.render(player) diff --git a/json/grails-app/views/_child3MultipleParents.gson b/json/grails-app/views/_child3MultipleParents.gson new file mode 100644 index 000000000..a6a377cb1 --- /dev/null +++ b/json/grails-app/views/_child3MultipleParents.gson @@ -0,0 +1,9 @@ +import grails.plugin.json.view.Player +import groovy.transform.Field + +inherits(template: 'parent3') +inherits(template: 'parent4') + +@Field Player player + +json g.render(player, [includes:'name']) diff --git a/json/grails-app/views/_child4MultipleParents.gson b/json/grails-app/views/_child4MultipleParents.gson new file mode 100644 index 000000000..f188161e4 --- /dev/null +++ b/json/grails-app/views/_child4MultipleParents.gson @@ -0,0 +1,11 @@ +import grails.plugin.json.view.Player +import groovy.transform.Field + +inherits(template: 'parent2') +inherits(template: 'parent4') + +@Field Player player + +json { + name player.name +} diff --git a/json/grails-app/views/_parent4.gson b/json/grails-app/views/_parent4.gson new file mode 100644 index 000000000..5af6f3039 --- /dev/null +++ b/json/grails-app/views/_parent4.gson @@ -0,0 +1,7 @@ +import groovy.transform.Field + +@Field Object object + +json { + bar "foo" +} diff --git a/json/src/main/groovy/grails/plugin/json/view/JsonViewWritableScript.groovy b/json/src/main/groovy/grails/plugin/json/view/JsonViewWritableScript.groovy index a3f43d626..bbed80730 100644 --- a/json/src/main/groovy/grails/plugin/json/view/JsonViewWritableScript.groovy +++ b/json/src/main/groovy/grails/plugin/json/view/JsonViewWritableScript.groovy @@ -4,8 +4,10 @@ import grails.plugin.json.builder.JsonOutput import grails.plugin.json.builder.StreamingJsonBuilder import grails.plugin.json.view.api.JsonView import grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper +import grails.plugin.json.view.api.internal.ParentInfo import grails.util.GrailsNameUtils import grails.views.AbstractWritableScript +import grails.views.GrailsViewTemplate import grails.views.api.GrailsView import groovy.transform.CompileStatic import org.grails.buffer.FastStringWriter @@ -46,13 +48,20 @@ abstract class JsonViewWritableScript extends AbstractWritableScript implements * @return */ StreamingJsonBuilder json(@DelegatesTo(value = StreamingJsonBuilder.StreamingJsonDelegate, strategy = Closure.DELEGATE_FIRST) Closure callable) { - if(parentTemplate != null) { + if(parentData.size() > 0) { if (!inline) { out.write(JsonOutput.OPEN_BRACE) } - def parentWritable = prepareParentWritable() - parentWritable.writeTo(out) - resetProcessedObjects() + Iterator parentInfoIt = parentData.iterator() + while ( parentInfoIt.hasNext() ) { + ParentInfo parentInfo = parentInfoIt.next() + def parentWritable = prepareParentWritable(parentInfo.parentTemplate, parentInfo.parentModel) + parentWritable.writeTo(out) + resetProcessedObjects() + if ( parentInfoIt.hasNext() ) { + out.write(JsonOutput.COMMA) + } + } def jsonDelegate = new StreamingJsonBuilder.StreamingJsonDelegate(out, false, generator) callable.setDelegate(jsonDelegate) callable.call() @@ -107,13 +116,20 @@ abstract class JsonViewWritableScript extends AbstractWritableScript implements * @return The json builder */ StreamingJsonBuilder json(JsonOutput.JsonWritable writable) { - if(parentTemplate != null) { + if(parentData.size() > 0) { if (!inline) { out.write(JsonOutput.OPEN_BRACE) } - def parentWritable = prepareParentWritable() - parentWritable.writeTo(out) - resetProcessedObjects() + Iterator parentInfoIt = parentData.iterator() + while ( parentInfoIt.hasNext() ) { + ParentInfo parentInfo = parentInfoIt.next() + def parentWritable = prepareParentWritable(parentInfo.parentTemplate, parentInfo.parentModel) + parentWritable.writeTo(out) + resetProcessedObjects() + if ( parentInfoIt.hasNext() ) { + out.write(JsonOutput.COMMA) + } + } writable.setInline(true) writable.setFirst(false) writable.writeTo(out) @@ -158,7 +174,7 @@ abstract class JsonViewWritableScript extends AbstractWritableScript implements return json } - private GrailsView prepareParentWritable() { + private GrailsView prepareParentWritable(GrailsViewTemplate parentTemplate, Map parentModel) { parentModel.putAll(binding.variables) for(o in binding.variables.values()) { if (o != null) { diff --git a/json/src/main/groovy/grails/plugin/json/view/api/JsonView.groovy b/json/src/main/groovy/grails/plugin/json/view/api/JsonView.groovy index 1f9210152..0cef22a42 100644 --- a/json/src/main/groovy/grails/plugin/json/view/api/JsonView.groovy +++ b/json/src/main/groovy/grails/plugin/json/view/api/JsonView.groovy @@ -5,6 +5,7 @@ import grails.plugin.json.builder.StreamingJsonBuilder import grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper import grails.plugin.json.view.api.internal.DefaultHalViewHelper import grails.plugin.json.view.api.internal.DefaultJsonApiViewHelper +import grails.plugin.json.view.api.internal.ParentInfo import grails.plugin.json.view.api.internal.TemplateRenderer import grails.plugin.json.view.api.jsonapi.JsonApiIdRenderStrategy import grails.views.GrailsViewTemplate @@ -21,7 +22,6 @@ import groovy.transform.CompileStatic */ @CompileStatic trait JsonView extends GrailsView { - /** * The default generator */ @@ -37,15 +37,7 @@ trait JsonView extends GrailsView { */ StreamingJsonBuilder json - /** - * The parent template if any - */ - GrailsViewTemplate parentTemplate - - /** - * The parent model, if any - */ - Map parentModel + Collection parentData = [] /** * Overrides the default helper with new methods specific to JSON building */ @@ -91,8 +83,11 @@ trait JsonView extends GrailsView { .resolveTemplateUri(getControllerNamespace(), getControllerName(), template.toString()) GrailsViewTemplate parentTemplate = (GrailsViewTemplate)templateEngine.resolveTemplate(templateUri, locale) if(parentTemplate != null) { - this.parentTemplate = parentTemplate - this.parentModel = model + ParentInfo parentInfo = new ParentInfo( + parentTemplate: parentTemplate, + parentModel: model + ) + parentData.add(parentInfo) } else { throw new ViewException("Template not found for name $template") diff --git a/json/src/main/groovy/grails/plugin/json/view/api/internal/ParentInfo.groovy b/json/src/main/groovy/grails/plugin/json/view/api/internal/ParentInfo.groovy new file mode 100644 index 000000000..e0d84fdaa --- /dev/null +++ b/json/src/main/groovy/grails/plugin/json/view/api/internal/ParentInfo.groovy @@ -0,0 +1,17 @@ +package grails.plugin.json.view.api.internal + +import grails.views.GrailsViewTemplate +import groovy.transform.CompileStatic + +@CompileStatic +class ParentInfo { + /** + * The parent template if any + */ + GrailsViewTemplate parentTemplate + + /** + * The parent model, if any + */ + Map parentModel +} diff --git a/json/src/test/groovy/grails/plugin/json/view/TemplateInheritanceSpec.groovy b/json/src/test/groovy/grails/plugin/json/view/TemplateInheritanceSpec.groovy index 8555ea840..64732c1ba 100644 --- a/json/src/test/groovy/grails/plugin/json/view/TemplateInheritanceSpec.groovy +++ b/json/src/test/groovy/grails/plugin/json/view/TemplateInheritanceSpec.groovy @@ -44,4 +44,31 @@ class TemplateInheritanceSpec extends Specification implements JsonViewTest { result.jsonText == '{"name":"Cantona"}' } + void "test extending multiple templates"() { + when: + + def result = render(template:'child2MultipleParents', model:[player: new Player(name: "Cantona")]) + then: + result.jsonText == '{"_links":{"self":{"href":"http://localhost:8080/player","hreflang":"en","type":"application/hal+json"}},"foo":"bar","bar":"foo","name":"Cantona"}' + } + + void "test extending multiple templates that uses g.render(..)"() { + + when: + def player = new Player(name: "Cantona") + player.id = 1L + def result = render(template:'child3MultipleParents', model:[player: player]) + then: + result.jsonText == '{"id":1,"bar":"foo","name":"Cantona"}' + } + + void "test extending multiple templates and rendering a JSON block"() { + when: + + def result = render(template:'child4MultipleParents', model:[player: new Player(name: "Cantona")]) + then: + result.jsonText == '{"_links":{"self":{"href":"http://localhost:8080/player","hreflang":"en","type":"application/hal+json"}},"foo":"bar","bar":"foo","name":"Cantona"}' + } + + } From 305222a7591acf7fc2df8ac023a0f5d15be663ad Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Thu, 11 May 2023 08:12:39 +0200 Subject: [PATCH 13/56] Update version history in documentation. (#418) * Update version history in documentation. * Added a note in the version history section to check Github release page for later releases. --- docs/src/docs/asciidoc/json/history.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/docs/asciidoc/json/history.adoc b/docs/src/docs/asciidoc/json/history.adoc index 55cae0d7b..754c34745 100644 --- a/docs/src/docs/asciidoc/json/history.adoc +++ b/docs/src/docs/asciidoc/json/history.adoc @@ -2,6 +2,8 @@ The current release is {version}. Below is a version history. +For later releases check the release notes at: https://github.com/grails/grails-views/releases + *2.0.2* * Fix bug where incorrect JSON was generated when all values are null in the nested object. From f05d192dafd84ad2cf170da42a9e85e06a7cf22f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Mar 2024 00:39:01 +0000 Subject: [PATCH 14/56] fix(deps): update gorm to v8.1.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6d2476205..94f7cb9e0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] assetpipeline = '4.3.0' caffeine = '2.9.3' -gorm = '8.1.0' +gorm = '8.1.1' gorm-hibernate5 = '8.0.3' gorm-mongodb = '8.1.2' grails = '6.1.2' From 4155296360619ac01423e2057bcf38cb0eb25fa7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Mar 2024 14:20:28 +0530 Subject: [PATCH 15/56] fix(deps): update grails-testing-support monorepo to v3.2.0 (#535) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 94f7cb9e0..cb2aa6d16 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ gorm-hibernate5 = '8.0.3' gorm-mongodb = '8.1.2' grails = '6.1.2' grails-gradle-plugin = '6.1.2' -grails-testing-support = '3.1.2' +grails-testing-support = '3.2.0' groovy = '3.0.21' java-baseline = '11' micronaut = '3.10.3' From 598b6c6c2d650c0ebc9647618d5909af92d2c556 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 7 Mar 2024 14:33:46 +0530 Subject: [PATCH 16/56] chore(build): Migrate to Develocity build cache connector (#536) To simplify cache management with the [Develocity cache connector](https://docs.gradle.com/enterprise/gradle-plugin/#using_the_develocity_connector) --- settings.gradle | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/settings.gradle b/settings.gradle index 81d961c8f..1ca0358ee 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,7 +8,7 @@ gradleEnterprise { buildScan { publishAlwaysIf(System.getenv('CI') == 'true') publishIfAuthenticated() - uploadInBackground = System.getenv('CI') == null + uploadInBackground = System.getenv("CI") == null capture { taskInputFiles = true } @@ -17,14 +17,10 @@ gradleEnterprise { buildCache { local { enabled = System.getenv('CI') != 'true' } - remote(HttpBuildCache) { - push = System.getenv('CI') == 'true' + remote(gradleEnterprise.buildCache) { + def isAuthenticated = System.getenv('GRADLE_ENTERPRISE_ACCESS_KEY') + push = System.getenv('CI') == 'true' && isAuthenticated enabled = true - url = 'https://ge.grails.org/cache/' - credentials { - username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER') - password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY') - } } } From b6058d03832f04cdd46b46397135204ce9ebf16e Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 7 Mar 2024 14:41:00 +0530 Subject: [PATCH 17/56] chore(release): enhance release workflow configurations (#537) - Breakdown into multiple jobs to simplify release process --- .github/workflows/release.yml | 98 +++++++++++++++++++++++++++-------- 1 file changed, 76 insertions(+), 22 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 011fddaf8..91e0016f3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,10 @@ name: Release on: release: types: [published] - jobs: - release: + publish: + outputs: + release_version: ${{ steps.release_version.outputs.value }} runs-on: ubuntu-latest env: GIT_USER_NAME: puneetbehl @@ -13,22 +14,34 @@ jobs: - uses: actions/checkout@v4 - uses: gradle/wrapper-validation-action@v2 - uses: actions/setup-java@v4 - with: { java-version: 11, distribution: temurin } - + with: + - java-version: 11 + - distribution: temurin - name: Get the current release version id: release_version - run: | - echo "Release version: ${GITHUB_REF:11}" - echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - + run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - name: Set projectVersion to the release version uses: micronaut-projects/github-actions/pre-release@master - + - name: Run Assemble + if: success() + id: assemble + uses: gradle/gradle-build-action@v2 + with: + arguments: 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 }} + - name: Upload Distribution + if: success() + uses: actions/upload-artifact@v4 + with: + name: grails-views-${{ steps.release_version.outputs.value }}.zip + path: ./**/build/libs/* - 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 release artifacts to Sonatype id: publish_to_sonatype uses: gradle/actions/setup-gradle@v3 @@ -44,32 +57,73 @@ jobs: SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} with: arguments: | - -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg - publishToSonatype - closeAndReleaseSonatypeStagingRepository - + -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg + publishToSonatype + closeSonatypeStagingRepository + release: + needs: publish + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + ref: v${{ needs.publish.outputs.release_version }} + - name: Nexus Staging Close And Release + uses: gradle/gradle-build-action@v2 + 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 }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + with: + arguments: | + findSonatypeStagingRepository + releaseSonatypeStagingRepository + - name: Run post-release + if: success() + uses: micronaut-projects/github-actions/post-release@master + with: + token: ${{ secrets.GITHUB_TOKEN }} + env: + SNAPSHOT_SUFFIX: -SNAPSHOT + docs: + needs: publish + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_TOKEN }} + ref: v${{ needs.publish.outputs.release_version }} + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: '11' - name: Generate Documentation if: success() uses: gradle/actions/setup-gradle@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 }} + GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} with: arguments: views-docs:docs - - name: Publish Documentation to Github Pages if: success() uses: micronaut-projects/github-pages-deploy-action@grails env: - BETA: ${{ contains(steps.release_version.outputs.release_version, 'M') || contains(steps.release_version.outputs.release_version, 'RC') }} + BETA: ${{ contains(needs.publish.outputs.release_version, 'M') }} BRANCH: gh-pages COMMIT_EMAIL: ${{ env.GIT_USER_EMAIL }} COMMIT_NAME: ${{ env.GIT_USER_NAME }} FOLDER: docs/build/docs GH_TOKEN: ${{ secrets.GH_TOKEN }} - VERSION: ${{ steps.release_version.outputs.release_version }} - - - name: Set projectVersion to the next snapshot version - if: success() - uses: micronaut-projects/github-actions/post-release@master \ No newline at end of file + VERSION: ${{ needs.publish.outputs.release_version }} \ No newline at end of file From dac2344d4dae34fed179dda37c7e02f02e4fe509 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:14:43 +0530 Subject: [PATCH 18/56] chore(deps): update gradle/gradle-build-action action to v3 (#538) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 91e0016f3..8b4dc88a9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ jobs: - name: Run Assemble if: success() id: assemble - uses: gradle/gradle-build-action@v2 + uses: gradle/gradle-build-action@v3 with: arguments: assemble env: @@ -72,7 +72,7 @@ jobs: token: ${{ secrets.GH_TOKEN }} ref: v${{ needs.publish.outputs.release_version }} - name: Nexus Staging Close And Release - uses: gradle/gradle-build-action@v2 + 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 }} From 61a38003ca360e130832be4fdadbf6c56bbfe8df Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Mar 2024 18:18:57 +0530 Subject: [PATCH 19/56] fix(deps): update grails-testing-support monorepo to v3.2.1 (#539) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cb2aa6d16..b5a83170a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ gorm-hibernate5 = '8.0.3' gorm-mongodb = '8.1.2' grails = '6.1.2' grails-gradle-plugin = '6.1.2' -grails-testing-support = '3.2.0' +grails-testing-support = '3.2.1' groovy = '3.0.21' java-baseline = '11' micronaut = '3.10.3' From 32856763cd014b1142be4c9182520ae8c0f96e84 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 7 Mar 2024 18:24:54 +0530 Subject: [PATCH 20/56] chore(release): change release workflow confiugration (#540) Update setup-java step. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8b4dc88a9..0ca948170 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,8 +15,8 @@ jobs: - uses: gradle/wrapper-validation-action@v2 - uses: actions/setup-java@v4 with: - - java-version: 11 - - distribution: temurin + java-version: 11 + distribution: temurin - name: Get the current release version id: release_version run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT From 85c0381a317edc75dd2d353ac7ee4a8f55f2667a Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Sat, 9 Mar 2024 15:21:22 +0100 Subject: [PATCH 21/56] fix(build): Sign all artifacts on release (#541) This commit tries to fix the problem where some artifacts are not signed on release. --- gradle-plugin/build.gradle | 7 ++++--- gradle/grailsCentralPublishing.gradle | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index 9f90ba6c3..9f34d709f 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -53,10 +53,11 @@ gradlePlugin { afterEvaluate { signing { + def publicationContainer = project.extensions.findByType(PublishingExtension).publications required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - Publication[] publications = new Publication[publishing.publications.size() - 1] - publishing.publications.findAll { it.name != 'pluginMaven' }.toArray(publications) - sign(publications) + Publication[] publicationsToSign = new Publication[publicationContainer.size() - 1] + publicationContainer.findAll { it.name != 'pluginMaven' }.toArray(publicationsToSign) + sign(publicationsToSign) } publishing.publications.each { publication -> diff --git a/gradle/grailsCentralPublishing.gradle b/gradle/grailsCentralPublishing.gradle index c7ac1470f..c71bd202e 100644 --- a/gradle/grailsCentralPublishing.gradle +++ b/gradle/grailsCentralPublishing.gradle @@ -40,10 +40,12 @@ project.extensions.configure(PublishingExtension) { PublishingExtension pe -> } afterEvaluate { - def mavenPublication = project.extensions.findByType(PublishingExtension).publications.named('pluginMaven') - project.extensions.configure(SigningExtension) { SigningExtension se -> + def publicationContainer = extensions.findByType(PublishingExtension).publications + extensions.configure(SigningExtension) { SigningExtension se -> se.required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - se.sign mavenPublication.get() + Publication[] publicationsToSign = new Publication[publicationContainer.size()] + publicationContainer.findAll().toArray(publicationsToSign) + se.sign(publicationsToSign) } } From a6c2716442c37dbc09c72b73e550ffea8007981a Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Mon, 11 Mar 2024 16:31:15 +0100 Subject: [PATCH 22/56] fix(build): Re-haul of signing/publishing (#543) As the `views-gradle` module uses the Gradle `java-gradle-plugin`, there are some extra considerations that must be taken for signing and publishing. This commit tries to accommodate these considerations. --- build.gradle | 8 ++--- core/build.gradle | 27 +++------------ docs/build.gradle | 2 +- gradle-plugin/build.gradle | 33 +++++++------------ gradle/api-docs-config.gradle | 14 ++++++++ gradle/grails-plugin-config.gradle | 9 +++++ gradle/java-config.gradle | 5 +++ ...ralPublishing.gradle => publishing.gradle} | 19 +++++++---- json-templates/build.gradle | 25 +++++++------- json-testing-support/build.gradle | 25 ++------------ json/build.gradle | 21 +++--------- markup/build.gradle | 25 +++----------- 12 files changed, 83 insertions(+), 130 deletions(-) create mode 100644 gradle/api-docs-config.gradle create mode 100644 gradle/grails-plugin-config.gradle create mode 100644 gradle/java-config.gradle rename gradle/{grailsCentralPublishing.gradle => publishing.gradle} (71%) diff --git a/build.gradle b/build.gradle index 224ef345d..f92183ea3 100644 --- a/build.gradle +++ b/build.gradle @@ -67,10 +67,10 @@ allprojects { if (isReleaseVersion) { nexusPublishing { - String ossUser = project.findProperty('sonatypeOssUsername') ?: '' - String ossPass = project.findProperty('sonatypeOssPassword') ?: '' - String ossStagingProfileId = project.findProperty('sonatypeOssStagingProfileId') ?: '' - String ossRepo = project.findProperty('sonatypeOssRepo') ?: '' + String ossUser = project.findProperty('sonatypeOssUsername') + String ossPass = project.findProperty('sonatypeOssPassword') + String ossStagingProfileId = project.findProperty('sonatypeOssStagingProfileId') + String ossRepo = project.findProperty('sonatypeOssRepo') ?: 'https://s01.oss.sonatype.org/service/local/' repositories { sonatype { nexusUrl = uri(ossRepo) diff --git a/core/build.gradle b/core/build.gradle index 6177e8f6a..6b8a71cec 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -8,9 +8,6 @@ plugins { group = 'org.grails' ext.set('projectDesc', 'Grails Views Core') -// Groovydoc task requires the Groovy version of Gradle -configurations.register('groovydocImplementation') - dependencies { implementation libs.groovy.core @@ -26,25 +23,9 @@ dependencies { api libs.caffeine // Used in public api testImplementation libs.spock.core - - groovydocImplementation localGroovy(), { - because 'The Groovydoc task requires the Groovy version of Gradle' - } -} - -java { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.baseline.get()) - withJavadocJar() - withSourcesJar() -} - -tasks.named('javadocJar', Jar) { - from tasks.named('groovydoc') -} - -tasks.withType(Groovydoc).configureEach { - classpath = configurations.groovydocImplementation - groovyClasspath = configurations.groovydocImplementation + testRuntimeOnly libs.slf4j.nop // Get rid of warnings about missing slf4j implementation during test task } -apply from: rootProject.layout.projectDirectory.file('gradle/grailsCentralPublishing.gradle') \ No newline at end of file +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file diff --git a/docs/build.gradle b/docs/build.gradle index 0955edccd..cc1881d8f 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -56,4 +56,4 @@ tasks.withType(Groovydoc).configureEach { tasks.register('docs') { group = 'documentation' dependsOn 'apidocs', 'asciidoctor' -} +} \ No newline at end of file diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index 9f34d709f..49d2d5b5f 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -20,29 +20,15 @@ dependencies { compileOnly "org.codehaus.groovy:groovy-xml:$GroovySystem.version" } -java { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.baseline.get()) - withJavadocJar() - withSourcesJar() -} - -tasks.named('javadocJar', Jar) { - from tasks.named('groovydoc') -} - -tasks.withType(Sign).configureEach { - onlyIf { isReleaseVersion } -} - gradlePlugin { plugins { - register('viewsJson') { + create('viewsJson') { id = 'org.grails.plugins.views-json' implementationClass = 'grails.views.gradle.json.GrailsJsonViewsPlugin' displayName = 'Grails Json Views Gradle Plugin' description = 'The Gradle plugin for Json Views' } - register('viewsMarkup') { + create('viewsMarkup') { id = 'org.grails.plugins.views-markup' implementationClass = 'grails.views.gradle.markup.GrailsMarkupViewsPlugin' displayName = 'Grails Markup Views Gradle Plugin' @@ -51,17 +37,16 @@ gradlePlugin { } } +// This is for signing and publishing the Gradle Plugin Marker poms afterEvaluate { signing { - def publicationContainer = project.extensions.findByType(PublishingExtension).publications required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - Publication[] publicationsToSign = new Publication[publicationContainer.size() - 1] - publicationContainer.findAll { it.name != 'pluginMaven' }.toArray(publicationsToSign) + def publicationContainer = project.extensions.findByType(PublishingExtension).publications + def publicationsToSign = publicationContainer.stream().filter { it.name != 'pluginMaven' }.toArray(Publication[]::new) sign(publicationsToSign) } - publishing.publications.each { publication -> - MavenPublication pub = publication as MavenPublication + def pub = publication as MavenPublication if (pub.name != 'pluginMaven') { pub.pom.withXml { def xml = asNode() @@ -69,4 +54,8 @@ afterEvaluate { } } } -} \ No newline at end of file +} + +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file diff --git a/gradle/api-docs-config.gradle b/gradle/api-docs-config.gradle new file mode 100644 index 000000000..137159f23 --- /dev/null +++ b/gradle/api-docs-config.gradle @@ -0,0 +1,14 @@ +// Groovydoc task requires the Groovy version of Gradle +configurations.register('groovydocImplementation') + +dependencies { + groovydocImplementation localGroovy(), { + because 'The Groovydoc task requires the Groovy version of Gradle' + } +} +tasks.withType(Groovydoc).configureEach { + classpath = configurations.groovydocImplementation +} +tasks.named('javadocJar', Jar) { + from tasks.named('groovydoc') +} diff --git a/gradle/grails-plugin-config.gradle b/gradle/grails-plugin-config.gradle new file mode 100644 index 000000000..a2916122f --- /dev/null +++ b/gradle/grails-plugin-config.gradle @@ -0,0 +1,9 @@ +group = 'org.grails.plugins' + +tasks.named('bootJar') { + enabled = false // Grails plugins shouldn't produce a boot jar +} +tasks.named('jar', Jar) { + enabled = true + archiveClassifier = '' // Skip the '-plain' suffix on the jar file name +} diff --git a/gradle/java-config.gradle b/gradle/java-config.gradle new file mode 100644 index 000000000..255391d97 --- /dev/null +++ b/gradle/java-config.gradle @@ -0,0 +1,5 @@ +java { + sourceCompatibility = JavaVersion.toVersion(libs.versions.java.baseline.get()) + withJavadocJar() + withSourcesJar() +} diff --git a/gradle/grailsCentralPublishing.gradle b/gradle/publishing.gradle similarity index 71% rename from gradle/grailsCentralPublishing.gradle rename to gradle/publishing.gradle index c71bd202e..c108144a7 100644 --- a/gradle/grailsCentralPublishing.gradle +++ b/gradle/publishing.gradle @@ -1,12 +1,20 @@ ext.set('signing.keyId', project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) ext.set('signing.password', project.findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) +ext.set('signing.secretKeyRingFile', project.findProperty('signing.secretKeyRingFile') ?: "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg") def javaComponent = components.named('java') project.extensions.configure(PublishingExtension) { PublishingExtension pe -> - pe.publications.register('pluginMaven', MavenPublication) { + // 'java-gradle-plugin' in views-gradle has already created this publication + if (!pe.publications.names.contains('pluginMaven')) { + pe.publications.register('pluginMaven', MavenPublication) + } + pe.publications.named('pluginMaven', MavenPublication) { artifactId = project.name - from javaComponent.get() + // 'java-gradle-plugin' in views-gradle has already configured this + if (project.name != 'views-gradle') { + from javaComponent.get() + } versionMapping { usage('java-api') { fromResolutionOf('runtimeClasspath') } usage('java-runtime') { fromResolutionResult() } @@ -28,8 +36,8 @@ project.extensions.configure(PublishingExtension) { PublishingExtension pe -> repositories { maven { credentials { - username = project.findProperty('artifactoryUsername') ?: '' - password = project.findProperty('artifactoryPassword') ?: '' + username = project.findProperty('artifactoryUsername') + password = project.findProperty('artifactoryPassword') } url = group == 'org.grails.plugins' ? uri('https://repo.grails.org/grails/plugins3-snapshots-local') : @@ -43,8 +51,7 @@ afterEvaluate { def publicationContainer = extensions.findByType(PublishingExtension).publications extensions.configure(SigningExtension) { SigningExtension se -> se.required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - Publication[] publicationsToSign = new Publication[publicationContainer.size()] - publicationContainer.findAll().toArray(publicationsToSign) + def publicationsToSign = publicationContainer.stream().filter { it.name == 'pluginMaven' }.toArray(Publication[]::new) se.sign(publicationsToSign) } } diff --git a/json-templates/build.gradle b/json-templates/build.gradle index 615cc70d2..5a0cf3be7 100644 --- a/json-templates/build.gradle +++ b/json-templates/build.gradle @@ -21,38 +21,35 @@ dependencies { compileOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during compileGsonViews task } -def sourceDir = layout.projectDirectory.dir('src/templates') -def outputDir = layout.buildDirectory.dir('classes/groovy/main') +def templateSourceDir = layout.projectDirectory.dir('src/templates') +def compilationOutputDir = layout.buildDirectory.dir('classes/groovy/main') sourceSets { main { groovy { - srcDirs = [sourceDir] + // Add templates as source dir + srcDirs = [templateSourceDir] } } } tasks.register('compileViews', JavaExec) { - inputs.dir sourceDir - outputs.dir outputDir + inputs.dir templateSourceDir + outputs.dir compilationOutputDir mainClass = 'grails.plugin.json.view.JsonViewCompiler' classpath configurations.compileClasspath + configurations.runtimeClasspath - args(sourceDir.asFile, outputDir.get().asFile, libs.versions.java.baseline.get(), ' ', ' ', 'none', 'UTF-8') + args(templateSourceDir.asFile, compilationOutputDir.get().asFile, libs.versions.java.baseline.get(), ' ', ' ', 'none', 'UTF-8') } +// This is needed to trigger compilation of the views tasks.named('classes') { dependsOn 'compileViews' } -java { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.baseline.get()) - withSourcesJar() - withJavadocJar() -} +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') // There are no javadocs for this project. // This is a workaround as a javadoc jar is required for publishing. tasks.named('javadocJar', Jar) { from 'src/templates' -} - -apply from: rootProject.layout.projectDirectory.file('gradle/grailsCentralPublishing.gradle') \ No newline at end of file +} \ No newline at end of file diff --git a/json-testing-support/build.gradle b/json-testing-support/build.gradle index 5e6ccb7cd..3f549496d 100644 --- a/json-testing-support/build.gradle +++ b/json-testing-support/build.gradle @@ -8,9 +8,6 @@ plugins { group = 'org.grails' ext.set('projectDesc', 'JSON Views Testing Support') - -configurations.register('groovydocImplementation') - dependencies { api project(':views-json') @@ -21,24 +18,8 @@ dependencies { implementation libs.groovy.core implementation libs.groovy.json implementation libs.spock.core - - groovydocImplementation localGroovy(), { - because 'The Groovydoc task requires the same Groovy version as Gradle' - } -} - -java { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.baseline.get()) - withJavadocJar() - withSourcesJar() -} - -tasks.withType(Groovydoc).configureEach { - classpath = configurations.groovydocImplementation -} - -tasks.named('javadocJar', Jar) { - from tasks.named('groovydoc') } -apply from: rootProject.layout.projectDirectory.file('gradle/grailsCentralPublishing.gradle') \ No newline at end of file +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file diff --git a/json/build.gradle b/json/build.gradle index 6c945214a..1814a6288 100644 --- a/json/build.gradle +++ b/json/build.gradle @@ -25,21 +25,9 @@ dependencies { testRuntimeOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during test task } -java { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.baseline.get()) - withJavadocJar() - withSourcesJar() -} - -tasks.named('bootJar') { - enabled = false // Don't need a bootJar for plugin -} - def testArtifacts = ['*.gson', 'circular/**'] tasks.named('jar', Jar) { - enabled = true // Need a jar for plugin - archiveClassifier = '' // Don't want the '-plain' classifier exclude testArtifacts } @@ -47,12 +35,11 @@ tasks.named('sourcesJar', Jar) { exclude testArtifacts } -tasks.named('javadocJar', Jar) { - from tasks.named('groovydoc') -} - tasks.named('build') { finalizedBy 'javadocJar', 'sourcesJar' } -apply from: rootProject.layout.projectDirectory.file('gradle/grailsCentralPublishing.gradle') \ No newline at end of file +apply from: rootProject.layout.projectDirectory.file('gradle/grails-plugin-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file diff --git a/markup/build.gradle b/markup/build.gradle index f17a3ebb0..3e7dedd6a 100644 --- a/markup/build.gradle +++ b/markup/build.gradle @@ -6,7 +6,6 @@ plugins { id 'signing' } -group = 'org.grails.plugins' ext.set('projectDesc', 'Grails Markup Views') dependencies { @@ -20,27 +19,11 @@ dependencies { testRuntimeOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during test task } -java { - sourceCompatibility = JavaVersion.toVersion(libs.versions.java.baseline.get()) - withJavadocJar() - withSourcesJar() -} - -tasks.named('bootJar') { - enabled = false // Don't need a bootJar for plugin -} - -tasks.named('jar', Jar) { - enabled = true // Need a jar for plugin - archiveClassifier = '' // Don't want the '-plain' classifier -} - -tasks.named('javadocJar', Jar) { - from tasks.named('groovydoc') -} - tasks.named('build') { finalizedBy 'javadocJar', 'sourcesJar' } -apply from: rootProject.layout.projectDirectory.file('gradle/grailsCentralPublishing.gradle') \ No newline at end of file +apply from: rootProject.layout.projectDirectory.file('gradle/grails-plugin-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file From 8b017001746f30b18706f77e69bd98a2316176fc Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Wed, 13 Mar 2024 07:47:34 +0100 Subject: [PATCH 23/56] fix(release): Separate the publications (#545) * fix(release): Separate the publications Create publications under different names and handle publishing of the views-gradle project separately. * chore(release): Update release workflow to upload dist file name --------- Co-authored-by: Puneet Behl --- .github/workflows/release.yml | 2 +- build.gradle | 14 ++++++++++---- gradle-plugin/build.gradle | 36 ++++++++++++++++++++++------------- gradle/publishing.gradle | 27 ++++---------------------- 4 files changed, 38 insertions(+), 41 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ca948170..097ba6f3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: if: success() uses: actions/upload-artifact@v4 with: - name: grails-views-${{ steps.release_version.outputs.value }}.zip + name: grails-views-${{ steps.release_version.outputs.value }} path: ./**/build/libs/* - name: Generate key file for artifact signing env: diff --git a/build.gradle b/build.gradle index f92183ea3..9f0f467e4 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,9 @@ version = projectVersion ext.set('grailsVersion', libs.versions.grails.asProvider().get()) ext.set('isSnapshot', version.endsWith('-SNAPSHOT')) ext.set('isReleaseVersion', !isSnapshot) +ext.set('signing.keyId', findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) +ext.set('signing.password', findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) +ext.set('signing.secretKeyRingFile', findProperty('signing.secretKeyRingFile') ?: "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg") ext.set('pomInfo', { delegate.url 'https://views.grails.org/latest/' delegate.licenses { @@ -63,14 +66,17 @@ allprojects { 'Implementation-Vendor': 'grails.org' ) } + tasks.withType(Sign).configureEach { + onlyIf { isReleaseVersion } + } } if (isReleaseVersion) { nexusPublishing { - String ossUser = project.findProperty('sonatypeOssUsername') - String ossPass = project.findProperty('sonatypeOssPassword') - String ossStagingProfileId = project.findProperty('sonatypeOssStagingProfileId') - String ossRepo = project.findProperty('sonatypeOssRepo') ?: 'https://s01.oss.sonatype.org/service/local/' + String ossUser = findProperty('sonatypeOssUsername') + String ossPass = findProperty('sonatypeOssPassword') + String ossStagingProfileId = findProperty('sonatypeOssStagingProfileId') + String ossRepo = findProperty('sonatypeOssRepo') ?: 'https://s01.oss.sonatype.org/service/local/' repositories { sonatype { nexusUrl = uri(ossRepo) diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index 49d2d5b5f..c099d39ef 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -37,25 +37,35 @@ gradlePlugin { } } -// This is for signing and publishing the Gradle Plugin Marker poms +// Signing and publishing for this project is handled +// separately as it is using the java-gradle-plugin afterEvaluate { + def publications = extensions.findByType(PublishingExtension).publications signing { required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - def publicationContainer = project.extensions.findByType(PublishingExtension).publications - def publicationsToSign = publicationContainer.stream().filter { it.name != 'pluginMaven' }.toArray(Publication[]::new) - sign(publicationsToSign) + sign(publications.withType(MavenPublication)) } - publishing.publications.each { publication -> - def pub = publication as MavenPublication - if (pub.name != 'pluginMaven') { - pub.pom.withXml { - def xml = asNode() - xml.children().last() + pomInfo - } + // Modify the 'pluginMaven' publication that is already + // set up by the java-gradle-plugin for the java components + publications.named('pluginMaven', MavenPublication) { + artifactId = project.name + versionMapping { + usage('java-api') { fromResolutionOf('runtimeClasspath') } + usage('java-runtime') { fromResolutionResult() } + } + pom { + name = 'Grails Views' + description = 'Provides additional view technologies to the Grails framework, including JSON and Markup views.' + } + } + // Add our pom info to all publications + // (e.g. also to the plugin marker poms) + publications.withType(MavenPublication).each { + it.pom.withXml { + asNode().children().last() + pomInfo } } } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') -apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') -apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file +apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') \ No newline at end of file diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index c108144a7..b586c98b2 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -1,20 +1,8 @@ -ext.set('signing.keyId', project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) -ext.set('signing.password', project.findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) -ext.set('signing.secretKeyRingFile', project.findProperty('signing.secretKeyRingFile') ?: "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg") - def javaComponent = components.named('java') project.extensions.configure(PublishingExtension) { PublishingExtension pe -> - - // 'java-gradle-plugin' in views-gradle has already created this publication - if (!pe.publications.names.contains('pluginMaven')) { - pe.publications.register('pluginMaven', MavenPublication) - } - pe.publications.named('pluginMaven', MavenPublication) { + pe.publications.register('maven', MavenPublication) { artifactId = project.name - // 'java-gradle-plugin' in views-gradle has already configured this - if (project.name != 'views-gradle') { - from javaComponent.get() - } + from javaComponent.get() versionMapping { usage('java-api') { fromResolutionOf('runtimeClasspath') } usage('java-runtime') { fromResolutionResult() } @@ -26,7 +14,6 @@ project.extensions.configure(PublishingExtension) { PublishingExtension pe -> pom.withXml { def pomNode = asNode() pomNode.children().last() + pomInfo - // dependency management shouldn't be included try { pomNode.dependencyManagement.replaceNode({}) } catch (Throwable ignore) {} } @@ -48,18 +35,12 @@ project.extensions.configure(PublishingExtension) { PublishingExtension pe -> } afterEvaluate { - def publicationContainer = extensions.findByType(PublishingExtension).publications + def publications = extensions.findByType(PublishingExtension).publications extensions.configure(SigningExtension) { SigningExtension se -> se.required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - def publicationsToSign = publicationContainer.stream().filter { it.name == 'pluginMaven' }.toArray(Publication[]::new) - se.sign(publicationsToSign) + se.sign(publications.named('maven').get()) } } - -tasks.withType(Sign).configureEach { - onlyIf { isReleaseVersion } -} - tasks.register('install') { dependsOn 'publishToMavenLocal' } \ No newline at end of file From 9137f438574a16b10cd4a78481ad20f0268f5622 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 14 Mar 2024 17:09:08 +0530 Subject: [PATCH 24/56] chore(release): update build configurations (#547) Fixes Signing and Publishing of the artifacts. --- build.gradle | 56 ++++++++++++------------ gradle-plugin/build.gradle | 90 ++++++++++++++++---------------------- gradle/publishing.gradle | 62 +++++++++++++++++--------- json/build.gradle | 1 + markup/build.gradle | 1 + 5 files changed, 109 insertions(+), 101 deletions(-) diff --git a/build.gradle b/build.gradle index 9f0f467e4..c3c6bb4bb 100644 --- a/build.gradle +++ b/build.gradle @@ -10,37 +10,39 @@ version = projectVersion ext.set('grailsVersion', libs.versions.grails.asProvider().get()) ext.set('isSnapshot', version.endsWith('-SNAPSHOT')) ext.set('isReleaseVersion', !isSnapshot) -ext.set('signing.keyId', findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) -ext.set('signing.password', findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) -ext.set('signing.secretKeyRingFile', findProperty('signing.secretKeyRingFile') ?: "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg") -ext.set('pomInfo', { - delegate.url 'https://views.grails.org/latest/' - delegate.licenses { - delegate.license { - delegate.name 'The Apache Software License, Version 2.0' - delegate.url 'https://www.apache.org/licenses/LICENSE-2.0.txt' + +allprojects { + + ext.set('signing.keyId', findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')) + ext.set('signing.password', findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')) + ext.set('signing.secretKeyRingFile', findProperty('signing.secretKeyRingFile') ?: "${System.properties['user.home']}${File.separator}.gnupg${File.separator}secring.gpg") + ext.set('pomInfo', { + delegate.url 'https://views.grails.org/latest/' + delegate.licenses { + delegate.license { + delegate.name 'The Apache Software License, Version 2.0' + delegate.url 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } } - } - delegate.scm { - delegate.url 'https://github.com/grails/grails-views/' - delegate.connection 'scm:git:git://github.com/grails/grails-views' - delegate.developerConnection 'scm:git:ssh://github.com:grails/grails-views' - } - delegate.developers { - delegate.developer { - delegate.id 'graemerocher' - delegate.name 'Graeme Rocher' - delegate.email 'graeme.rocher@gmail.com' + delegate.scm { + delegate.url 'https://github.com/grails/grails-views/' + delegate.connection 'scm:git:git://github.com/grails/grails-views' + delegate.developerConnection 'scm:git:ssh://github.com:grails/grails-views' } - delegate.developer { - delegate.id 'puneetbehl' - delegate.name 'Puneet Behl' - delegate.email 'behlp@unityfoundation.io' + delegate.developers { + delegate.developer { + delegate.id 'graemerocher' + delegate.name 'Graeme Rocher' + delegate.email 'graeme.rocher@gmail.com' + } + delegate.developer { + delegate.id 'puneetbehl' + delegate.name 'Puneet Behl' + delegate.email 'behlp@unityfoundation.io' + } } - } -}) + }) -allprojects { version = rootProject.version repositories { mavenLocal() // Used by Groovy Joint workflow github action after building Groovy diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index c099d39ef..0f896713d 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -1,71 +1,55 @@ plugins { - id 'java-gradle-plugin' - id 'groovy' - id 'maven-publish' - id 'signing' + id 'java-gradle-plugin' + id 'groovy' + id 'maven-publish' + id 'signing' } group = 'org.grails.plugins' ext.set('projectDesc', 'Grails Views Gradle Plugin') dependencies { - implementation libs.grails.bootstrap - implementation libs.grails.gradle.plugin - implementation libs.groovy.core - implementation libs.spring.boot.gradle.plugin + implementation libs.grails.bootstrap + implementation libs.grails.gradle.plugin + implementation libs.groovy.core + implementation libs.spring.boot.gradle.plugin - // This is a workaround for grails-bootstrap exposing a - // different version of groovy-xml than the one used by Gradle. - // This causes issues with the Groovy compiler. - compileOnly "org.codehaus.groovy:groovy-xml:$GroovySystem.version" + // This is a workaround for grails-bootstrap exposing a + // different version of groovy-xml than the one used by Gradle. + // This causes issues with the Groovy compiler. + compileOnly "org.codehaus.groovy:groovy-xml:$GroovySystem.version" } gradlePlugin { - plugins { - create('viewsJson') { - id = 'org.grails.plugins.views-json' - implementationClass = 'grails.views.gradle.json.GrailsJsonViewsPlugin' - displayName = 'Grails Json Views Gradle Plugin' - description = 'The Gradle plugin for Json Views' - } - create('viewsMarkup') { - id = 'org.grails.plugins.views-markup' - implementationClass = 'grails.views.gradle.markup.GrailsMarkupViewsPlugin' - displayName = 'Grails Markup Views Gradle Plugin' - description = 'The Gradle plugin for Markup Views' - } - } + plugins { + create('viewsJson') { + id = 'org.grails.plugins.views-json' + implementationClass = 'grails.views.gradle.json.GrailsJsonViewsPlugin' + displayName = 'Grails Json Views Gradle Plugin' + description = 'The Gradle plugin for Json Views' + } + create('viewsMarkup') { + id = 'org.grails.plugins.views-markup' + implementationClass = 'grails.views.gradle.markup.GrailsMarkupViewsPlugin' + displayName = 'Grails Markup Views Gradle Plugin' + description = 'The Gradle plugin for Markup Views' + } + } } -// Signing and publishing for this project is handled +// Publishing for this project is handled // separately as it is using the java-gradle-plugin afterEvaluate { - def publications = extensions.findByType(PublishingExtension).publications - signing { - required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - sign(publications.withType(MavenPublication)) - } - // Modify the 'pluginMaven' publication that is already - // set up by the java-gradle-plugin for the java components - publications.named('pluginMaven', MavenPublication) { - artifactId = project.name - versionMapping { - usage('java-api') { fromResolutionOf('runtimeClasspath') } - usage('java-runtime') { fromResolutionResult() } - } - pom { - name = 'Grails Views' - description = 'Provides additional view technologies to the Grails framework, including JSON and Markup views.' - } - } - // Add our pom info to all publications - // (e.g. also to the plugin marker poms) - publications.withType(MavenPublication).each { - it.pom.withXml { - asNode().children().last() + pomInfo - } - } + publishing.publications.each { MavenPublication publication -> + if (publication.name != "pluginMaven") { + publication.pom.withXml { + def xml = asNode() + xml.children().last() + pomInfo + } + } + } } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') -apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') \ No newline at end of file +apply from: rootProject.layout.projectDirectory.file('gradle/api-docs-config.gradle') +apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') \ No newline at end of file diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index b586c98b2..96d46e76b 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -1,21 +1,35 @@ def javaComponent = components.named('java') -project.extensions.configure(PublishingExtension) { PublishingExtension pe -> - pe.publications.register('maven', MavenPublication) { - artifactId = project.name - from javaComponent.get() - versionMapping { - usage('java-api') { fromResolutionOf('runtimeClasspath') } - usage('java-runtime') { fromResolutionResult() } - } - pom { - name = 'Grails Views' - description = 'Provides additional view technologies to the Grails framework, including JSON and Markup views.' - } - pom.withXml { - def pomNode = asNode() - pomNode.children().last() + pomInfo - // dependency management shouldn't be included - try { pomNode.dependencyManagement.replaceNode({}) } catch (Throwable ignore) {} + +publishing { + publications { + pluginMaven(MavenPublication) { + artifactId = project.name + artifactId = "grails-${project.name}" + if (project.name != 'views-gradle') { + from javaComponent.get() + } + versionMapping { + usage('java-api') { fromResolutionOf('runtimeClasspath') } + usage('java-runtime') { fromResolutionResult() } + } + if (ext.has('isGrailsPlugin')) { + artifact source: "${project.sourceSets.main.groovy.classesDirectory.getAsFile().get()}/META-INF/grails-plugin.xml", + classifier: "plugin", + extension: 'xml' + } + pom { + name = 'Grails Views' + description = 'Provides additional view technologies to the Grails framework, including JSON and Markup views.' + } + pom.withXml { + def pomNode = asNode() + pomNode.children().last() + pomInfo + // dependency management shouldn't be included + try { + pomNode.dependencyManagement.replaceNode({}) + } catch (Throwable ignore) { + } + } } } @@ -35,12 +49,18 @@ project.extensions.configure(PublishingExtension) { PublishingExtension pe -> } afterEvaluate { - def publications = extensions.findByType(PublishingExtension).publications - extensions.configure(SigningExtension) { SigningExtension se -> - se.required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - se.sign(publications.named('maven').get()) + signing { + required = { isReleaseVersion && gradle.taskGraph.hasTask("publish") } + Publication[] publications = new Publication[project.publishing.publications.size()] + project.publishing.publications.findAll().toArray(publications) + sign(publications) + } + + tasks.withType(Sign) { + onlyIf { isReleaseVersion } } } + tasks.register('install') { dependsOn 'publishToMavenLocal' } \ No newline at end of file diff --git a/json/build.gradle b/json/build.gradle index 1814a6288..ada341fd0 100644 --- a/json/build.gradle +++ b/json/build.gradle @@ -8,6 +8,7 @@ plugins { group = 'org.grails.plugins' ext.set('projectDesc', 'Grails JSON Views') +ext.set('isGrailsPlugin', true) dependencies { diff --git a/markup/build.gradle b/markup/build.gradle index 3e7dedd6a..ffb0b0e49 100644 --- a/markup/build.gradle +++ b/markup/build.gradle @@ -7,6 +7,7 @@ plugins { } ext.set('projectDesc', 'Grails Markup Views') +ext.set('isGrailsPlugin', true) dependencies { From b884aed34300412fd0279f869f9adcffc7d84e76 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 14 Mar 2024 22:58:11 +0530 Subject: [PATCH 25/56] chore(reelase): add root-project groupid (#548) Define `group` for rootProject so that nexus-publish plugin correctly matches staging repository via Gradle task `findSonatypeStagingRepo`. This is suggested in gradle-nexus/publish-plugin#310. --- build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/build.gradle b/build.gradle index c3c6bb4bb..d8a4745ac 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ plugins { id 'org.asciidoctor.jvm.convert' } +group = 'org.grails' version = projectVersion ext.set('grailsVersion', libs.versions.grails.asProvider().get()) ext.set('isSnapshot', version.endsWith('-SNAPSHOT')) From 50aa0af5a10c030eeca173d2e5514fa3e838ed2d Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 14 Mar 2024 23:12:43 +0530 Subject: [PATCH 26/56] chore(release): update release-drafter config (#549) Improve the release notes template to segregate based on semantic commits. --- .github/release-drafter.yml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6c4938f8a..cbe5824a1 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,24 +1,43 @@ name-template: $RESOLVED_VERSION tag-template: v$RESOLVED_VERSION +pull-request: + title-templates: + fix: '🐛 $TITLE (#$NUMBER)' + feat: '🚀 $TITLE (#$NUMBER)' + default: '$TITLE (#$NUMBER)' categories: - - title: ✨ Features + - title: '🚀 Features' labels: + - 'feat' - "type: enhancement" - "type: new feature" - "type: major" - - title: 🐛 Bug Fixes/Improvements + - title: '🐛 Bug Fixes' labels: + - 'fix' - "type: improvement" - "type: bug" - "type: minor" - - title: 🛠 Dependency upgrades + - title: '📚 Documentation' labels: + - 'docs' + - title: '🔧 Maintenance' + labels: + - 'chore' + - 'refactor' + - 'style' + - 'test' + - 'ci' + - 'perf' + - 'build' + - 'deps' - "type: dependency upgrade" - "dependencies" - - title: ⚙️ Build/CI - labels: - "type: ci" - "type: build" + - title: '⏪ Reverts' + labels: + - 'revert' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' version-resolver: major: From f3e201a04691c25c95d2fd31995514ccd257cee6 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 14 Mar 2024 23:34:40 +0530 Subject: [PATCH 27/56] chore(ci): auto-label pull-requests (#551) Update release-drafter/release-drafter configurations to add autolabeler config so it automatically labels pull requests. --- .github/release-drafter.yml | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index cbe5824a1..f92689d96 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -5,6 +5,72 @@ pull-request: fix: '🐛 $TITLE (#$NUMBER)' feat: '🚀 $TITLE (#$NUMBER)' default: '$TITLE (#$NUMBER)' +autolabeler: + - label: 'bug' + branch: + - '/fix\/.+/' + title: + - '/fix/i' + - label: 'feature' + branch: + - '/feature\/.+/' + title: + - '/feat/i' + - label: 'documentation' + branch: + - '/docs\/.+/' + title: + - '/docs/i' + - label: 'maintenance' + branch: + - '/(chore|refactor|style|test|ci|perf|build|deps)\/.+/' + title: + - '/(chore|refactor|style|test|ci|perf|build|deps)/i' + - label: 'chore' + branch: + - '/chore\/.+/' + title: + - '/chore/i' + - label: 'refactor' + branch: + - '/refactor\/.+/' + title: + - '/refactor/i' + - label: 'style' + branch: + - '/style\/.+/' + title: + - '/style/i' + - label: 'test' + branch: + - '/test\/.+/' + title: + - '/test/i' + - label: 'ci' + branch: + - '/ci\/.+/' + title: + - '/ci/i' + - label: 'perf' + branch: + - '/perf\/.+/' + title: + - '/perf/i' + - label: 'build' + branch: + - '/build\/.+/' + title: + - '/build/i' + - label: 'deps' + branch: + - '/deps\/.+/' + title: + - '/deps/i' + - label: 'revert' + branch: + - '/revert\/.+/' + title: + - '/revert/i' categories: - title: '🚀 Features' labels: From 73e21c63de6d9d0184ffb3ffddfbd376a55e5ed9 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 14 Mar 2024 23:35:20 +0530 Subject: [PATCH 28/56] chore(release): update javaci workflow configuration (#550) Rename property `artifactoryPublishUsername` to `artifactoryUsername`, and `artifactoryPublishPassword` to `artifactoryPassword`. --- .github/workflows/gradle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 9c14bc3f3..20a58c243 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -60,8 +60,8 @@ jobs: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - ORG_GRADLE_PROJECT_artifactoryPublishUsername: ${{ secrets.ARTIFACTORY_USERNAME }} - ORG_GRADLE_PROJECT_artifactoryPublishPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} + ORG_GRADLE_PROJECT_artifactoryUsername: ${{ secrets.ARTIFACTORY_USERNAME }} + ORG_GRADLE_PROJECT_artifactoryPassword: ${{ secrets.ARTIFACTORY_PASSWORD }} with: arguments: | -Dorg.gradle.internal.publish.checksums.insecure=true From 583cc5e052fd22e250d482bfc882652c787be7ac Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 14 Mar 2024 23:58:49 +0530 Subject: [PATCH 29/56] chore(release): update release configurations (#552) Change env variable ORG_GRADLE_PROJECT_sonatypeOssRepo value to read from the secrets. --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 097ba6f3d..ef89053ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,7 +52,7 @@ jobs: ORG_GRADLE_PROJECT_sonatypeOssUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_sonatypeOssPassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_sonatypeOssStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} - ORG_GRADLE_PROJECT_sonatypeOssRepo: 'https://s01.oss.sonatype.org/service/local/' + ORG_GRADLE_PROJECT_sonatypeOssRepo: ${{ secrets.SONATYPE_NEXUS_URL }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} with: @@ -80,6 +80,7 @@ jobs: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + ORG_GRADLE_PROJECT_sonatypeOssRepo: ${{ secrets.SONATYPE_NEXUS_URL }} with: arguments: | findSonatypeStagingRepository From 0a57fd7b49945a61611d90f7d97c300decb9c9e7 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 14 Mar 2024 23:59:18 +0530 Subject: [PATCH 30/56] chore(releasenotes): udpate workflow configurations (#553) * pull_request event is required only for autolabeler * pull_request_target event is required for autolabeler to support PRs from forks --- .github/workflows/release-notes.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index dd1a081c6..8453cc17b 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -6,6 +6,10 @@ on: branches: - master - '[2-9]+.[0-9]+.x' + pull_request: + types: [opened, reopened, synchronize] + pull_request_target: + types: [opened, reopened, synchronize] workflow_dispatch: jobs: release_notes: From deeebaaf95dd7254b3e7b9e7a2e3dba1359195c3 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 15 Mar 2024 00:20:11 +0530 Subject: [PATCH 31/56] chore(release): update workflow configurations (#554) Use correct environment variables for the release job in the release.yml config. --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef89053ba..ffb2e1f5a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -77,9 +77,9 @@ jobs: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + ORG_GRADLE_PROJECT_sonatypeOssUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_sonatypeOssPassword: ${{ secrets.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_sonatypeOssStagingProfileId: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} ORG_GRADLE_PROJECT_sonatypeOssRepo: ${{ secrets.SONATYPE_NEXUS_URL }} with: arguments: | From a5446d74e301ba38e3400cfcad18fe30c234466c Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Thu, 14 Mar 2024 18:53:42 +0000 Subject: [PATCH 32/56] [skip ci] Release v3.2.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 962d89c35..6280b4a98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.0-SNAPSHOT +projectVersion=3.2.0 # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From 6a1f3e0e3ea510c291fd172490505ae9c44dcbb3 Mon Sep 17 00:00:00 2001 From: micronaut-build Date: Thu, 14 Mar 2024 18:57:21 +0000 Subject: [PATCH 33/56] chore: Bump version to 3.2.1-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 6280b4a98..7cd8b95ce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.0 +projectVersion=3.2.1-SNAPSHOT # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From d0d87ee8ad31930fc0ff80c64a92a13f4923fda9 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Thu, 21 Mar 2024 17:37:12 +0100 Subject: [PATCH 34/56] fix(release): Set the correct artifactId (#559) --- gradle/publishing.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index 96d46e76b..081789fa2 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -4,7 +4,6 @@ publishing { publications { pluginMaven(MavenPublication) { artifactId = project.name - artifactId = "grails-${project.name}" if (project.name != 'views-gradle') { from javaComponent.get() } From e3e227dfdd771e933402ce4b3fd36791a60c8dec Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:07:50 +0530 Subject: [PATCH 35/56] fix(deps): update dependency org.grails:grails-datastore-gorm-mongodb to v8.2.0 (#557) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b5a83170a..bdd755e2f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ assetpipeline = '4.3.0' caffeine = '2.9.3' gorm = '8.1.1' gorm-hibernate5 = '8.0.3' -gorm-mongodb = '8.1.2' +gorm-mongodb = '8.2.0' grails = '6.1.2' grails-gradle-plugin = '6.1.2' grails-testing-support = '3.2.1' From 432c298ee2adb6e47654469b9378b6aa17ac590f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:08:09 +0530 Subject: [PATCH 36/56] fix(deps): update gorm to v8.1.2 (#555) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bdd755e2f..51e3d6dc3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] assetpipeline = '4.3.0' caffeine = '2.9.3' -gorm = '8.1.1' +gorm = '8.1.2' gorm-hibernate5 = '8.0.3' gorm-mongodb = '8.2.0' grails = '6.1.2' From 62bcea4ebcfc15d8adc2b09b1b01a6a4dbc0a1a0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:12:07 +0530 Subject: [PATCH 37/56] fix(deps): update dependency org.grails:grails-datastore-gorm-hibernate5 to v8.1.0 (#556) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 51e3d6dc3..9b881251e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ assetpipeline = '4.3.0' caffeine = '2.9.3' gorm = '8.1.2' -gorm-hibernate5 = '8.0.3' +gorm-hibernate5 = '8.1.0' gorm-mongodb = '8.2.0' grails = '6.1.2' grails-gradle-plugin = '6.1.2' From 2db5957cffe86b9abe9fac19136c785759681efc Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Fri, 22 Mar 2024 06:30:38 +0000 Subject: [PATCH 38/56] [skip ci] Release v3.2.1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7cd8b95ce..1b985768e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.1-SNAPSHOT +projectVersion=3.2.1 # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From c25c819db76ef5ddef8c403e49ab8eced645eed6 Mon Sep 17 00:00:00 2001 From: micronaut-build Date: Fri, 22 Mar 2024 06:36:51 +0000 Subject: [PATCH 39/56] chore: Bump version to 3.2.2-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1b985768e..644a80c1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.1 +projectVersion=3.2.2-SNAPSHOT # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From 0f508c41314ce8f3f9b164a7139e8bbd5df87788 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Mon, 25 Mar 2024 22:09:16 +0100 Subject: [PATCH 40/56] fix(deps): Set correct dependency configurations (#561) --- core/build.gradle | 18 +++++++++--------- .../mvc/renderer/DefaultViewRenderer.groovy | 1 - gradle-plugin/build.gradle | 14 ++++++++------ .../markup/GrailsMarkupViewsPlugin.groovy | 1 - gradle/libs.versions.toml | 10 ++++++++++ json-templates/build.gradle | 2 +- json-testing-support/build.gradle | 10 +++++++--- json/build.gradle | 7 ++++--- markup/build.gradle | 13 ++++++++++--- .../markup/view/MarkupViewGrailsPlugin.groovy | 5 ----- .../markup/view/MarkupViewTemplate.groovy | 1 - .../view/MarkupViewTemplateEngine.groovy | 4 ---- .../markup/view/mvc/MarkupViewResolver.groovy | 1 - 13 files changed, 49 insertions(+), 38 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 6b8a71cec..9540a3a89 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -10,17 +10,17 @@ ext.set('projectDesc', 'Grails Views Core') dependencies { - implementation libs.groovy.core - - implementation libs.grails.core - implementation libs.grails.web.urlmappings - implementation libs.grails.mimetypes + api libs.caffeine // Used in public API + api libs.grails.datastore.core // MappingContext is used in public API + api libs.grails.mimetypes // MimeUtility is used in public API + api libs.grails.rest // Used in public API + api libs.grails.web.urlmappings // LinkGenerator is used in public API + api libs.spring.context // MessageSource is used in public API + + implementation libs.grails.bootstrap implementation libs.grails.datastore.gorm.support - implementation libs.grails.rest - implementation libs.slf4j.api - - api libs.caffeine // Used in public api + implementation libs.spring.beans testImplementation libs.spock.core testRuntimeOnly libs.slf4j.nop // Get rid of warnings about missing slf4j implementation during test task diff --git a/core/src/main/groovy/grails/views/mvc/renderer/DefaultViewRenderer.groovy b/core/src/main/groovy/grails/views/mvc/renderer/DefaultViewRenderer.groovy index a8ceabe5a..806e4b231 100644 --- a/core/src/main/groovy/grails/views/mvc/renderer/DefaultViewRenderer.groovy +++ b/core/src/main/groovy/grails/views/mvc/renderer/DefaultViewRenderer.groovy @@ -13,7 +13,6 @@ import org.grails.plugins.web.rest.render.ServletRenderContext import org.grails.plugins.web.rest.render.html.DefaultHtmlRenderer import org.grails.web.util.GrailsApplicationAttributes import org.springframework.web.servlet.ModelAndView -import org.springframework.web.servlet.View import org.springframework.web.servlet.view.AbstractUrlBasedView /** diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index 0f896713d..6995192bf 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -9,15 +9,17 @@ group = 'org.grails.plugins' ext.set('projectDesc', 'Grails Views Gradle Plugin') dependencies { - implementation libs.grails.bootstrap + + // the gradle api is provided by java-gradle-plugin + + implementation libs.grails.bootstrap, { + // grails-bootstrap leaks groovy-xml which is a problem for Gradle (version conflict) + exclude group: 'org.codehaus.groovy', module: 'groovy-xml' + } implementation libs.grails.gradle.plugin - implementation libs.groovy.core implementation libs.spring.boot.gradle.plugin - // This is a workaround for grails-bootstrap exposing a - // different version of groovy-xml than the one used by Gradle. - // This causes issues with the Groovy compiler. - compileOnly "org.codehaus.groovy:groovy-xml:$GroovySystem.version" + compileOnly libs.groovy.core // @CompileStatic } gradlePlugin { diff --git a/gradle-plugin/src/main/groovy/grails/views/gradle/markup/GrailsMarkupViewsPlugin.groovy b/gradle-plugin/src/main/groovy/grails/views/gradle/markup/GrailsMarkupViewsPlugin.groovy index cf4f1ece8..baf6eede3 100644 --- a/gradle-plugin/src/main/groovy/grails/views/gradle/markup/GrailsMarkupViewsPlugin.groovy +++ b/gradle-plugin/src/main/groovy/grails/views/gradle/markup/GrailsMarkupViewsPlugin.groovy @@ -1,7 +1,6 @@ package grails.views.gradle.markup import grails.views.gradle.AbstractGroovyTemplatePlugin -import grails.views.gradle.markup.MarkupViewCompilerTask import groovy.transform.CompileStatic /** diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9b881251e..ebd17641b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,9 +9,11 @@ grails-gradle-plugin = '6.1.2' grails-testing-support = '3.2.1' groovy = '3.0.21' java-baseline = '11' +javax-annotation-api = '1.3.2' micronaut = '3.10.3' slf4j = '1.7.36' spock = '2.3-groovy-3.0' +spring = '5.3.33' spring-boot = '2.7.18' [libraries] @@ -23,6 +25,7 @@ grails-datastore-core = { module = 'org.grails:grails-datastore-core', version.r grails-datastore-gorm-hibernate5 = { module = 'org.grails:grails-datastore-gorm-hibernate5', version.ref = 'gorm-hibernate5' } grails-datastore-gorm-mongodb = { module = 'org.grails:grails-datastore-gorm-mongodb', version.ref = 'gorm-mongodb' } grails-datastore-gorm-support = { module = 'org.grails:grails-datastore-gorm-support', version.ref = 'gorm' } +grails-encoder = { module = 'org.grails:grails-encoder', version.ref = 'grails' } grails-gradle-plugin = { module = 'org.grails:grails-gradle-plugin', version.ref = 'grails-gradle-plugin' } grails-mimetypes = { module = 'org.grails:grails-plugin-mimetypes', version.ref = 'grails' } grails-rest = { module = 'org.grails:grails-plugin-rest', version.ref = 'grails' } @@ -31,8 +34,15 @@ grails-testing-support-gorm = { module = 'org.grails:grails-gorm-testing-support grails-web-urlmappings = { module = 'org.grails:grails-web-url-mappings', version.ref = 'grails' } groovy-core = { module = 'org.codehaus.groovy:groovy', version.ref = 'groovy' } groovy-json = { module = 'org.codehaus.groovy:groovy-json', version.ref = 'groovy' } +groovy-templates = { module = 'org.codehaus.groovy:groovy-templates', version.ref = 'groovy' } +javax-annotation-api = { module = 'javax.annotation:javax.annotation-api', version.ref = 'javax-annotation-api' } micronaut-http-client = { module = 'io.micronaut:micronaut-http-client', version.ref = 'micronaut' } slf4j-api = { module = 'org.slf4j:slf4j-api', version.ref = 'slf4j' } slf4j-nop = { module = 'org.slf4j:slf4j-nop', version.ref = 'slf4j' } spock-core = { module = 'org.spockframework:spock-core', version.ref = 'spock' } +spring-beans = { module = 'org.springframework:spring-beans', version.ref = 'spring' } +spring-context = { module = 'org.springframework:spring-context', version.ref = 'spring' } +spring-web = { module = 'org.springframework:spring-web', version.ref = 'spring' } +spring-webmvc = { module = 'org.springframework:spring-webmvc', version.ref = 'spring' } +spring-boot = { module = 'org.springframework.boot:spring-boot', version.ref = 'spring-boot' } spring-boot-gradle-plugin = { module = 'org.springframework.boot:spring-boot-gradle-plugin', version.ref = 'spring-boot' } \ No newline at end of file diff --git a/json-templates/build.gradle b/json-templates/build.gradle index 5a0cf3be7..b304d3292 100644 --- a/json-templates/build.gradle +++ b/json-templates/build.gradle @@ -36,7 +36,7 @@ tasks.register('compileViews', JavaExec) { inputs.dir templateSourceDir outputs.dir compilationOutputDir mainClass = 'grails.plugin.json.view.JsonViewCompiler' - classpath configurations.compileClasspath + configurations.runtimeClasspath + classpath configurations.compileClasspath args(templateSourceDir.asFile, compilationOutputDir.get().asFile, libs.versions.java.baseline.get(), ' ', ' ', 'none', 'UTF-8') } diff --git a/json-testing-support/build.gradle b/json-testing-support/build.gradle index 3f549496d..7feeea438 100644 --- a/json-testing-support/build.gradle +++ b/json-testing-support/build.gradle @@ -10,14 +10,18 @@ ext.set('projectDesc', 'JSON Views Testing Support') dependencies { - api project(':views-json') - api libs.grails.datastore.core // Used in public api + api project(':views-json') // Used in public API + api libs.spring.web // Used in public API + api libs.grails.datastore.core // Used in public API + api libs.spock.core // Used in public API implementation libs.grails.core implementation libs.grails.testing.support.core + implementation libs.grails.web.urlmappings implementation libs.groovy.core implementation libs.groovy.json - implementation libs.spock.core + implementation libs.groovy.templates + implementation libs.spring.webmvc } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/json/build.gradle b/json/build.gradle index ada341fd0..9e7b6e880 100644 --- a/json/build.gradle +++ b/json/build.gradle @@ -12,10 +12,11 @@ ext.set('isGrailsPlugin', true) dependencies { - api project(':views-core') + api project(':views-core') // Used in public API + api libs.grails.rest // Used in public API - implementation libs.grails.core - implementation libs.grails.rest + implementation libs.grails.encoder + implementation libs.groovy.core implementation libs.groovy.json testImplementation libs.grails.testing.support.core diff --git a/markup/build.gradle b/markup/build.gradle index ffb0b0e49..a4f4d40ff 100644 --- a/markup/build.gradle +++ b/markup/build.gradle @@ -11,11 +11,18 @@ ext.set('isGrailsPlugin', true) dependencies { - api project(':views-core') + api project(':views-core') // Used in public API + api libs.grails.core // Used in public API + api libs.grails.mimetypes // Used in public API + api libs.grails.rest // Used in public API - implementation libs.grails.core - implementation libs.grails.rest + implementation libs.groovy.core + implementation libs.spring.beans + implementation libs.spring.boot // For @ConfigurationProperties + compileOnly libs.javax.annotation.api // Provided + + testImplementation libs.grails.web.urlmappings testImplementation libs.spock.core testRuntimeOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during test task } diff --git a/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewGrailsPlugin.groovy b/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewGrailsPlugin.groovy index 149f32b13..03b290e90 100644 --- a/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewGrailsPlugin.groovy +++ b/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewGrailsPlugin.groovy @@ -2,13 +2,8 @@ package grails.plugin.markup.view import grails.plugin.markup.view.mvc.MarkupViewResolver import grails.plugins.Plugin -import grails.util.BuildSettings -import grails.util.Environment -import grails.util.Metadata -import grails.views.ViewsEnvironment import grails.views.mvc.GenericGroovyTemplateViewResolver import grails.views.resolve.PluginAwareTemplateResolver -import org.grails.io.support.GrailsResourceUtils /** * Plugin class for markup views diff --git a/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplate.groovy b/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplate.groovy index 14a78cc45..ecbd109ff 100644 --- a/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplate.groovy +++ b/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplate.groovy @@ -1,7 +1,6 @@ package grails.plugin.markup.view import grails.plugin.markup.view.api.MarkupView -import grails.views.Views import grails.views.WritableScript import groovy.text.markup.BaseTemplate import groovy.text.markup.MarkupTemplateEngine diff --git a/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplateEngine.groovy b/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplateEngine.groovy index 6e939604d..ad8e2d44f 100644 --- a/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplateEngine.groovy +++ b/markup/src/main/groovy/grails/plugin/markup/view/MarkupViewTemplateEngine.groovy @@ -1,11 +1,8 @@ package grails.plugin.markup.view -import grails.compiler.traits.TraitInjector import grails.plugin.markup.view.internal.MarkupViewsTransform -import grails.views.GrailsViewTemplate import grails.views.ResolvableGroovyTemplateEngine import grails.views.ViewCompilationException -import grails.views.WritableScript import grails.views.WritableScriptTemplate import grails.views.api.GrailsView import grails.views.compiler.ViewsTransform @@ -19,7 +16,6 @@ import org.codehaus.groovy.control.CompilationFailedException import org.codehaus.groovy.control.CompilerConfiguration import org.codehaus.groovy.control.customizers.ASTTransformationCustomizer import org.codehaus.groovy.control.customizers.CompilationCustomizer -import org.grails.core.io.support.GrailsFactoriesLoader /** * A {@link ResolvableGroovyTemplateEngine} that uses Groovy's {@link MarkupTemplateEngine} internally diff --git a/markup/src/main/groovy/grails/plugin/markup/view/mvc/MarkupViewResolver.groovy b/markup/src/main/groovy/grails/plugin/markup/view/mvc/MarkupViewResolver.groovy index c1355197e..04ee5c696 100644 --- a/markup/src/main/groovy/grails/plugin/markup/view/mvc/MarkupViewResolver.groovy +++ b/markup/src/main/groovy/grails/plugin/markup/view/mvc/MarkupViewResolver.groovy @@ -4,7 +4,6 @@ import grails.core.support.proxy.ProxyHandler import grails.plugin.markup.view.MarkupViewConfiguration import grails.plugin.markup.view.MarkupViewTemplate import grails.plugin.markup.view.MarkupViewTemplateEngine -import grails.plugin.markup.view.MarkupViewWritableScriptTemplate import grails.plugin.markup.view.renderer.MarkupViewXmlRenderer import grails.rest.render.RendererRegistry import grails.views.mvc.SmartViewResolver From 012c5912d54386adb2675a52c5392727983d447d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 02:40:02 +0530 Subject: [PATCH 41/56] fix(deps): update dependency org.grails.plugins:views-gradle to v3.2.1 (#560) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/buildsrc.libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/buildsrc.libs.versions.toml b/gradle/buildsrc.libs.versions.toml index a65976859..6bc50e297 100644 --- a/gradle/buildsrc.libs.versions.toml +++ b/gradle/buildsrc.libs.versions.toml @@ -2,7 +2,7 @@ asciidoctor-gradle-jvm = '4.0.2' assetpipeline = '4.4.0' grails-gradle-plugin = '6.1.2' -grails-views = '3.1.2' +grails-views = '3.2.1' groovy-doc = '1.0.1' nexus-publish-gradle-plugin = '1.3.0' From 021f7f5c3bd3573edce5a127d2fd1a48219fdd62 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 03:25:26 +0530 Subject: [PATCH 42/56] fix(deps): update dependency io.micronaut:micronaut-http-client to v3.10.4 (#562) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ebd17641b..0a369339e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ grails-testing-support = '3.2.1' groovy = '3.0.21' java-baseline = '11' javax-annotation-api = '1.3.2' -micronaut = '3.10.3' +micronaut = '3.10.4' slf4j = '1.7.36' spock = '2.3-groovy-3.0' spring = '5.3.33' From 0a3e6e3a3386c5f6db45c00dd0be6f85a9f65feb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 18:01:22 +0530 Subject: [PATCH 43/56] fix(deps): update grails-testing-support monorepo to v3.2.2 (#564) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a369339e..85b9b3db1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ gorm-hibernate5 = '8.1.0' gorm-mongodb = '8.2.0' grails = '6.1.2' grails-gradle-plugin = '6.1.2' -grails-testing-support = '3.2.1' +grails-testing-support = '3.2.2' groovy = '3.0.21' java-baseline = '11' javax-annotation-api = '1.3.2' From 8c589227edae21f640d3363c339a5a26c1db07ed Mon Sep 17 00:00:00 2001 From: Emma Richardson <94012886+Richardson-e@users.noreply.github.com> Date: Thu, 28 Mar 2024 07:31:33 -0500 Subject: [PATCH 44/56] Add note in documentation about property name space restriction (#558) Co-authored-by: Emma Richardson <49138186+Emrichardsone@users.noreply.github.com> --- docs/src/docs/asciidoc/json/modelNaming.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/docs/asciidoc/json/modelNaming.adoc b/docs/src/docs/asciidoc/json/modelNaming.adoc index 28e7f3fb9..166725f3a 100644 --- a/docs/src/docs/asciidoc/json/modelNaming.adoc +++ b/docs/src/docs/asciidoc/json/modelNaming.adoc @@ -3,7 +3,7 @@ Grails Framework supports a convention for the model names in your JSON views. If the convention does not meet your needs, model variables can be explicitly defined. NOTE: Some model names are _reserved_ since there are properties of the same name injected into the view: -`locale`, `response`, `request`, `page`, `controllerNamespace`, `controllerName`, `actionName`, `config`, `generator` +`locale`, `response`, `request`, `page`, `controllerNamespace`, `controllerName`, `actionName`, `config`, `generator`, `json` == Explicit Model Naming From c7f188d4ec2114a4c7b1b66f610591f91bbaedda Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 28 Mar 2024 22:10:50 +0530 Subject: [PATCH 45/56] chore(releasenotes): update workflow configurations (#565) --- .github/release-drafter.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index f92689d96..a21db2e5b 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -11,6 +11,11 @@ autolabeler: - '/fix\/.+/' title: - '/fix/i' + - label: 'improvement' + branch: + - '/improv\/.+/' + title: + - '/improv/i' - label: 'feature' branch: - '/feature\/.+/' @@ -23,9 +28,9 @@ autolabeler: - '/docs/i' - label: 'maintenance' branch: - - '/(chore|refactor|style|test|ci|perf|build|deps)\/.+/' + - '/(chore|refactor|style|test|ci|perf|build)\/.+/' title: - - '/(chore|refactor|style|test|ci|perf|build|deps)/i' + - '/(chore|refactor|style|test|ci|perf|build)/i' - label: 'chore' branch: - '/chore\/.+/' @@ -74,21 +79,27 @@ autolabeler: categories: - title: '🚀 Features' labels: - - 'feat' + - 'feature' - "type: enhancement" - "type: new feature" - "type: major" - - title: '🐛 Bug Fixes' + - "type: minor" + - title: '💡 Improvements' labels: - - 'fix' + - 'improvement' - "type: improvement" + + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bug' - "type: bug" - - "type: minor" - title: '📚 Documentation' labels: - 'docs' - title: '🔧 Maintenance' labels: + - 'maintenance' - 'chore' - 'refactor' - 'style' @@ -96,9 +107,6 @@ categories: - 'ci' - 'perf' - 'build' - - 'deps' - - "type: dependency upgrade" - - "dependencies" - "type: ci" - "type: build" - title: '⏪ Reverts' From d5c860f4a4555555c107f53548a99a8378c99454 Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Thu, 28 Mar 2024 16:47:35 +0000 Subject: [PATCH 46/56] [skip ci] Release v3.2.2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 644a80c1f..7d25e208d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.2-SNAPSHOT +projectVersion=3.2.2 # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From a63b169c3e2344c91572fa98351145d957faa35f Mon Sep 17 00:00:00 2001 From: micronaut-build Date: Thu, 28 Mar 2024 16:52:46 +0000 Subject: [PATCH 47/56] chore: Bump version to 3.2.3-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 7d25e208d..d767e757c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.2 +projectVersion=3.2.3-SNAPSHOT # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From 2bf8a9b486fe5b698328b36d1d2de7420fcd43fc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Apr 2024 08:30:45 +0530 Subject: [PATCH 48/56] fix(deps): update dependency org.grails.plugins:views-gradle to v3.2.2 (#566) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/buildsrc.libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/buildsrc.libs.versions.toml b/gradle/buildsrc.libs.versions.toml index 6bc50e297..9a28cf4b8 100644 --- a/gradle/buildsrc.libs.versions.toml +++ b/gradle/buildsrc.libs.versions.toml @@ -2,7 +2,7 @@ asciidoctor-gradle-jvm = '4.0.2' assetpipeline = '4.4.0' grails-gradle-plugin = '6.1.2' -grails-views = '3.2.1' +grails-views = '3.2.2' groovy-doc = '1.0.1' nexus-publish-gradle-plugin = '1.3.0' From a5765fa0f665d78402e3b4436dfabadb85f2db6f Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Thu, 4 Apr 2024 13:59:03 +0530 Subject: [PATCH 49/56] fix(jsontemplates): change mongodb lib as compileOnly (#568) --- json-templates/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/json-templates/build.gradle b/json-templates/build.gradle index b304d3292..241ffea1c 100644 --- a/json-templates/build.gradle +++ b/json-templates/build.gradle @@ -16,7 +16,7 @@ dependencies { // The templates expect classes from this library as models // but I'm not sure in what context these templates are used // They were previously compileOnly - implementation libs.grails.datastore.gorm.mongodb + compileOnly libs.grails.datastore.gorm.mongodb compileOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during compileGsonViews task } @@ -52,4 +52,4 @@ apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') // This is a workaround as a javadoc jar is required for publishing. tasks.named('javadocJar', Jar) { from 'src/templates' -} \ No newline at end of file +} From 9cfb8eb3c0c40266b1dbf7482a73101548935962 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Apr 2024 14:00:33 +0530 Subject: [PATCH 50/56] chore(deps): update plugin com.gradle.enterprise to v3.17 (#567) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 1ca0358ee..ea26e7c90 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,5 @@ plugins { - id 'com.gradle.enterprise' version '3.16.2' + id 'com.gradle.enterprise' version '3.17' id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.13' } From 3f511d8d2d95f3faa5bfe7a3d52d1ff98cc4c31f Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Thu, 4 Apr 2024 09:28:40 +0000 Subject: [PATCH 51/56] [skip ci] Release v3.2.3 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index d767e757c..e89027cf1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.3-SNAPSHOT +projectVersion=3.2.3 # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From 9187db727f8740c0cc9daacc0c6450fdf331ba35 Mon Sep 17 00:00:00 2001 From: micronaut-build Date: Thu, 4 Apr 2024 11:04:17 +0000 Subject: [PATCH 52/56] chore: Bump version to 3.2.4-SNAPSHOT --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e89027cf1..028d2872a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -projectVersion=3.2.3 +projectVersion=3.2.4-SNAPSHOT # This prevents the Grails Gradle Plugin from unnecessarily excluding slf4j-simple in the generated POMs # https://github.com/grails/grails-gradle-plugin/issues/222 From 166c13c732bfffc36884ad9da83d4cd5ad9396a3 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Thu, 4 Apr 2024 14:10:03 +0200 Subject: [PATCH 53/56] fix(deps): Update and comment views-json-template deps (#569) --- gradle/libs.versions.toml | 2 ++ json-templates/build.gradle | 16 ++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 85b9b3db1..5917d751c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,6 +11,7 @@ groovy = '3.0.21' java-baseline = '11' javax-annotation-api = '1.3.2' micronaut = '3.10.4' +mongodb = '4.11.1' slf4j = '1.7.36' spock = '2.3-groovy-3.0' spring = '5.3.33' @@ -37,6 +38,7 @@ groovy-json = { module = 'org.codehaus.groovy:groovy-json', version.ref = 'groov groovy-templates = { module = 'org.codehaus.groovy:groovy-templates', version.ref = 'groovy' } javax-annotation-api = { module = 'javax.annotation:javax.annotation-api', version.ref = 'javax-annotation-api' } micronaut-http-client = { module = 'io.micronaut:micronaut-http-client', version.ref = 'micronaut' } +mongodb-bson = { module = 'org.mongodb:bson', version.ref = 'mongodb' } slf4j-api = { module = 'org.slf4j:slf4j-api', version.ref = 'slf4j' } slf4j-nop = { module = 'org.slf4j:slf4j-nop', version.ref = 'slf4j' } spock-core = { module = 'org.spockframework:spock-core', version.ref = 'spock' } diff --git a/json-templates/build.gradle b/json-templates/build.gradle index 241ffea1c..20ddb046e 100644 --- a/json-templates/build.gradle +++ b/json-templates/build.gradle @@ -12,11 +12,15 @@ dependencies { api project(':views-json') - // Should this be api, implementation, compileOnly or provided? - // The templates expect classes from this library as models - // but I'm not sure in what context these templates are used - // They were previously compileOnly - compileOnly libs.grails.datastore.gorm.mongodb + // The templates in this project use classes from these dependencies so they should be in the implementation configuration. + // + // But, setting them as implementation will make grails apps using this project try to autoconfigure MongoDB beans, + // even without the real MongoDB dependencies on the classpath, which fails with ClassNotFoundExeption. + // + // Therefore, because this project is only supposed to work with MongoDB, setting them as compileOnly/provided is + // probably best, as it will not break apps that erroneously include this project as a dependency but don't use MongoDB. + compileOnly libs.grails.datastore.gorm.mongodb // provided + compileOnly libs.mongodb.bson // provided compileOnly libs.slf4j.nop // Get rid of warning about missing slf4j implementation during compileGsonViews task } @@ -52,4 +56,4 @@ apply from: rootProject.layout.projectDirectory.file('gradle/publishing.gradle') // This is a workaround as a javadoc jar is required for publishing. tasks.named('javadocJar', Jar) { from 'src/templates' -} +} \ No newline at end of file From 4de0c2ddad9150f50f1b89cb0ab6930821a63c59 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:15:11 +0530 Subject: [PATCH 54/56] fix(deps): update dependency org.mongodb:bson to v4.11.2 (#571) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5917d751c..81b779b79 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ groovy = '3.0.21' java-baseline = '11' javax-annotation-api = '1.3.2' micronaut = '3.10.4' -mongodb = '4.11.1' +mongodb = '4.11.2' slf4j = '1.7.36' spock = '2.3-groovy-3.0' spring = '5.3.33' From 6f69cf2f059bcea8197761e7a06a1836d2416529 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Apr 2024 20:15:20 +0530 Subject: [PATCH 55/56] fix(deps): update dependency org.grails.plugins:views-gradle to v3.2.3 (#570) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/buildsrc.libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/buildsrc.libs.versions.toml b/gradle/buildsrc.libs.versions.toml index 9a28cf4b8..0eb675358 100644 --- a/gradle/buildsrc.libs.versions.toml +++ b/gradle/buildsrc.libs.versions.toml @@ -2,7 +2,7 @@ asciidoctor-gradle-jvm = '4.0.2' assetpipeline = '4.4.0' grails-gradle-plugin = '6.1.2' -grails-views = '3.2.2' +grails-views = '3.2.3' groovy-doc = '1.0.1' nexus-publish-gradle-plugin = '1.3.0' From fde9f3cd4b0bd3f94f11754c79427ba81dc8e41e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Apr 2024 14:46:04 +0000 Subject: [PATCH 56/56] fix(deps): update dependency org.mongodb:bson to v5 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 81b779b79..49fb2de77 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ groovy = '3.0.21' java-baseline = '11' javax-annotation-api = '1.3.2' micronaut = '3.10.4' -mongodb = '4.11.2' +mongodb = '5.0.1' slf4j = '1.7.36' spock = '2.3-groovy-3.0' spring = '5.3.33'