diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 53926182f4e..aebdfa982cf 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,4 +1,4 @@ -name: Java CI +name: "Java CI" on: push: branches: @@ -8,83 +8,97 @@ on: - '[7-9]+.[0-9]+.x' jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read + strategy: + fail-fast: false + matrix: + java: [17, 21] steps: - - uses: actions/checkout@v4 - - name: Set up JDK + - name: "ðŸ“Ĩ Checkout the repository" + uses: actions/checkout@v4 + - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: + java-version: ${{ matrix.java }} distribution: liberica - java-version: 17 - - name: Setup Gradle + - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: Run Build + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "ðŸ”Ļ Run Build" id: build - run: ./gradlew build env: - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew build --continue publish: if: github.event_name == 'push' - needs: ["build"] - runs-on: ubuntu-latest + needs: build + runs-on: ubuntu-24.04 + permissions: + contents: read + packages: read steps: - - uses: actions/checkout@v4 - - name: Set up JDK + - name: "ðŸ“Ĩ Checkout the repository" + uses: actions/checkout@v4 + - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: liberica java-version: 17 - - name: Setup Gradle + distribution: liberica + - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: Publish to Artifactory (repo.grails.org) - run: ./gradlew -Dorg.gradle.internal.publish.checksums.insecure=true publish + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "ðŸ“Ī Publish Snapshot to repo.grails.org" env: - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + GRADLE_PUBLISH_RELEASE: 'false' + MAVEN_PUBLISH_USERNAME: ${{ secrets.MAVEN_PUBLISH_USERNAME }} + MAVEN_PUBLISH_PASSWORD: ${{ secrets.MAVEN_PUBLISH_PASSWORD }} + MAVEN_PUBLISH_URL: ${{ secrets.MAVEN_PUBLISH_SNAPSHOT_URL }} + run: ./gradlew --no-build-cache publish trigger-build-gorm-impls: if: github.event_name == 'push' - needs: ["build", "publish"] - runs-on: ubuntu-latest + needs: [build, publish] + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - name: Extract branch name + - name: "📝 Store the target branch" id: extract_branch - run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - - name: Create Snapshot Message for the Workflow Dispatch + run: | + echo "🔍 Determine Target Branch" + TARGET_BRANCH=${GITHUB_REF#refs/heads/} + echo $TARGET_BRANCH + echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT + - name: "📝 Create Snapshot Message for the Workflow Dispatch" id: dispatch_message - run: echo "value={\"message\":\"New Core Snapshot $(date) - $GITHUB_SHA\"}" >> $GITHUB_OUTPUT - - name: Invoke the Java CI workflow in GORM Hibernate5 - uses: benc-uk/workflow-dispatch@v1.2 + run: echo "value={\"message\":\"New Data Mapping Snapshots $(date) - $GITHUB_SHA\"}" >> $GITHUB_OUTPUT + - name: "ðŸ“Ą Invoke the Java CI workflow in GORM Hibernate5" + uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action) with: workflow: Java CI repo: grails/gorm-hibernate5 ref: ${{ steps.extract_branch.outputs.value }} token: ${{ secrets.GH_TOKEN }} - - name: Invoke the Java CI workflow in GORM Hibernate6 - uses: benc-uk/workflow-dispatch@v1.2 + - name: "ðŸ“Ą Invoke the Java CI workflow in GORM Hibernate6" + uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action) with: workflow: Java CI repo: grails/gorm-hibernate6 ref: ${{ steps.extract_branch.outputs.value }} token: ${{ secrets.GH_TOKEN }} - - name: Invoke the Java CI workflow in GORM MongoDB - uses: benc-uk/workflow-dispatch@v1.2 + - name: "ðŸ“Ą Invoke the Java CI workflow in GORM MongoDB" + uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action) with: workflow: Java CI repo: grails/gorm-mongodb ref: ${{ steps.extract_branch.outputs.value }} token: ${{ secrets.GH_TOKEN }} inputs: ${{ steps.dispatch_message.outputs.value }} - - name: Invoke the Java CI workflow in GORM Neo4j - uses: benc-uk/workflow-dispatch@v1.2 + - name: "ðŸ“Ą Invoke the Java CI workflow in GORM Neo4j" + uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action) with: workflow: Java CI repo: grails/gorm-neo4j diff --git a/.github/workflows/groovy-joint-workflow.yml b/.github/workflows/groovy-joint-workflow.yml index 18daee4c379..2a539c948b8 100644 --- a/.github/workflows/groovy-joint-workflow.yml +++ b/.github/workflows/groovy-joint-workflow.yml @@ -9,17 +9,19 @@ on: workflow_dispatch: permissions: contents: read + packages: read jobs: build_groovy: - runs-on: ubuntu-latest + name: "Build Groovy" + runs-on: ubuntu-24.04 outputs: groovyVersion: ${{ steps.groovy-version.outputs.value }} steps: - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: liberica java-version: 17 + distribution: liberica - name: "🗄ïļ Cache local Maven repository" uses: actions/cache@v4 with: @@ -45,8 +47,8 @@ jobs: - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: "📝 Store Groovy version to use when building this project" + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "📝 Store Groovy version to use when building the project" id: groovy-version run: | cd groovy @@ -68,27 +70,20 @@ jobs: run: | echo "VALUE<> $GITHUB_OUTPUT echo "def isAuthenticated = System.getenv('DEVELOCITY_ACCESS_KEY') != null" >> $GITHUB_OUTPUT - echo "def isBuildCacheAuthenticated =" >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') != null &&" >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') != null" >> $GITHUB_OUTPUT - echo "" >> $GITHUB_OUTPUT echo "develocity {" >> $GITHUB_OUTPUT echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT echo " buildScan {" >> $GITHUB_OUTPUT + echo " tag('groovy')" >> $GITHUB_OUTPUT + echo " tag('grails-datamapping')" >> $GITHUB_OUTPUT echo " publishing.onlyIf { isAuthenticated }" >> $GITHUB_OUTPUT echo " uploadInBackground = false" >> $GITHUB_OUTPUT echo " }" >> $GITHUB_OUTPUT echo "}" >> $GITHUB_OUTPUT - echo "" >> $GITHUB_OUTPUT echo "buildCache {" >> $GITHUB_OUTPUT echo " local { enabled = false }" >> $GITHUB_OUTPUT echo " remote(develocity.buildCache) {" >> $GITHUB_OUTPUT - echo " push = isBuildCacheAuthenticated" >> $GITHUB_OUTPUT + echo " push = isAuthenticated" >> $GITHUB_OUTPUT echo " enabled = true" >> $GITHUB_OUTPUT - echo " usernameAndPassword(" >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_USER') ?: ''," >> $GITHUB_OUTPUT - echo " System.getenv('DEVELOCITY_BUILD_CACHE_NODE_KEY') ?: ''" >> $GITHUB_OUTPUT - echo " )" >> $GITHUB_OUTPUT echo " }" >> $GITHUB_OUTPUT echo "}" >> $GITHUB_OUTPUT echo "" >> $GITHUB_OUTPUT @@ -105,16 +100,13 @@ jobs: # Add Develocity setup related configuration after line no 22 in gradle/build-scans.gradle echo "${{ steps.develocity-conf-2.outputs.value }}" | sed -i -e "22r /dev/stdin" gradle/build-scans.gradle - name: "ðŸ”Ļ Publish Groovy to local maven repository (no docs)" - env: - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: | cd groovy ./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK build_project: - needs: [build_groovy] + name: "Build Project" + needs: build_groovy runs-on: ubuntu-latest steps: - name: "ðŸ“Ĩ Checkout project" @@ -122,12 +114,12 @@ jobs: - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: liberica java-version: 17 + distribution: liberica - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - name: "🗄ïļ Restore local Maven repository from cache" uses: actions/cache@v4 with: @@ -135,12 +127,10 @@ jobs: key: cache-local-maven-${{ github.sha }} - name: "ðŸŠķ Add mavenLocal repository to build" run: sed -i 's|// mavenLocal() // Keep|mavenLocal() // Keep|' build.gradle - - name: "ðŸ”Ļ Build and test project using the locally built Groovy snapshot" + - name: "ðŸ”Ļ Build and test the project using the locally built Groovy snapshot" env: - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} run: > - ./gradlew build + ./gradlew build --continue -PgroovyVersion=${{needs.build_groovy.outputs.groovyVersion}} - -x groovydoc + -x groovydoc \ No newline at end of file diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index f5966bc3375..75b66d20733 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -1,4 +1,4 @@ -name: Changelog +name: "Release Drafter" on: issues: types: [closed,reopened] @@ -8,42 +8,15 @@ on: pull_request: types: [opened, reopened, synchronize] pull_request_target: - types: [opened, reopened, synchronize] + types: [opened, reopened, synchronize] workflow_dispatch: jobs: - release_notes: + update_release_draft: + permissions: + contents: read # limit to read access runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Check if it has release drafter config file - id: check_release_drafter - run: | - has_release_drafter=$([ -f .github/release-drafter.yml ] && echo "true" || echo "false") - echo "has_release_drafter=${has_release_drafter}" >> $GITHUB_OUTPUT - - name: Extract branch name - id: extract_branch - run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - # If it has release drafter: - - uses: release-drafter/release-drafter@v6 - if: steps.check_release_drafter.outputs.has_release_drafter == 'true' + - name: "📝 Update Release Draft" + uses: release-drafter/release-drafter@v6 env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - # Otherwise: - - name: Export Gradle Properties - if: steps.check_release_drafter.outputs.has_release_drafter == 'false' - uses: grails/github-actions/export-gradle-properties@main - - uses: grails/github-actions/release-notes@main - if: steps.check_release_drafter.outputs.has_release_drafter == 'false' - id: release_notes - with: - token: ${{ secrets.GH_TOKEN }} - - uses: ncipollo/release-action@v1 - if: steps.check_release_drafter.outputs.has_release_drafter == 'false' && steps.release_notes.outputs.generated_changelog == 'true' - with: - allowUpdates: true - commit: ${{ steps.release_notes.outputs.current_branch }} - draft: true - name: ${{ env.title }} ${{ steps.release_notes.outputs.next_version }} - tag: v${{ steps.release_notes.outputs.next_version }} - bodyFile: CHANGELOG.md - token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de9c020f53a..ef024798ae2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,127 +1,126 @@ -name: Release +name: "Release" on: release: types: [published] +env: + GIT_USER_NAME: grails-build + GIT_USER_EMAIL: grails-build@users.noreply.github.com jobs: publish: + name: "Publish to Sonatype Staging Repository" outputs: release_version: ${{ steps.release_version.outputs.value }} target_branch: ${{ steps.extract_branch.outputs.value }} - runs-on: ubuntu-latest - env: - GIT_USER_NAME: 'grails-build' - GIT_USER_EMAIL: 'grails-build@users.noreply.github.com' + runs-on: ubuntu-24.04 steps: - - name: Checkout repository + - name: "ðŸ“Ĩ Checkout repository" uses: actions/checkout@v4 - with: - token: ${{ secrets.GH_TOKEN }} - - name: Set up JDK + - name: "☕ïļ Setup JDK" uses: actions/setup-java@v4 with: - distribution: liberica java-version: 17 - - name: Run pre-release - uses: grails/github-actions/pre-release@main + distribution: liberica + - name: "🐘 Setup Gradle" + uses: gradle/actions/setup-gradle@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Target Branch + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "⚙ïļ Run pre-release" + uses: grails/github-actions/pre-release@main + - name: "🔍 Determine Target Branch" id: extract_branch run: | echo "Determining Target Branch" TARGET_BRANCH=`cat $GITHUB_EVENT_PATH | jq '.release.target_commitish' | sed -e 's/^"\(.*\)"$/\1/g'` echo $TARGET_BRANCH echo "value=${TARGET_BRANCH}" >> $GITHUB_OUTPUT - - name: Set the current release version + - name: "📝 Store the current release version" id: release_version run: echo "value=${GITHUB_REF:11}" >> $GITHUB_OUTPUT - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: Run Assemble + - name: "ðŸ§Đ Run Assemble" if: success() id: assemble - run: ./gradlew -U assemble env: - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Upload Distribution + run: ./gradlew --refresh-dependencies assemble + - name: "ðŸ“Ī Upload Distribution to workflow summary page" if: success() uses: actions/upload-artifact@v4 with: name: grails-data-mapping-${{ steps.release_version.outputs.value }}.zip path: ./**/build/libs/* - - name: Generate secring file + - name: "🔐 Generate key file for artifact signing" env: SECRING_FILE: ${{ secrets.SECRING_FILE }} run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg - - name: Publish to Sonatype OSSRH + - name: "ðŸ“Ī Publish to and close Sonatype staging repository" id: publish - run: > - ./gradlew -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg - publishToSonatype - closeSonatypeStagingRepository env: - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_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 }} + GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + GRAILS_PUBLISH_RELEASE: 'true' + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} + NEXUS_PUBLISH_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} + NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} - SECRING_FILE: ${{ secrets.SECRING_FILE }} - GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + run: > + ./gradlew --no-build-cache + -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg + publishToSonatype + closeSonatypeStagingRepository release: + name: "Release Sonatype Staging Repository" needs: publish - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 permissions: contents: read + packages: read steps: - - name: Checkout repository + - name: "ðŸ“Ĩ Checkout repository" uses: actions/checkout@v4 with: - token: ${{ secrets.GH_TOKEN }} ref: v${{ needs.publish.outputs.release_version }} - - name: Setup Gradle + - name: "☕ïļ Setup JDK" + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: liberica + - name: "🐘 Setup Gradle" uses: gradle/actions/setup-gradle@v4 with: - develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} - - name: Nexus Staging Close And Release - run: > - ./gradlew findSonatypeStagingRepository - releaseSonatypeStagingRepository + develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + - name: "🚀 Release Sonatype Staging Repository" env: - DEVELOCITY_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} - DEVELOCITY_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 }} GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} - - name: Run post-release + GRAILS_PUBLISH_RELEASE: 'true' + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }} + NEXUS_PUBLISH_URL: ${{ secrets.NEXUS_PUBLISH_RELEASE_URL }} + NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }} + run: > + ./gradlew + findSonatypeStagingRepository + releaseSonatypeStagingRepository + - name: "⚙ïļ Run post-release" if: success() uses: grails/github-actions/post-release@main - with: - token: ${{ secrets.GITHUB_TOKEN }} - env: - SNAPSHOT_SUFFIX: -SNAPSHOT docs: - needs: [publish] - runs-on: ubuntu-latest + name: "Publish Documentation" + needs: publish + runs-on: ubuntu-24.04 permissions: contents: write + packages: read steps: - - name: Create Message for the GORM Documentation Release + - name: "📝 Create Message for the GORM Documentation Release" id: gorm_docs_release_message - run: | - echo "value={\"gorm_version\":\"$RELEASE_VERSION\"}" >> $GITHUB_OUTPUT env: RELEASE_VERSION: ${{ needs.publish.outputs.release_version }} - - name: Invoke gorm-docs release workflow + run: echo "value={\"gorm_version\":\"$RELEASE_VERSION\"}" >> $GITHUB_OUTPUT + - name: "ðŸ“Ą Invoke gorm-docs release workflow" if: success() id: gorm_docs - uses: benc-uk/workflow-dispatch@v1.2 + uses: benc-uk/workflow-dispatch@e2e5e9a103e331dad343f381a29e654aea3cf8fc # v1.2.4 (Use commit sha as this is a 3rd party action) with: workflow: Release repo: grails/gorm-docs diff --git a/build.gradle b/build.gradle index ed3847dbfa2..de46e880db5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,36 +1,40 @@ -io.github.gradlenexus.publishplugin.InitializeNexusStagingRepository - -buildscript { - repositories { - maven { url = 'https://repo.grails.org/grails/core' } - } - dependencies { - classpath 'io.github.gradle-nexus:publish-plugin:2.0.0' - } -} - ext { - isCiBuild = System.getenv().get("CI") as Boolean - isSnapshot = project.projectVersion.endsWith("-SNAPSHOT") - isReleaseVersion = !isSnapshot + isCiBuild = System.getenv('CI') + excludeUnusedTransDeps = findProperty('excludeUnusedTransDeps') } -group = "org.grails" -version = project.projectVersion +String customGroovyVersion = findProperty('groovyVersion') ?: System.getenv('GROOVY_VERSION') +if (customGroovyVersion) { + logger.lifecycle("Using custom Groovy version: $customGroovyVersion") +} allprojects { + + if (customGroovyVersion) { + configurations.configureEach { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + if (details.requested.group == 'org.apache.groovy') { + details.useVersion(customGroovyVersion) + } + } + } + } + repositories { mavenCentral() maven { url = 'https://repo.grails.org/grails/core' } // mavenLocal() // Keep, this will be uncommented and used by CI (groovy-joint-workflow) - if (findProperty('groovyVersion')?.endsWith('-SNAPSHOT')) { + if (customGroovyVersion?.endsWith('-SNAPSHOT')) { + // Used for testing locally against the latest snapshot of Groovy + // Usage: ./gradlew build -P"groovyVersion=X.X.X-SNAPSHOT" + logger.lifecycle('Adding Groovy Snapshot Repo for project: {}, Using Groovy {}', name, customGroovyVersion) maven { name = 'ASF Snapshot repo' url = 'https://repository.apache.org/content/repositories/snapshots' } } if (System.getenv('GITHUB_MAVEN_PASSWORD') && !grailsVersion.endsWith('-SNAPSHOT')) { - System.out.println("Adding Grails Core Staging Repo for project: $name") + logger.lifecycle('Adding Grails Core Staging Repo for project: {}', name) maven { url = 'https://maven.pkg.github.com/grails/grails-core' credentials { @@ -42,25 +46,7 @@ allprojects { } } -if (isReleaseVersion) { - apply plugin: 'io.github.gradle-nexus.publish-plugin' - nexusPublishing { - repositories { - sonatype { - nexusUrl = uri('https://s01.oss.sonatype.org/service/local') - username = System.getenv('SONATYPE_USERNAME') ?: project.findProperty('sonatypeOssUsername') ?: '' - password = System.getenv('SONATYPE_PASSWORD') ?: project.findProperty('sonatypeOssPassword') ?: '' - stagingProfileId = System.getenv('SONATYPE_STAGING_PROFILE_ID') ?: project.findProperty('sonatypeOssStagingProfileId') ?: '' - } - } - } - //do not generate extra load on Nexus with new staging repository if signing fails - tasks.withType(InitializeNexusStagingRepository).configureEach { - shouldRunAfter = tasks.withType(Sign) - } -} - -apply from: "gradle/idea.gradle" -apply from: "gradle/aggregate-test-report.gradle" - - +tasks.register('clean', Delete) { + group = 'build' + delete layout.buildDirectory +} \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000000..fc836be2fbc --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,28 @@ +plugins { + id 'groovy-gradle-plugin' +} + +def versions = new Properties() +file('../gradle.properties').withInputStream { + versions.load(it) +} + +repositories { + mavenLocal() + maven { url = 'https://repo.grails.org/grails/core' } + mavenCentral() + if (System.getenv('GITHUB_MAVEN_PASSWORD')) { + maven { + url = 'https://maven.pkg.github.com/grails/grails-core' + credentials { + username = 'DOES_NOT_MATTER' + password = System.getenv('GITHUB_MAVEN_PASSWORD') + } + } + } +} + +dependencies { + implementation platform("org.grails:grails-bom:${versions.getProperty('grailsVersion')}") + implementation 'org.grails:grails-gradle-plugin' +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 0c340b464ff..e5ef6383c1b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,6 @@ commonsValidatorVersion=1.9.0 hibernateVersion=5.6.15.Final jakartaElVersion=4.0.0 jakartaElGlassfishImplVersion=4.0.2 -groovyVersion=4.0.24 javassistVersion=3.30.2-GA org.gradle.caching=true diff --git a/gradle/aggregate-test-report.gradle b/gradle/aggregate-test-report.gradle deleted file mode 100644 index 6d4b1adc159..00000000000 --- a/gradle/aggregate-test-report.gradle +++ /dev/null @@ -1,20 +0,0 @@ - -apply plugin: 'groovy' - -tasks.register('testAll', TestReport) { - // Where to write the aggregated report - destinationDirectory = layout.buildDirectory.dir("reports/tests/test-results").get().asFile - - // Tell it to gather results from all subprojects' 'test' tasks - reportOn(subprojects*.tasks*.withType(Test)) - - // Make sure all subprojects' tests have run before we aggregate - dependsOn(subprojects*.tasks*.withType(Test)) - - // (Optional) Clean up the existing report directory before regenerating - doFirst { - delete destinationDir - } - - outputs.upToDateWhen { false } -} \ No newline at end of file diff --git a/gradle/doc-config.gradle b/gradle/doc-config.gradle index a982984ec08..7cc96f504a2 100644 --- a/gradle/doc-config.gradle +++ b/gradle/doc-config.gradle @@ -1,7 +1,4 @@ - -configure([javadoc]) { - options.encoding "UTF-8" - options.docEncoding "UTF-8" - options.charSet "UTF-8" - options.jFlags "-Xms64M", "-Xmx512M" -} \ No newline at end of file +tasks.withType(Javadoc).configureEach { + options.encoding('UTF-8') + options.jFlags('-Xms64M', '-Xmx512M') +} diff --git a/gradle/idea.gradle b/gradle/idea.gradle deleted file mode 100644 index 09e767a92b2..00000000000 --- a/gradle/idea.gradle +++ /dev/null @@ -1,41 +0,0 @@ -apply plugin: 'idea' - -idea { - project { - jdkName "17" - languageLevel "17" - ipr { - withXml { provider -> - def node = provider.asNode() - - // Use Git - node.component.find { it.'@name' == 'VcsDirectoryMappings' }?.mapping[0].'@vcs' = 'Git' - - // Apply our code formatting - node.append(new XmlParser().parse(file("gradle/ideaCodeStyle.xml"))) - - // Use the ASL2 license header - def copyrightManager = node.component.find { it.'@name' == 'CopyrightManager' } - copyrightManager.@default = "ASL2" - def aslCopyright = copyrightManager.copyright.find { it.option.find { it.@name == "myName" }?.@value == "ASL2" } - if (aslCopyright == null) { - copyrightManager.append(new XmlParser().parseText(''' - - - ''')) - } - - // Disable Spring framework detection - node.append(new NodeBuilder().component(name: 'FrameworkDetectionExcludesConfiguration') { - type(id: 'Spring') - type(id: 'web') - }) - } - } - } -} diff --git a/gradle/ideaCodeStyle.xml b/gradle/ideaCodeStyle.xml deleted file mode 100644 index 9c957569e66..00000000000 --- a/gradle/ideaCodeStyle.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/gradle/java-config.gradle b/gradle/java-config.gradle index 5469790f2eb..6a72fe1eb8e 100644 --- a/gradle/java-config.gradle +++ b/gradle/java-config.gradle @@ -1,13 +1 @@ -compileJava.options.release = javaVersion.toInteger() - -java { - withSourcesJar() - withJavadocJar() -} - -afterEvaluate { project -> - def hasSnapshotVersion = project.version.endsWith("-SNAPSHOT") - if(isSnapshot != hasSnapshotVersion) { - throw new StopExecutionException("${project.name} has version \"${project.version}\" which is${isSnapshot ? 'n\'t' : ''} a snapshot version.") - } -} +compileJava.options.release = javaVersion.toInteger() \ No newline at end of file diff --git a/gradle/publish-config.gradle b/gradle/publish-config.gradle index 08adc187250..cf869766e6b 100644 --- a/gradle/publish-config.gradle +++ b/gradle/publish-config.gradle @@ -1,77 +1,18 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -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") - -publishing { - if (isSnapshot) { - repositories { - maven { - credentials { - username = System.getenv('ARTIFACTORY_USERNAME') ?: project.findProperty('artifactoryPublishUsername') ?: '' - password = System.getenv('ARTIFACTORY_PASSWORD') ?: project.findProperty('artifactoryPublishPassword') ?: '' - } - url = 'https://repo.grails.org/grails/libs-snapshots-local' - } - } - } - - publications { - maven(MavenPublication) { - - artifactId = project.findProperty('artifactId') ?: project.name - groupId = project.group - version = project.version - - from components.java - - pom { - name = project.findProperty('pomTitle') ?: 'Grails GORM' - description = project.findProperty('pomDescription') ?: 'GORM - Grails Data Access Framework' - url = 'https://gorm.grails.org/' - - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - - developers { - for (dev in project.findProperty('pomDevelopers') ?: [[id: 'graemerocher', name: 'Graeme Rocher'], [id: 'jeffscottbrown', name: 'Jeff Brown'], [id: 'burtbeckwith', name: 'Burt Beckwith'], [id: 'jameskleeh', name: 'James Kleeh'], [id: 'puneetbelh', name: 'Puneet Behl'], [id: 'jamesfredley', name: 'James Fredley']]) { - developer { - id = dev.id - name = dev.name - } - } - } - - scm { - url = 'scm:git@github.com:grails/grails-data-mapping.git' - connection = 'scm:git@github.com:grails/grails-data-mapping.git' - developerConnection = 'scm:git@github.com:grails/grails-data-mapping.git' - } - } - - // dependency management shouldn't be included - pom.withXml { - def pomNode = asNode() - try { pomNode.dependencyManagement.replaceNode({}) } catch (Throwable ignore) {} - } - } - } +import org.grails.gradle.plugin.publishing.GrailsPublishExtension + +apply plugin: 'org.grails.grails-publish' + +project.extensions.configure(GrailsPublishExtension) { + it.githubSlug = 'grails/grails-data-mapping' + it.license.name = 'Apache-2.0' + it.title = findProperty('pomTitle') ?: 'Grails GORM' + it.desc = findProperty('pomDescription') ?: 'GORM - Grails Data Access Framework' + it.developers = findProperty('pomDevelopers') as Map ?: [ + 'graemerocher': 'Graeme Rocher', + 'jeffscottbrown': 'Jeff Brown', + 'burtbeckwith': 'Burt Beckwith', + 'jameskleeh': 'James Kleeh', + 'puneetbehl': 'Puneet Behl', + 'jamesfredley': 'James Fredley' + ] } - -afterEvaluate { - signing { - required = { isReleaseVersion && gradle.taskGraph.hasTask('publish') } - sign(publishing.publications.maven) - } -} - -tasks.withType(Sign) { - onlyIf { isReleaseVersion } -} \ No newline at end of file diff --git a/gradle/tck-config.gradle b/gradle/tck-config.gradle index bc6d5fedc9a..994bc3ac401 100644 --- a/gradle/tck-config.gradle +++ b/gradle/tck-config.gradle @@ -1,5 +1,5 @@ dependencies { - testImplementation project(":grails-datastore-gorm-tck") + testImplementation project(':grails-datastore-gorm-tck') } // We need to test against the TCK. Gradle cannot find/run tests from jars @@ -10,7 +10,7 @@ dependencies { // helper, used below. def toBaseClassRelativePathWithoutExtension = { String base, String classFile -> if (classFile.startsWith(base)) { - def sansClass = classFile[0 .. classFile.size() - ".class".size() - 1] + def sansClass = classFile[0 .. classFile.size() - '.class'.size() - 1] def dollarIndex = sansClass.indexOf('$') def baseClass = dollarIndex > 0 ? sansClass[0..dollarIndex - 1] : sansClass def relative = baseClass - base - '/' @@ -21,31 +21,30 @@ def toBaseClassRelativePathWithoutExtension = { String base, String classFile -> } } -test.doFirst { - File tckClassesDir = project(":grails-datastore-gorm-tck").sourceSets.main.output.classesDirs.files.first() - def thisProjectsTests = // surely there is a less hardcoded way to do this - copy { - from tckClassesDir - into sourceSets.test.output.classesDirs.files.first() - include "**/*.class" - exclude { details -> - // Do not copy across any TCK class (or nested classes of that class) - // If there is a corresponding source file in the particular modules - // test source tree. Allows a module to override a test/helper. - - if (!details.file.isFile()) { - return false - } - def candidatePath = details.file.absolutePath - def relativePath = toBaseClassRelativePathWithoutExtension(tckClassesDir.absolutePath, candidatePath) - - if (relativePath == null) { - throw new IllegalStateException("$candidatePath does not appear to be in the TCK") - } - - project.file("src/test/groovy/${relativePath}.groovy").exists() +tasks.named('test') { + doFirst { + File tckClassesDir = findProject(':grails-datastore-gorm-tck').sourceSets.main.output.classesDirs.files.first() + // surely there is a less hardcoded way to do this + copy { + from tckClassesDir + into sourceSets.test.output.classesDirs.files.first() + include '**/*.class' + exclude { details -> + // Do not copy across any TCK class (or nested classes of that class) + // If there is a corresponding source file in the particular modules + // test source tree. Allows a module to override a test/helper. + if (!details.file.isFile()) { + return false } + def candidatePath = details.file.absolutePath + def relativePath = toBaseClassRelativePathWithoutExtension(tckClassesDir.absolutePath, candidatePath) + if (relativePath == null) { + throw new IllegalStateException("$candidatePath does not appear to be in the TCK") + } + file("src/test/groovy/${relativePath}.groovy").exists() } + } + } } // Only enable to force snapshot dependency updates due to spring dependency management plugin snapshot caching behavior diff --git a/gradle/test-config.gradle b/gradle/test-config.gradle index d72ee71e688..436ccecd72d 100644 --- a/gradle/test-config.gradle +++ b/gradle/test-config.gradle @@ -1,13 +1,12 @@ -compileTestGroovy { - configure(groovyOptions.forkOptions) { - jvmArgs = [ '-Xmx768m'] - } +tasks.named('compileTestGroovy', GroovyCompile) { + groovyOptions.forkOptions.jvmArgs = ['-Xmx768m'] } -test { +tasks.withType(Test).configureEach { useJUnitPlatform() testLogging { - exceptionFormat ='full' + events 'passed', 'skipped', 'failed' + exceptionFormat = 'full' } if (isCiBuild) { maxParallelForks = 2 @@ -22,7 +21,7 @@ test { forkEvery = 100 jvmArgs = ['-server', '-Xmx2048M'] } - if(System.getProperty("debug.tests")) { + if (System.getProperty('debug.tests')) { jvmArgs '-Xmx2g', '-Xdebug', '-Xnoagent', '-Djava.compiler=NONE', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005' } diff --git a/grails-datastore-async/build.gradle b/grails-datastore-async/build.gradle index 3a9cba57d86..b676e9ab470 100644 --- a/grails-datastore-async/build.gradle +++ b/grails-datastore-async/build.gradle @@ -7,20 +7,25 @@ version = projectVersion group = 'org.grails' dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - api "org.grails:grails-async" + api 'org.grails:grails-async', { + // ast: DelegateAsyncUtils, Promise, Promises + } + + implementation 'org.apache.groovy:groovy', { + // impl: GroovyASTTransformationClass, etc + } - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" + compileOnly 'jakarta.annotation:jakarta.annotation-api', { + // comp: Documented, ElementType, Retention, RetentionPolicy, Target + } - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" + testImplementation 'org.spockframework:spock-core' - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/grails-datastore-core/build.gradle b/grails-datastore-core/build.gradle index 130bfe9665c..d93df7c10ca 100644 --- a/grails-datastore-core/build.gradle +++ b/grails-datastore-core/build.gradle @@ -7,35 +7,60 @@ version = projectVersion group = 'org.grails' dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" - - api "jakarta.transaction:jakarta.transaction-api" - api "org.slf4j:slf4j-api" - api "org.slf4j:jcl-over-slf4j" - api "jakarta.persistence:jakarta.persistence-api" - api "org.springframework:spring-core" - api "org.springframework:spring-beans" - api "org.springframework:spring-tx" - api "org.springframework:spring-context" - implementation "com.github.ben-manes.caffeine:caffeine" - implementation "org.javassist:javassist:$javassistVersion" - - // we need the Grails @Entity annotation to test GORM syntax mapping - testImplementation project(":grails-datastore-gorm") - - testImplementation "org.springframework:spring-context" - testImplementation "org.springframework:spring-web" - - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" - - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" + + api 'jakarta.persistence:jakarta.persistence-api', { + // api: FlushModeType, AccessType, CascadeType, EnumType, FetchType, LockModeType, JoinType + // impl: Entity, Transient + } + api "org.javassist:javassist:$javassistVersion", { + // api: MethodHandler + } + api 'org.springframework:spring-context', { + // api: ApplicationContext, ApplicationEvent, ApplicationEventPublisher, ConfigurableApplicationContext, MessageSource, TransactionDefinition, Validator + // impl: DataBinder + } + api 'org.springframework:spring-core', { + // api: ConcurrentReferenceHashMap (used in deprecated class), ConversionService, Converter, ConverterRegistry, PropertyResolver + // impl: Assert, ClassUtils, ConversionException, ConversionFailedException, MapPropertySource, NamedThreadLocal, PathMatchingResourcePatternResolver, Resource (api?), StringUtils + } + api 'org.springframework:spring-tx', { + // api: DataAccessResourceFailureException, OptimisticLockingFailureException, TransactionDefinition + // impl: DefaultTransactionDefinition, InvalidDataAccessResourceUsageException, NoTransactionException, TransactionSynchronizationManager + } + + implementation 'com.github.ben-manes.caffeine:caffeine', { + // impl: Caffeine, RemovalListener + } + implementation 'jakarta.annotation:jakarta.annotation-api', { + // impl: PreDestroy + } + implementation 'org.apache.groovy:groovy', { + // impl: Builder + // comp: CompileStatic + } + implementation 'org.springframework:spring-beans', { + // impl: Autowired, BeanUtils, BeanWrapper, BeanWrapperImpl, MutablePropertyValues + } + + compileOnly 'org.slf4j:slf4j-api', { + // provided: Logger, LoggerFactory + } + + + testImplementation project(':grails-datastore-gorm'), { + // we only need the @grails.gorm.annotation.Entity annotation to test GORM syntax mapping + transitive = false + } + testImplementation 'org.junit.jupiter:junit-jupiter-api', { + // There are some tests that use JUnit 5 + } + testImplementation 'org.spockframework:spock-core' + + testRuntimeOnly 'org.apache.groovy:groovy-test-junit5' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/AbstractPersistentCollection.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/AbstractPersistentCollection.java index 1879a75162e..4c8d263bb70 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/AbstractPersistentCollection.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/AbstractPersistentCollection.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2011 SpringSource +/* Copyright (C) 2011-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -15,7 +15,6 @@ package org.grails.datastore.mapping.collection; import org.grails.datastore.mapping.core.Session; -import org.grails.datastore.mapping.engine.AssociationIndexer; import org.grails.datastore.mapping.engine.AssociationQueryExecutor; import org.grails.datastore.mapping.model.PersistentEntity; import org.grails.datastore.mapping.model.types.Association; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentList.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentList.java index fa6155d2dbd..f6426135ecd 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentList.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentList.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,9 +21,7 @@ import java.util.ListIterator; import org.grails.datastore.mapping.core.Session; -import org.grails.datastore.mapping.engine.AssociationIndexer; import org.grails.datastore.mapping.engine.AssociationQueryExecutor; -import org.grails.datastore.mapping.model.PersistentEntity; import org.grails.datastore.mapping.model.types.Association; /** diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentSortedSet.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentSortedSet.java index 2a87a178476..945ffb0c3ca 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentSortedSet.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/collection/PersistentSortedSet.java @@ -1,7 +1,6 @@ package org.grails.datastore.mapping.collection; import org.grails.datastore.mapping.core.Session; -import org.grails.datastore.mapping.engine.AssociationIndexer; import org.grails.datastore.mapping.engine.AssociationQueryExecutor; import org.grails.datastore.mapping.model.types.Association; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractDatastore.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractDatastore.java index e4d34bbd4f4..48c2e17c936 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractDatastore.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractDatastore.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,7 +17,6 @@ import groovy.lang.Closure; import groovy.lang.GroovySystem; import groovy.lang.MetaClassRegistry; -import groovy.util.ConfigObject; import org.grails.datastore.mapping.cache.TPCacheAdapterRepository; import org.grails.datastore.mapping.config.Property; import org.grails.datastore.mapping.model.MappingContext; @@ -25,7 +24,6 @@ import org.grails.datastore.mapping.model.PersistentProperty; import org.grails.datastore.mapping.model.PropertyMapping; import org.grails.datastore.mapping.model.types.BasicTypeConverterRegistrar; -import org.grails.datastore.mapping.reflect.ClassPropertyFetcher; import org.grails.datastore.mapping.reflect.FieldEntityAccess; import org.grails.datastore.mapping.services.DefaultServiceRegistry; import org.grails.datastore.mapping.services.Service; @@ -34,12 +32,10 @@ import org.grails.datastore.mapping.transactions.SessionHolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.DisposableBean; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.convert.converter.ConverterRegistry; -import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.PropertyResolver; import org.springframework.transaction.support.TransactionSynchronizationManager; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractSession.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractSession.java index 23cf3f7912a..3f248557dfd 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractSession.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/AbstractSession.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,10 +18,18 @@ import com.github.benmanes.caffeine.cache.RemovalListener; import org.grails.datastore.mapping.cache.TPCacheAdapterRepository; import org.grails.datastore.mapping.config.Entity; -import org.grails.datastore.mapping.core.impl.*; +import org.grails.datastore.mapping.core.impl.PendingDelete; +import org.grails.datastore.mapping.core.impl.PendingInsert; +import org.grails.datastore.mapping.core.impl.PendingOperation; +import org.grails.datastore.mapping.core.impl.PendingOperationExecution; +import org.grails.datastore.mapping.core.impl.PendingUpdate; import org.grails.datastore.mapping.dirty.checking.DirtyCheckable; import org.grails.datastore.mapping.dirty.checking.DirtyCheckingSupport; -import org.grails.datastore.mapping.engine.*; +import org.grails.datastore.mapping.engine.EntityAccess; +import org.grails.datastore.mapping.engine.EntityPersister; +import org.grails.datastore.mapping.engine.NativeEntryEntityPersister; +import org.grails.datastore.mapping.engine.NonPersistentTypeException; +import org.grails.datastore.mapping.engine.Persister; import org.grails.datastore.mapping.model.MappingContext; import org.grails.datastore.mapping.model.PersistentEntity; import org.grails.datastore.mapping.model.PersistentProperty; @@ -42,7 +50,14 @@ import jakarta.persistence.FlushModeType; import java.io.Serializable; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/DatastoreUtils.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/DatastoreUtils.java index 3d995bef71d..2a60febf845 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/DatastoreUtils.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/DatastoreUtils.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,7 +16,16 @@ import groovy.lang.Closure; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; import groovy.util.ConfigObject; import groovy.util.ConfigSlurper; @@ -27,7 +36,12 @@ import org.springframework.core.NamedThreadLocal; import org.springframework.core.convert.ConversionException; import org.springframework.core.convert.converter.Converter; -import org.springframework.core.env.*; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.EnumerablePropertySource; +import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.MutablePropertySources; +import org.springframework.core.env.PropertyResolver; +import org.springframework.core.env.PropertySource; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.dao.DataAccessResourceFailureException; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/AbstractConnectionSourceFactory.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/AbstractConnectionSourceFactory.java index 08baa33e13e..924626fcb84 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/AbstractConnectionSourceFactory.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/AbstractConnectionSourceFactory.java @@ -5,7 +5,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.PropertyResolver; -import java.io.Serializable; import java.util.List; /** diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.java index 92dec9f3469..1a1aedeecd6 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/core/connections/DefaultConnectionSource.java @@ -1,7 +1,5 @@ package org.grails.datastore.mapping.core.connections; -import org.springframework.core.env.PropertyResolver; - import java.io.Closeable; import java.io.IOException; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/dirty/checking/DirtyCheckableCollection.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/dirty/checking/DirtyCheckableCollection.java index ca800b4e5a7..562165a4e33 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/dirty/checking/DirtyCheckableCollection.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/dirty/checking/DirtyCheckableCollection.java @@ -1,7 +1,6 @@ package org.grails.datastore.mapping.dirty.checking; import java.io.Serializable; -import java.util.Collection; /** * @author Graeme Rocher diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/BeanEntityAccess.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/BeanEntityAccess.java index b2d3d0f8664..29d5d15b833 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/BeanEntityAccess.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/engine/BeanEntityAccess.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,8 +16,6 @@ import java.beans.PropertyDescriptor; import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.HashSet; import java.util.Set; import org.grails.datastore.mapping.model.PersistentProperty; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/keyvalue/mapping/config/KeyValueMappingFactory.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/keyvalue/mapping/config/KeyValueMappingFactory.java index 5093525c84b..803b177f80c 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/keyvalue/mapping/config/KeyValueMappingFactory.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/keyvalue/mapping/config/KeyValueMappingFactory.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,7 +18,6 @@ import org.grails.datastore.mapping.model.MappingFactory; import org.grails.datastore.mapping.model.PersistentEntity; import org.grails.datastore.mapping.model.PersistentProperty; -import org.grails.datastore.mapping.model.types.TenantId; import java.beans.PropertyDescriptor; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractMappingContext.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractMappingContext.java index 35a7f8f816d..3b84f2112b5 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractMappingContext.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/AbstractMappingContext.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -34,7 +34,6 @@ import org.grails.datastore.mapping.proxy.JavassistProxyFactory; import org.grails.datastore.mapping.proxy.ProxyFactory; import org.grails.datastore.mapping.proxy.ProxyHandler; -import org.grails.datastore.mapping.reflect.ClassPropertyFetcher; import org.grails.datastore.mapping.reflect.EntityReflector; import org.grails.datastore.mapping.reflect.FieldEntityAccess; import org.grails.datastore.mapping.validation.ValidatorRegistry; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingConfigurationStrategy.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingConfigurationStrategy.java index eef5e2dd47f..a118f49af44 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingConfigurationStrategy.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingConfigurationStrategy.java @@ -1,7 +1,5 @@ package org.grails.datastore.mapping.model; -import org.grails.datastore.mapping.model.types.TenantId; - import java.util.List; import java.util.Set; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingContext.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingContext.java index b28d610c25a..d708b76bc8e 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingContext.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingContext.java @@ -1,10 +1,10 @@ -/* Copyright 2004-2005 the original author or authors. +/* Copyright 2004-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -25,7 +25,6 @@ import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.ConverterRegistry; import org.grails.datastore.mapping.proxy.ProxyFactory; -import org.springframework.core.env.PropertyResolver; import org.springframework.validation.Validator; /** diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.java index 192ae2031e4..e1e9481c7c2 100755 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/config/GormMappingConfigurationStrategy.java @@ -1,10 +1,10 @@ -/* Copyright 2004-2005 the original author or authors. +/* Copyright 2004-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -15,7 +15,6 @@ package org.grails.datastore.mapping.model.config; import groovy.lang.Closure; -import groovy.lang.GroovyObject; import java.beans.Introspector; import java.beans.PropertyDescriptor; @@ -24,7 +23,6 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -35,7 +33,6 @@ import jakarta.persistence.Entity; -import groovy.lang.MetaBeanProperty; import groovy.lang.MetaProperty; import org.grails.datastore.mapping.engine.internal.MappingUtils; import org.grails.datastore.mapping.model.ClassMapping; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/types/Basic.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/types/Basic.java index fe0d5d72c0d..eeb728b51ac 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/types/Basic.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/types/Basic.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2011 SpringSource +/* Copyright (C) 2011-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,7 +16,6 @@ import java.beans.PropertyDescriptor; import java.util.Collection; -import java.util.Collections; import java.util.List; import java.util.Map; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/multitenancy/MultiTenancySettings.groovy b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/multitenancy/MultiTenancySettings.groovy index b4d7b0156d8..e2adfe17833 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/multitenancy/MultiTenancySettings.groovy +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/multitenancy/MultiTenancySettings.groovy @@ -33,7 +33,7 @@ class MultiTenancySettings { return tenantResolver } else if(tenantResolverClass != null) { - return BeanUtils.instantiate(tenantResolverClass) + return BeanUtils.instantiateClass(tenantResolverClass) } return new NoTenantResolver() } diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/AssociationQueryProxyHandler.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/AssociationQueryProxyHandler.java index 2bbfe1d7180..2a83031c2c5 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/AssociationQueryProxyHandler.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/AssociationQueryProxyHandler.java @@ -1,11 +1,11 @@ /* - * Copyright 2015 original authors + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,14 +18,10 @@ import org.grails.datastore.mapping.core.Session; import org.grails.datastore.mapping.dirty.checking.DirtyCheckable; import org.grails.datastore.mapping.engine.AssociationQueryExecutor; -import org.grails.datastore.mapping.reflect.FieldEntityAccess; -import org.springframework.cglib.reflect.FastClass; -import org.springframework.cglib.reflect.FastMethod; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.util.ReflectionUtils; import java.io.Serializable; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.List; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/JavassistProxyFactory.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/JavassistProxyFactory.java index ff05a323c07..09d031303cb 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/JavassistProxyFactory.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/JavassistProxyFactory.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -22,7 +22,6 @@ import org.codehaus.groovy.transform.trait.Traits; import org.grails.datastore.mapping.collection.PersistentCollection; import org.grails.datastore.mapping.core.Session; -import org.grails.datastore.mapping.dirty.checking.DirtyCheckable; import org.grails.datastore.mapping.engine.AssociationQueryExecutor; import org.grails.datastore.mapping.reflect.ClassPropertyFetcher; import org.grails.datastore.mapping.reflect.ReflectionUtils; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/SessionEntityProxyMethodHandler.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/SessionEntityProxyMethodHandler.java index 76fefa1ddc7..9a0e524c790 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/SessionEntityProxyMethodHandler.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/proxy/SessionEntityProxyMethodHandler.java @@ -1,11 +1,11 @@ /* - * Copyright 2014 original authors + * Copyright 2014-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,17 +17,12 @@ import org.grails.datastore.mapping.core.Session; import org.grails.datastore.mapping.dirty.checking.DirtyCheckable; -import org.grails.datastore.mapping.model.PersistentEntity; -import org.grails.datastore.mapping.reflect.FieldEntityAccess; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.cglib.reflect.FastClass; -import org.springframework.cglib.reflect.FastMethod; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.util.ReflectionUtils; import java.io.Serializable; -import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/projections/ManualProjections.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/projections/ManualProjections.java index 1d0aa558aac..c6f20561a1b 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/projections/ManualProjections.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/query/projections/ManualProjections.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -19,7 +19,6 @@ import java.util.List; import org.codehaus.groovy.runtime.DefaultGroovyMethods; -import org.grails.datastore.mapping.engine.EntityAccess; import org.grails.datastore.mapping.model.PersistentEntity; import org.grails.datastore.mapping.query.Query; import org.grails.datastore.mapping.query.order.ManualEntityOrdering; diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/ClassPropertyFetcher.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/ClassPropertyFetcher.java index 0fa347289bf..f8d0203d0c3 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/ClassPropertyFetcher.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/ClassPropertyFetcher.java @@ -1,10 +1,10 @@ -/* Copyright 2004-2005 the original author or authors. +/* Copyright 2004-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -115,7 +115,7 @@ public Class getJavaClass() { */ @Deprecated public Object getReference() { - return BeanUtils.instantiate(clazz); + return BeanUtils.instantiateClass(clazz); } /** diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/EntityReflector.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/EntityReflector.java index 1e7ad0644f1..013f344c82b 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/EntityReflector.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/EntityReflector.java @@ -1,13 +1,11 @@ package org.grails.datastore.mapping.reflect; - import org.grails.datastore.mapping.model.PersistentEntity; import org.springframework.cglib.reflect.FastClass; import java.io.Serializable; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.util.List; import java.util.Map; /** diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/NameUtils.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/NameUtils.java index db2b89fc380..1a056cafe99 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/NameUtils.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/reflect/NameUtils.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -22,7 +22,6 @@ import org.codehaus.groovy.runtime.MetaClassHelper; import org.grails.datastore.mapping.model.config.GormProperties; -import org.springframework.util.CollectionUtils; /** * @author Graeme Rocher diff --git a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/validation/ValidationException.java b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/validation/ValidationException.java index 2b0170c4079..f2eee4915b2 100644 --- a/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/validation/ValidationException.java +++ b/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/validation/ValidationException.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,7 +18,6 @@ import org.codehaus.groovy.runtime.DefaultGroovyMethods; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.util.ClassUtils; -import org.springframework.util.ReflectionUtils; import org.springframework.validation.Errors; import org.springframework.validation.ObjectError; diff --git a/grails-datastore-gorm-async/build.gradle b/grails-datastore-gorm-async/build.gradle index 7ac51697263..4af98298537 100644 --- a/grails-datastore-gorm-async/build.gradle +++ b/grails-datastore-gorm-async/build.gradle @@ -7,21 +7,37 @@ version = projectVersion group = 'org.grails' dependencies { - implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - api project(":grails-datastore-gorm") - api project(":grails-datastore-async") + implementation platform("org.grails:grails-bom:$grailsVersion") - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" + api project(':grails-datastore-gorm'), { + // api: GormEntity, GormStaticApi, GormOperations, GormStaticOperations + // impl: GormEnhancer + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + //exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' // Entity + //exclude group: 'org.grails', module: 'grails-datastore-core' // DirtyCheckable + exclude group: 'org.grails', module: 'grails-datastore-gorm-validation' + //exclude group: 'org.springframework', module: 'spring-context' // Errors + exclude group: 'org.springframework', module: 'spring-jdbc' + //exclude group: 'org.springframework', module: 'spring-tx' // TransactionDefinition + } + } + api 'org.grails:grails-async', { + // api: Promise, PromiseDecorator, PromiseDecoratorProvider + // impl: Promises + } - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" + compileOnlyApi project(':grails-datastore-async'), { + // AST (source retention annotation): DelegateAsync + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-async + exclude group: 'org.grails', module: 'grails-async' + } + } - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" + compileOnly 'org.apache.groovy:groovy' } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/grails-datastore-gorm-support/build.gradle b/grails-datastore-gorm-support/build.gradle index 4949714e452..8fbad61f5e0 100644 --- a/grails-datastore-gorm-support/build.gradle +++ b/grails-datastore-gorm-support/build.gradle @@ -7,41 +7,83 @@ version = projectVersion group = 'org.grails' dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - - api project(':grails-datastore-gorm') - api "org.grails:grails-core:$grailsVersion" - api "org.grails:grails-bootstrap:$grailsVersion" - - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" - - compileOnly "org.springframework:spring-orm" - compileOnly "org.springframework:spring-webmvc" - compileOnly "org.grails:grails-web-url-mappings" - compileOnly "org.grails:grails-web-common" - compileOnly("org.hibernate:hibernate-core-jakarta:$hibernateVersion") { - exclude group:'commons-logging', module:'commons-logging' - exclude group:'commons-collections', module:'commons-collections' - exclude group:'org.slf4j', module:'slf4j-api' - exclude group:'xml-apis', module:'xml-apis' - exclude group:'dom4j', module:'dom4j' - exclude group:'antlr', module: 'antlr' + + api project(':grails-datastore-core'), { + // api: AssociationQueryExecutor, Datastore, GrailsArtefactClassInjector, ProxyFactory, ProxyHandler, Session + // impl: AstUtils, PropertySourcesConfig + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-core + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + //exclude group: 'org.javassist', module: 'javassist' // (test) + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + api project(':grails-datastore-gorm'), { + // api: AbstractDatastorePersistenceContextInterceptor + // impl: GormEntityTransformation + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + //exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' // Entity (test) + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-datastore-gorm-validation' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-jdbc' + //exclude group: 'org.springframework', module: 'spring-tx' // TransactionDefinition in GormEntity$Trait$Helper (test) + } + } + api 'org.grails:grails-core', { + // api: AstTransformer, EntityProxyHandler, PersistenceContextInterceptor + // impl: PropertySourcesConfig + if (excludeUnusedTransDeps) { + // API dependencies in grails-core + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + exclude group: 'jakarta.inject', module: 'jakarta.inject-api' + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + //exclude group: 'org.grails', module: 'grails-bootstrap' // Resource + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-spring' + exclude group: 'org.springframework', module: 'spring-beans' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + exclude group: 'org.springframework.boot', module: 'spring-boot' + exclude group: 'org.springframework.boot', module: 'spring-boot-autoconfigure' + } + } + api 'org.springframework:spring-context', { + // api: ConfigurableApplicationContext + } + api 'org.springframework:spring-core', { + // api: PropertyResolver + // impl: ConfigurableConversionService, Converter } - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" + implementation 'org.grails:grails-bootstrap', { + // impl: GrailsResourceUtils + if (excludeUnusedTransDeps) { + // API dependencies in grails-bootstrap + exclude group: 'org.yaml', module: 'snakeyaml' + } + } + + compileOnly 'org.apache.groovy:groovy', { + // comp: CompileStatic + } - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" + testImplementation 'org.spockframework:spock-core' + + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests } -project.tasks.withType(Jar) { - configure { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } +tasks.withType(Jar).configureEach { + // META-INF/grails.factories is also present in grails-core + duplicatesStrategy = DuplicatesStrategy.EXCLUDE } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/grails-datastore-gorm-tck/build.gradle b/grails-datastore-gorm-tck/build.gradle index 3cbcee1b00c..ae930e0320d 100644 --- a/grails-datastore-gorm-tck/build.gradle +++ b/grails-datastore-gorm-tck/build.gradle @@ -7,26 +7,86 @@ version = projectVersion group = 'org.grails' dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - api project(":grails-datastore-gorm-async") - api project(":grails-datastore-gorm-support") + api project(':grails-datastore-core'), { + // api: AbstractPersistenceEvent, AbstractPersistenceEventListener, AbstractQueryEvent, Datastore, + // DirtyCheckable, ProxyHandler, Session + // impl: DatastoreUtils, EventType, OneToOne, OptimisticLockingException, PersistentEntity, PostDeleteEvent, + // PostQueryEvent, PreDeleteEvent, PreInsertEvent, PreQueryEvent, PreUpdateEvent, SessionCreationEvent, + // ValidationEvent + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-core + //exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' // Entity + exclude group: 'org.javassist', module: 'javassist' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + api project(':grails-datastore-gorm'), { + // api: ApplyDetachedCriteriaTransform, DetachedCriteria, DirtyCheck, Entity + // impl: CascadingValidator, ConfigurableApplicationEventPublisher, GroovyProxyFactory, PagedResultList + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + exclude group: 'org.grails', module: 'grails-datastore-core' + //exclude group: 'org.grails', module: 'grails-datastore-gorm-validation' // CascadingValidator + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-jdbc' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + api project(':grails-datastore-gorm-async'), { + // api: AsyncEntity + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm-async + exclude group: 'org.grails', module: 'grails-datastore-gorm' + //exclude group: 'org.grails', module: 'grails-async' // PromiseDecoratorProvider + } + } + api 'org.springframework:spring-context', { + // api: ApplicationEvent, SmartApplicationListener + // impl: ApplicationEventPublisher, ConfigurableApplicationContext, Validator + } + + implementation 'org.grails:grails-core', { + // impl: ValidationException + if (excludeUnusedTransDeps) { + // API dependencies in grails-core + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + exclude group: 'jakarta.inject', module: 'jakarta.inject-api' + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + //exclude group: 'org.grails', module: 'grails-bootstrap' // Resource + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-spring' + exclude group: 'org.springframework', module: 'spring-beans' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + exclude group: 'org.springframework.boot', module: 'spring-boot' + exclude group: 'org.springframework.boot', module: 'spring-boot-autoconfigure' + } + } + implementation 'org.springframework:spring-tx', { + // impl: DataIntegrityViolationException + } + implementation 'org.spockframework:spock-core' - api "jakarta.servlet:jakarta.servlet-api" - api "org.apache.groovy:groovy-test-junit5" - api "org.junit.jupiter:junit-jupiter-api" - api "org.junit.platform:junit-platform-runner" - api "org.springframework:spring-expression" + compileOnlyApi project(':grails-datastore-gorm-support'), { + // ast transforms + } + compileOnly 'org.apache.groovy:groovy' - implementation "org.spockframework:spock-core" - runtimeOnly "org.apache.groovy:groovy-dateutil" - runtimeOnly "org.junit.jupiter:junit-jupiter-engine" + runtimeOnly 'org.apache.groovy:groovy-dateutil', { + // Groovy Date Utils Extensions are used in the tests + } } //compileGroovy.groovyOptions.fork = false //compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'] apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') -apply from: rootProject.layout.projectDirectory.file('gradle/test-config.gradle') apply from: rootProject.layout.projectDirectory.file('gradle/publish-config.gradle') diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/CriteriaBuilderSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/CriteriaBuilderSpec.groovy index 9526c304e84..41ec7136fc3 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/CriteriaBuilderSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/CriteriaBuilderSpec.groovy @@ -1,6 +1,6 @@ package grails.gorm.tests -import spock.lang.Ignore +import spock.lang.PendingFeatureIf /** * Abstract base test for criteria queries. Subclasses should do the necessary setup to configure GORM @@ -31,7 +31,13 @@ class CriteriaBuilderSpec extends GormDatastoreSpec { result == 4 } - @Ignore // ignored this test because the id() projection does not actually exist in GORM for Hibernate + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'ignored this test because the id() projection does not actually exist in GORM for Hibernate' + ) void "Test id projection"() { given: def entity = new TestEntity(name:"Bob", age: 44, child:new ChildEntity(name:"Child")).save(flush:true) diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/DomainEventsSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/DomainEventsSpec.groovy index 9daa82b0160..aac09a6fa13 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/DomainEventsSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/DomainEventsSpec.groovy @@ -4,9 +4,7 @@ import grails.gorm.DetachedCriteria import grails.persistence.Entity; import spock.lang.Issue -import org.grails.datastore.mapping.core.Session - -import spock.lang.Ignore +import spock.lang.PendingFeature /** * @author graemerocher @@ -267,7 +265,7 @@ class DomainEventsSpec extends GormDatastoreSpec { 3 == PersonEvent.STORE.afterLoad } - @Ignore + @PendingFeature(reason = 'Was previously @Ignore') void "Test bean autowiring"() { given: def personService = new Object() diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/EnumSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/EnumSpec.groovy index d3d40cf0cd2..7d890971aa5 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/EnumSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/EnumSpec.groovy @@ -2,8 +2,6 @@ package grails.gorm.tests import grails.persistence.Entity -import org.grails.datastore.mapping.core.Session -import spock.lang.IgnoreRest import spock.lang.Issue class EnumSpec extends GormDatastoreSpec { diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/FirstAndLastMethodSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/FirstAndLastMethodSpec.groovy index 5c7b044491c..57f4c39be47 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/FirstAndLastMethodSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/FirstAndLastMethodSpec.groovy @@ -2,11 +2,18 @@ package grails.gorm.tests import grails.persistence.Entity -import spock.lang.Ignore +import spock.lang.PendingFeature +import spock.lang.PendingFeatureIf -@Ignore class FirstAndLastMethodSpec extends GormDatastoreSpec { + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test first and last method with empty datastore"() { given: assert SimpleWidget.count() == 0 @@ -24,6 +31,13 @@ class FirstAndLastMethodSpec extends GormDatastoreSpec { result == null } + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test first and last method with multiple entities in the datastore"() { given: assert new SimpleWidget(name: 'one', spanishName: 'uno').save() @@ -44,6 +58,13 @@ class FirstAndLastMethodSpec extends GormDatastoreSpec { result?.name == 'three' } + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test first and last method with one entity"() { given: assert new SimpleWidget(name: 'one', spanishName: 'uno').save() @@ -62,6 +83,13 @@ class FirstAndLastMethodSpec extends GormDatastoreSpec { result?.name == 'one' } + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test first and last method with sort parameter"() { given: assert new SimpleWidget(name: 'one', spanishName: 'uno').save() @@ -118,6 +146,13 @@ class FirstAndLastMethodSpec extends GormDatastoreSpec { result?.spanishName == 'uno' } + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test first and last method with non standard identifier"() { given: ['one', 'two', 'three'].each { name -> @@ -138,6 +173,12 @@ class FirstAndLastMethodSpec extends GormDatastoreSpec { result?.name == 'three' } + @PendingFeatureIf( + value = { !( + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test first and last method with composite key"() { given: assert new PersonWithCompositeKey(firstName: 'Steve', lastName: 'Harris', age: 56).save() diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/GormEnhancerSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/GormEnhancerSpec.groovy index 56876092a5b..17a162c2ae3 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/GormEnhancerSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/GormEnhancerSpec.groovy @@ -1,6 +1,6 @@ package grails.gorm.tests -import spock.lang.Ignore +import spock.lang.PendingFeatureIf /** * @author graemerocher @@ -160,7 +160,13 @@ class GormEnhancerSpec extends GormDatastoreSpec { results.find { it.name == "Frank" } != null } - @Ignore + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test ilike query"() { given: def age = 40 diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/NamedQuerySpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/NamedQuerySpec.groovy index 7e461afd784..29e070294d7 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/NamedQuerySpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/NamedQuerySpec.groovy @@ -2,8 +2,8 @@ package grails.gorm.tests import grails.persistence.Entity -import spock.lang.Ignore -import spock.lang.IgnoreRest +import spock.lang.PendingFeature +import spock.lang.PendingFeatureIf /** * @author graemerocher @@ -425,7 +425,7 @@ class NamedQuerySpec extends GormDatastoreSpec { 'Some Recent Book' == publications[2].title } - @Ignore // queries on associations not yet supported + @PendingFeature(reason = 'queries on associations not yet supported') void "Test named query with relationships in criteria"() { given: @@ -468,7 +468,7 @@ class NamedQuerySpec extends GormDatastoreSpec { 'groovy' == results[0].name } - @Ignore // queries on associations not yet supported + @PendingFeature(reason = 'queries on associations not yet supported') void "Test list distinct entities"() { given: @@ -500,7 +500,7 @@ class NamedQuerySpec extends GormDatastoreSpec { true == 'orange' in names } - @Ignore // queries on associations not yet supported + @PendingFeature(reason = 'queries on associations not yet supported') void "Another test on listing distinct entities"() { given: new PlantCategory(name:"leafy") @@ -682,8 +682,7 @@ class NamedQuerySpec extends GormDatastoreSpec { 'Some New Book' == publications[0].title } - // findby boolean queries not yet supported - @Ignore + @PendingFeature(reason = 'findby boolean queries not yet supported') void "Test named query with findAll by boolean property"() { given: def Publication = ga.getDomainClass("Publication").clazz @@ -703,8 +702,13 @@ class NamedQuerySpec extends GormDatastoreSpec { publications[1].title == 'Some Book' } - // findby boolean queries not yet supported - @Ignore + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'findby boolean queries not yet supported' + ) void "Test named query with find by boolean property"() { given: @@ -742,7 +746,13 @@ class NamedQuerySpec extends GormDatastoreSpec { 3 == numberOfNewBooksNamedSomeBook } - @Ignore // list order by not yet supported + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'list order by not yet supported' + ) void "Test named query with listOrderBy*() dynamic finder"() { given: @@ -826,7 +836,13 @@ class NamedQuerySpec extends GormDatastoreSpec { publication == null } - @Ignore + @PendingFeatureIf( + value = { !( + System.getProperty('hibernate5.gorm.suite') || + System.getProperty('mongodb.gorm.suite') + )}, + reason = 'Was previously @Ignore' + ) void "Test count method following named criteria"() { given: diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/OneToOneSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/OneToOneSpec.groovy index 0dbf8592b24..ded301d4aba 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/OneToOneSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/OneToOneSpec.groovy @@ -2,7 +2,6 @@ package grails.gorm.tests import grails.persistence.Entity import org.grails.datastore.mapping.model.types.OneToOne -import org.grails.datastore.mapping.proxy.EntityProxy class OneToOneSpec extends GormDatastoreSpec { diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/PersistenceEventListenerSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/PersistenceEventListenerSpec.groovy index 323fa2fd131..cef3ee1ccf5 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/PersistenceEventListenerSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/PersistenceEventListenerSpec.groovy @@ -11,7 +11,6 @@ import org.grails.datastore.mapping.engine.event.PostDeleteEvent import org.grails.datastore.mapping.engine.event.PreDeleteEvent import org.grails.datastore.mapping.engine.event.ValidationEvent import org.springframework.context.ApplicationEvent -import org.springframework.context.ApplicationEventPublisher import org.springframework.context.ConfigurableApplicationContext /** diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/QueryEventsSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/QueryEventsSpec.groovy index a0d1d88a1a9..6edcfda8317 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/QueryEventsSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/QueryEventsSpec.groovy @@ -11,7 +11,11 @@ import spock.lang.Ignore /** * Tests for query events. */ -@Ignore +@Ignore(''' +Cannot invoke method addApplicationListener() on null object +java.lang.NullPointerException: Cannot invoke method addApplicationListener() on null object + at grails.gorm.tests.QueryEventsSpec.setup(QueryEventsSpec.groovy) +''') class QueryEventsSpec extends GormDatastoreSpec { SpecQueryEventListener listener diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/SessionCreationEventSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/SessionCreationEventSpec.groovy index 5cb50c64de9..53aa1dedf4e 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/SessionCreationEventSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/SessionCreationEventSpec.groovy @@ -9,7 +9,11 @@ import spock.lang.Ignore /** * Test case that session creation events are fired. */ -@Ignore +@Ignore(''' +Cannot invoke method addApplicationListener() on null object +java.lang.NullPointerException: Cannot invoke method addApplicationListener() on null object + at grails.gorm.tests.SessionCreationEventSpec.setup(SessionCreationEventSpec.groovy) +''') class SessionCreationEventSpec extends GormDatastoreSpec { Listener listener diff --git a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/UpdateWithProxyPresentSpec.groovy b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/UpdateWithProxyPresentSpec.groovy index 368c35dc04a..6f24227e2dc 100644 --- a/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/UpdateWithProxyPresentSpec.groovy +++ b/grails-datastore-gorm-tck/src/main/groovy/grails/gorm/tests/UpdateWithProxyPresentSpec.groovy @@ -5,7 +5,6 @@ import grails.gorm.async.AsyncEntity import grails.gorm.dirty.checking.DirtyCheck import grails.persistence.Entity import groovy.transform.EqualsAndHashCode -import org.grails.datastore.gorm.proxy.GroovyProxyFactory import org.grails.datastore.gorm.query.transform.ApplyDetachedCriteriaTransform /** diff --git a/grails-datastore-gorm-test/build.gradle b/grails-datastore-gorm-test/build.gradle index 314e036dc7b..1b26edd4bf0 100644 --- a/grails-datastore-gorm-test/build.gradle +++ b/grails-datastore-gorm-test/build.gradle @@ -7,29 +7,90 @@ version = projectVersion group = 'org.grails' dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - api project(":grails-datastore-gorm") - api project(":grails-datastore-core") + api project(':grails-datastore-core'), { + // api: AbstractDatastore, AbstractKeyValueEntityPersister, AbstractSession, AssociationIndexer, + // ConfigurationException, ConnectionSourceSettings, ConnectionSources, ConnectionSourcesProvider, + // Datastore, EntityAccess, IdentityGenerationException, InMemoryConnectionSources, KeyValueMappingContext, + // MappingContext, MultipleConnectionSourceCapableDatastore, MultiTenancySettings, + // OptimisticLockingException, Persister, Property, PropertyValueIndexer, SchemaMultiTenantCapableDatastore, + // Session, TenantResolver, Transaction, TransactionCapableDatastore + // impl: DatastoreTransactionManager, DatastoreUtils, EntityPersister, PersistentEntity, Settings + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-core + //exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' // JoinType + //exclude group: 'org.javassist', module: 'javassist' // activate JavassistProxyFactory + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + api project(':grails-datastore-gorm'), { + // api: ConfigurableApplicationEventPublisher, GormEnhancer, GormInstanceApi, GormStaticApi, GormValidationApi + // impl: MultiTenantEventListener, ClasspathEntityScanner + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm + //exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' // PostConstruct + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-datastore-gorm-validation' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-jdbc' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + api 'org.springframework:spring-context', { + // api: ApplicationEventPublisher, ConfigurableApplicationContext + } + api 'org.springframework:spring-core', { + // api: PropertyResolver + } + api 'org.springframework:spring-tx', { + // api: PlatformTransactionManager + } + + compileOnly 'org.apache.groovy:groovy', { + // comp: CompileStatic + } - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" + testImplementation 'org.apache.groovy:groovy-json', { + // impl: DefaultJsonGenerator, JsonGenerator + } + testImplementation 'org.junit.platform:junit-platform-suite', { + // api: SelectClasses, Suite + } + testImplementation project(':grails-datastore-gorm-tck') +/* + testCompileOnly 'org.grails:grails-core', { + // api: Entity + // impl: ValidationException + if (excludeUnusedTransDeps) { + // API dependencies in grails-core + //exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' // PostConstruct + exclude group: 'jakarta.inject', module: 'jakarta.inject-api' + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + //exclude group: 'org.grails', module: 'grails-bootstrap' // Resource + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-spring' + exclude group: 'org.springframework', module: 'spring-beans' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + exclude group: 'org.springframework.boot', module: 'spring-boot' + exclude group: 'org.springframework.boot', module: 'spring-boot-autoconfigure' + } + } +*/ + testImplementation 'org.spockframework:spock-core' - implementation "com.github.ben-manes.caffeine:caffeine" // Commented out since we aren't building / publishing //testImplementation project(":grails-datastore-gorm-rx") - testImplementation project(":grails-datastore-gorm-tck") - testImplementation "org.apache.groovy:groovy-json" - testRuntimeOnly "org.springframework:spring-aop" - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" - - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" -} + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests + } //compileTestGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'] diff --git a/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/ReadOnlyCriteriaSpec.groovy b/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/ReadOnlyCriteriaSpec.groovy index 23c37ff4d1c..bb78d7f27a1 100644 --- a/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/ReadOnlyCriteriaSpec.groovy +++ b/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/ReadOnlyCriteriaSpec.groovy @@ -1,6 +1,5 @@ package grails.gorm.tests -import grails.gorm.tests.GormDatastoreSpec import spock.lang.Issue class ReadOnlyCriteriaSpec extends GormDatastoreSpec { diff --git a/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/WhereMethodSpec.groovy b/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/WhereMethodSpec.groovy index 71356baa666..b8ea0756967 100644 --- a/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/WhereMethodSpec.groovy +++ b/grails-datastore-gorm-test/src/test/groovy/grails/gorm/tests/WhereMethodSpec.groovy @@ -1195,7 +1195,6 @@ class Project { } - @Ignore // rlike not suppported by all datastores yet def "Test rlike query"() { given:"A bunch of people" createPeople() diff --git a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CompositeIdentifierSpec.groovy b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CompositeIdentifierSpec.groovy index 0cfd7d5fb6d..d42f68a7d82 100644 --- a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CompositeIdentifierSpec.groovy +++ b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CompositeIdentifierSpec.groovy @@ -3,14 +3,14 @@ package org.grails.datastore.gorm import grails.gorm.tests.GormDatastoreSpec import grails.persistence.Entity -import spock.lang.Ignore +import spock.lang.PendingFeature /** * TODO: Support composite ids */ -@Ignore class CompositeIdentifierSpec extends GormDatastoreSpec { + @PendingFeature(reason = 'Composite ids not supported') void "Test that a composite identifier is treated as assigned"() { given:"A domain model with a composite identifier" def u = new User(name: "Bob").save() diff --git a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomTypeMarshallingSpec.groovy b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomTypeMarshallingSpec.groovy index 85626710217..7977ab94a01 100644 --- a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomTypeMarshallingSpec.groovy +++ b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/CustomTypeMarshallingSpec.groovy @@ -2,8 +2,8 @@ package org.grails.datastore.gorm import grails.gorm.tests.GormDatastoreSpec import grails.persistence.Entity -import spock.lang.Ignore import spock.lang.Issue +import spock.lang.PendingFeature import spock.lang.Shared class CustomTypeMarshallingSpec extends GormDatastoreSpec { @@ -50,7 +50,7 @@ class CustomTypeMarshallingSpec extends GormDatastoreSpec { } @Issue("http://jira.grails.org/browse/GRAILS-8436") - @Ignore + @PendingFeature(reason = 'Was previously @Ignore') void "can re-save an existing instance without modifications"() { given: def p = Person.findByName("Fred") diff --git a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/HasManyDefaultMappedBySpec.groovy b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/HasManyDefaultMappedBySpec.groovy index aa35200d043..22010fe343c 100644 --- a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/HasManyDefaultMappedBySpec.groovy +++ b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/HasManyDefaultMappedBySpec.groovy @@ -5,11 +5,8 @@ import grails.persistence.Entity import org.grails.datastore.mapping.model.types.Association -import spock.lang.Ignore - class HasManyDefaultMappedBySpec extends GormDatastoreSpec { - @Ignore void "Test that has-many with multiple potential matches for the other side matches correctly"() { when:"A has many with multiple potential matching sides is retrieved" diff --git a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/SimpleMapTestSuite.groovy b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/SimpleMapTestSuite.groovy index b9413e42afd..bc9be03f9c4 100644 --- a/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/SimpleMapTestSuite.groovy +++ b/grails-datastore-gorm-test/src/test/groovy/org/grails/datastore/gorm/SimpleMapTestSuite.groovy @@ -1,15 +1,13 @@ package org.grails.datastore.gorm import grails.gorm.tests.NotInListSpec -import org.junit.platform.runner.JUnitPlatform import org.junit.platform.suite.api.SelectClasses -import org.junit.runner.RunWith +import org.junit.platform.suite.api.Suite /** * @author graemerocher */ -//TODO: Replace with JUnit5 declarative test suites once https://github.com/junit-team/junit5/issues/744 is resolved -@RunWith(JUnitPlatform) +@Suite @SelectClasses([NotInListSpec]) class SimpleMapTestSuite { } diff --git a/grails-datastore-gorm-validation/build.gradle b/grails-datastore-gorm-validation/build.gradle index 4443bd18374..6ef34b29451 100644 --- a/grails-datastore-gorm-validation/build.gradle +++ b/grails-datastore-gorm-validation/build.gradle @@ -7,29 +7,50 @@ version = projectVersion group = 'org.grails' dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" + api project(':grails-datastore-core'), { + // api: MappingContext, PersistentProperty + // impl: ClassPropertyFetcher, ClassUtils, PersistentEntity, GormProperties, Property, KeyValueMappingContext, + // PersistentEntity, GormProperties, Identity, ToOne + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-core + //exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' // FetchType + //exclude group: 'org.javassist', module: 'javassist' // MethodHandler (in tests) + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + } + } - api project(":grails-datastore-core") - api "commons-validator:commons-validator:$commonsValidatorVersion", { + api "commons-validator:commons-validator:$commonsValidatorVersion", { // Candidate for grails-bom? exclude group: 'xml-apis', module:'xml-apis' exclude group: 'commons-digester', module:'commons-digester' exclude group: 'commons-logging', module:'commons-logging' exclude group: 'commons-beanutils', module:'commons-beanutils' } + api 'org.springframework:spring-context' + // api: Errors, MessageSource, Validator + // impl: BindingResult, FieldError, LocaleContextHolder + + implementation 'org.slf4j:jcl-over-slf4j' + // impl: Log, LogFactory + + implementation 'org.springframework:spring-beans' + // impl: BeanWrapper, BeanWrapperImpl, InvalidPropertyException + + implementation 'org.springframework:spring-core' + // impl: ReflectionUtils, ToStringCreator, Assert, StringUtils - compileOnly("org.hibernate.validator:hibernate-validator") - testImplementation("org.hibernate.validator:hibernate-validator") + compileOnly 'org.apache.groovy:groovy' + compileOnly 'org.slf4j:slf4j-api' // provided + // impl: Logger, LoggerFactory - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" + testImplementation 'org.spockframework:spock-core' - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/grails-datastore-gorm-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/builder/ConstrainedPropertyBuilder.java b/grails-datastore-gorm-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/builder/ConstrainedPropertyBuilder.java index 0e591c46ad2..dac82dfcccc 100644 --- a/grails-datastore-gorm-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/builder/ConstrainedPropertyBuilder.java +++ b/grails-datastore-gorm-validation/src/main/groovy/org/grails/datastore/gorm/validation/constraints/builder/ConstrainedPropertyBuilder.java @@ -17,7 +17,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.InvalidPropertyException; -import java.beans.PropertyDescriptor; import java.lang.reflect.Modifier; import java.util.*; diff --git a/grails-datastore-gorm/build.gradle b/grails-datastore-gorm/build.gradle index 06584ae9da9..e7732a0b62a 100644 --- a/grails-datastore-gorm/build.gradle +++ b/grails-datastore-gorm/build.gradle @@ -7,35 +7,98 @@ version = projectVersion group = 'org.grails' dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" - - api project(":grails-datastore-core") - api project(":grails-datastore-gorm-validation") - - implementation "org.slf4j:slf4j-api" - - // :grails-datastore-gorm:compileGroovy requires jakarta.el.ExpressionFactory - // required by gorm-hibernate5 test compilation - compileOnlyApi("jakarta.el:jakarta.el-api:$jakartaElVersion") - runtimeOnly "org.glassfish:jakarta.el:$jakartaElGlassfishImplVersion" - - compileOnly("org.hibernate.validator:hibernate-validator") - compileOnly("org.springframework:spring-jdbc") - compileOnly("org.springframework:spring-web") - testImplementation("org.springframework:spring-jdbc") - testImplementation("org.hibernate.validator:hibernate-validator") - testRuntimeOnly("com.h2database:h2") - - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" - - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" + + api project(':grails-datastore-core'), { + // api: BuildableCriteria, ConnectionSourcesProvider, Criteria, Datastore, MappingContext, PersistentEntity, + // ProjectionList, Query, QueryableCriteria, QueryCreator, Session, SessionCallback, ValidatorRegistry, + // VoidSessionCallback + // impl: Association, AssociationQuery, Basic, ClassUtils, Connection, ConnectionSource, DatastoreUtils, + // NameUtils, PersistentProperty, Restrictions, QueryArgumentsAware + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-core + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + //exclude group: 'org.javassist', module: 'javassist' // activate JavassistProxyFactory + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + api project(':grails-datastore-gorm-validation'), { + // api: BeforeValidateHelper, CascadingValidator, DefaultValidatorRegistry + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm-validation + exclude group: 'commons-validator', module: 'commons-validator' + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.springframework', module: 'spring-context' + } + } + api 'jakarta.annotation:jakarta.annotation-api', { + // api: PostConstruct, PreDestroy + } + api 'jakarta.persistence:jakarta.persistence-api', { + // api: FetchType, JoinType + } + api 'org.grails:grails-core', { + // ast: grails.persistence.Entity + if (excludeUnusedTransDeps) { + // API dependencies in grails-core + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + exclude group: 'jakarta.inject', module: 'jakarta.inject-api' + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + //exclude group: 'org.grails', module: 'grails-bootstrap' // Resource + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-spring' + exclude group: 'org.springframework', module: 'spring-beans' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + exclude group: 'org.springframework.boot', module: 'spring-boot' + exclude group: 'org.springframework.boot', module: 'spring-boot-autoconfigure' + } + } + api 'org.springframework:spring-context', { + // api: Validator + } + api 'org.springframework:spring-jdbc', { + // api: DriverManagerDataSource + // impl: DelegatingDataSource, TransactionAwareDataSourceProxy + } + api 'org.springframework:spring-tx', { + // api: Isolation, PlatformTransactionManager, Propagation, TransactionAttribute, TransactionDefinition, + // TransactionException + // impl: DataIntegrityViolationException, DefaultTransactionDefinition, LazyConnectionDataSourceProxy, + // NoRollbackRuleAttribute, RollbackRuleAttribute, TransactionCallback, TransactionDefinition, + // TransactionStatus, TransactionSynchronizationManager, TransactionSystemException + } + + implementation 'org.apache.groovy:groovy', { + // impl: Closure, ClosureExpression, DelegatesTo, GroovyASTTransformationClass + // comp: CompileDynamic, CompileStatic + } + implementation 'org.hibernate.validator:hibernate-validator', { + // impl: ResourceBundleMessageInterpolator + } + + compileOnlyApi "jakarta.el:jakarta.el-api:$jakartaElVersion" + + runtimeOnly "org.glassfish:jakarta.el:$jakartaElGlassfishImplVersion", { + // Note: Default EL implementation included for convenience, + // can be replaced by downstream consumers + } + + compileOnly 'org.slf4j:slf4j-api' + + testImplementation 'org.grails:grails-core', { + // impl: ValidationException + } + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.spockframework:spock-core' + + testRuntimeOnly 'com.h2database:h2' + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests } //compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'] diff --git a/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/CurrentTenant.java b/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/CurrentTenant.java index 5217cbeba1a..a05b3a4ba49 100644 --- a/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/CurrentTenant.java +++ b/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/CurrentTenant.java @@ -1,11 +1,11 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,7 +16,6 @@ package grails.gorm.multitenancy; import org.codehaus.groovy.transform.GroovyASTTransformationClass; -import org.grails.datastore.gorm.multitenancy.transform.TenantTransform; import org.grails.datastore.gorm.transform.GormASTTransformationClass; import org.grails.datastore.mapping.core.connections.ConnectionSourcesProvider; diff --git a/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/Tenant.java b/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/Tenant.java index 8cc1c040cc4..8f471702dca 100644 --- a/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/Tenant.java +++ b/grails-datastore-gorm/src/main/groovy/grails/gorm/multitenancy/Tenant.java @@ -1,11 +1,11 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -15,7 +15,6 @@ */ package grails.gorm.multitenancy; -import org.codehaus.groovy.transform.GroovyASTTransformation; import org.codehaus.groovy.transform.GroovyASTTransformationClass; import org.grails.datastore.gorm.transform.GormASTTransformationClass; import org.grails.datastore.mapping.core.connections.ConnectionSourcesProvider; diff --git a/grails-datastore-gorm/src/main/groovy/grails/gorm/transactions/Transactional.java b/grails-datastore-gorm/src/main/groovy/grails/gorm/transactions/Transactional.java index d658898cef1..00d0ca5c9b1 100644 --- a/grails-datastore-gorm/src/main/groovy/grails/gorm/transactions/Transactional.java +++ b/grails-datastore-gorm/src/main/groovy/grails/gorm/transactions/Transactional.java @@ -1,11 +1,11 @@ /* - * Copyright 2017 the original author or authors. + * Copyright 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,9 +16,7 @@ package grails.gorm.transactions; import org.codehaus.groovy.transform.GroovyASTTransformationClass; -import org.grails.datastore.gorm.transactions.transform.TransactionalTransform; import org.grails.datastore.gorm.transform.GormASTTransformationClass; -import org.grails.datastore.mapping.core.Datastore; import org.grails.datastore.mapping.core.connections.ConnectionSource; import org.grails.datastore.mapping.core.connections.ConnectionSourcesProvider; import org.springframework.transaction.TransactionDefinition; diff --git a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormEnhancer.groovy b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormEnhancer.groovy index 5e3691a3c4a..9adea3a65e4 100644 --- a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormEnhancer.groovy +++ b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/GormEnhancer.groovy @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -38,8 +38,6 @@ import org.grails.datastore.mapping.model.PersistentEntity import org.grails.datastore.mapping.model.config.GormProperties import org.grails.datastore.mapping.multitenancy.MultiTenancySettings import org.grails.datastore.mapping.multitenancy.MultiTenantCapableDatastore -import org.grails.datastore.mapping.multitenancy.TenantResolver -import org.grails.datastore.mapping.multitenancy.resolvers.FixedTenantResolver import org.grails.datastore.mapping.reflect.ClassPropertyFetcher import org.grails.datastore.mapping.reflect.ClassUtils import org.grails.datastore.mapping.reflect.MetaClassUtils diff --git a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/AbstractFindByFinder.java b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/AbstractFindByFinder.java index d1cb65c87d4..e765873831e 100644 --- a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/AbstractFindByFinder.java +++ b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/AbstractFindByFinder.java @@ -1,6 +1,5 @@ package org.grails.datastore.gorm.finders; -import java.util.List; import java.util.regex.Pattern; import org.grails.datastore.mapping.core.Datastore; diff --git a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/DynamicFinder.java b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/DynamicFinder.java index b5f976975cb..17bd93ca0bf 100644 --- a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/DynamicFinder.java +++ b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/DynamicFinder.java @@ -1,10 +1,10 @@ -/* Copyright (C) 2010 SpringSource +/* Copyright (C) 2010-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -19,7 +19,6 @@ import groovy.lang.MissingMethodException; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -57,7 +56,6 @@ import org.grails.datastore.mapping.reflect.NameUtils; import org.springframework.core.convert.ConversionException; import org.springframework.core.convert.ConversionService; -import org.springframework.util.ReflectionUtils; import org.springframework.util.StringUtils; /** * Abstract base class for dynamic finders. diff --git a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/multitenancy/MultiTenantEventListener.java b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/multitenancy/MultiTenantEventListener.java index 72f508c515d..54635bfedae 100644 --- a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/multitenancy/MultiTenantEventListener.java +++ b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/multitenancy/MultiTenantEventListener.java @@ -10,9 +10,7 @@ import org.grails.datastore.mapping.multitenancy.MultiTenantCapableDatastore; import org.grails.datastore.mapping.multitenancy.exceptions.TenantException; import org.grails.datastore.mapping.query.Query; -import org.grails.datastore.mapping.query.event.PostQueryEvent; import org.grails.datastore.mapping.query.event.PreQueryEvent; -import org.grails.datastore.mapping.reflect.EntityReflector; import org.springframework.context.ApplicationEvent; import java.io.Serializable; diff --git a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/transactions/transform/TransactionalTransform.groovy b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/transactions/transform/TransactionalTransform.groovy index 26e789aa26d..4a0b5a0f1e9 100644 --- a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/transactions/transform/TransactionalTransform.groovy +++ b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/transactions/transform/TransactionalTransform.groovy @@ -1,10 +1,10 @@ -/* Copyright (C) 2017 original authors +/* Copyright (C) 2017-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -33,7 +33,6 @@ import org.grails.datastore.gorm.transform.AbstractDatastoreMethodDecoratingTran import org.grails.datastore.mapping.core.Ordered import org.grails.datastore.mapping.core.connections.MultipleConnectionSourceCapableDatastore import org.grails.datastore.mapping.multitenancy.MultiTenantCapableDatastore -import org.grails.datastore.mapping.reflect.AstUtils import org.grails.datastore.mapping.transactions.CustomizableRollbackTransactionAttribute import org.grails.datastore.mapping.transactions.TransactionCapableDatastore import org.springframework.transaction.PlatformTransactionManager diff --git a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/utils/AbstractRecursiveAnnotationVisitor.java b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/utils/AbstractRecursiveAnnotationVisitor.java index a372208261a..6a034751de6 100644 --- a/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/utils/AbstractRecursiveAnnotationVisitor.java +++ b/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/utils/AbstractRecursiveAnnotationVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import org.springframework.util.ReflectionUtils; import java.lang.reflect.Field; -import java.security.AccessControlException; /** * {@link AnnotationVisitor} to recursively visit annotations. @@ -98,7 +97,7 @@ protected Object getEnumValue(String asmTypeDescriptor, String attributeValue) { catch (ClassNotFoundException | NoClassDefFoundError ex) { logger.debug("Failed to classload enum type while reading annotation metadata", ex); } - catch (IllegalAccessException | AccessControlException ex) { + catch (IllegalAccessException | SecurityException ex) { logger.debug("Could not access enum value while reading annotation metadata", ex); } return valueToUse; diff --git a/grails-datastore-gorm/src/test/groovy/grails/gorm/annotation/transactions/TransactionalTransformSpec.groovy b/grails-datastore-gorm/src/test/groovy/grails/gorm/annotation/transactions/TransactionalTransformSpec.groovy index 40baf5fd788..f6d14eba0fe 100644 --- a/grails-datastore-gorm/src/test/groovy/grails/gorm/annotation/transactions/TransactionalTransformSpec.groovy +++ b/grails-datastore-gorm/src/test/groovy/grails/gorm/annotation/transactions/TransactionalTransformSpec.groovy @@ -19,7 +19,6 @@ import org.springframework.util.ReflectionUtils import spock.lang.Issue import spock.lang.Specification -import jakarta.annotation.PostConstruct import javax.sql.DataSource /** */ @@ -1047,11 +1046,6 @@ class TransactionalTransformSpecService implements InitializingBean { return TransactionSynchronizationManager.isActualTransactionActive() } - @PostConstruct - public void init() { - - } - @Override public void afterPropertiesSet() throws Exception { assert !TransactionSynchronizationManager.isActualTransactionActive() diff --git a/grails-datastore-gorm/src/test/groovy/org/grails/datastore/gorm/dirty/checking/DirtyCheckTransformationSpec.groovy b/grails-datastore-gorm/src/test/groovy/org/grails/datastore/gorm/dirty/checking/DirtyCheckTransformationSpec.groovy index 316fd823def..86fb85041d5 100644 --- a/grails-datastore-gorm/src/test/groovy/org/grails/datastore/gorm/dirty/checking/DirtyCheckTransformationSpec.groovy +++ b/grails-datastore-gorm/src/test/groovy/org/grails/datastore/gorm/dirty/checking/DirtyCheckTransformationSpec.groovy @@ -3,7 +3,7 @@ package org.grails.datastore.gorm.dirty.checking import grails.gorm.annotation.Entity import grails.gorm.dirty.checking.DirtyCheck import org.grails.datastore.mapping.dirty.checking.DirtyCheckable -import spock.lang.Ignore +import spock.lang.PendingFeature import spock.lang.Specification import spock.lang.Issue @@ -351,7 +351,7 @@ class FundProduct { book.getOriginalValue('title') == 'The Stand' } - @Ignore // currently fails, TODO: add support for dirty checking collection/map changes + @PendingFeature(reason = 'currently fails, TODO: add support for dirty checking collection/map changes') void "Test that you can dirty check changes to simple collections"() { given: "A new book is created" def book = new Book() diff --git a/grails-datastore-web/build.gradle b/grails-datastore-web/build.gradle index c605049c081..ee9e4c32f63 100644 --- a/grails-datastore-web/build.gradle +++ b/grails-datastore-web/build.gradle @@ -7,26 +7,52 @@ version = projectVersion group = 'org.grails' dependencies { - implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - - api "jakarta.annotation:jakarta.annotation-api" - implementation "jakarta.validation:jakarta.validation-api" - - api project(":grails-datastore-core") - api "org.springframework:spring-web" - api "org.springframework:spring-context" - compileOnly "jakarta.servlet:jakarta.servlet-api" - testImplementation "jakarta.servlet:jakarta.servlet-api" - testImplementation "org.springframework:spring-test" - - testImplementation "org.apache.groovy:groovy-test-junit5" - testImplementation "org.junit.jupiter:junit-jupiter-engine" - testImplementation "org.junit.platform:junit-platform-runner" + implementation platform("org.grails:grails-bom:$grailsVersion") - testImplementation "org.junit.jupiter:junit-jupiter-api" - testImplementation "org.spockframework:spock-core" + api project(':grails-datastore-core'), { + // api: Datastore + // impl: DatastoreUtils, Session, SessionHolder + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-core + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + exclude group: 'org.javassist', module: 'javassist' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + // exclude group: 'org.springframework', module: 'spring-tx' // ResourceHolderSupport + } + } + api 'org.springframework:spring-context', { + // api: ModelMap + } + api 'org.springframework:spring-web', { + // api: WebRequest, WebRequestInterceptor + } + implementation 'org.springframework:spring-tx', { + // impl: TransactionSynchronizationManager + } + + compileOnlyApi 'jakarta.persistence:jakarta.persistence-api', { + // compApi: FlushModeType + } + + compileOnly 'jakarta.servlet:jakarta.servlet-api', { + // comp: Cookie, HttpServletRequest + } + compileOnly 'org.apache.groovy:groovy', { + // comp: CompileStatic + } + + testImplementation 'jakarta.servlet:jakarta.servlet-api', { + // impl: Cookie + } + testImplementation 'org.springframework:spring-test', { + // impl: MockHttpServletRequest + } + testImplementation 'org.spockframework:spock-core' + + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + testRuntimeOnly 'org.slf4j:slf4j-nop' // Get rid of warning about missing slf4j implementation during tests } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/grails-gorm-testing-support/build.gradle b/grails-gorm-testing-support/build.gradle index 46854a69861..fdd57f9e838 100755 --- a/grails-gorm-testing-support/build.gradle +++ b/grails-gorm-testing-support/build.gradle @@ -9,20 +9,110 @@ group = 'org.grails' ext { pomTitle = 'Grails Web Testing Support' pomDescription = 'Support for writing concise expressive tests for Grails Web Artifacts' - pomDevelopers = [ - [id: 'jeffscottbrown', name: 'Jeff Brown'], - [id: 'jameskleeh', name: 'James Kleeh'] - ] + pomDevelopers = ['jeffscottbrown': 'Jeff Brown', 'jameskleeh': 'James Kleeh'] } dependencies { + implementation platform("org.grails:grails-bom:$grailsVersion") - implementation 'org.apache.groovy:groovy' - api 'org.grails:grails-plugin-domain-class' - api project(':grails-datastore-gorm-test') + api project(':grails-datastore-core'), { + // api: AbstractDatastore, PersistentEntity, Session + // impl: DatastoreUtils, Initializable, MappingContext, Settings, Service + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-core + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + exclude group: 'org.javassist', module: 'javassist' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + api project(':grails-datastore-gorm-validation'), { + // api: CascadingValidator, ConstraintsEvaluator, PersistentEntityValidator + // impl: ConstraintRegistry, DefaultConstraintEvaluator, DefaultConstraintRegistry, PersistentEntityValidator + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm-validation + exclude group: 'commons-validator', module: 'commons-validator' + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.springframework', module: 'spring-context' + } + } + api 'org.grails:grails-testing-support', { + // api: GrailsUnitTest + if (excludeUnusedTransDeps) { + // API dependencies in grails-testing-support + exclude group: 'org.springframework', module: 'spring-test' + exclude group: 'org.grails', module: 'grails-plugin-codecs' + exclude group: 'org.grails', module: 'grails-plugin-databinding' + exclude group: 'org.grails', module: 'grails-datastore-gorm' + exclude group: 'org.grails', module: 'grails-test' + exclude group: 'org.springframework.boot', module: 'spring-boot-test' + exclude group: 'org.spockframework', module: 'spock-spring' + exclude group: 'org.spockframework', module: 'spock-core' + exclude group: 'org.apache.groovy', module: 'groovy-test-junit5' + exclude group: 'org.junit.jupiter', module: 'junit-jupiter-api' + exclude group: 'org.junit.platform', module: 'junit-platform-runner' + } + } + api 'org.springframework:spring-context', { + // api: MessageSource + // impl: ConfigurableApplicationContext, ConfigurableConversionService, Validator + } + api 'org.springframework:spring-tx', { + // api: PlatformTransactionManager + } + api 'org.spockframework:spock-core', { + // api: IGlobalExtension, IMethodInterceptor, IMethodInvocation + // impl: Converter + } + + implementation project(':grails-datastore-gorm'), { + // impl: GormEnhancer, UniqueConstraint + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + //exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' // Entity + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-datastore-gorm-validation' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-jdbc' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + implementation project(':grails-datastore-gorm-test'), { + // impl: SimpleMapDatastore + if (excludeUnusedTransDeps) { + // API dependencies in grails-datastore-gorm-test + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-datastore-gorm' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + } + } + implementation 'org.grails:grails-core', { + // impl: ConstraintEvalUtils, DomainClassArtefactHandler, GrailsClass + if (excludeUnusedTransDeps) { + // API dependencies in grails-core + exclude group: 'jakarta.annotation', module: 'jakarta.annotation-api' + exclude group: 'jakarta.inject', module: 'jakarta.inject-api' + exclude group: 'jakarta.persistence', module: 'jakarta.persistence-api' + //exclude group: 'org.grails', module: 'grails-bootstrap' // Resource + exclude group: 'org.grails', module: 'grails-datastore-core' + exclude group: 'org.grails', module: 'grails-spring' + exclude group: 'org.springframework', module: 'spring-beans' + exclude group: 'org.springframework', module: 'spring-context' + exclude group: 'org.springframework', module: 'spring-core' + exclude group: 'org.springframework', module: 'spring-tx' + exclude group: 'org.springframework.boot', module: 'spring-boot' + exclude group: 'org.springframework.boot', module: 'spring-boot-autoconfigure' + } + } - api 'org.grails:grails-testing-support' + compileOnly 'org.apache.groovy:groovy', { + // comp: CompileStatic, CompileDynamic, TypeCheckingMode + } } apply from: rootProject.layout.projectDirectory.file('gradle/java-config.gradle') diff --git a/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/DataTestSetupSpecInterceptor.groovy b/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/DataTestSetupSpecInterceptor.groovy index c233453295d..ecce8d53e0e 100644 --- a/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/DataTestSetupSpecInterceptor.groovy +++ b/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/DataTestSetupSpecInterceptor.groovy @@ -9,7 +9,6 @@ import org.grails.datastore.gorm.validation.constraints.registry.ConstraintRegis import org.grails.datastore.gorm.validation.constraints.registry.DefaultConstraintRegistry import org.grails.datastore.mapping.core.DatastoreUtils import org.grails.datastore.mapping.model.MappingContext -import org.grails.datastore.mapping.reflect.ClassUtils import org.grails.datastore.mapping.simple.SimpleMapDatastore import org.grails.datastore.mapping.transactions.DatastoreTransactionManager import org.grails.validation.ConstraintEvalUtils diff --git a/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/GormTestingSupportExtension.groovy b/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/GormTestingSupportExtension.groovy index e77eabdb365..f08a29da08e 100644 --- a/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/GormTestingSupportExtension.groovy +++ b/grails-gorm-testing-support/src/main/groovy/org/grails/testing/gorm/spock/GormTestingSupportExtension.groovy @@ -2,11 +2,11 @@ package org.grails.testing.gorm.spock import grails.testing.gorm.DataTest import groovy.transform.CompileStatic -import org.spockframework.runtime.extension.AbstractGlobalExtension +import org.spockframework.runtime.extension.IGlobalExtension import org.spockframework.runtime.model.SpecInfo @CompileStatic -class GormTestingSupportExtension extends AbstractGlobalExtension { +class GormTestingSupportExtension implements IGlobalExtension { DataTestSetupSpecInterceptor dataTestSetupSpecInterceptor = new DataTestSetupSpecInterceptor() DataTestSetupInterceptor dataTestSetupInterceptor = new DataTestSetupInterceptor() diff --git a/settings.gradle b/settings.gradle index 559f25deee5..0c9db875daf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ plugins { - id 'com.gradle.develocity' version '3.19' - id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.0.2' + id 'com.gradle.develocity' version '3.19.1' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '2.1' } def isCI = System.getenv('CI') != null @@ -11,7 +11,7 @@ develocity { server = 'https://ge.grails.org' buildScan { tag('grails') - tag('grails-gsp') + tag('grails-data-mapping') publishing.onlyIf { isAuthenticated } uploadInBackground = isLocal } @@ -27,22 +27,26 @@ buildCache { rootProject.name = 'grails-data-mapping' -include ("grails-datastore-core", - "grails-datastore-web", +include( + 'grails-datastore-core', + 'grails-datastore-web', - // Core GORM Implementation projects - 'grails-datastore-gorm', - 'grails-datastore-async', - 'grails-datastore-gorm-async', - 'grails-datastore-gorm-validation', - 'grails-datastore-gorm-support', - 'grails-datastore-gorm-tck', - 'grails-datastore-gorm-test', + // Core GORM Implementation projects + 'grails-datastore-gorm', + 'grails-datastore-async', + 'grails-datastore-gorm-async', + 'grails-datastore-gorm-validation', + 'grails-datastore-gorm-support', + 'grails-datastore-gorm-tck', + 'grails-datastore-gorm-test', - // RX projects - // until this can be finished ported to grails 7, we are disabling - //'grails-datastore-gorm-rx', + // RX projects + // until this can be finished ported to grails 7, we are disabling + //'grails-datastore-gorm-rx', - // Testing Support - 'grails-gorm-testing-support' + // Testing Support + 'grails-gorm-testing-support', + + // Test Report + 'test-report' ) diff --git a/test-report/build.gradle b/test-report/build.gradle new file mode 100644 index 00000000000..20cac9237b6 --- /dev/null +++ b/test-report/build.gradle @@ -0,0 +1,27 @@ +plugins { + id 'java' + id 'test-report-aggregation' +} + +dependencies { + testReportAggregation project(':grails-datastore-async') + testReportAggregation project(':grails-datastore-core') + testReportAggregation project(':grails-datastore-gorm') + testReportAggregation project(':grails-datastore-gorm-async') + testReportAggregation project(':grails-datastore-gorm-support') + testReportAggregation project(':grails-datastore-gorm-test') + testReportAggregation project(':grails-datastore-gorm-validation') + testReportAggregation project(':grails-datastore-web') +} + +reporting { + reports { + testAggregateTestReport(AggregateTestReport) { + testType = TestSuiteType.UNIT_TEST + } + } +} + +tasks.named('check') { + dependsOn tasks.named('testAggregateTestReport', TestReport) +}