You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by bo...@apache.org on 2026/03/31 18:28:23 UTC
(grails-core) branch 8.0.x-hibernate7 updated: linting
This is an automated email from the ASF dual-hosted git repository.
borinquenkid pushed a commit to branch 8.0.x-hibernate7
in repository https://gitbox.apache.org/repos/asf/grails-core.git
The following commit(s) were added to refs/heads/8.0.x-hibernate7 by this push:
new ac62344e16 linting
ac62344e16 is described below
commit ac62344e1634e7112092e43f663e69020b06f351
Author: Walter Duque de Estrada <wb...@mac.com>
AuthorDate: Tue Mar 31 13:27:47 2026 -0500
linting
---
BRANCHES.md | 255 ---------------------
build-logic/plugins/build.gradle | 7 +
.../grails/buildsrc/GrailsCodeStylePlugin.groovy | 57 +++++
.../buildsrc/GrailsCodeStylePluginSpec.groovy | 87 +++++++
fix_codenarc.py | 79 -------
gradle/grails-extension-gradle-config.gradle | 7 +
gradle/publish-root-config.gradle | 2 +-
gradle/rat-root-config.gradle | 27 +--
.../orm/hibernate/proxy/HibernateProxyHandler.java | 26 +--
.../grails/orm/hibernate/HibernateDatastore.java | 34 ++-
grails-data-hibernate7/dbmigration/build.gradle | 13 +-
.../database/HibernateClassicDatabase.java | 4 +-
.../ext/hibernate/database/HibernateDatabase.java | 44 ++--
.../database/HibernateSpringBeanDatabase.java | 6 +-
.../database/HibernateSpringPackageDatabase.java | 2 +-
.../hibernate/database/NoOpConnectionProvider.java | 2 +-
.../NoOpMultiTenantConnectionProvider.java | 2 +-
.../database/connection/HibernateConnection.java | 14 +-
.../connection/HibernateConnectionMetadata.java | 5 +-
.../database/connection/HibernateDriver.java | 11 +-
.../snapshot/ColumnSnapshotGenerator.java | 9 +-
.../snapshot/ForeignKeySnapshotGenerator.java | 6 +-
.../hibernate/snapshot/IndexSnapshotGenerator.java | 13 +-
.../hibernate/snapshot/TableSnapshotGenerator.java | 2 +-
.../UniqueConstraintSnapshotGenerator.java | 4 +-
grails-data-test-report/build.gradle | 9 +-
settings.gradle | 4 +-
27 files changed, 286 insertions(+), 445 deletions(-)
diff --git a/BRANCHES.md b/BRANCHES.md
deleted file mode 100644
index 12a71d877c..0000000000
--- a/BRANCHES.md
+++ /dev/null
@@ -1,255 +0,0 @@
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you 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
-
- 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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-| Branch | Date | Type |
-| --- | --- | --- |
-| origin/GRAILS-6737-Groovy-1.7.5 | 2010-09-17 | CLOSED |
-| origin/GRAILS-6278 | 2010-09-17 | CLOSED |
-| origin/GRAILS-5087 | 2012-12-07 | CLOSED |
-| origin/GRAILS-9997 | 2013-07-30 | CLOSED |
-| origin/GRAILS-10533 | 2013-10-14 | CLOSED |
-| origin/GRAILS-10512 | 2013-10-14 | CLOSED |
-| origin/GRAILS-10613 | 2013-10-15 | CLOSED |
-| origin/GRAILS-10660 | 2013-10-29 | CLOSED |
-| origin/GRAILS-10631 | 2013-11-05 | CLOSED |
-| origin/GRAILS-10728 | 2013-11-06 | CLOSED |
-| origin/GRAILS-10448 | 2013-11-06 | CLOSED |
-| origin/GRAILS-10780 | 2013-11-19 | CLOSED |
-| origin/GRAILS-10813 | 2013-11-21 | CLOSED |
-| origin/GRAILS-10838 | 2013-11-25 | CLOSED |
-| origin/GRAILS-10826 | 2013-11-26 | CLOSED |
-| origin/GRAILS-10835 | 2013-11-27 | CLOSED |
-| origin/GRAILS-10853 | 2013-12-02 | CLOSED |
-| origin/GRAILS-10868 | 2013-12-03 | CLOSED |
-| origin/GRAILS-10871 | 2013-12-03 | CLOSED |
-| origin/GRAILS-9664 | 2013-12-04 | CLOSED |
-| origin/GRAILS-10882 | 2013-12-09 | CLOSED |
-| origin/GRAILS-10852 | 2013-12-13 | CLOSED |
-| origin/GRAILS-10910 | 2013-12-13 | CLOSED |
-| origin/GRAILS-10908 | 2013-12-14 | CLOSED |
-| origin/GRAILS-10683b | 2013-12-23 | CLOSED |
-| origin/GRAILS-10897 | 2014-01-08 | CLOSED |
-| origin/GRAILS-8426 | 2014-01-10 | CLOSED |
-| origin/GRAILS-10973 | 2014-01-13 | CLOSED |
-| origin/GRAILS-11003 | 2014-01-22 | CLOSED |
-| origin/GRAILS-11011 | 2014-01-22 | CLOSED |
-| origin/GRAILS-11075 | 2014-02-04 | CLOSED |
-| origin/GRAILS-11093 | 2014-02-06 | CLOSED |
-| origin/GRAILS-11104 | 2014-02-11 | CLOSED |
-| origin/GRAILS-10683 | 2014-02-13 | CLOSED |
-| origin/GRAILS-11145 | 2014-02-26 | CLOSED |
-| origin/GRAILS-11197 | 2014-03-10 | CLOSED |
-| origin/GRAILS-9686 | 2014-03-14 | CLOSED |
-| origin/GRAILS-10031 | 2014-03-17 | CLOSED |
-| origin/GRAILS-11222 | 2014-03-18 | CLOSED |
-| origin/GRAILS-11238 | 2014-03-19 | CLOSED |
-| origin/GRAILS-11242 | 2014-03-24 | CLOSED |
-| origin/GRAILS-11204 | 2014-05-01 | CLOSED |
-| origin/GRAILS-6766 | 2014-05-01 | CLOSED |
-| origin/GRAILS-9996 | 2014-05-08 | CLOSED |
-| origin/GRAILS-10905 | 2014-05-08 | CLOSED |
-| origin/GRAILS-11448 | 2014-05-27 | CLOSED |
-| origin/GRAILS-11453 | 2014-05-28 | CLOSED |
-| origin/GRAILS-11462 | 2014-06-02 | CLOSED |
-| origin/GRAILS-11129 | 2014-06-10 | CLOSED |
-| origin/GRAILS-11505 | 2014-06-13 | CLOSED |
-| origin/GRAILS-11505B | 2014-06-17 | CLOSED |
-| origin/GRAILS-11505C | 2014-06-17 | CLOSED |
-| origin/GRAILS-11585 | 2014-07-16 | CLOSED |
-| origin/GRAILS-11576 | 2014-07-25 | CLOSED |
-| origin/GRAILS-11625 | 2014-08-04 | CLOSED |
-| origin/GRAILS-11543 | 2014-08-14 | CLOSED |
-| origin/GRAILS-11666 | 2014-08-18 | CLOSED |
-| origin/GRAILS-11661 | 2014-08-18 | CLOSED |
-| origin/GRAILS-11686 | 2014-08-26 | CLOSED |
-| origin/GRAILS-11680 | 2014-10-21 | CLOSED |
-| origin/GRAILS-11791 | 2014-10-23 | CLOSED |
-| origin/GRAILS-11748 | 2014-10-23 | CLOSED |
-| origin/GRAILS-11806 | 2014-10-30 | CLOSED |
-| origin/GRAILS-11638 | 2014-10-30 | CLOSED |
-| origin/GRAILS-11976 | 2015-02-09 | CLOSED |
-| origin/GRAILS-11973 | 2015-02-09 | CLOSED |
-| origin/GRAILS-11958 | 2015-02-09 | CLOSED |
-| origin/GRAILS-12112 | 2015-03-25 | CLOSED |
-| origin/issue_9183 | 2015-08-13 | CLOSED |
-| origin/issue10188 | 2016-10-27 | CLOSED |
-| origin/issue10282 | 2016-11-19 | CLOSED |
-| origin/GRAILS-10300-10315 | 2016-12-09 | CLOSED |
-| origin/issue10423 | 2017-01-24 | CLOSED |
-| origin/GRAILS-10392 | 2017-02-09 | CLOSED |
-| origin/issue10502 | 2017-02-27 | CLOSED |
-| origin/issue10600 | 2017-04-22 | CLOSED |
-| origin/issue-10844 | 2018-02-26 | CLOSED |
-| origin/issue-10844_take2 | 2020-11-05 | CLOSED |
-| origin/feature/scaffolding-5.1.0 | 2024-09-11 | CLOSED |
-| origin/renovate/major-jansi.version | 2024-10-24 | CLOSED |
-| origin/renovate/major-javahamcrest-monorepo | 2024-10-24 | CLOSED |
-| origin/add-grails-events-transform | 2024-12-23 | CLOSED |
-| origin/renovate/alpine-3.x | 2024-12-27 | CLOSED |
-| origin/renovate/actions-upload-artifact-4.x | 2025-02-21 | CLOSED |
-| origin/renovate/com.gradle.develocity-3.x | 2025-02-25 | CLOSED |
-| origin/renovate/io.micronaut.serde-micronaut-serde-jackson-2.x | 2025-03-03 | CLOSED |
-| origin/renovate/io.micronaut-micronaut-http-client-4.x | 2025-03-13 | CLOSED |
-| origin/issue-14804 | 2025-06-11 | CLOSED |
-| origin/retry-build-step | 2025-06-18 | CLOSED |
-| origin/renovate/micronautversion | 2025-07-12 | CLOSED |
-| origin/addition-micronaut-feature-test | 2025-08-06 | CLOSED |
-| origin/update-rest-transform-dependency | 2025-08-07 | CLOSED |
-| origin/JavaExec-argsFile | 2025-09-22 | CLOSED |
-| origin/java-25-support-test | 2025-09-24 | CLOSED |
-| origin/fix-starter-published-dependencies | 2025-10-04 | CLOSED |
-| origin/fix/null-constructor-arg-groovy4 | 2026-03-03 | CLOSED |
-| origin/issue_8974 | 2015-03-23 | MERGE |
-| origin/issue_610 | 2015-04-06 | MERGE |
-| origin/issue-11211 | 2019-01-03 | MERGE |
-| origin/patch-decouple-gradle | 2024-07-24 | MERGE |
-| origin/web-profile-jar-artifact | 2025-10-08 | MERGE |
-| origin/jrebelFeatureFix | 2025-10-29 | MERGE |
-| origin/chore/gsp_and_gson_dependencies_and_apply | 2025-11-12 | MERGE |
-| origin/fix/issue_15228-respond-errors | 2025-11-18 | MERGE |
-| origin/banner-versions | 2025-11-19 | MERGE |
-| origin/remove-webjars-locator-core-dep | 2025-11-26 | MERGE |
-| origin/merge-back-7.0.5 | 2026-01-12 | MERGE |
-| origin/invokeDynamicDisable | 2026-01-17 | MERGE |
-| origin/deps/update-java-gradle-groovy-versions | 2026-01-27 | MERGE |
-| origin/task/add-agents-md-15145 | 2026-01-30 | MERGE |
-| origin/matrei-patch-1 | 2026-02-12 | MERGE |
-| origin/fix/flaky-geb-tests | 2026-02-19 | MERGE |
-| origin/refactor/centralize-groovydoc-plugin | 2026-02-19 | MERGE |
-| origin/test/query-connection-routing | 2026-02-21 | MERGE |
-| origin/micronaut-fixes-2 | 2026-02-21 | MERGE |
-| origin/forgeReloadingChanges | 2026-02-23 | MERGE |
-| origin/database-cleanup-feature | 2026-02-25 | MERGE |
-| origin/fix-detachedcriteria-join-get-hibernate7 | 2026-02-25 | MERGE |
-| origin/fix-detachedcriteria-join-get | 2026-02-25 | MERGE |
-| origin/fix/where-query-bugs | 2026-02-26 | MERGE |
-| origin/fix/async-promise-spec-read-timeout | 2026-03-03 | MERGE |
-| origin/fix/groovy-joint-ci-stability | 2026-03-03 | MERGE |
-| origin/groovy2 | 2012-03-26 | OTHER |
-| origin/cs-bug-arrays | 2013-04-08 | OTHER |
-| origin/scb-encoding-support | 2013-04-10 | OTHER |
-| origin/grails9190 | 2013-05-15 | OTHER |
-| origin/reactor | 2013-05-31 | OTHER |
-| origin/expressionevaluationutils | 2013-09-22 | OTHER |
-| origin/troubleshootingmasterbranch | 2013-11-11 | OTHER |
-| origin/jefftestbranch | 2013-11-12 | OTHER |
-| origin/bindingformatimprovement | 2013-12-16 | OTHER |
-| origin/beanbuilder | 2014-01-16 | OTHER |
-| origin/typechecking | 2014-01-16 | OTHER |
-| origin/rule_refactoring | 2014-01-28 | OTHER |
-| origin/springloaded_115 | 2014-02-27 | OTHER |
-| origin/grails-web-splitting | 2014-03-22 | OTHER |
-| origin/annotation_collector_problem | 2014-03-25 | OTHER |
-| origin/binding_collection_problem | 2014-04-01 | OTHER |
-| origin/jsp-refactor | 2014-04-11 | OTHER |
-| origin/GROOVY-6836-ClassCastException | 2014-07-21 | OTHER |
-| origin/grails-shell | 2014-09-30 | OTHER |
-| origin/grails-shell-2 | 2014-10-02 | OTHER |
-| origin/grails-shell-3 | 2014-10-06 | OTHER |
-| origin/gsp-split2 | 2014-12-05 | OTHER |
-| origin/Groovy_242_stackmap_frame_error | 2015-03-19 | OTHER |
-| origin/token_replacement | 2015-03-30 | OTHER |
-| origin/owasp | 2015-05-20 | OTHER |
-| origin/command_object_init | 2016-02-25 | OTHER |
-| origin/dont_constrain_readonly_properties | 2016-03-02 | OTHER |
-| origin/json_issue | 2016-03-15 | OTHER |
-| origin/build_scan | 2017-07-27 | OTHER |
-| origin/plugin_issues | 2018-06-15 | OTHER |
-| origin/jackson-renderer-poc | 2018-11-23 | OTHER |
-| origin/gorm-entity | 2018-12-04 | OTHER |
-| origin/gradle-plugin-datastore-rest-client-removal | 2019-03-29 | OTHER |
-| origin/groovy2.5.11 | 2020-04-17 | OTHER |
-| origin/eric/scopeDefaultFix | 2020-07-21 | OTHER |
-| origin/puneetbehl/enableIncrementalGroovyCompile | 2021-08-06 | OTHER |
-| origin/mavenLocal | 2021-12-08 | OTHER |
-| origin/gradle/experiment4 | 2022-01-26 | OTHER |
-| origin/upgrade/apache-groovy | 2022-09-01 | OTHER |
-| origin/buxfix/12596-grails-520-create-app-throws-cannot-resolve-dependency-orgspringframeworkbootspring-boot-dependencies270-no-repositories-are-defined | 2022-09-14 | OTHER |
-| origin/merge-5_2_x | 2022-11-10 | OTHER |
-| origin/12082-micronaut-beans-do-not-receive-configuration-from-environments-block | 2022-12-06 | OTHER |
-| origin/cleanup/grails-shell | 2023-09-06 | OTHER |
-| origin/convert-ContainerRender-to-trait | 2024-12-10 | OTHER |
-| origin/renovate/pin-dependencies | 2025-03-07 | OTHER |
-| origin/groovy-debug-ast-logging | 2025-04-29 | OTHER |
-| origin/groovydoc-tool-rewrite | 2025-05-23 | OTHER |
-| origin/markup-issue | 2025-06-13 | OTHER |
-| origin/url-mapping-testing | 2025-06-14 | OTHER |
-| origin/feature/gradle9 | 2025-09-18 | OTHER |
-| origin/grails7-initial-neo4jUpdates | 2025-10-02 | OTHER |
-| origin/groovy-5-fixes | 2026-02-05 | OTHER |
-| origin/micronaut-fixes | 2026-02-18 | OTHER |
-| origin/configuration-command | 2026-02-19 | OTHER |
-| origin/renovate/micronautserdejacksonversion | 2025-03-03 | OPEN |
-| origin/renovate/major-apache-maven-resolver-monorepo | 2025-07-12 | OPEN |
-| origin/issue-11795 | 2025-08-18 | OPEN |
-| origin/fix/clarify-caffeine | 2025-09-23 | OPEN |
-| origin/issue15290 | 2025-12-16 | OPEN |
-| origin/dependabot/github_actions/gradle/actions-5 | 2026-02-03 | OPEN |
-| origin/dependabot/gradle/grails-forge/7.0.x/com.gradle.common-custom-user-data-gradle-plugin-2.4.0 | 2026-02-03 | OPEN |
-| origin/groovy-5 | 2026-02-04 | OPEN |
-| origin/dependabot/github_actions/actions/cache-5 | 2026-02-17 | OPEN |
-| origin/feat/publish-groovydoc-plugin | 2026-02-21 | OPEN |
-| origin/issue-13752-upgrade-jansi-jline | 2026-02-25 | OPEN |
-| origin/upgrade/gradle-9.3.1 | 2026-02-25 | OPEN |
-| origin/feat/gradle-managed-version-overrides | 2026-02-26 | OPEN |
-| origin/docs/configuration-hybrid | 2026-02-26 | OPEN |
-| origin/deprecate-for-removal | 2026-02-27 | OPEN |
-| origin/docs/spring-security-upgrade-instructions | 2026-02-28 | OPEN |
-| origin/conditionalPluginConfiguration | 2026-03-01 | OPEN |
-| origin/fix/negative-number-locale-15178 | 2026-03-02 | OPEN |
-| origin/fix/scaffolding-test-flaky-login | 2026-03-03 | OPEN |
-| origin/feature/taglib-method-actions | 2026-03-03 | OPEN |
-| origin/fix/dataservice-null-datastore-guard | 2026-03-03 | OPEN |
-| origin/fix/ersatz-roundtrip-connection-reset | 2026-03-03 | OPEN |
-| origin/feat/http-client-testing-support | 2026-03-05 | OPEN |
-| origin/1.1.x | 2009-11-26 | RELEASE |
-| origin/1.3.0.RC2 | 2010-04-23 | RELEASE |
-| origin/1.2.x | 2010-10-11 | RELEASE |
-| origin/1.3.x | 2012-06-01 | RELEASE |
-| origin/2.0.x | 2013-05-30 | RELEASE |
-| origin/2.1.x | 2013-09-21 | RELEASE |
-| origin/2.2.x | 2014-07-27 | RELEASE |
-| origin/2.3.x | 2015-06-17 | RELEASE |
-| origin/2.4.x | 2015-09-08 | RELEASE |
-| origin/3.0.x | 2016-07-27 | RELEASE |
-| origin/3.1.x | 2017-05-09 | RELEASE |
-| origin/3.1.x-issue-9058 | 2017-05-23 | RELEASE |
-| origin/3.2.x | 2019-10-10 | RELEASE |
-| origin/master | 2021-11-24 | RELEASE |
-| origin/4.0.x | 2022-06-03 | RELEASE |
-| origin/5.1.x | 2022-10-13 | RELEASE |
-| origin/5.0.x | 2022-11-25 | RELEASE |
-| origin/5.2.x | 2023-02-13 | RELEASE |
-| origin/2.5.x | 2023-12-17 | RELEASE |
-| origin/3.3.x | 2024-01-09 | RELEASE |
-| origin/4.1.x | 2024-01-26 | RELEASE |
-| origin/5.3.x | 2024-01-26 | RELEASE |
-| origin/6.1.x | 2024-02-27 | RELEASE |
-| origin/6.0.x | 2024-04-09 | RELEASE |
-| origin/5.4.x | 2024-09-11 | RELEASE |
-| origin/6.2.x | 2025-01-03 | RELEASE |
-| origin/gh-pages | 2025-01-07 | RELEASE |
-| origin/7.0.x-hibernate6 | 2025-10-15 | RELEASE |
-| origin/7.0.x-binding-error-14947-15147 | 2025-10-21 | RELEASE |
-| origin/7.1.x-hibernate6 | 2025-12-03 | RELEASE |
-| origin/7.1.x | 2026-02-27 | RELEASE |
-| origin/8.0.x | 2026-02-28 | RELEASE |
-| origin/8.0.x-hibernate7 | 2026-03-01 | RELEASE |
-| origin/7.0.x | 2026-03-04 | RELEASE |
-| origin | 2026-03-04 | RELEASE |
-| origin/8.0.x-hibernate7-dev | 2026-03-05 | RELEASE |
diff --git a/build-logic/plugins/build.gradle b/build-logic/plugins/build.gradle
index f5fe824bc7..8636b1de56 100644
--- a/build-logic/plugins/build.gradle
+++ b/build-logic/plugins/build.gradle
@@ -40,6 +40,13 @@ dependencies {
implementation "org.cyclonedx.bom:org.cyclonedx.bom.gradle.plugin:${gradleProperties.gradleCycloneDxPluginVersion}"
implementation "com.diffplug.spotless:spotless-plugin-gradle:${gradleProperties.spotlessVersion}"
implementation "com.github.spotbugs.snom:spotbugs-gradle-plugin:${gradleProperties.spotbugsPluginVersion}"
+
+ testImplementation "org.spockframework:spock-core:${gradleBomDependencyVersions['gradle-spock.version']}"
+ testImplementation gradleTestKit()
+}
+
+tasks.named('test') {
+ useJUnitPlatform()
}
gradlePlugin {
diff --git a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsCodeStylePlugin.groovy b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsCodeStylePlugin.groovy
index 5064317207..9312dcf919 100644
--- a/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsCodeStylePlugin.groovy
+++ b/build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/GrailsCodeStylePlugin.groovy
@@ -73,6 +73,8 @@ class GrailsCodeStylePlugin implements Plugin<Project> {
static String CODENARC_ENABLED_PROPERTY = 'grails.codestyle.enabled.codenarc'
static String CODENARC_CONFIG_FILE_NAME = 'codenarc.groovy'
+ static String CODENARC_FIX_PROPERTY = 'grails.codestyle.codenarc.fix'
+
static String SPOTBUGS_ENABLED_PROPERTY = 'grails.codestyle.enabled.spotbugs'
static String IGNORE_FAILURES_PROPERTY = 'grails.codestyle.ignoreFailures'
@@ -618,6 +620,8 @@ class GrailsCodeStylePlugin implements Plugin<Project> {
static void configureCodenarc(Project project) {
project.pluginManager.apply(CodeNarcPlugin)
+ registerCodenarcFixTask(project)
+
project.extensions.configure(CodeNarcExtension) {
it.configFile = project.extensions.getByType(GrailsCodeStyleExtension)
.codenarcDirectory.file(CODENARC_CONFIG_FILE_NAME).get().asFile
@@ -630,6 +634,10 @@ class GrailsCodeStylePlugin implements Plugin<Project> {
it.onlyIf { !project.hasProperty('skipCodeStyle') }
it.ignoreFailures = GradleUtils.lookupProperty(project, IGNORE_FAILURES_PROPERTY, false)
+ if (GradleUtils.lookupProperty(project, CODENARC_FIX_PROPERTY, false)) {
+ it.dependsOn('codenarcFix')
+ }
+
// Redirect XML report output to a single directory to consolidate
// reports across all subprojects into one known location
it.reports.xml.required.set(true)
@@ -662,4 +670,53 @@ class GrailsCodeStylePlugin implements Plugin<Project> {
}
}
}
+
+ private static void registerCodenarcFixTask(Project project) {
+ if (project.tasks.findByName('codenarcFix')) {
+ return
+ }
+
+ project.tasks.register('codenarcFix') {
+ it.group = 'verification'
+ it.description = 'Automatically fixes some CodeNarc violations'
+ it.doLast {
+ project.fileTree(project.projectDir) {
+ it.include 'src/**/*.groovy'
+ it.exclude '**/build/**'
+ }.each { file ->
+ String content = file.text
+ String original = content
+
+ // 1. ClassStartsWithBlankLine
+ content = content.replaceAll(/(class\s+[^{]+\{\n)([ \t]*[^ \s\n\/])/, '$1\n$2')
+
+ // 2. SpaceAroundMapEntryColon
+ content = content.replaceAll(/([\[,]\s*(?:[\w\-.]+|'[^']+'|"[^"]+")):([^\s\/])/, '$1: $2')
+ content = content.replaceAll(/(\(\s*(?:[\w\-.]+|'[^']+'|"[^"]+")):([^\s\/])/, '$1: $2')
+
+ // 3. UnnecessaryGString
+ content = content.replaceAll(/"([^"$\n\\]*)"/) { all, inner ->
+ if (!inner.contains("'")) {
+ return "'$inner'"
+ }
+ return all
+ }
+
+ // 4. UnnecessarySemicolon
+ content = content.replaceAll(/(?m);[ \t]*$/, '')
+
+ // 5. SpaceBeforeOpeningBrace
+ content = content.replaceAll(/([\)\]\}\w])\{/, '$1 {')
+
+ // 6. ConsecutiveBlankLines
+ content = content.replaceAll(/\n{3,}/, '\n\n')
+
+ if (content != original) {
+ file.text = content
+ project.logger.lifecycle("Fixed CodeNarc violations in ${file.path}")
+ }
+ }
+ }
+ }
+ }
}
diff --git a/build-logic/plugins/src/test/groovy/org/apache/grails/buildsrc/GrailsCodeStylePluginSpec.groovy b/build-logic/plugins/src/test/groovy/org/apache/grails/buildsrc/GrailsCodeStylePluginSpec.groovy
new file mode 100644
index 0000000000..3f8ceb7642
--- /dev/null
+++ b/build-logic/plugins/src/test/groovy/org/apache/grails/buildsrc/GrailsCodeStylePluginSpec.groovy
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
+ *
+ * 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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.grails.buildsrc
+
+import org.gradle.testkit.runner.GradleRunner
+import spock.lang.Specification
+import spock.lang.TempDir
+import java.nio.file.Path
+
+class GrailsCodeStylePluginSpec extends Specification {
+ @TempDir
+ Path testProjectDir
+
+ File buildFile
+ File groovyFile
+
+ def setup() {
+ buildFile = testProjectDir.resolve('build.gradle').toFile()
+ buildFile << """
+ plugins {
+ id 'groovy'
+ id 'org.apache.grails.gradle.grails-code-style'
+ }
+
+ // Minimal configuration for the plugin
+ repositories {
+ mavenCentral()
+ }
+ """
+
+ testProjectDir.resolve('src/main/groovy').toFile().mkdirs()
+ groovyFile = testProjectDir.resolve('src/main/groovy/Test.groovy').toFile()
+ }
+
+ def "test codenarcFix task fixes violations"() {
+ given: "a file with violations"
+ groovyFile.text = """package org.test
+
+class Test{
+ def map = [key:"value"]
+ def str = "unnecessary gstring"
+ def semi = "semicolon";
+ def lines = 1
+
+
+ def other = 2
+}
+"""
+ when: "running codenarcFix"
+ def result = GradleRunner.create()
+ .withProjectDir(testProjectDir.toFile())
+ .withArguments('codenarcFix', '--stacktrace')
+ .withPluginClasspath()
+ .build()
+
+ then: "task finished successfully"
+ result.task(':codenarcFix').outcome == org.gradle.testkit.runner.TaskOutcome.SUCCESS
+
+ and: "violations are fixed"
+ def fixedContent = groovyFile.text
+ fixedContent.contains('class Test {') // SpaceBeforeOpeningBrace
+ // Note: ClassStartsWithBlankLine regex in the plugin is:
+ // content.replaceAll(/(class\s+[^{]+\{\n)([ \t]*[^ \s\n\/])/, '$1\n$2')
+ // In our case, it should match "class Test{\n def map" and insert a newline
+ fixedContent.contains('class Test {\n\n def map')
+ fixedContent.contains('[key: \'value\']') // SpaceAroundMapEntryColon and UnnecessaryGString
+ fixedContent.contains("'unnecessary gstring'") // UnnecessaryGString
+ fixedContent.contains('def semi = \'semicolon\'\n') // UnnecessarySemicolon
+ fixedContent.count('\n\n') == 3 // ConsecutiveBlankLines (3 reduced to 2), plus others
+ }
+}
diff --git a/fix_codenarc.py b/fix_codenarc.py
deleted file mode 100644
index e7501fd4c6..0000000000
--- a/fix_codenarc.py
+++ /dev/null
@@ -1,79 +0,0 @@
-import os
-import re
-import sys
-
-def fix_file(file_path):
- with open(file_path, 'r') as f:
- content = f.read()
-
- original_content = content
-
- # 1. ClassStartsWithBlankLine
- # Look for class declaration followed by opening brace and then a non-blank line
- # (?![\s\n]*}) to avoid empty classes
- content = re.sub(r'(class\s+[^{]+\{\n)([ \t]*[^ \s\n/}])', r'\1\n\2', content)
-
- # 2. SpaceAroundMapEntryColon
- # Look for [key:value] or ,key:value or [key:value,
- # keys can be words, or quoted strings.
- # We use a more inclusive match for the key: either a word, or anything inside quotes.
- # Handle the colon and ensure there's no space after it.
- content = re.sub(r'([\[,]\s*(?:[\w\-.]+|\'[^\']+\'|"[^"]+")):([^\s/])', r'\1: \2', content)
- # Also for method calls if they start with a word or quoted string
- content = re.sub(r'(\(\s*(?:[\w\-.]+|\'[^\']+\'|"[^"]+")):([^\s/])', r'\1: \2', content)
-
- # 3. UnnecessaryGString
- # Replace "string" with 'string' if no $ and no ' inside.
- # We'll only do this for simple strings to avoid breaking things.
- def replace_gstring(match):
- s = match.group(0)
- inner = s[1:-1]
- if '$' not in inner and "'" not in inner and '\\' not in inner:
- return f"'{inner}'"
- return s
-
- # Match double quoted strings that don't span multiple lines
- content = re.sub(r'"[^" \n]*"', replace_gstring, content)
- # Match double quoted strings with spaces but no interpolation
- content = re.sub(r'"[^"$\n]*"', replace_gstring, content)
-
- # 4. UnnecessarySemicolon
- # Remove trailing semicolons (not in strings)
- content = re.sub(r'(?m);[ \t]*$', '', content)
-
- # 5. SpaceBeforeOpeningBrace
- # Ensure space before { if it's preceded by ) or ] or }
- content = re.sub(r'([\)\]\}])\{', r'\1 {', content)
-
- # 6. ConsecutiveBlankLines
- # Replace 3 or more newlines with 2 newlines
- content = re.sub(r'\n{3,}', '\n\n', content)
-
- if content != original_content:
- with open(file_path, 'w') as f:
- f.write(content)
- return True
- return False
-
-def main(path):
- count = 0
- if os.path.isfile(path):
- if path.endswith('.groovy'):
- if fix_file(path):
- print(f"Fixed {path}")
- count += 1
- else:
- for root, dirs, files in os.walk(path):
- for file in files:
- if file.endswith('.groovy'):
- file_path = os.path.join(root, file)
- if fix_file(file_path):
- print(f"Fixed {file_path}")
- count += 1
- print(f"Total files modified: {count}")
-
-if __name__ == "__main__":
- if len(sys.argv) > 1:
- main(sys.argv[1])
- else:
- print("Usage: python fix_codenarc.py <directory>")
diff --git a/gradle/grails-extension-gradle-config.gradle b/gradle/grails-extension-gradle-config.gradle
index a69ebc0082..d491c3f2e5 100644
--- a/gradle/grails-extension-gradle-config.gradle
+++ b/gradle/grails-extension-gradle-config.gradle
@@ -31,4 +31,11 @@ grails {
// this means you MUST publish locally via ./gradlew :grails-bom:publishMavenPublicationToLocalBomRepository
// this causes unexpected version mismatches in the various plugin projects
springDependencyManagement = false
+
+ // Allow CI to toggle Groovy invokedynamic (indy) via -PgrailsIndy=true
+ // This enables testing functional tests with both indy enabled and disabled.
+ // See: https://github.com/apache/grails-core/issues/15321
+ if (project.hasProperty('grailsIndy')) {
+ indy = Boolean.parseBoolean(project.property('grailsIndy') as String)
+ }
}
\ No newline at end of file
diff --git a/gradle/publish-root-config.gradle b/gradle/publish-root-config.gradle
index f487d557da..a30a66eff8 100644
--- a/gradle/publish-root-config.gradle
+++ b/gradle/publish-root-config.gradle
@@ -121,7 +121,7 @@ def publishedProjects = [
// hibernate7
'grails-data-hibernate7',
'grails-data-hibernate7-core',
- //TODO: 'grails-data-hibernate7-dbmigration',
+ 'grails-data-hibernate7-dbmigration',
'grails-data-hibernate7-spring-boot',
// mongodb
diff --git a/gradle/rat-root-config.gradle b/gradle/rat-root-config.gradle
index 8befe646fa..b3a256aad5 100644
--- a/gradle/rat-root-config.gradle
+++ b/gradle/rat-root-config.gradle
@@ -1,18 +1,20 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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
*
- * https://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,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
apply plugin: 'org.nosphere.apache.rat'
@@ -88,7 +90,6 @@ tasks.named('rat') {
'local.properties', // local properties
'test_output.log', // test output log
'0_build_grails.txt', // large build log
- 'fix_codenarc.py', // fix codenarc script
'*_VIOLATIONS.md', // generated violation reports
'plans/*.md', // development plans
'grails-data-hibernate7/*.md', // hibernate 7 migration docs
diff --git a/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java b/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java
index f44825cc34..7613689274 100644
--- a/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java
+++ b/grails-data-hibernate5/core/src/main/groovy/org/grails/orm/hibernate/proxy/HibernateProxyHandler.java
@@ -1,20 +1,18 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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
*
- * https://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, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.grails.orm.hibernate.proxy;
diff --git a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/HibernateDatastore.java b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/HibernateDatastore.java
index 7eb37cbd90..19c6e0f456 100644
--- a/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/HibernateDatastore.java
+++ b/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/HibernateDatastore.java
@@ -39,6 +39,7 @@ import javax.sql.DataSource;
import groovy.lang.Closure;
+import jakarta.annotation.Nullable;
import jakarta.annotation.PreDestroy;
import org.hibernate.FlushMode;
@@ -65,7 +66,6 @@ import org.springframework.context.support.StaticMessageSource;
import org.springframework.core.env.PropertyResolver;
import org.springframework.jdbc.datasource.ConnectionHolder;
import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
-import org.springframework.lang.Nullable;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionSynchronizationManager;
@@ -552,7 +552,7 @@ public class HibernateDatastore extends AbstractDatastore
final HibernateConnectionSource defaultConnectionSource =
(HibernateConnectionSource) getConnectionSources().getDefaultConnectionSource();
if (multiTenantMode == MultiTenancySettings.MultiTenancyMode.SCHEMA) {
- return new HibernateGormEnhancer(this, (PlatformTransactionManager) transactionManager, defaultConnectionSource.getSettings()) {
+ return new HibernateGormEnhancer(this, transactionManager, defaultConnectionSource.getSettings()) {
@Override
public List<String> allQualifiers(Datastore datastore, PersistentEntity entity) {
List<String> allQualifiers = super.allQualifiers(datastore, entity);
@@ -580,7 +580,7 @@ public class HibernateDatastore extends AbstractDatastore
}
};
} else {
- return new HibernateGormEnhancer(this, (PlatformTransactionManager) transactionManager, defaultConnectionSource.getSettings());
+ return new HibernateGormEnhancer(this, transactionManager, defaultConnectionSource.getSettings());
}
}
@@ -932,24 +932,26 @@ public class HibernateDatastore extends AbstractDatastore
@Override
public <T> T withSession(final Closure<T> callable) {
Closure<T> multiTenantCallable = prepareMultiTenantClosure(callable);
- return (T) getHibernateTemplate().execute(multiTenantCallable);
+ return getHibernateTemplate().execute(multiTenantCallable);
}
public <T> T withSession(String connectionName, final Closure<T> callable) {
HibernateDatastore datastore = getDatastoreForConnection(connectionName);
- Closure multiTenantCallable = datastore.prepareMultiTenantClosure(callable);
- return (T) datastore.getHibernateTemplate().execute(multiTenantCallable);
+ Closure<?> multiTenantCallable = datastore.prepareMultiTenantClosure(callable);
+ IHibernateTemplate hibernateTemplate = datastore.getHibernateTemplate();
+ Object execute = hibernateTemplate.execute(multiTenantCallable);
+ return (T) execute;
}
public <T> T withNewSession(String connectionName, final Closure<T> callable) {
HibernateDatastore datastore = getDatastoreForConnection(connectionName);
- Closure multiTenantCallable = datastore.prepareMultiTenantClosure(callable);
+ Closure<?> multiTenantCallable = datastore.prepareMultiTenantClosure(callable);
return (T) datastore.getHibernateTemplate().executeWithNewSession(multiTenantCallable);
}
public <T> T withNewSession(final Closure<T> callable) {
Closure<T> multiTenantCallable = prepareMultiTenantClosure(callable);
- return (T) getHibernateTemplate().executeWithNewSession(multiTenantCallable);
+ return getHibernateTemplate().executeWithNewSession(multiTenantCallable);
}
@Override
@@ -957,7 +959,7 @@ public class HibernateDatastore extends AbstractDatastore
if (getMultiTenancyMode() == MultiTenancySettings.MultiTenancyMode.DATABASE) {
HibernateDatastore datastore = getDatastoreForConnection(tenantId.toString());
SessionFactory sf = datastore.getSessionFactory();
- return (T1) datastore.getHibernateTemplate().executeWithExistingOrCreateNewSession(sf, callable);
+ return datastore.getHibernateTemplate().executeWithExistingOrCreateNewSession(sf, callable);
} else {
return withNewSession(callable);
}
@@ -988,7 +990,7 @@ public class HibernateDatastore extends AbstractDatastore
public T call(Object... args) {
enableMultiTenancyFilter();
try {
- return (T) callable.call(args);
+ return callable.call(args);
} finally {
disableMultiTenancyFilter();
}
@@ -1023,7 +1025,7 @@ public class HibernateDatastore extends AbstractDatastore
HibernateMappingContext mappingContext,
ConfigurableApplicationEventPublisher eventPublisher) {
super(connectionSources, mappingContext, eventPublisher, true,
- ((HibernateConnectionSource) connectionSources.getDefaultConnectionSource()).getSource());
+ connectionSources.getDefaultConnectionSource().getSource());
this.parent = parent;
}
@@ -1032,16 +1034,6 @@ public class HibernateDatastore extends AbstractDatastore
return null;
}
- @Override
- public IHibernateTemplate getHibernateTemplate() {
- return new GrailsHibernateTemplate(getSessionFactory(), this);
- }
-
- @Override
- public IHibernateTemplate getHibernateTemplate(int flushMode) {
- return new GrailsHibernateTemplate(getSessionFactory(), this, flushMode);
- }
-
@Override
public HibernateDatastore getDatastoreForConnection(String connectionName) {
if (Settings.SETTING_DATASOURCE.equals(connectionName) ||
diff --git a/grails-data-hibernate7/dbmigration/build.gradle b/grails-data-hibernate7/dbmigration/build.gradle
index 8347c1ef9e..822b672474 100644
--- a/grails-data-hibernate7/dbmigration/build.gradle
+++ b/grails-data-hibernate7/dbmigration/build.gradle
@@ -18,11 +18,12 @@
*/
plugins {
- id 'java-library'
id 'org.apache.grails.buildsrc.properties'
id 'org.apache.grails.gradle.grails-plugin'
-
-
+ id 'org.apache.grails.buildsrc.compile'
+ id 'org.apache.grails.buildsrc.publish'
+ id 'org.apache.grails.buildsrc.sbom'
+ id 'org.apache.grails.gradle.grails-code-style'
}
version = projectVersion
@@ -44,7 +45,7 @@ dependencies {
exclude group: 'org.liquibase', module: 'liquibase-core'
}
- implementation("org.liquibase:liquibase-core:4.33.0")
+ implementation("org.liquibase:liquibase-core:$liquibaseHibernate7CoreVersion")
implementation("org.hibernate.models:hibernate-models:1.0.1")
implementation project(':grails-data-hibernate7')
compileOnly("org.hibernate.orm:hibernate-envers:$hibernate7Version")
@@ -96,7 +97,7 @@ dependencies {
constraints {
implementation("org.liquibase:liquibase-core") {
version {
- strictly "4.33.0"
+ strictly "$liquibaseHibernate7CoreVersion"
}
}
}
@@ -119,8 +120,6 @@ tasks.withType(Test).configureEach {
}
}
apply {
- from rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
- from rootProject.layout.projectDirectory.file('gradle/code-style-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/hibernate7-test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java
index bf96504bd8..363b84e3eb 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateClassicDatabase.java
@@ -24,12 +24,12 @@ import liquibase.database.DatabaseConnection;
import liquibase.exception.DatabaseException;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.MetadataSources;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
import org.hibernate.service.ServiceRegistry;
-import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
/**
* Database implementation for "classic" hibernate configurations.
@@ -107,4 +107,4 @@ public class HibernateClassicDatabase extends HibernateDatabase {
protected String getDefaultDatabaseProductName() {
return "Hibernate Classic";
}
-}
\ No newline at end of file
+}
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java
index 93c7bcd799..87377426fc 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateDatabase.java
@@ -132,8 +132,8 @@ public abstract class HibernateDatabase extends AbstractJdbcDatabase {
if (underlyingConnection instanceof HibernateConnection) {
return (HibernateConnection) underlyingConnection;
} else {
- throw new UnexpectedLiquibaseException("Underlying connection is not a HibernateConnection: "
- + underlyingConnection.getClass().getName());
+ throw new UnexpectedLiquibaseException("Underlying connection is not a HibernateConnection: " +
+ underlyingConnection.getClass().getName());
}
} else if (originalConnection instanceof HibernateConnection) {
return (HibernateConnection) originalConnection;
@@ -161,10 +161,10 @@ public abstract class HibernateDatabase extends AbstractJdbcDatabase {
return ((CustomMetadataFactory)
clazz.getDeclaredConstructor().newInstance())
.getMetadata(this, getHibernateConnection());
- } catch (InstantiationException
- | IllegalAccessException
- | InvocationTargetException
- | NoSuchMethodException e) {
+ } catch (InstantiationException |
+ IllegalAccessException |
+ InvocationTargetException |
+ NoSuchMethodException e) {
throw new DatabaseException(e);
}
}
@@ -223,11 +223,11 @@ public abstract class HibernateDatabase extends AbstractJdbcDatabase {
.getDeclaredConstructor()
.newInstance();
Scope.getCurrentScope().getLog(getClass()).info("Using dialect " + dialectString);
- } catch (InstantiationException
- | IllegalAccessException
- | InvocationTargetException
- | NoSuchMethodException
- | ClassNotFoundException e) {
+ } catch (InstantiationException |
+ IllegalAccessException |
+ InvocationTargetException |
+ NoSuchMethodException |
+ ClassNotFoundException e) {
throw new DatabaseException(e);
}
} else {
@@ -267,11 +267,11 @@ public abstract class HibernateDatabase extends AbstractJdbcDatabase {
.getDeclaredConstructor()
.newInstance());
}
- } catch (InstantiationException
- | IllegalAccessException
- | InvocationTargetException
- | NoSuchMethodException
- | ClassNotFoundException e) {
+ } catch (InstantiationException |
+ IllegalAccessException |
+ InvocationTargetException |
+ NoSuchMethodException |
+ ClassNotFoundException e) {
throw new DatabaseException(e);
}
}
@@ -312,11 +312,11 @@ public abstract class HibernateDatabase extends AbstractJdbcDatabase {
break;
}
}
- } catch (InstantiationException
- | IllegalAccessException
- | InvocationTargetException
- | NoSuchMethodException
- | ClassNotFoundException e) {
+ } catch (InstantiationException |
+ IllegalAccessException |
+ InvocationTargetException |
+ NoSuchMethodException |
+ ClassNotFoundException e) {
throw new DatabaseException(e);
}
}
@@ -402,4 +402,4 @@ public abstract class HibernateDatabase extends AbstractJdbcDatabase {
public boolean isCaseSensitive() {
return false;
}
-}
\ No newline at end of file
+}
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java
index 5a6b964302..68be728e38 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringBeanDatabase.java
@@ -181,8 +181,8 @@ public class HibernateSpringBeanDatabase extends HibernateDatabase {
if (Object.class.isAssignableFrom(newClass)) {
return newClass.asSubclass(Object.class);
} else {
- throw new IllegalStateException("The provided class '" + className + "' is not assignable from the '"
- + Object.class.getName() + "' superclass.");
+ throw new IllegalStateException("The provided class '" + className + "' is not assignable from the '" +
+ Object.class.getName() + "' superclass.");
}
} catch (ClassNotFoundException e) {
throw new IllegalStateException(
@@ -199,4 +199,4 @@ public class HibernateSpringBeanDatabase extends HibernateDatabase {
protected String getDefaultDatabaseProductName() {
return "Hibernate Spring Bean";
}
-}
\ No newline at end of file
+}
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java
index 8954cb4958..0cddb43b7d 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/HibernateSpringPackageDatabase.java
@@ -180,4 +180,4 @@ public class HibernateSpringPackageDatabase extends JpaPersistenceDatabase {
protected String getDefaultDatabaseProductName() {
return "Hibernate Spring Package";
}
-}
\ No newline at end of file
+}
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java
index c9dba4a8b1..dd5e1e9964 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpConnectionProvider.java
@@ -85,4 +85,4 @@ class NoOpConnectionProvider implements ConnectionProvider {
public void releaseConnection(String tenantIdentifier, Connection connection) {
// No-op
}
-}
\ No newline at end of file
+}
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java
index c38a6796e0..47cb562aae 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/NoOpMultiTenantConnectionProvider.java
@@ -77,4 +77,4 @@ class NoOpMultiTenantConnectionProvider implements MultiTenantConnectionProvider
public boolean supportsAggressiveRelease() {
return false;
}
-}
\ No newline at end of file
+}
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java
index 2bc48961d5..85b51642a5 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnection.java
@@ -22,7 +22,19 @@ import java.io.IOException;
import java.io.StringReader;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
-import java.sql.*;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.CallableStatement;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.NClob;
+import java.sql.PreparedStatement;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.sql.Struct;
import java.util.Collections;
import java.util.Map;
import java.util.Properties;
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java
index bfb529c9ac..cbe7e722b0 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateConnectionMetadata.java
@@ -18,7 +18,10 @@
*/
package liquibase.ext.hibernate.database.connection;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.RowIdLifetime;
import org.hibernate.Version;
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java
index 3ef3d604c6..c8151d2d6b 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/database/connection/HibernateDriver.java
@@ -18,7 +18,10 @@
*/
package liquibase.ext.hibernate.database.connection;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLFeatureNotSupportedException;
import java.util.Properties;
import java.util.logging.Logger;
@@ -34,17 +37,17 @@ public class HibernateDriver implements Driver, LiquibaseExtDriver {
private ResourceAccessor resourceAccessor;
@Override
- public Connection connect(String url, Properties info) {
+ public Connection connect(String url, Properties info) {
return new HibernateConnection(url, resourceAccessor);
}
@Override
- public boolean acceptsURL(String url) {
+ public boolean acceptsURL(String url) {
return url.startsWith("hibernate:");
}
@Override
- public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
+ public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
return new DriverPropertyInfo[0];
}
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java
index 3be329e0ff..5155923877 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ColumnSnapshotGenerator.java
@@ -18,7 +18,6 @@
*/
package liquibase.ext.hibernate.snapshot;
-import java.util.List;
import java.util.Locale;
import java.util.Optional;
import java.util.regex.Matcher;
@@ -191,8 +190,8 @@ public class ColumnSnapshotGenerator extends HibernateSnapshotGenerator {
if (generator instanceof org.hibernate.id.IdentityGenerator) {
isAutoIncrement = true;
- } else if (generator
- instanceof org.hibernate.id.enhanced.SequenceStyleGenerator seqGen) {
+ } else if (generator instanceof
+ org.hibernate.id.enhanced.SequenceStyleGenerator seqGen) {
if (PostgreSQLDialect.class.isAssignableFrom(dialect.getClass())) {
String sequenceName =
resolveSequenceName(seqGen, hibernateTable, hibernateColumn);
@@ -273,8 +272,8 @@ public class ColumnSnapshotGenerator extends HibernateSnapshotGenerator {
Scope.getCurrentScope()
.getLog(getClass())
- .info("Converted column data type - hibernate type: " + hibernateType + ", SQL type: " + sqlTypeCode
- + ", type name: " + dataType.getTypeName());
+ .info("Converted column data type - hibernate type: " + hibernateType + ", SQL type: " + sqlTypeCode +
+ ", type name: " + dataType.getTypeName());
dataType.setDataTypeId(sqlTypeCode);
return dataType;
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ForeignKeySnapshotGenerator.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ForeignKeySnapshotGenerator.java
index 1c6636bd80..b1d5fb1675 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ForeignKeySnapshotGenerator.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/ForeignKeySnapshotGenerator.java
@@ -19,14 +19,12 @@
package liquibase.ext.hibernate.snapshot;
import liquibase.exception.DatabaseException;
-import liquibase.ext.hibernate.database.HibernateDatabase;
import liquibase.snapshot.DatabaseSnapshot;
import liquibase.snapshot.InvalidExampleException;
import liquibase.snapshot.SnapshotGenerator;
import liquibase.structure.DatabaseObject;
import liquibase.structure.core.ForeignKey;
import liquibase.structure.core.Table;
-import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.mapping.Column;
public class ForeignKeySnapshotGenerator extends HibernateSnapshotGenerator {
@@ -71,8 +69,8 @@ public class ForeignKeySnapshotGenerator extends HibernateSnapshotGenerator {
for (Column column : hibernateForeignKey.getReferencedColumns()) {
fk.addPrimaryKeyColumn(new liquibase.structure.core.Column(column.getName()));
}
- if (fk.getPrimaryKeyColumns() == null
- || fk.getPrimaryKeyColumns().isEmpty()) {
+ if (fk.getPrimaryKeyColumns() == null ||
+ fk.getPrimaryKeyColumns().isEmpty()) {
if (hibernateReferencedTable.getPrimaryKey() != null) {
for (Column column :
hibernateReferencedTable.getPrimaryKey().getColumns()) {
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/IndexSnapshotGenerator.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/IndexSnapshotGenerator.java
index 99e8a7ca19..98d53dfb50 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/IndexSnapshotGenerator.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/IndexSnapshotGenerator.java
@@ -24,7 +24,12 @@ import liquibase.snapshot.DatabaseSnapshot;
import liquibase.snapshot.InvalidExampleException;
import liquibase.snapshot.SnapshotGenerator;
import liquibase.structure.DatabaseObject;
-import liquibase.structure.core.*;
+import liquibase.structure.core.Column;
+import liquibase.structure.core.ForeignKey;
+import liquibase.structure.core.Index;
+import liquibase.structure.core.Relation;
+import liquibase.structure.core.Table;
+import liquibase.structure.core.UniqueConstraint;
public class IndexSnapshotGenerator extends HibernateSnapshotGenerator {
@@ -85,9 +90,9 @@ public class IndexSnapshotGenerator extends HibernateSnapshotGenerator {
for (var selectable : hibernateIndex.getSelectables()) {
org.hibernate.mapping.Column hibernateColumn = (org.hibernate.mapping.Column) selectable;
String hibernateOrder = hibernateIndex.getSelectableOrderMap().get(hibernateColumn);
- Boolean descending = HIBERNATE_ORDER_ASC.equals(hibernateOrder)
- ? Boolean.FALSE
- : (HIBERNATE_ORDER_DESC.equals(hibernateOrder) ? Boolean.TRUE : null);
+ Boolean descending = HIBERNATE_ORDER_ASC.equals(hibernateOrder) ?
+ Boolean.FALSE :
+ (HIBERNATE_ORDER_DESC.equals(hibernateOrder) ? Boolean.TRUE : null);
index.getColumns()
.add(new Column(hibernateColumn.getName())
.setRelation(table)
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java
index 4eb83cd552..a8bcbe929d 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java
@@ -29,7 +29,7 @@ import liquibase.structure.core.Schema;
import liquibase.structure.core.Table;
import org.hibernate.boot.model.relational.Namespace;
import org.hibernate.boot.spi.MetadataImplementor;
-import org.hibernate.mapping.*;
+import org.hibernate.mapping.ForeignKey;
public class TableSnapshotGenerator extends HibernateSnapshotGenerator {
diff --git a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java
index 507267914d..99e8691c1f 100644
--- a/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java
+++ b/grails-data-hibernate7/dbmigration/src/main/java/liquibase/ext/hibernate/snapshot/UniqueConstraintSnapshotGenerator.java
@@ -87,8 +87,8 @@ public class UniqueConstraintSnapshotGenerator extends HibernateSnapshotGenerato
UniqueConstraint uniqueConstraint = new UniqueConstraint();
uniqueConstraint.setRelation(table);
uniqueConstraint.setClustered(Boolean.FALSE); // No way to set true via Hibernate
- String name = "UC_" + table.getName().toUpperCase(Locale.ROOT)
- + column.getName().toUpperCase(Locale.ROOT) + "_COL";
+ String name = "UC_" + table.getName().toUpperCase(Locale.ROOT) +
+ column.getName().toUpperCase(Locale.ROOT) + "_COL";
if (name.length() > MAX_NAME_LENGTH) {
name = name.substring(START_INDEX, SHORTENED_NAME_LENGTH);
}
diff --git a/grails-data-test-report/build.gradle b/grails-data-test-report/build.gradle
index 0383526f6a..736c6ffd4e 100644
--- a/grails-data-test-report/build.gradle
+++ b/grails-data-test-report/build.gradle
@@ -31,7 +31,14 @@ dependencies {
testReportAggregation project(':grails-datamapping-core-test')
testReportAggregation project(':grails-datamapping-validation')
testReportAggregation project(':grails-datastore-web')
- testReportAggregation project(':grails-data-hibernate7-core')
+}
+
+reporting {
+ reports {
+ testAggregateTestReport(AggregateTestReport) {
+ testSuiteName = 'test'
+ }
+ }
}
tasks.named('check') {
diff --git a/settings.gradle b/settings.gradle
index 373774e018..e81285fb2a 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -251,8 +251,8 @@ include ':grails-data-hibernate7'
findProject(':grails-data-hibernate7').projectDir = new File(settingsDir, 'grails-data-hibernate7/grails-plugin')
//
//TODO: need to publish or have forked version of liquibase
-//TODO: include 'grails-data-hibernate7-dbmigration'
-//TODO: findProject(':grails-data-hibernate7-dbmigration').projectDir = new File(settingsDir, 'grails-data-hibernate7/dbmigration')
+include 'grails-data-hibernate7-dbmigration'
+findProject(':grails-data-hibernate7-dbmigration').projectDir = new File(settingsDir, 'grails-data-hibernate7/dbmigration')
//
include 'grails-data-hibernate7-spring-boot'
findProject(':grails-data-hibernate7-spring-boot').projectDir = new File(settingsDir, 'grails-data-hibernate7/boot-plugin')