From 3e36bc4f6d69e43915da1e779593d2c5beb2f5b3 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Thu, 26 Dec 2024 18:10:53 -0600 Subject: [PATCH] HHH-19003 - Various build script work --- .../annotation-descriptor-generator.gradle | 7 +- build.gradle | 35 +- documentation/documentation.gradle | 73 +-- gradle.properties | 2 + gradle/base-information.gradle | 26 - gradle/databases.gradle | 392 ------------ gradle/java-module.gradle | 576 ------------------ gradle/javadoc.gradle | 81 --- gradle/module.gradle | 13 - gradle/published-java-module.gradle | 62 -- gradle/releasable.gradle | 10 - gradle/relocated-published-java-module.gradle | 68 --- hibernate-agroal/hibernate-agroal.gradle | 8 +- hibernate-c3p0/hibernate-c3p0.gradle | 8 +- .../hibernate-community-dialects.gradle | 8 +- hibernate-core/hibernate-core.gradle | 12 +- hibernate-envers/hibernate-envers.gradle | 10 +- hibernate-graalvm/hibernate-graalvm.gradle | 8 +- hibernate-hikaricp/hibernate-hikaricp.gradle | 8 +- ...ernate-integrationtest-java-modules.gradle | 6 +- hibernate-jcache/hibernate-jcache.gradle | 8 +- hibernate-jfr/hibernate-jfr.gradle | 8 +- .../hibernate-micrometer.gradle | 8 +- hibernate-platform/hibernate-platform.gradle | 16 +- .../hibernate-scan-jandex.gradle | 6 +- hibernate-spatial/hibernate-spatial.gradle | 11 +- hibernate-testing/hibernate-testing.gradle | 8 +- hibernate-ucp/hibernate-ucp.gradle | 8 +- hibernate-vector/hibernate-vector.gradle | 8 +- local-build-plugins/build.gradle | 12 +- .../CompilerStubsArgumentProvider.groovy | 22 + .../main/groovy/HeapDumpPathProvider.groovy | 21 + .../src/main/groovy/local.code-quality.gradle | 135 ++++ .../src/main/groovy/local.databases.gradle | 376 ++++++++++++ .../src/main/groovy/local.java-module.gradle | 335 ++++++++++ .../src/main/groovy/local.javadoc.gradle | 50 ++ .../local.publishing-group-relocation.gradle | 14 +- .../local.publishing-java-module.gradle | 61 ++ .../src/main/groovy/local.publishing.gradle | 22 +- .../{orm/env => build}/HibernateVersion.java | 34 +- .../{orm/env => build}/JpaVersion.java | 13 +- .../org/hibernate/build/OrmBuildDetails.java | 82 +++ .../org/hibernate/build/ReleaseDetails.java | 68 +++ .../org/hibernate/build/aspects/Aspect.java | 16 + .../hibernate/build/aspects/ModuleAspect.java | 43 ++ .../orm/env/EnvironmentProjectPlugin.java | 21 - .../orm/env/EnvironmentSettingsPlugin.java | 11 +- .../org/hibernate/orm/env/OrmBuildConfig.java | 18 + .../orm/post/AbstractJandexAwareTask.java | 3 +- .../hibernate/orm/post/DialectReportTask.java | 5 +- .../properties/SettingsDocGenerationTask.java | 14 +- .../SettingsDocumentationPlugin.java | 5 +- release/release.gradle | 475 +++++++-------- tooling/hibernate-ant/hibernate-ant.gradle | 10 +- .../hibernate-gradle-plugin.gradle | 74 +-- .../hibernate-maven-plugin.gradle | 37 +- .../hibernate-processor.gradle | 31 +- 57 files changed, 1752 insertions(+), 1750 deletions(-) delete mode 100644 gradle/base-information.gradle delete mode 100644 gradle/databases.gradle delete mode 100644 gradle/java-module.gradle delete mode 100644 gradle/javadoc.gradle delete mode 100644 gradle/module.gradle delete mode 100644 gradle/published-java-module.gradle delete mode 100644 gradle/releasable.gradle delete mode 100644 gradle/relocated-published-java-module.gradle create mode 100644 local-build-plugins/src/main/groovy/CompilerStubsArgumentProvider.groovy create mode 100644 local-build-plugins/src/main/groovy/HeapDumpPathProvider.groovy create mode 100644 local-build-plugins/src/main/groovy/local.code-quality.gradle create mode 100644 local-build-plugins/src/main/groovy/local.databases.gradle create mode 100644 local-build-plugins/src/main/groovy/local.java-module.gradle create mode 100644 local-build-plugins/src/main/groovy/local.javadoc.gradle rename gradle/group-relocation.gradle => local-build-plugins/src/main/groovy/local.publishing-group-relocation.gradle (60%) create mode 100644 local-build-plugins/src/main/groovy/local.publishing-java-module.gradle rename gradle/publishing.gradle => local-build-plugins/src/main/groovy/local.publishing.gradle (91%) rename local-build-plugins/src/main/java/org/hibernate/{orm/env => build}/HibernateVersion.java (65%) rename local-build-plugins/src/main/java/org/hibernate/{orm/env => build}/JpaVersion.java (81%) create mode 100644 local-build-plugins/src/main/java/org/hibernate/build/OrmBuildDetails.java create mode 100644 local-build-plugins/src/main/java/org/hibernate/build/ReleaseDetails.java create mode 100644 local-build-plugins/src/main/java/org/hibernate/build/aspects/Aspect.java create mode 100644 local-build-plugins/src/main/java/org/hibernate/build/aspects/ModuleAspect.java delete mode 100644 local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentProjectPlugin.java create mode 100644 local-build-plugins/src/main/java/org/hibernate/orm/env/OrmBuildConfig.java diff --git a/annotation-descriptor-generator/annotation-descriptor-generator.gradle b/annotation-descriptor-generator/annotation-descriptor-generator.gradle index 9af4cdbf2727..33cf9bb3be0e 100644 --- a/annotation-descriptor-generator/annotation-descriptor-generator.gradle +++ b/annotation-descriptor-generator/annotation-descriptor-generator.gradle @@ -1,3 +1,4 @@ -apply from: rootProject.file( 'gradle/java-module.gradle' ) -apply plugin: 'org.hibernate.build.version-injection' - +plugins { + id "local.java-module" + id "org.hibernate.build.version-injection" +} diff --git a/build.gradle b/build.gradle index d98d8687aa86..8bc674ebaff0 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,8 @@ buildscript { plugins { - id 'org.hibernate.build.xjc-jakarta' version '2.0.3' apply false + id "local.module" + id "org.hibernate.build.version-injection" version "2.0.0" apply false id 'org.hibernate.matrix-test' version '3.1.1' apply false id 'org.hibernate.orm.database-service' apply false @@ -37,25 +38,27 @@ plugins { id "com.dorongold.task-tree" version "2.1.1" } -apply from: file( 'gradle/module.gradle' ) - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Release Task - -tasks.register('release') { - description = "The task performed when we are performing a release build. Relies on " + - "the fact that subprojects will appropriately define a release task " + - "themselves if they have any release-related activities to perform" - - doFirst { - def javaVersionsInUse = jdkVersions.allVersions - if (javaVersionsInUse != [JavaLanguageVersion.of(17)].toSet()) { - throw new IllegalStateException("Please use JDK 17 to perform the release. Currently using: ${javaVersionsInUse}") - } - } +// Releasing + +tasks.register( 'releasePrepare' ) { + group "release-prepare" + description "Scripted release 'Release Prepare' stage. " + + "Includes various checks as to the publish-ability of the project: testing, generation, etc. " + + "Sub-projects register their own `releasePrepare` to hook into this stage." + // See `:release:releasePrepare` which does a lot of heavy lifting here } +tasks.register( 'releasePerform' ) { + group "release-perform" + description "Scripted release 'Release Perform' stage. " + + "Generally this entails publishing artifacts to various servers. " + + "Sub-projects register their own `releasePerform` to hook into this stage." + // See `:release:releasePerform` which does a lot of heavy lifting here +} + + nexusPublishing { repositories { sonatype() diff --git a/documentation/documentation.gradle b/documentation/documentation.gradle index 04ebbeaf49d5..dd6e19eab50b 100644 --- a/documentation/documentation.gradle +++ b/documentation/documentation.gradle @@ -1,10 +1,16 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ import java.util.function.Function import org.asciidoctor.gradle.jvm.AsciidoctorTask import org.asciidoctor.gradle.jvm.pdf.AsciidoctorPdfTask buildscript { - configurations.all { + configurations.configureEach { resolutionStrategy.dependencySubstitution { substitute module( 'com.burgstaller:okhttp-digest:1.10' ) using module( 'io.github.rburgst:okhttp-digest:1.21' @@ -14,6 +20,11 @@ buildscript { } plugins { + id "local.module" + id "local.javadoc" + + id "org.hibernate.orm.build.reports" + id 'org.asciidoctor.jvm.convert' version '4.0.2' id 'org.asciidoctor.jvm.pdf' version '4.0.2' id "org.asciidoctor.jvm.gems" version "4.0.2" @@ -25,19 +36,8 @@ repositories { ruby.gems() } -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ - - -apply from: rootProject.file( 'gradle/module.gradle' ) -apply from: rootProject.file( 'gradle/releasable.gradle' ) - -apply plugin: 'org.hibernate.orm.build.reports' - +def hibernateVersion = ormBuildDetails.hibernateVersion +def jpaVersion = ormBuildDetails.jpaVersion defaultTasks 'buildDocs' @@ -174,13 +174,9 @@ dependencies { } -if ( project.ormVersion.isSnapshot ) { +if ( hibernateVersion.isSnapshot ) { // only run the ci build tasks for SNAPSHOT versions tasks.register('ciBuild') { dependsOn clean } - tasks.release.enabled false -} -else { - tasks.release.dependsOn clean } @@ -229,9 +225,6 @@ def aggregateJavadocsTask = tasks.register( "javadoc", Javadoc ) { } } -apply from: rootProject.file( 'gradle/javadoc.gradle' ) - - asciidoctorj { requires 'rouge' modules { @@ -242,10 +235,10 @@ asciidoctorj { attributes icons: 'font', experimental: true, 'source-highlighter': 'rouge', - majorMinorVersion: rootProject.ormVersion.family, - fullVersion: rootProject.ormVersion.fullName, + majorMinorVersion: hibernateVersion.family, + fullVersion: hibernateVersion.fullName, javaCompatibleVersions: jdks.versions.compatible.get(), - jakartaJpaVersion: rootProject.jakartaJpaVersion, + jakartaJpaVersion: jpaVersion.name, jdbcVersion: jdks.versions.jdbc.get() options logDocuments: true @@ -257,7 +250,7 @@ asciidoctorj { def renderTopicalGuideHtmlTask = tasks.register( 'renderTopicalGuideHtml', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the Topical Guides in HTML format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion sourceDir = file( 'src/main/asciidoc/topical' ) outputDir = new File( "$buildDir/asciidoc/topical/html_single" ) @@ -295,7 +288,7 @@ def buildTutorialZipTask = tasks.register( 'buildTutorialZip', Zip ) { task -> def renderGettingStartedGuideHtmlTask = tasks.register( 'renderGettingStartedGuideHtmlTask', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the Getting Started Guides (quickstarts) in HTML format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion finalizedBy buildTutorialZipTask sourceDir = file( 'src/main/asciidoc/quickstart/guides' ) @@ -324,7 +317,7 @@ def renderGettingStartedGuideHtmlTask = tasks.register( 'renderGettingStartedGui def renderGettingStartedGuidePdfTask = tasks.register( 'renderGettingStartedGuidePdf', AsciidoctorPdfTask ) { task -> group = "Documentation" description = 'Renders the Getting Started Guides in PDF format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion baseDir = file( 'src/main/asciidoc/quickstart/guides' ) @@ -348,7 +341,7 @@ def renderGettingStartedGuidesTask = tasks.register( 'renderGettingStartedGuides def renderIntroductionHtmlTask = tasks.register( 'renderIntroductionHtml', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the Introduction in HTML format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion sourceDir = file( 'src/main/asciidoc/introduction' ) sources 'Hibernate_Introduction.adoc' @@ -379,7 +372,7 @@ def renderIntroductionHtmlTask = tasks.register( 'renderIntroductionHtml', Ascii def renderIntroductionPdfTask = tasks.register( 'renderIntroductionPdf', AsciidoctorPdfTask ) { task -> group = "Documentation" description = 'Renders the Introduction in PDF format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion baseDir = file( 'src/main/asciidoc/introduction' ) @@ -407,7 +400,7 @@ def renderQueryLanguageGuideHtmlTask = tasks.register( 'renderQueryLanguageGuide task.group = "Documentation" task.description = 'Renders the Query Language document in HTML format using Asciidoctor.' - task.inputs.property "hibernate-version", project.ormVersion + task.inputs.property "hibernate-version", hibernateVersion task.sourceDir = file( 'src/main/asciidoc/querylanguage' ) task.sources 'Hibernate_Query_Language.adoc' @@ -439,7 +432,7 @@ def renderQueryLanguageGuidePdfTask = tasks.register( 'renderQueryLanguageGuideP group = "Documentation" description = 'Renders the Query Language document in PDF format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion sourceDir = file( 'src/main/asciidoc/querylanguage' ) baseDir = file( 'src/main/asciidoc/querylanguage' ) @@ -455,7 +448,7 @@ def renderRepositoriesHtmlTask = tasks.register( 'renderRepositoriesHtml', Ascii task.group = "Documentation" task.description = 'Renders the Hibernate Data Repositories document in HTML format using Asciidoctor.' - task.inputs.property "hibernate-version", project.ormVersion + task.inputs.property "hibernate-version", hibernateVersion task.sourceDir = file( 'src/main/asciidoc/repositories' ) task.sources 'Hibernate_Data_Repositories.adoc' @@ -487,7 +480,7 @@ def renderRepositoriesPdfTask = tasks.register( 'renderRepositoriesPdf', Asciido group = "Documentation" description = 'Renders the Hibernate Data Repositories document in PDF format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion sourceDir = file( 'src/main/asciidoc/repositories' ) baseDir = file( 'src/main/asciidoc/repositories' ) @@ -667,7 +660,7 @@ def generateSettingsDocTask = tasks.named( "generateSettingsDoc" ) { def renderUserGuideHtmlTask = tasks.register( 'renderUserGuideHtml', AsciidoctorTask ) { task -> group = "Documentation" description = 'Renders the User Guides in HTML format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion inputs.file( generateSettingsDocTask.get().outputFile ) dependsOn generateSettingsDocTask, generateDialectTableReport @@ -712,7 +705,7 @@ def renderUserGuidesTask = tasks.register( 'renderUserGuides' ) { task -> def renderIntegrationGuideHtmlTask = tasks.register( "renderIntegrationGuideHtml", AsciidoctorTask ) { task-> group = "Documentation" description = 'Renders the User Guides in HTML format using Asciidoctor.' - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion sourceDir = file( 'src/main/asciidoc/integrationguide' ) sources { @@ -755,7 +748,7 @@ def copyMigrationGuideTask = tasks.register( "copyMigrationGuide", Copy ) {task group = "Documentation" description = "Copies migration-guide.adoc in preparation for rendering." - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion from rootProject.layout.projectDirectory.file( "migration-guide.adoc" ) into migrationGuideSourceStagingDir @@ -766,7 +759,7 @@ def renderMigrationGuideTask = tasks.register( "renderMigrationGuide", Asciidoct description = "Renders the Migration Guide in HTML format using Asciidoctor." dependsOn copyMigrationGuideTask - inputs.property "hibernate-version", project.ormVersion + inputs.property "hibernate-version", hibernateVersion sourceDir = migrationGuideSourceStagingDir @@ -794,7 +787,7 @@ def renderLoggingReportTask = tasks.register( 'renderLoggingReport', Asciidoctor task.description = 'Renders the logging report (generated LoggingReportTask) by in HTML format using Asciidoctor.' task.dependsOn "generateLoggingReport" - task.inputs.property "version", project.ormVersion + task.inputs.property "version", hibernateVersion task.sourceDir = layout.buildDirectory.dir( 'orm/generated/logging' ) task.sources 'logging.adoc' @@ -820,7 +813,7 @@ def renderDialectReportTask = tasks.register( 'renderDialectReport', Asciidoctor task.dependsOn "generateDialectReport" task.dependsOn "generateDialectTableReport" - task.inputs.property "version", project.ormVersion + task.inputs.property "version", hibernateVersion task.sourceDir = layout.buildDirectory.dir( 'orm/generated/dialect' ) task.sources 'dialect.adoc' diff --git a/gradle.properties b/gradle.properties index 199ddfd524b9..70ee1d9a77bb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,5 @@ +db=h2 + # Keep all these properties in sync unless you know what you are doing! # We set '-Dlog4j2.disableJmx=true' to prevent classloader leaks triggered by the logger. # (Some of these settings need to be repeated in the test.jvmArgs blocks of each module) diff --git a/gradle/base-information.gradle b/gradle/base-information.gradle deleted file mode 100644 index 70fab5ea80b2..000000000000 --- a/gradle/base-information.gradle +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ - -apply plugin: 'base' -apply plugin: 'org.hibernate.orm.build.env-project' - -buildscript { - dependencies { - constraints { - classpath("org.apache.logging.log4j:log4j-core") { - version { - strictly("[2.17.1, 3[") - prefer("2.17.1") - } - because('CVE-2021-44228, CVE-2021-45046, CVE-2021-45105, CVE-2021-44832: Log4j vulnerable to remote code execution and other critical security vulnerabilities') - } - } - } -} - -group = 'org.hibernate.orm' -version = project.ormVersion.fullName diff --git a/gradle/databases.gradle b/gradle/databases.gradle deleted file mode 100644 index 55b6314399c1..000000000000 --- a/gradle/databases.gradle +++ /dev/null @@ -1,392 +0,0 @@ -import org.apache.tools.ant.filters.ReplaceTokens - -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ - -// build a map of the database settings to use. -ext { - db = project.hasProperty('db') ? project.getProperty('db') : 'h2' - dbHost = System.getProperty( 'dbHost', 'localhost' ) - dbService = System.getProperty( 'dbService', '' ) - runID = System.getProperty( 'runID', '' ) - dbBundle = [ - h2 : [ - 'db.dialect' : 'org.hibernate.dialect.H2Dialect', - 'jdbc.driver': 'org.h2.Driver', - 'jdbc.user' : 'sa', - 'jdbc.pass' : '', - 'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE', - 'jdbc.datasource' : 'org.h2.Driver', -// 'jdbc.datasource' : 'org.h2.jdbcx.JdbcDataSource', - 'connection.init_sql' : '', - 'hibernate.dialect.native_param_markers' : 'true' - ], - hsqldb : [ - 'db.dialect' : 'org.hibernate.dialect.HSQLDialect', - 'jdbc.driver': 'org.hsqldb.jdbc.JDBCDriver', - 'jdbc.user' : 'sa', - 'jdbc.pass' : '', - 'jdbc.url' : 'jdbc:hsqldb:mem:test', - 'jdbc.datasource' : 'org.hsqldb.jdbc.JDBCDriver', -// 'jdbc.datasource' : 'org.hsqldb.jdbc.JDBCDataSource', - 'connection.init_sql' : '' - ], - derby : [ - 'db.dialect' : 'org.hibernate.dialect.DerbyDialect', - 'jdbc.driver': 'org.apache.derby.iapi.jdbc.AutoloadedDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:derby:memory:;databaseName=hibernate_orm_test;create=true', - 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDriver', -// 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDataSource', - 'connection.init_sql' : '' - ], - derby_old : [ - 'db.dialect' : 'org.hibernate.dialect.DerbyDialect', - 'jdbc.driver': 'org.apache.derby.jdbc.EmbeddedDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:derby:memory:;databaseName=hibernate_orm_test;create=true', - 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDriver', -// 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDataSource', - 'connection.init_sql' : '' - ], - pgsql : [ - 'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect', - 'jdbc.driver': 'org.postgresql.Driver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com - 'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', - 'jdbc.datasource' : 'org.postgresql.Driver', -// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', - 'connection.init_sql' : '' - ], - pgsql_ci : [ - 'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect', - 'jdbc.driver': 'org.postgresql.Driver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com - 'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', - 'jdbc.datasource' : 'org.postgresql.Driver', -// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', - 'connection.init_sql' : '' - ], - edb_ci : [ - 'db.dialect' : 'org.hibernate.dialect.PostgresPlusDialect', - 'jdbc.driver': 'org.postgresql.Driver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com - 'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', - 'jdbc.datasource' : 'org.postgresql.Driver', -// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', - 'connection.init_sql' : '' - ], - sybase_ci : [ - 'db.dialect' : 'org.hibernate.dialect.SybaseASEDialect', - 'jdbc.driver': 'net.sourceforge.jtds.jdbc.Driver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - // Disable prepared statement caching to avoid issues with changing schemas - 'jdbc.url' : 'jdbc:jtds:sybase://' + dbHost + ':9000/hibernate_orm_test;maxStatements=0;cacheMetaData=false', - 'jdbc.datasource' : 'net.sourceforge.jtds.jdbc.Driver', -// 'jdbc.datasource' : 'net.sourceforge.jtds.jdbcx.JtdsDataSource', - 'connection.init_sql' : 'set ansinull on' - ], - sybase_jconn_ci : [ - 'db.dialect' : 'org.hibernate.dialect.SybaseASEDialect', - 'jdbc.driver': 'com.sybase.jdbc4.jdbc.SybDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - // Disable prepared statement caching to avoid issues with changing schemas - 'jdbc.url' : 'jdbc:sybase:Tds:' + dbHost + ':9000/hibernate_orm_test', - 'jdbc.datasource' : 'com.sybase.jdbc4.jdbc.SybDriver', -// 'jdbc.datasource' : 'com.sybase.jdbc4.jdbc.SybDataSource', - 'connection.init_sql' : 'set ansinull on set quoted_identifier on' - ], - mysql : [ - 'db.dialect' : 'org.hibernate.dialect.MySQLDialect', - 'jdbc.driver': 'com.mysql.cj.jdbc.Driver', - 'jdbc.user' : 'hibernateormtest', - 'jdbc.pass' : 'hibernateormtest', - 'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test', - 'jdbc.datasource' : 'com.mysql.jdbc.Driver', -// 'jdbc.datasource' : 'com.mysql.cj.jdbc.MysqlDataSource', - 'connection.init_sql' : '' - ], - mysql_ci : [ - 'db.dialect' : 'org.hibernate.dialect.MySQLDialect', - 'jdbc.driver': 'com.mysql.cj.jdbc.Driver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true', - 'jdbc.datasource' : 'com.mysql.jdbc.Driver', -// 'jdbc.datasource' : 'com.mysql.cj.jdbc.MysqlDataSource', - 'connection.init_sql' : '' - ], - mariadb : [ - 'db.dialect' : 'org.hibernate.dialect.MariaDBDialect', - 'jdbc.driver': 'org.mariadb.jdbc.Driver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test', - 'jdbc.datasource' : 'org.mariadb.jdbc.Driver', -// 'jdbc.datasource' : 'org.mariadb.jdbc.MariaDbDataSource', - 'connection.init_sql' : '' - ], - mariadb_ci : [ - 'db.dialect' : 'org.hibernate.dialect.MariaDBDialect', - 'jdbc.driver': 'org.mariadb.jdbc.Driver', - 'jdbc.user' : 'root', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test', - 'jdbc.datasource' : 'org.mariadb.jdbc.Driver', -// 'jdbc.datasource' : 'org.mariadb.jdbc.MariaDbDataSource', - 'connection.init_sql' : '' - ], - tidb : [ - 'db.dialect' : 'org.hibernate.dialect.TiDBDialect', - 'jdbc.driver': 'com.mysql.jdbc.Driver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:mysql://' + dbHost + ':4000/hibernate_orm_test', - 'jdbc.datasource' : 'com.mysql.jdbc.Driver', -// 'jdbc.datasource' : 'com.mysql.cj.jdbc.MysqlDataSource', - 'connection.init_sql' : '' - ], - oracle : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xepdb1', - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_ci : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/freepdb1', - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_xe_ci : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xepdb1', - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_legacy_ci : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - // For 11 version that doesn't have any XEPDB1 database service - 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE', - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_cloud_autonomous_tls : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test_' + runID, - 'jdbc.pass' : 'Oracle_19_Password', - // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). - // - // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: - // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html - 'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=5)(retry_delay=1)(address=(protocol=tcps)(port=1521)(host=' + dbHost + '.oraclecloud.com))(connect_data=(service_name=' + dbService + '_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))?oracle.jdbc.enableQueryResultCache=false&oracle.jdbc.thinForceDNSLoadBalancing=true&tcp.nodelay=yes', - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_cloud_autonomous : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test_' + runID, - 'jdbc.pass' : 'Oracle_19_Password', - // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). - // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: - // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html - 'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=5)(retry_delay=1)(address=(protocol=tcp)(port=1521)(host=' + dbHost + '.oraclevcn.com))(connect_data=(service_name=' + dbService + '_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))?oracle.jdbc.enableQueryResultCache=false&oracle.jdbc.thinForceDNSLoadBalancing=true&tcp.nodelay=yes', - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_cloud_db19c : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test_' + runID, - 'jdbc.pass' : 'Oracle_19_Password', - // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). - // - // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: - // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html - 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService, - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_cloud_db21c : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test_' + runID, - 'jdbc.pass' : 'Oracle_21_Password', - // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). - // - // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: - // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html - 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService, - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - oracle_cloud_db23c : [ - 'db.dialect' : 'org.hibernate.dialect.OracleDialect', - 'jdbc.driver': 'oracle.jdbc.OracleDriver', - 'jdbc.user' : 'hibernate_orm_test_' + runID, - 'jdbc.pass' : 'Oracle_23_Password', - // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). - // - // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: - // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html - 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService, - 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', -// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', - 'connection.init_sql' : '' - ], - mssql : [ - 'db.dialect' : 'org.hibernate.dialect.SQLServerDialect', - 'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver', - 'jdbc.user' : 'hibernate_orm_test', - 'jdbc.pass' : 'hibernate_orm_test', - 'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';instance=SQLEXPRESS;databaseName=hibernate_orm_test;trustServerCertificate=true', - 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver', -// 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDataSource', - 'connection.init_sql' : '' - ], - mssql_ci : [ - 'db.dialect' : 'org.hibernate.dialect.SQLServerDialect', - 'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver', - 'jdbc.user' : 'sa', - 'jdbc.pass' : 'Hibernate_orm_test', - 'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test;sendTimeAsDatetime=false;trustServerCertificate=true', - 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver', -// 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDataSource', - 'connection.init_sql' : '' - ], - informix : [ - 'db.dialect' : 'org.hibernate.community.dialect.InformixDialect', - 'jdbc.driver': 'com.informix.jdbc.IfxDriver', - 'jdbc.user' : 'informix', - 'jdbc.pass' : 'in4mix', - 'jdbc.url' : 'jdbc:informix-sqli://' + dbHost + ':9088/dev:INFORMIXSERVER=informix;user=informix;password=in4mix;DBDATE=Y4MD-;DELIMIDENT=Y;DB_LOCALE=en_US.utf8', - 'jdbc.datasource' : 'com.informix.jdbc.IfxDriver', -// 'jdbc.datasource' : 'com.informix.jdbcx.IfxDataSource', - 'connection.init_sql' : '' - ], - db2 : [ - 'db.dialect' : 'org.hibernate.dialect.DB2Dialect', - 'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver', - 'jdbc.user' : 'db2inst1', - 'jdbc.pass' : 'db2inst1-pwd', - 'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test', - 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2Driver', -// 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2SimpleDataSource', - 'connection.init_sql' : '' - ], - db2_ci : [ - 'db.dialect' : 'org.hibernate.dialect.DB2Dialect', - 'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver', - 'jdbc.user' : 'orm_test', - 'jdbc.pass' : 'orm_test', - 'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test', - 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2Driver', -// 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2SimpleDataSource', - 'connection.init_sql' : '' - ], - hana_cloud : [ - 'db.dialect' : 'org.hibernate.dialect.HANADialect', - 'jdbc.driver': 'com.sap.db.jdbc.Driver', - 'jdbc.user' : 'HIBERNATE_TEST', - 'jdbc.pass' : 'H1bernate_test', - // Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html - 'jdbc.url' : 'jdbc:sap://' + dbHost + ':443/?encrypt=true&validateCertificate=false&statementCacheSize=0', - 'jdbc.datasource' : 'com.sap.db.jdbc.Driver', -// 'jdbc.datasource' : 'com.sap.db.jdbcext.HanaDataSource', - 'connection.init_sql' : '' - ], - hana_ci : [ - 'db.dialect' : 'org.hibernate.dialect.HANADialect', - 'jdbc.driver': 'com.sap.db.jdbc.Driver', - 'jdbc.user' : 'SYSTEM', - 'jdbc.pass' : 'H1bernate_test', - // Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html - 'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0', - 'jdbc.datasource' : 'com.sap.db.jdbc.Driver', -// 'jdbc.datasource' : 'com.sap.db.jdbcext.HanaDataSource', - 'connection.init_sql' : '' - ], - cockroachdb : [ - 'db.dialect' : 'org.hibernate.dialect.CockroachDialect', - // CockroachDB uses the same pgwire protocol as PostgreSQL, so the driver is the same. - 'jdbc.driver': 'org.postgresql.Driver', - 'jdbc.user' : 'root', - 'jdbc.pass' : '', - // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com - 'jdbc.url' : 'jdbc:postgresql://' + dbHost + ':26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', - 'jdbc.datasource' : 'org.postgresql.Driver', -// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', - 'connection.init_sql' : '' - ], - firebird : [ - 'db.dialect' : 'org.hibernate.community.dialect.FirebirdDialect', - 'jdbc.driver': 'org.firebirdsql.jdbc.FBDriver', - 'jdbc.user' : 'sysdba', - 'jdbc.pass' : 'masterkey', - // Overriding default transaction definition (5 seconds instead of infinite wait) to prevent problems in test cleanup - // Expects alias 'hibernate_orm_test' in aliases.conf (FB2.5 and earlier) or databases.conf (FB3.0 and later) - // Created database must either use default character set NONE, or UTF8 with page size 16384 or higher (to prevent issues with indexes due to keysize) - 'jdbc.url' : 'jdbc:firebirdsql://' + dbHost +'/hibernate_orm_test?charSet=utf-8;TRANSACTION_READ_COMMITTED=read_committed,rec_version,wait,lock_timeout=5', - 'jdbc.datasource' : 'org.firebirdsql.jdbc.FBDriver', -// 'jdbc.datasource' : 'org.firebirdsql.jdbc.FBDataSource', - 'connection.init_sql' : '' - ], - altibase : [ - 'db.dialect' : 'org.hibernate.community.dialect.AltibaseDialect', - 'jdbc.driver': 'Altibase.jdbc.driver.AltibaseDriver', - 'jdbc.user' : 'sys', - 'jdbc.pass' : 'manager', - 'connection.init_sql' : '', - 'jdbc.url' : 'jdbc:Altibase://' + dbHost + ':20300/mydb?force_clob_bind=true', - 'jdbc.datasource' : 'Altibase.jdbc.driver.AltibaseDriver' - ], - ] -} - - -def processTestResourcesTask = project.tasks.findByName( 'processTestResources' ) -if ( processTestResourcesTask != null ) { - processTestResourcesTask.inputs.property( 'db', db ) - processTestResourcesTask.inputs.property( 'dbHost', dbHost ) -// processTestResourcesTask.inputs.property( "gradle.libs.versions.h2", project.getProperty( "gradle.libs.versions.h2", "2.1.214" ) ) -// processTestResourcesTask.inputs.property( "gradle.libs.versions.h2gis", project.getProperty( "gradle.libs.versions.h2gis", "2.1.0" ) ) -// processTestResourcesTask.inputs.property( "gradle.libs.versions.hsqldb", project.getProperty( "gradle.libs.versions.hsqldb", "2.7.4" ) ) -// processTestResourcesTask.inputs.property( "gradle.libs.versions.derby", project.getProperty( "gradle.libs.versions.derby", "10.15.2.0" ) ) - processTestResourcesTask.filter( ReplaceTokens, tokens: dbBundle[db] ) -} diff --git a/gradle/java-module.gradle b/gradle/java-module.gradle deleted file mode 100644 index a86dd724eb73..000000000000 --- a/gradle/java-module.gradle +++ /dev/null @@ -1,576 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ - -/** - * Support for modules that contain Java code - */ - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath buildscriptLibs.forbiddenapis - } -} - - -import org.apache.tools.ant.filters.ReplaceTokens - -apply plugin: 'java-library' - -apply from: rootProject.file( 'gradle/module.gradle' ) -apply from: rootProject.file( 'gradle/databases.gradle' ) -apply from: rootProject.file( 'gradle/javadoc.gradle' ) - -apply plugin: 'biz.aQute.bnd.builder' -apply plugin: 'org.hibernate.orm.database-service' -apply plugin: 'org.hibernate.orm.build.java-module' - -apply plugin: 'org.checkerframework' -apply plugin: 'de.thetaphi.forbiddenapis' -apply plugin: 'com.diffplug.spotless' - -apply plugin: "jacoco" -apply plugin: 'build-dashboard' -apply plugin: 'project-report' - - -// Attempt to leverage JetBrain's Gradle extension to automatically define -// `copyResourcesToIntelliJOutFolder` as a "build trigger" on import. -// -// However, see https://github.com/JetBrains/gradle-idea-ext-plugin/issues/8 - -apply plugin: 'org.jetbrains.gradle.plugin.idea-ext' - -ext { - java9ModuleNameBase = project.name.startsWith( 'hibernate-' ) ? name.drop( 'hibernate-'.length() ): name - java9ModuleName = "org.hibernate.orm.$project.java9ModuleNameBase".replace('-','.') - forbiddenAPITargetJDKCompatibility = '11' -} - -if ( !project.description ) { - project.description = "The Hibernate ORM $project.name module" -} - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Reproducible Builds - -// https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives -// Configure archive tasks to produce reproducible archives: -tasks.withType(AbstractArchiveTask).configureEach { - preserveFileTimestamps = false - reproducibleFileOrder = true -} - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Configurations and Dependencies - -configurations.configureEach { - resolutionStrategy.eachDependency { details -> - //Force the "byte buddy agent" version to match the Byte Buddy version - // we use, as Mockito might pull in a mismatched version transitively - if (details.requested.group == "net.bytebuddy" && details.requested.name == 'byte-buddy-agent') { - details.useVersion libs.versions.byteBuddy.get() - } - } -} - -dependencies { - implementation libs.logging - - compileOnly libs.loggingAnnotations - // Used for compiling some Oracle specific JdbcTypes - compileOnly jdbcLibs.oracle - - // JUnit dependencies made up of: - // * JUnit 5 - // * the Jupiter engine which runs JUnit 5 based tests - // * the "vintage" engine - which runs JUnit 3 and 4 based tests - testImplementation testLibs.junit5Api - testImplementation testLibs.junit5Engine - testImplementation testLibs.junit5Params - testImplementation testLibs.junit4 - testImplementation testLibs.junit4Engine - testImplementation testLibs.assertjCore - - testRuntimeOnly testLibs.log4j2 - testRuntimeOnly libs.byteBuddy - - //Databases - testRuntimeOnly jdbcLibs.h2 - testRuntimeOnly jdbcLibs.derby - testRuntimeOnly jdbcLibs.derbyTools - testRuntimeOnly jdbcLibs.hsqldb - testRuntimeOnly jdbcLibs.postgresql - testRuntimeOnly jdbcLibs.mssql - testRuntimeOnly jdbcLibs.informix - testRuntimeOnly jdbcLibs.cockroachdb - testRuntimeOnly jdbcLibs.sybase - testRuntimeOnly rootProject.fileTree(dir: 'drivers', include: '*.jar') - - // Since both the DB2 driver and HANA have a package "net.jpountz" we have to add dependencies conditionally - // This is due to the "no split-packages" requirement of Java 9+ - - if ( db.startsWith( 'db2' ) ) { - testRuntimeOnly jdbcLibs.db2 - } - else if ( db.startsWith( 'hana' ) ) { - testRuntimeOnly jdbcLibs.hana - } - else if ( db.startsWith( 'mysql' ) || db.startsWith( 'tidb' ) ) { - testRuntimeOnly jdbcLibs.mysql - } - else if ( db.startsWith( 'mariadb' ) ) { - testRuntimeOnly jdbcLibs.mariadb - } - else if ( db.startsWith( 'firebird' ) ) { - testRuntimeOnly jdbcLibs.firebird - } - else if ( db.startsWith( 'oracle' ) ) { - testRuntimeOnly jdbcLibs.oracle - testRuntimeOnly jdbcLibs.oracleXml - testRuntimeOnly jdbcLibs.oracleXmlParser - } - else if ( db.startsWith( 'altibase' ) ) { - testRuntimeOnly jdbcLibs.altibase - } - else if ( db.startsWith( 'informix' ) ) { - testRuntimeOnly jdbcLibs.informix - } - - annotationProcessor libs.loggingProcessor - annotationProcessor libs.logging - annotationProcessor libs.loggingAnnotations - - - constraints { - implementation('org.apache.logging.log4j:log4j-core') { - version { - strictly('[2.17.1, 3[') - prefer('2.17.1') - } - because('CVE-2021-44228, CVE-2021-45046, CVE-2021-45105, CVE-2021-44832: Log4j vulnerable to remote code execution and other critical security vulnerabilities') - } - } -} - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Compilation - -tasks.withType( JavaCompile ) { - options.encoding = 'UTF-8' - options.warnings false - options.fork = true - options.forkOptions.memoryMaximumSize = '896m' - - options.compilerArgs += [ - // disable adding @Generated annotation in the logger impls to make - // the logging annotation processor create the same sources each time. - "-Aorg.jboss.logging.tools.addGeneratedAnnotation=false" -// "-nowarn", -// "-encoding", "UTF-8" - ] -} - -tasks.compileJava.dependsOn spotlessApply - -task compile(dependsOn: [compileJava, processResources, compileTestJava, processTestResources] ) - - - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Attach tools JAR to the classpath for byteman tests - -final File toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar") -if ( toolsJar.exists() ) { - dependencies{ - testImplementation files( toolsJar ) - } -} - - - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Testing -class HeapDumpPathProvider implements CommandLineArgumentProvider { - @OutputDirectory - Provider path - - @Override - Iterable asArguments() { - ["-XX:HeapDumpPath=${path.get().asFile.absolutePath}"] - } -} - -tasks.withType( Test.class ).each { test -> - test.useJUnitPlatform() - - test.usesService( project.gradle.sharedServices.registrations.getByName( 'databaseService' ).service ) - - // Byteman needs this property to be set, https://developer.jboss.org/thread/274997 - test.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"] - - test.jvmArgumentProviders.add( - new HeapDumpPathProvider( path: project.layout.buildDirectory.dir("OOM-dump") ) - ) - - test.jvmArgs += [ - '-XX:+HeapDumpOnOutOfMemoryError', - '-XX:MetaspaceSize=256M' - ] - - test.maxHeapSize = '3G' - - test.systemProperties['hibernate.test.validatefailureexpected'] = true - test.systemProperties['hibernate.highlight_sql'] = false - test.systemProperties += System.properties.findAll { it.key.startsWith( "hibernate." ) } - - test.enableAssertions = true - - if ( project.name != 'hibernate-testing' ) { - test.dependsOn ':hibernate-testing:test' - } - - // Allow to exclude specific tests - if ( project.hasProperty( 'excludeTests' ) ) { - test.filter { - excludeTestsMatching project.property('excludeTests').toString() - } - } -} - -sourceSets { - test { - resources { - configure( srcDir('src/test/resources') ) { - filter { - include '*.properties' - include '*.xml' - include '**/*.properties' - include '**/*.xml' - } - } - } - } -} - - -processTestResources { - duplicatesStrategy DuplicatesStrategy.INCLUDE - inputs.property( "db", db ) - inputs.property( "dbHost", dbHost ) - inputs.file( rootProject.file( "gradle/databases.gradle" ) ) - doLast { - copy { - from( sourceSets.test.java.srcDirs ) { - include '**/*.properties' - include '**/*.xml' - } - into sourceSets.test.java.classesDirectory - } - copy { - from file( 'src/test/resources' ) - into file( "${buildDir}/resources/test" ) - exclude 'src/test/resources/hibernate.properties' - } - copy { - from file( 'src/test/resources/hibernate.properties' ) - into file( "${buildDir}/resources/test" ) - filter( ReplaceTokens, tokens: dbBundle[db] ) - } - } -} - -// Keep system properties in sync with gradle.properties! -test { - systemProperty 'user.language', 'en' - systemProperty 'user.country', 'US' - systemProperty 'user.timezone', 'UTC' - systemProperty 'file.encoding', 'UTF-8' - // Needed for AdoptOpenJDK on alpine? The problem is similar to this: https://github.com/mockito/mockito/issues/978 - jvmArgs '-XX:+StartAttachListener' -} - -test { - if ( project.findProperty( 'log-test-progress' )?.toString()?.toBoolean() ) { - // Log a statement for each test. - // Used in the Travis build so that Travis doesn't end up panicking because there's no output for a long time. - testLogging { - events "passed", "skipped", "failed" - exceptionFormat = 'full' - } - } -} - - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Jar - -jar { - manifest { - attributes( - // Basic JAR manifest attributes - 'Specification-Title': project.name, - 'Specification-Version': project.version, - 'Specification-Vendor': 'Hibernate.org', - 'Implementation-Title': project.name, - 'Implementation-Version': project.version, - 'Implementation-Vendor': 'Hibernate.org', - 'Implementation-Vendor-Id': 'org.hibernate', - 'Implementation-Url': 'https://hibernate.org/orm', - - // Java 9 module name - 'Automatic-Module-Name': project.java9ModuleName, - - // Hibernate-specific JAR manifest attributes - 'Hibernate-VersionFamily': project.ormVersion.family, - 'Hibernate-JpaVersion': project.jpaVersion.name, - - // BND Plugin instructions (for OSGi): - '-reproducible': true, - '-noextraheaders': true, - 'Bundle-Name': project.name, - 'Bundle-SymbolicName': project.java9ModuleName, - 'Bundle-Vendor': 'Hibernate.org', - 'Bundle-DocURL': "https://www.hibernate.org/orm/${project.ormVersion.family}", - // This is overridden in some sub-projects - 'Import-Package': [ - // Temporarily support JTA 1.1 -- Karaf and other frameworks still - // use it. Without this, the plugin generates [1.2,2). - 'javax.transaction;version="[1.1,2)"', - // Also import every package referenced in the code - // (note that '*' is resolved at build time to a list of packages) - '*' - ].join( ',' ), - '-exportcontents': "*;version=${project.version}" - ) - } -} - - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// sources - -task sourcesJar(type: Jar) { - from project.sourceSets.main.allSource - manifest { - attributes( - // Basic JAR manifest attributes - 'Specification-Title': project.name, - 'Specification-Version': project.version, - 'Specification-Vendor': 'Hibernate.org', - 'Implementation-Title': project.name, - 'Implementation-Version': project.version, - 'Implementation-Vendor': 'Hibernate.org', - 'Implementation-Vendor-Id': 'org.hibernate', - 'Implementation-Url': 'https://hibernate.org/orm', - - // Hibernate-specific JAR manifest attributes - 'Hibernate-VersionFamily': project.ormVersion.family, - 'Hibernate-JpaVersion': project.jpaVersion.name - ) - } - archiveClassifier.set( 'sources' ) -} - - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Javadoc - -tasks.named( "javadoc", Javadoc ) { - configure( options ) { - windowTitle = "Hibernate Javadocs ($project.name)" - docTitle = "Hibernate Javadocs ($project.name : $project.version)" - } -} - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// IDE - - -/* - The latest versions of IntelliJ copy the test resources into out/test/resources and - use those for its test classpath. Unfortunately, this occurs before the placeholder - in the test config file are substituted with the testing values. - - This behaviour prevents the execution of the hibernate tests from inside the IDE. - - A solution is to enable the 'After Build' Execution of the copyResourcesToIntelliJOutFolder task - from the 'Gradle project' IntelliJ tool window ( The task can be found under hibernate-orm > Task > other) - */ -task copyResourcesToIntelliJOutFolder(type: Task, dependsOn: project.tasks.processTestResources) { - doLast { - copy { - from "$buildDir/resources/test" - into 'out/test/resources' - } - } -} - - - -/* - Use this task to set the current DB in a given module. - - > gradlew sDB -Pdb=mysql - - Afterward, you can run any test from the IDE against that particular DB. - */ -task setDataBase dependsOn( processTestResources, copyResourcesToIntelliJOutFolder ) { - println( "Setting current database to ${db}" ) -} - -tasks.copyResourcesToIntelliJOutFolder.mustRunAfter processTestResources - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Report configs - -tasks.register('enforceRules') { - doLast { - def illegalImport = ~/^import (sun|java.awt|org.slf4j)/ - def missingNewline = ~/^\s*}\s*(else|catch|finally)/ - def lowerEll = ~/\b\d+l\b/ - def equals = ~/boolean +equals\((@?\w+ )*Object \w+\)/ - def hashCode = ~/int +hashCode\(\)/ - def errors = 0 - def tree = fileTree("src/main/java/") - tree.include "**/*.java" - tree.each { file -> - def lineNum = 0 - def shortName = file.path.substring(rootDir.path.length()) - def equalsMinusHashcode = 0 - file.eachLine { line -> - lineNum++ - if (line =~ illegalImport) { - errors++ - logger.error("Illegal import in ${shortName}\n${lineNum}: ${line}") - } - if (line =~ missingNewline) { - errors++ - logger.error("Missing newline in ${shortName}\n${lineNum}: ${line}") - } - if (line =~ lowerEll) { - errors++ - logger.error("Lowercase long literal in ${shortName}\n${lineNum}: ${line}") - } - if (!line.startsWith("//")) { //ignore commented-out code - if (line =~ equals) { - equalsMinusHashcode ++ - } - if (line =~ hashCode) { - equalsMinusHashcode -- - } - } - } - if (equalsMinusHashcode>0) { - errors++ - logger.error("Equals with missing hash code in ${shortName}") - } - if (equalsMinusHashcode<0) { - errors++ - logger.error("Hash code with missing equals in ${shortName}") - } - } - if ( errors>0 ) { - throw new GradleException("Code rules were violated ($errors problems)") - } - } -} - -spotless { - //Don't fail during the check: rather than enforcing guidelines, we use this plugin to fix mistakes automatically. - enforceCheck false - java { - targetExclude( "**/target/**/*.java" ) - licenseHeaderFile rootProject.file( 'spotless.license.java' ) - removeUnusedImports() - indentWithTabs( 4 ) - trimTrailingWhitespace() - endWithNewline() - } -} - -tasks.check.dependsOn enforceRules - -tasks.register( "ciCheck" ) { - // Task used by CI builds - group "verification" - description "Checks for CI environments" - dependsOn tasks.check -} - -gradle.taskGraph.whenReady { - if ( it.hasTask( tasks.ciCheck ) ) { - // These are already enforced by the formatChecks task - tasks.spotlessApply.enabled = false - tasks.spotlessJavaApply.enabled = false - tasks.enforceRules.enabled = false - } -} - -tasks.register( "formatChecks" ) { - // Only runs static code analysis, doesn't require compilation - group "verification" - description "Code style and formatting checks" - - dependsOn tasks.spotlessCheck - dependsOn tasks.enforceRules -} - -class CompilerStubsArgumentProvider implements CommandLineArgumentProvider { - - @InputDirectory - @PathSensitive(PathSensitivity.NONE) - File stubsDir - - @Override - Iterable asArguments() { - { return ["-Astubs=${stubsDir}"]} - } -} - -tasks.withType(JavaCompile).configureEach { task -> - // stubs argument needs to be passed as an absolute path, JavaCompile uses the Worker API which changes the current - // working directory and prevents from using a relative path to locate a project file. - // Using a CommandLineArgumentProvider allows build cache hits when the build cache is relocated. - task.options.compilerArgumentProviders.add(new CompilerStubsArgumentProvider(stubsDir: new File(project.rootDir, "checkerstubs"))) - - if (System.getProperty('APT_DEBUG', 'false') == 'true') { - task.options.forkOptions.jvmArgs += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099'] - } -} - -checkerFramework { - excludeTests = true - checkers = [ - 'org.checkerframework.checker.nullness.NullnessChecker' - ] - extraJavacArgs = [ - '-AsuppressWarnings=initialization', - // stubs is passed directly through options.compilerArgumentProviders - '-AonlyDefs=^org\\.hibernate\\.(jdbc|exception|integrator|processor|service|spi|pretty|property\\.access|stat|engine\\.(config|jndi|profile|spi|transaction)|(action|context|bytecode)\\.spi)\\.' - ] -} - -tasks.forbiddenApisMain { - // unfortunately we currently have many uses of default Locale implicitly (~370) - // which need to be fixed before we can enable the "unsafe" check - //bundledSignatures += ["jdk-system-out", "jdk-non-portable", "jdk-unsafe-${jdkVersions.baseline}"] - bundledSignatures += ["jdk-system-out", "jdk-non-portable"] - - suppressAnnotations += [ - "org.hibernate.internal.build.AllowSysOut", - "org.hibernate.internal.build.AllowPrintStacktrace", - "org.hibernate.internal.build.AllowNonPortable" - ] -} - -tasks.forbiddenApisTest { - enabled = false -} - diff --git a/gradle/javadoc.gradle b/gradle/javadoc.gradle deleted file mode 100644 index b868c2626961..000000000000 --- a/gradle/javadoc.gradle +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ - -apply from: rootProject.file( 'gradle/base-information.gradle' ) - -tasks.named( "javadoc", Javadoc ) { - def currentYear = new GregorianCalendar().get( Calendar.YEAR ) - - inputs.property "ormVersion", project.ormVersion - inputs.property "currentYear", currentYear - - // exclude any generated sources and internal packages - exclude 'org/hibernate/grammars' - include '**/*.java' - - maxMemory = '512m' - - configure( options ) { - quiet() - - // this is the config needed to use asciidoclet for Javadoc rendering. It relies on a build from John's PR @ https://github.com/asciidoctor/asciidoclet/pull/91 - // however, the PR does not work for me in that Javadocs with `@asciidoclet` are not rendered using asciidoc(tor/let). Also tried the preferable `@asciidoc` - // with the same result. Leaving all this config in place however as the outcome is the same as not enabling it. - // todo (6.0) : need to find out why the asciidoclet PR does not work - // - // Travis CI JDK 11 build did not like this -// docletpath = configurations.asciidoclet.files.asType(List) -// doclet = 'org.asciidoctor.Asciidoclet' - - use = true - encoding = 'UTF-8' - - stylesheetFile = rootProject.file( "shared/javadoc/stylesheet.css" ) - bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." - - // The javadoc folder contains cached versions of the respective element-list files to avoid release issues when servers are down - // When upgrading versions of the libraries, don't forget to update the file contents in the repository - linksOffline 'https://docs.oracle.com/en/java/javase/17/docs/api/', "${project.rootDir}/javadoc/javase17" - linksOffline 'https://jakarta.ee/specifications/bean-validation/3.0/apidocs/', "${project.rootDir}/javadoc/jakarta-validation-3.0" - linksOffline 'https://jakarta.ee/specifications/cdi/4.0/apidocs/', "${project.rootDir}/javadoc/jakarta-cdi-4.0" - linksOffline 'https://jakarta.ee/specifications/platform/9/apidocs/', "${project.rootDir}/javadoc/jakarta-platform-9" - linksOffline 'https://www.javadoc.io/doc/javax.cache/cache-api/1.0.0/', "${project.rootDir}/javadoc/javax-cache-1.0" - - tags( - 'apiNote:a:API Note:', - 'implSpec:a:Implementation Specification:', - 'implNote:a:Implementation Note:', - 'todo:X', - 'remove:a:Removal (deprecation):', - 'settingDefault:f:Default Value:' - ) - - addBooleanOption('Xdoclint:none', true) - } -} - -tasks.register("javadocJar", Jar) { - from project.tasks.javadoc.outputs - manifest { - attributes( - // Basic JAR manifest attributes - 'Specification-Title': project.name, - 'Specification-Version': project.version, - 'Specification-Vendor': 'Hibernate.org', - 'Implementation-Title': project.name, - 'Implementation-Version': project.version, - 'Implementation-Vendor': 'Hibernate.org', - 'Implementation-Vendor-Id': 'org.hibernate', - 'Implementation-Url': 'https://hibernate.org/orm', - - // Hibernate-specific JAR manifest attributes - 'Hibernate-VersionFamily': project.ormVersion.family, - 'Hibernate-JpaVersion': project.jakartaJpaVersion.name - ) - } - archiveClassifier.set( 'javadoc' ) -} diff --git a/gradle/module.gradle b/gradle/module.gradle deleted file mode 100644 index 229fd4a55f7f..000000000000 --- a/gradle/module.gradle +++ /dev/null @@ -1,13 +0,0 @@ -// Applied to all modules (sub-projects) - -apply from: rootProject.file( 'gradle/base-information.gradle' ) - -apply plugin: 'idea' -apply plugin: 'eclipse' - -// minimize changes, at least for now (gradle uses 'build' by default).. -buildDir = "target" - -configurations.all { - exclude group: 'xml-apis', module: 'xml-apis' -} \ No newline at end of file diff --git a/gradle/published-java-module.gradle b/gradle/published-java-module.gradle deleted file mode 100644 index 1f0dfdffc187..000000000000 --- a/gradle/published-java-module.gradle +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html - */ - -apply from: rootProject.file( 'gradle/java-module.gradle' ) -apply from: rootProject.file( 'gradle/publishing.gradle' ) - -tasks.register("publishReleaseArtifacts") { - // mirror for `:release:publishReleaseArtifacts` - dependsOn tasks.release -} - -configurations { - javadocSources { - description = "All Java sources for the project's Javadoc" - canBeConsumed = true - canBeResolved = false - visible = false - } -} - -dependencies { - javadocSources sourceSets.main.allJava -} - -java { - // Configure the Java "software component" to include javadoc and sources jars in addition to the classes jar. - // Ultimately, this component is what makes up the publication for this project. - withJavadocJar() - withSourcesJar() -} - - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Publishing - -var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension -publishingExtension.publications.named("publishedArtifacts", MavenPublication) { - // Add the Java component to the main publication - from components.java -} - - - -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Release / publishing tasks - -tasks.register('ciBuild') { - dependsOn test, tasks.publishToSonatype -} - -tasks.release.dependsOn tasks.test, tasks.publishToSonatype - -tasks.preVerifyRelease.dependsOn build -tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication -tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication - -tasks.publishToSonatype.mustRunAfter test - diff --git a/gradle/releasable.gradle b/gradle/releasable.gradle deleted file mode 100644 index 5ceb774c436f..000000000000 --- a/gradle/releasable.gradle +++ /dev/null @@ -1,10 +0,0 @@ -apply from: rootProject.file( 'gradle/base-information.gradle' ) - -tasks.register('release') { - mustRunAfter ':release:releaseChecks' - enabled !project.ormVersion.isSnapshot -} - -tasks.register('preVerifyRelease') { - dependsOn ':release:preVerifyRelease' -} diff --git a/gradle/relocated-published-java-module.gradle b/gradle/relocated-published-java-module.gradle deleted file mode 100644 index 35b2eecc2ab9..000000000000 --- a/gradle/relocated-published-java-module.gradle +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html. - */ -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) - -publishing { - publications { - // relocation for the published artifacts based on the old groupId - relocationPom( MavenPublication ) { - pom { - name = project.name + ' - relocation' - groupId = 'org.hibernate' - artifactId = project.name - version = project.version - - description = project.description - url = 'https://hibernate.org/orm' - - organization { - name = 'Hibernate.org' - url = 'https://hibernate.org' - } - - licenses { - license { - name = 'GNU Library General Public License v2.1 or later' - url = 'https://www.opensource.org/licenses/LGPL-2.1' - comments = 'See discussion at https://hibernate.org/community/license/ for more details.' - distribution = 'repo' - } - } - - scm { - url = 'https://github.com/hibernate/hibernate-orm' - connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git' - developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git' - } - - developers { - developer { - id = 'hibernate-team' - name = 'The Hibernate Development Team' - organization = 'Hibernate.org' - organizationUrl = 'https://hibernate.org' - } - } - - issueManagement { - system = 'jira' - url = 'https://hibernate.atlassian.net/browse/HHH' - } - - distributionManagement { - relocation { - groupId = 'org.hibernate.orm' - artifactId = project.name - version = project.version - } - } - } - } - } -} - -tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication \ No newline at end of file diff --git a/hibernate-agroal/hibernate-agroal.gradle b/hibernate-agroal/hibernate-agroal.gradle index 69071f20acdc..1a2730e44535 100644 --- a/hibernate-agroal/hibernate-agroal.gradle +++ b/hibernate-agroal/hibernate-agroal.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Integration for Agroal as a ConnectionProvider for Hibernate ORM' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Integration for Agroal as a ConnectionProvider for Hibernate ORM' dependencies { implementation project( ':hibernate-core' ) diff --git a/hibernate-c3p0/hibernate-c3p0.gradle b/hibernate-c3p0/hibernate-c3p0.gradle index fa2c3b712c72..64e39e191def 100644 --- a/hibernate-c3p0/hibernate-c3p0.gradle +++ b/hibernate-c3p0/hibernate-c3p0.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Integration for c3p0 Connection pooling into Hibernate ORM' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Integration for c3p0 Connection pooling into Hibernate ORM' dependencies { implementation project( ':hibernate-core' ) diff --git a/hibernate-community-dialects/hibernate-community-dialects.gradle b/hibernate-community-dialects/hibernate-community-dialects.gradle index 7e19a78ceb20..0ed79a16a4e4 100644 --- a/hibernate-community-dialects/hibernate-community-dialects.gradle +++ b/hibernate-community-dialects/hibernate-community-dialects.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Hibernate\'s community supported dialects' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Hibernate\'s community supported dialects' dependencies { api project( ':hibernate-core' ) diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index c8bc62706b15..e0160fe7cb3f 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -7,17 +7,17 @@ import org.apache.tools.ant.filters.ReplaceTokens plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" + + id "org.hibernate.orm.antlr" id "local-xjc-plugin" + + id "org.hibernate.matrix-test" } description = 'Hibernate\'s core ORM functionality' -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) - -apply plugin: 'org.hibernate.orm.antlr' -apply plugin: 'org.hibernate.matrix-test' - configurations { tests { description = 'Configuration for the produced test jar' diff --git a/hibernate-envers/hibernate-envers.gradle b/hibernate-envers/hibernate-envers.gradle index 40f2e746b0cf..5f474acac11f 100644 --- a/hibernate-envers/hibernate-envers.gradle +++ b/hibernate-envers/hibernate-envers.gradle @@ -5,12 +5,14 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Hibernate\'s entity version (audit/history) support' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) + id "org.hibernate.matrix-test" +} -apply plugin: 'org.hibernate.matrix-test' +description = "Hibernate's entity version (audit/history) support" dependencies { api project( ':hibernate-core' ) diff --git a/hibernate-graalvm/hibernate-graalvm.gradle b/hibernate-graalvm/hibernate-graalvm.gradle index 1c80c90ae6ae..df820f3ece68 100644 --- a/hibernate-graalvm/hibernate-graalvm.gradle +++ b/hibernate-graalvm/hibernate-graalvm.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = "Experimental extension to make it easier to compile applications into a GraalVM native image" +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = "Experimental extension to make it easier to compile applications into a GraalVM native image" dependencies { //No need for transitive dependencies: this is all just metadata to be used as companion jar. diff --git a/hibernate-hikaricp/hibernate-hikaricp.gradle b/hibernate-hikaricp/hibernate-hikaricp.gradle index 76f6b28ae19d..effd4a1b12f5 100644 --- a/hibernate-hikaricp/hibernate-hikaricp.gradle +++ b/hibernate-hikaricp/hibernate-hikaricp.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Integration for HikariCP into Hibernate O/RM' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Integration for HikariCP into Hibernate O/RM' dependencies { implementation project( ':hibernate-core' ) diff --git a/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle b/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle index 7d84aaded595..994c4526826a 100644 --- a/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle +++ b/hibernate-integrationtest-java-modules/hibernate-integrationtest-java-modules.gradle @@ -5,9 +5,11 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Integration tests for running Hibernate ORM in the Java module path' +plugins { + id "local.java-module" +} -apply from: rootProject.file( 'gradle/java-module.gradle' ) +description = 'Integration tests for running Hibernate ORM in the Java module path' // See https://docs.gradle.org/6.7.1/userguide/java_testing.html#blackbox_integration_testing // See https://docs.gradle.org/6.7.1/samples/sample_java_modules_multi_project_with_integration_tests.html diff --git a/hibernate-jcache/hibernate-jcache.gradle b/hibernate-jcache/hibernate-jcache.gradle index d58dd2de3d0c..e0ace86fc430 100644 --- a/hibernate-jcache/hibernate-jcache.gradle +++ b/hibernate-jcache/hibernate-jcache.gradle @@ -1,7 +1,9 @@ -description = 'Integration for javax.cache into Hibernate as a second-level caching service' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Integration for javax.cache into Hibernate as a second-level caching service' dependencies { api project( ':hibernate-core' ) diff --git a/hibernate-jfr/hibernate-jfr.gradle b/hibernate-jfr/hibernate-jfr.gradle index 4544ea8b916f..b9d0ae15a8a2 100644 --- a/hibernate-jfr/hibernate-jfr.gradle +++ b/hibernate-jfr/hibernate-jfr.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Integration for JDK JFR into Hibernate O/RM' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Integration for JDK JFR into Hibernate O/RM' dependencies { implementation project( ':hibernate-core' ) diff --git a/hibernate-micrometer/hibernate-micrometer.gradle b/hibernate-micrometer/hibernate-micrometer.gradle index b3de5010eeb0..461d5cca2a28 100644 --- a/hibernate-micrometer/hibernate-micrometer.gradle +++ b/hibernate-micrometer/hibernate-micrometer.gradle @@ -1,7 +1,9 @@ -description = 'Integration for Micrometer metrics into Hibernate as a metrics collection package' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Integration for Micrometer metrics into Hibernate as a metrics collection package' dependencies { implementation project( ':hibernate-core' ) diff --git a/hibernate-platform/hibernate-platform.gradle b/hibernate-platform/hibernate-platform.gradle index d2147de7a59f..74f2949fc25c 100644 --- a/hibernate-platform/hibernate-platform.gradle +++ b/hibernate-platform/hibernate-platform.gradle @@ -1,12 +1,11 @@ plugins { - id 'java-platform' + id "java-platform" + id "local.module" + id "local.publishing" } description = 'Platform (BOM) for Hibernate ORM dependencies' -apply from: rootProject.file( "gradle/base-information.gradle" ) -apply from: rootProject.file( "gradle/publishing.gradle" ) - dependencies { constraints { api project( ":hibernate-core" ) @@ -67,9 +66,10 @@ publishingExtension.publications.named("publishedArtifacts", MavenPublication) { from components.javaPlatform } -tasks.register("publishReleaseArtifacts") { - // mirror for `:release:publishReleaseArtifacts` - dependsOn tasks.release +tasks.register("releasePerform") { + group "release" + description "See :release:releasePerform for details. Here we hook in publishing to Sonatype" + + dependsOn tasks.publishToSonatype } -tasks.release.dependsOn tasks.publishToSonatype diff --git a/hibernate-scan-jandex/hibernate-scan-jandex.gradle b/hibernate-scan-jandex/hibernate-scan-jandex.gradle index e016a3b60fc5..85c99fb39234 100644 --- a/hibernate-scan-jandex/hibernate-scan-jandex.gradle +++ b/hibernate-scan-jandex/hibernate-scan-jandex.gradle @@ -1,6 +1,8 @@ -description = 'Integrate support for Jandex into Hibernate O/RM' +plugins { + id "local.publishing-java-module" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) +description = 'Integrate support for Jandex into Hibernate O/RM' dependencies { api project( ':hibernate-core' ) diff --git a/hibernate-spatial/hibernate-spatial.gradle b/hibernate-spatial/hibernate-spatial.gradle index f93d2a0c95b4..32e60ec9beeb 100644 --- a/hibernate-spatial/hibernate-spatial.gradle +++ b/hibernate-spatial/hibernate-spatial.gradle @@ -5,13 +5,14 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Integrate support for Spatial/GIS data into Hibernate O/RM' - -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" -apply plugin: 'org.hibernate.matrix-test' + id "org.hibernate.matrix-test" +} +description = 'Integrate support for Spatial/GIS data into Hibernate O/RM' dependencies { api project( ':hibernate-core' ) diff --git a/hibernate-testing/hibernate-testing.gradle b/hibernate-testing/hibernate-testing.gradle index f3458967f31f..9135e2b0dfc3 100644 --- a/hibernate-testing/hibernate-testing.gradle +++ b/hibernate-testing/hibernate-testing.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Support for testing Hibernate ORM functionality' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Support for testing Hibernate ORM functionality' dependencies { api project( ':hibernate-core' ) diff --git a/hibernate-ucp/hibernate-ucp.gradle b/hibernate-ucp/hibernate-ucp.gradle index bab89e3ca2bd..8b981b4bde3b 100644 --- a/hibernate-ucp/hibernate-ucp.gradle +++ b/hibernate-ucp/hibernate-ucp.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Integration for Oracle UCP into Hibernate O/RM' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Integration for Oracle UCP into Hibernate O/RM' dependencies { implementation project( ':hibernate-core' ) diff --git a/hibernate-vector/hibernate-vector.gradle b/hibernate-vector/hibernate-vector.gradle index 7806a0d0a3e5..09334a628165 100644 --- a/hibernate-vector/hibernate-vector.gradle +++ b/hibernate-vector/hibernate-vector.gradle @@ -5,10 +5,12 @@ * See the lgpl.txt file in the root directory or . */ -description = 'Hibernate\'s extensions for vector support' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) +description = 'Hibernate\'s extensions for vector support' dependencies { api project( ':hibernate-core' ) diff --git a/local-build-plugins/build.gradle b/local-build-plugins/build.gradle index b06a32cbe9c9..d1296e267415 100644 --- a/local-build-plugins/build.gradle +++ b/local-build-plugins/build.gradle @@ -6,7 +6,7 @@ */ plugins { id "java-gradle-plugin" - id "groovy" + id 'groovy-gradle-plugin' } repositories { @@ -29,6 +29,8 @@ dependencies { implementation 'org.eclipse:yasson:2.0.4' implementation 'org.jsoup:jsoup:1.15.3' + implementation "de.thetaphi:forbiddenapis:3.8" + implementation "org.apache.maven:maven-embedder:3.9.9" implementation "org.apache.maven:maven-compat:3.9.9" implementation "org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18" @@ -76,10 +78,6 @@ gradlePlugin { id = 'org.hibernate.orm.build.jdks-settings' implementationClass = 'org.hibernate.orm.toolchains.JdkVersionSettingsPlugin' } - envProject { - id = 'org.hibernate.orm.build.env-project' - implementationClass = 'org.hibernate.orm.env.EnvironmentProjectPlugin' - } settingsDocumentationPlugin { id = 'org.hibernate.orm.build.settings-doc' implementationClass = 'org.hibernate.orm.properties.SettingsDocumentationPlugin' @@ -100,6 +98,10 @@ gradlePlugin { id = "local-xjc-plugin" implementationClass = "org.hibernate.build.xjc.XjcPlugin" } + register("aspect-module") { + id = "local.module" + implementationClass = "org.hibernate.build.aspects.ModuleAspect" + } } } diff --git a/local-build-plugins/src/main/groovy/CompilerStubsArgumentProvider.groovy b/local-build-plugins/src/main/groovy/CompilerStubsArgumentProvider.groovy new file mode 100644 index 000000000000..33e8b017abca --- /dev/null +++ b/local-build-plugins/src/main/groovy/CompilerStubsArgumentProvider.groovy @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +import org.gradle.api.tasks.InputDirectory +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity +import org.gradle.process.CommandLineArgumentProvider + +/** + * @author Steve Ebersole + */ +class CompilerStubsArgumentProvider implements CommandLineArgumentProvider { + @InputDirectory + @PathSensitive(PathSensitivity.NONE) + File stubsDir + + @Override + Iterable asArguments() { + { return ["-Astubs=${stubsDir}"]} + } +} \ No newline at end of file diff --git a/local-build-plugins/src/main/groovy/HeapDumpPathProvider.groovy b/local-build-plugins/src/main/groovy/HeapDumpPathProvider.groovy new file mode 100644 index 000000000000..65eef1193fb0 --- /dev/null +++ b/local-build-plugins/src/main/groovy/HeapDumpPathProvider.groovy @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +import org.gradle.api.file.Directory +import org.gradle.api.provider.Provider +import org.gradle.api.tasks.OutputDirectory +import org.gradle.process.CommandLineArgumentProvider + +/** + * @author Steve Ebersole + */ +class HeapDumpPathProvider implements CommandLineArgumentProvider { + @OutputDirectory + Provider path + + @Override + Iterable asArguments() { + ["-XX:HeapDumpPath=${path.get().asFile.absolutePath}"] + } +} diff --git a/local-build-plugins/src/main/groovy/local.code-quality.gradle b/local-build-plugins/src/main/groovy/local.code-quality.gradle new file mode 100644 index 000000000000..66308b2978e6 --- /dev/null +++ b/local-build-plugins/src/main/groovy/local.code-quality.gradle @@ -0,0 +1,135 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ + +plugins { + id "org.checkerframework" + id "de.thetaphi.forbiddenapis" + id "com.diffplug.spotless" +} + +tasks.register( "ciCheck" ) { + // Task used by CI builds + group "verification" + description "Checks for CI environments" + dependsOn tasks.check +} + +gradle.taskGraph.whenReady { + if ( it.hasTask( tasks.ciCheck ) ) { + // These are already enforced by the formatChecks task + tasks.spotlessApply.enabled = false + tasks.spotlessJavaApply.enabled = false + tasks.enforceRules.enabled = false + } +} + +tasks.register( "formatChecks" ) { + // Only runs static code analysis, doesn't require compilation + group "verification" + description "Code style and formatting checks" + + dependsOn tasks.spotlessCheck + dependsOn tasks.enforceRules +} + + +def enforceRulesTask = tasks.register('enforceRules') { + inputs.dir("src/main/java") + doLast { + def illegalImport = ~/^import (sun|java.awt|org.slf4j)/ + def missingNewline = ~/^\s*}\s*(else|catch|finally)/ + def lowerEll = ~/\b\d+l\b/ + def equals = ~/boolean +equals\((@?\w+ )*Object \w+\)/ + def hashCode = ~/int +hashCode\(\)/ + def errors = 0 + def tree = fileTree("src/main/java/") + tree.include "**/*.java" + tree.each { file -> + def lineNum = 0 + def shortName = file.path.substring(rootDir.path.length()) + def equalsMinusHashcode = 0 + file.eachLine { line -> + lineNum++ + if (line =~ illegalImport) { + errors++ + logger.error("Illegal import in ${shortName}\n${lineNum}: ${line}") + } + if (line =~ missingNewline) { + errors++ + logger.error("Missing newline in ${shortName}\n${lineNum}: ${line}") + } + if (line =~ lowerEll) { + errors++ + logger.error("Lowercase long literal in ${shortName}\n${lineNum}: ${line}") + } + if (!line.startsWith("//")) { //ignore commented-out code + if (line =~ equals) { + equalsMinusHashcode++ + } + if (line =~ hashCode) { + equalsMinusHashcode-- + } + } + } + if (equalsMinusHashcode > 0) { + errors++ + logger.error("Equals with missing hash code in ${shortName}") + } + if (equalsMinusHashcode < 0) { + errors++ + logger.error("Hash code with missing equals in ${shortName}") + } + } + if (errors > 0) { + throw new GradleException("Code rules were violated ($errors problems)") + } + } +} + +tasks.check.dependsOn enforceRulesTask + +spotless { + //Don't fail during the check: rather than enforcing guidelines, we use this plugin to fix mistakes automatically. + enforceCheck false + java { + targetExclude( "**/target/**/*.java" ) + licenseHeaderFile rootProject.file( 'spotless.license.java' ) + removeUnusedImports() + indentWithTabs( 4 ) + trimTrailingWhitespace() + endWithNewline() + } +} + +tasks.compileJava.dependsOn tasks.spotlessJavaApply + +checkerFramework { + excludeTests = true + checkers = [ + 'org.checkerframework.checker.nullness.NullnessChecker' + ] + extraJavacArgs = [ + '-AsuppressWarnings=initialization', + // stubs is passed directly through options.compilerArgumentProviders + '-AonlyDefs=^org\\.hibernate\\.(jdbc|exception|integrator|processor|service|spi|pretty|property\\.access|stat|engine\\.(config|jndi|profile|spi|transaction)|(action|context|bytecode)\\.spi)\\.' + ] +} + +tasks.forbiddenApisMain { + // unfortunately we currently have many uses of default Locale implicitly (~370) + // which need to be fixed before we can enable the "unsafe" check + //bundledSignatures += ["jdk-system-out", "jdk-non-portable", "jdk-unsafe-${jdkVersions.baseline}"] + bundledSignatures += ["jdk-system-out", "jdk-non-portable"] + + suppressAnnotations += [ + "org.hibernate.internal.build.AllowSysOut", + "org.hibernate.internal.build.AllowPrintStacktrace", + "org.hibernate.internal.build.AllowNonPortable" + ] +} + +tasks.forbiddenApisTest { + enabled = false +} diff --git a/local-build-plugins/src/main/groovy/local.databases.gradle b/local-build-plugins/src/main/groovy/local.databases.gradle new file mode 100644 index 000000000000..4c8b94a0858d --- /dev/null +++ b/local-build-plugins/src/main/groovy/local.databases.gradle @@ -0,0 +1,376 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ + +ext { + db = project.hasProperty('db') ? project.getProperty('db') : 'h2' + dbHost = System.getProperty( 'dbHost', 'localhost' ) + dbService = System.getProperty( 'dbService', '' ) + runID = System.getProperty( 'runID', '' ) + + dbBundle = [ + h2 : [ + 'db.dialect' : 'org.hibernate.dialect.H2Dialect', + 'jdbc.driver': 'org.h2.Driver', + 'jdbc.user' : 'sa', + 'jdbc.pass' : '', + 'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE', + 'jdbc.datasource' : 'org.h2.Driver', +// 'jdbc.datasource' : 'org.h2.jdbcx.JdbcDataSource', + 'connection.init_sql' : '', + 'hibernate.dialect.native_param_markers' : 'true' + ], + hsqldb : [ + 'db.dialect' : 'org.hibernate.dialect.HSQLDialect', + 'jdbc.driver': 'org.hsqldb.jdbc.JDBCDriver', + 'jdbc.user' : 'sa', + 'jdbc.pass' : '', + 'jdbc.url' : 'jdbc:hsqldb:mem:test', + 'jdbc.datasource' : 'org.hsqldb.jdbc.JDBCDriver', +// 'jdbc.datasource' : 'org.hsqldb.jdbc.JDBCDataSource', + 'connection.init_sql' : '' + ], + derby : [ + 'db.dialect' : 'org.hibernate.dialect.DerbyDialect', + 'jdbc.driver': 'org.apache.derby.iapi.jdbc.AutoloadedDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:derby:memory:;databaseName=hibernate_orm_test;create=true', + 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDriver', +// 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDataSource', + 'connection.init_sql' : '' + ], + derby_old : [ + 'db.dialect' : 'org.hibernate.dialect.DerbyDialect', + 'jdbc.driver': 'org.apache.derby.jdbc.EmbeddedDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:derby:memory:;databaseName=hibernate_orm_test;create=true', + 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDriver', +// 'jdbc.datasource' : 'org.apache.derby.jdbc.EmbeddedDataSource', + 'connection.init_sql' : '' + ], + pgsql : [ + 'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect', + 'jdbc.driver': 'org.postgresql.Driver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com + 'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', + 'jdbc.datasource' : 'org.postgresql.Driver', +// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', + 'connection.init_sql' : '' + ], + pgsql_ci : [ + 'db.dialect' : 'org.hibernate.dialect.PostgreSQLDialect', + 'jdbc.driver': 'org.postgresql.Driver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com + 'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', + 'jdbc.datasource' : 'org.postgresql.Driver', +// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', + 'connection.init_sql' : '' + ], + edb_ci : [ + 'db.dialect' : 'org.hibernate.dialect.PostgresPlusDialect', + 'jdbc.driver': 'org.postgresql.Driver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com + 'jdbc.url' : 'jdbc:postgresql://' + dbHost + '/hibernate_orm_test?preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', + 'jdbc.datasource' : 'org.postgresql.Driver', +// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', + 'connection.init_sql' : '' + ], + sybase_ci : [ + 'db.dialect' : 'org.hibernate.dialect.SybaseASEDialect', + 'jdbc.driver': 'net.sourceforge.jtds.jdbc.Driver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + // Disable prepared statement caching to avoid issues with changing schemas + 'jdbc.url' : 'jdbc:jtds:sybase://' + dbHost + ':9000/hibernate_orm_test;maxStatements=0;cacheMetaData=false', + 'jdbc.datasource' : 'net.sourceforge.jtds.jdbc.Driver', +// 'jdbc.datasource' : 'net.sourceforge.jtds.jdbcx.JtdsDataSource', + 'connection.init_sql' : 'set ansinull on' + ], + sybase_jconn_ci : [ + 'db.dialect' : 'org.hibernate.dialect.SybaseASEDialect', + 'jdbc.driver': 'com.sybase.jdbc4.jdbc.SybDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + // Disable prepared statement caching to avoid issues with changing schemas + 'jdbc.url' : 'jdbc:sybase:Tds:' + dbHost + ':9000/hibernate_orm_test', + 'jdbc.datasource' : 'com.sybase.jdbc4.jdbc.SybDriver', +// 'jdbc.datasource' : 'com.sybase.jdbc4.jdbc.SybDataSource', + 'connection.init_sql' : 'set ansinull on set quoted_identifier on' + ], + mysql : [ + 'db.dialect' : 'org.hibernate.dialect.MySQLDialect', + 'jdbc.driver': 'com.mysql.cj.jdbc.Driver', + 'jdbc.user' : 'hibernateormtest', + 'jdbc.pass' : 'hibernateormtest', + 'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test', + 'jdbc.datasource' : 'com.mysql.jdbc.Driver', +// 'jdbc.datasource' : 'com.mysql.cj.jdbc.MysqlDataSource', + 'connection.init_sql' : '' + ], + mysql_ci : [ + 'db.dialect' : 'org.hibernate.dialect.MySQLDialect', + 'jdbc.driver': 'com.mysql.cj.jdbc.Driver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:mysql://' + dbHost + '/hibernate_orm_test?allowPublicKeyRetrieval=true', + 'jdbc.datasource' : 'com.mysql.jdbc.Driver', +// 'jdbc.datasource' : 'com.mysql.cj.jdbc.MysqlDataSource', + 'connection.init_sql' : '' + ], + mariadb : [ + 'db.dialect' : 'org.hibernate.dialect.MariaDBDialect', + 'jdbc.driver': 'org.mariadb.jdbc.Driver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test', + 'jdbc.datasource' : 'org.mariadb.jdbc.Driver', +// 'jdbc.datasource' : 'org.mariadb.jdbc.MariaDbDataSource', + 'connection.init_sql' : '' + ], + mariadb_ci : [ + 'db.dialect' : 'org.hibernate.dialect.MariaDBDialect', + 'jdbc.driver': 'org.mariadb.jdbc.Driver', + 'jdbc.user' : 'root', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:mariadb://' + dbHost + '/hibernate_orm_test', + 'jdbc.datasource' : 'org.mariadb.jdbc.Driver', +// 'jdbc.datasource' : 'org.mariadb.jdbc.MariaDbDataSource', + 'connection.init_sql' : '' + ], + tidb : [ + 'db.dialect' : 'org.hibernate.dialect.TiDBDialect', + 'jdbc.driver': 'com.mysql.jdbc.Driver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:mysql://' + dbHost + ':4000/hibernate_orm_test', + 'jdbc.datasource' : 'com.mysql.jdbc.Driver', +// 'jdbc.datasource' : 'com.mysql.cj.jdbc.MysqlDataSource', + 'connection.init_sql' : '' + ], + oracle : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xepdb1', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_ci : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/freepdb1', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_xe_ci : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/xepdb1', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_legacy_ci : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + // For 11 version that doesn't have any XEPDB1 database service + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521:XE', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_cloud_autonomous_tls : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test_' + runID, + 'jdbc.pass' : 'Oracle_19_Password', + // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). + // + // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: + // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html + 'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=5)(retry_delay=1)(address=(protocol=tcps)(port=1521)(host=' + dbHost + '.oraclecloud.com))(connect_data=(service_name=' + dbService + '_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))?oracle.jdbc.enableQueryResultCache=false&oracle.jdbc.thinForceDNSLoadBalancing=true&tcp.nodelay=yes', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_cloud_autonomous : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test_' + runID, + 'jdbc.pass' : 'Oracle_19_Password', + // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). + // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: + // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html + 'jdbc.url' : 'jdbc:oracle:thin:@(description=(retry_count=5)(retry_delay=1)(address=(protocol=tcp)(port=1521)(host=' + dbHost + '.oraclevcn.com))(connect_data=(service_name=' + dbService + '_tp.adb.oraclecloud.com))(security=(ssl_server_dn_match=no)))?oracle.jdbc.enableQueryResultCache=false&oracle.jdbc.thinForceDNSLoadBalancing=true&tcp.nodelay=yes', + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_cloud_db19c : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test_' + runID, + 'jdbc.pass' : 'Oracle_19_Password', + // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). + // + // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: + // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService, + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_cloud_db21c : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test_' + runID, + 'jdbc.pass' : 'Oracle_21_Password', + // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). + // + // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: + // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService, + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + oracle_cloud_db23c : [ + 'db.dialect' : 'org.hibernate.dialect.OracleDialect', + 'jdbc.driver': 'oracle.jdbc.OracleDriver', + 'jdbc.user' : 'hibernate_orm_test_' + runID, + 'jdbc.pass' : 'Oracle_23_Password', + // Requires dbHost (pointing to the right cloud region) AND dbService (unique database name). + // + // To avoid hibernate-spatial tests failure, JVM must be enabled as stated in documentation: + // https://docs.oracle.com/en/cloud/paas/autonomous-database/adbsa/autonomous-oracle-java.html + 'jdbc.url' : 'jdbc:oracle:thin:@' + dbHost + ':1521/' + dbService, + 'jdbc.datasource' : 'oracle.jdbc.OracleDriver', +// 'jdbc.datasource' : 'oracle.jdbc.datasource.impl.OracleDataSource', + 'connection.init_sql' : '' + ], + mssql : [ + 'db.dialect' : 'org.hibernate.dialect.SQLServerDialect', + 'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver', + 'jdbc.user' : 'hibernate_orm_test', + 'jdbc.pass' : 'hibernate_orm_test', + 'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';instance=SQLEXPRESS;databaseName=hibernate_orm_test;trustServerCertificate=true', + 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver', +// 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDataSource', + 'connection.init_sql' : '' + ], + mssql_ci : [ + 'db.dialect' : 'org.hibernate.dialect.SQLServerDialect', + 'jdbc.driver': 'com.microsoft.sqlserver.jdbc.SQLServerDriver', + 'jdbc.user' : 'sa', + 'jdbc.pass' : 'Hibernate_orm_test', + 'jdbc.url' : 'jdbc:sqlserver://' + dbHost + ';databaseName=hibernate_orm_test;sendTimeAsDatetime=false;trustServerCertificate=true', + 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDriver', +// 'jdbc.datasource' : 'com.microsoft.sqlserver.jdbc.SQLServerDataSource', + 'connection.init_sql' : '' + ], + informix : [ + 'db.dialect' : 'org.hibernate.community.dialect.InformixDialect', + 'jdbc.driver': 'com.informix.jdbc.IfxDriver', + 'jdbc.user' : 'informix', + 'jdbc.pass' : 'in4mix', + 'jdbc.url' : 'jdbc:informix-sqli://' + dbHost + ':9088/dev:INFORMIXSERVER=informix;user=informix;password=in4mix;DBDATE=Y4MD-;DELIMIDENT=Y;DB_LOCALE=en_US.utf8', + 'jdbc.datasource' : 'com.informix.jdbc.IfxDriver', +// 'jdbc.datasource' : 'com.informix.jdbcx.IfxDataSource', + 'connection.init_sql' : '' + ], + db2 : [ + 'db.dialect' : 'org.hibernate.dialect.DB2Dialect', + 'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver', + 'jdbc.user' : 'db2inst1', + 'jdbc.pass' : 'db2inst1-pwd', + 'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test', + 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2Driver', +// 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2SimpleDataSource', + 'connection.init_sql' : '' + ], + db2_ci : [ + 'db.dialect' : 'org.hibernate.dialect.DB2Dialect', + 'jdbc.driver': 'com.ibm.db2.jcc.DB2Driver', + 'jdbc.user' : 'orm_test', + 'jdbc.pass' : 'orm_test', + 'jdbc.url' : 'jdbc:db2://' + dbHost + ':50000/orm_test', + 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2Driver', +// 'jdbc.datasource' : 'com.ibm.db2.jcc.DB2SimpleDataSource', + 'connection.init_sql' : '' + ], + hana_cloud : [ + 'db.dialect' : 'org.hibernate.dialect.HANADialect', + 'jdbc.driver': 'com.sap.db.jdbc.Driver', + 'jdbc.user' : 'HIBERNATE_TEST', + 'jdbc.pass' : 'H1bernate_test', + // Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html + 'jdbc.url' : 'jdbc:sap://' + dbHost + ':443/?encrypt=true&validateCertificate=false&statementCacheSize=0', + 'jdbc.datasource' : 'com.sap.db.jdbc.Driver', +// 'jdbc.datasource' : 'com.sap.db.jdbcext.HanaDataSource', + 'connection.init_sql' : '' + ], + hana_ci : [ + 'db.dialect' : 'org.hibernate.dialect.HANADialect', + 'jdbc.driver': 'com.sap.db.jdbc.Driver', + 'jdbc.user' : 'SYSTEM', + 'jdbc.pass' : 'H1bernate_test', + // Disable prepared statement caching due to https://help.sap.com/viewer/0eec0d68141541d1b07893a39944924e/2.0.04/en-US/78f2163887814223858e4369d18e2847.html + 'jdbc.url' : 'jdbc:sap://' + dbHost + ':39017/?statementCacheSize=0', + 'jdbc.datasource' : 'com.sap.db.jdbc.Driver', +// 'jdbc.datasource' : 'com.sap.db.jdbcext.HanaDataSource', + 'connection.init_sql' : '' + ], + cockroachdb : [ + 'db.dialect' : 'org.hibernate.dialect.CockroachDialect', + // CockroachDB uses the same pgwire protocol as PostgreSQL, so the driver is the same. + 'jdbc.driver': 'org.postgresql.Driver', + 'jdbc.user' : 'root', + 'jdbc.pass' : '', + // Disable prepared statement caching due to https://www.postgresql.org/message-id/CAEcMXhmmRd4-%2BNQbnjDT26XNdUoXdmntV9zdr8%3DTu8PL9aVCYg%40mail.gmail.com + 'jdbc.url' : 'jdbc:postgresql://' + dbHost + ':26257/defaultdb?sslmode=disable&preparedStatementCacheQueries=0&escapeSyntaxCallMode=callIfNoReturn', + 'jdbc.datasource' : 'org.postgresql.Driver', +// 'jdbc.datasource' : 'org.postgresql.ds.PGSimpleDataSource', + 'connection.init_sql' : '' + ], + firebird : [ + 'db.dialect' : 'org.hibernate.community.dialect.FirebirdDialect', + 'jdbc.driver': 'org.firebirdsql.jdbc.FBDriver', + 'jdbc.user' : 'sysdba', + 'jdbc.pass' : 'masterkey', + // Overriding default transaction definition (5 seconds instead of infinite wait) to prevent problems in test cleanup + // Expects alias 'hibernate_orm_test' in aliases.conf (FB2.5 and earlier) or databases.conf (FB3.0 and later) + // Created database must either use default character set NONE, or UTF8 with page size 16384 or higher (to prevent issues with indexes due to keysize) + 'jdbc.url' : 'jdbc:firebirdsql://' + dbHost +'/hibernate_orm_test?charSet=utf-8;TRANSACTION_READ_COMMITTED=read_committed,rec_version,wait,lock_timeout=5', + 'jdbc.datasource' : 'org.firebirdsql.jdbc.FBDriver', +// 'jdbc.datasource' : 'org.firebirdsql.jdbc.FBDataSource', + 'connection.init_sql' : '' + ], + altibase : [ + 'db.dialect' : 'org.hibernate.community.dialect.AltibaseDialect', + 'jdbc.driver': 'Altibase.jdbc.driver.AltibaseDriver', + 'jdbc.user' : 'sys', + 'jdbc.pass' : 'manager', + 'connection.init_sql' : '', + 'jdbc.url' : 'jdbc:Altibase://' + dbHost + ':20300/mydb?force_clob_bind=true', + 'jdbc.datasource' : 'Altibase.jdbc.driver.AltibaseDriver' + ], + ] +} \ No newline at end of file diff --git a/local-build-plugins/src/main/groovy/local.java-module.gradle b/local-build-plugins/src/main/groovy/local.java-module.gradle new file mode 100644 index 000000000000..71d1f7238159 --- /dev/null +++ b/local-build-plugins/src/main/groovy/local.java-module.gradle @@ -0,0 +1,335 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ + +import org.apache.tools.ant.filters.ReplaceTokens + +plugins { + id "java-library" + id "local.module" + id "local.javadoc" + id "local.databases" + + id "biz.aQute.bnd.builder" + + id "org.hibernate.orm.database-service" + id "org.hibernate.orm.build.java-module" + + id "jacoco" + id "build-dashboard" + id "project-report" +} + +def hibernateVersion = ormBuildDetails.hibernateVersion +def jpaVersion = ormBuildDetails.jpaVersion + +def java9ModuleNameBase = project.name.startsWith( 'hibernate-' ) ? name.drop( 'hibernate-'.length() ): name +def java9ModuleName = "org.hibernate.orm.$java9ModuleNameBase".replace('-','.') + +sourceSets { + test { + resources { + configure( srcDir('src/test/resources') ) { + filter { + include '*.properties' + include '*.xml' + include '**/*.properties' + include '**/*.xml' + } + } + } + } +} + +dependencies { + implementation libs.logging + + compileOnly libs.loggingAnnotations + // Used for compiling some Oracle specific JdbcTypes + compileOnly jdbcLibs.oracle + + // JUnit dependencies made up of: + // * JUnit 5 + // * the Jupiter engine which runs JUnit 5 based tests + // * the "vintage" engine - which runs JUnit 3 and 4 based tests + testImplementation testLibs.junit5Api + testImplementation testLibs.junit5Engine + testImplementation testLibs.junit5Params + testImplementation testLibs.junit4 + testImplementation testLibs.junit4Engine + testImplementation testLibs.assertjCore + + testRuntimeOnly testLibs.log4j2 + testRuntimeOnly libs.byteBuddy + + //Databases + testRuntimeOnly jdbcLibs.h2 + testRuntimeOnly jdbcLibs.derby + testRuntimeOnly jdbcLibs.derbyTools + testRuntimeOnly jdbcLibs.hsqldb + testRuntimeOnly jdbcLibs.postgresql + testRuntimeOnly jdbcLibs.mssql + testRuntimeOnly jdbcLibs.informix + testRuntimeOnly jdbcLibs.cockroachdb + testRuntimeOnly jdbcLibs.sybase + testRuntimeOnly rootProject.fileTree(dir: 'drivers', include: '*.jar') + + // Since both the DB2 driver and HANA have a package "net.jpountz" we have to add dependencies conditionally + // This is due to the "no split-packages" requirement of Java 9+ + + if ( db.startsWith( 'db2' ) ) { + testRuntimeOnly jdbcLibs.db2 + } + else if ( db.startsWith( 'hana' ) ) { + testRuntimeOnly jdbcLibs.hana + } + else if ( db.startsWith( 'mysql' ) || db.startsWith( 'tidb' ) ) { + testRuntimeOnly jdbcLibs.mysql + } + else if ( db.startsWith( 'mariadb' ) ) { + testRuntimeOnly jdbcLibs.mariadb + } + else if ( db.startsWith( 'firebird' ) ) { + testRuntimeOnly jdbcLibs.firebird + } + else if ( db.startsWith( 'oracle' ) ) { + testRuntimeOnly jdbcLibs.oracle + testRuntimeOnly jdbcLibs.oracleXml + testRuntimeOnly jdbcLibs.oracleXmlParser + } + else if ( db.startsWith( 'altibase' ) ) { + testRuntimeOnly jdbcLibs.altibase + } + else if ( db.startsWith( 'informix' ) ) { + testRuntimeOnly jdbcLibs.informix + } + + annotationProcessor libs.loggingProcessor + annotationProcessor libs.logging + annotationProcessor libs.loggingAnnotations + + + constraints { + implementation('org.apache.logging.log4j:log4j-core') { + version { + strictly('[2.17.1, 3[') + prefer('2.17.1') + } + because('CVE-2021-44228, CVE-2021-45046, CVE-2021-45105, CVE-2021-44832: Log4j vulnerable to remote code execution and other critical security vulnerabilities') + } + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Compilation + +tasks.register('compile') { + dependsOn compileJava + dependsOn processResources + dependsOn compileTestJava + dependsOn processTestResources +} + +tasks.withType( JavaCompile ).configureEach { + options.encoding = 'UTF-8' + options.warnings false + options.fork = true + options.forkOptions.memoryMaximumSize = '896m' + + options.compilerArgs += [ + // disable adding @Generated annotation in the logger impls to make + // the logging annotation processor create the same sources each time. + "-Aorg.jboss.logging.tools.addGeneratedAnnotation=false" + ] + + // stubs argument needs to be passed as an absolute path, JavaCompile uses the Worker API which changes the current + // working directory and prevents from using a relative path to locate a project file. + // Using a CommandLineArgumentProvider allows build cache hits when the build cache is relocated. + options.compilerArgumentProviders.add(new CompilerStubsArgumentProvider(stubsDir: new File(project.rootDir, "checkerstubs"))) + + if (System.getProperty('APT_DEBUG', 'false') == 'true') { + task.options.forkOptions.jvmArgs += ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9099'] + } +} + +processTestResources { + duplicatesStrategy DuplicatesStrategy.INCLUDE + + inputs.property( "db", db ) + inputs.property( "dbHost", dbHost ) + inputs.property( "dbConfig", dbBundle[db]) + + doLast { + copy { + from( sourceSets.test.java.srcDirs ) { + include '**/*.properties' + include '**/*.xml' + } + into sourceSets.test.java.classesDirectory + } + copy { + from file( 'src/test/resources' ) + into file( "${buildDir}/resources/test" ) + exclude 'src/test/resources/hibernate.properties' + } + copy { + from file( 'src/test/resources/hibernate.properties' ) + into file( "${buildDir}/resources/test" ) + filter( ReplaceTokens, tokens: dbBundle[db] ) + } + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Testing + +tasks.withType( Test.class ).each { test -> + test.useJUnitPlatform() + + test.usesService( project.gradle.sharedServices.registrations.getByName( 'databaseService' ).service ) + + // Byteman needs this property to be set, https://developer.jboss.org/thread/274997 + test.jvmArgs += ["-Djdk.attach.allowAttachSelf=true"] + + test.jvmArgumentProviders.add( + new HeapDumpPathProvider( path: project.layout.buildDirectory.dir("OOM-dump") ) + ) + + test.jvmArgs += [ + '-XX:+HeapDumpOnOutOfMemoryError', + '-XX:MetaspaceSize=256M' + ] + + test.maxHeapSize = '3G' + + test.systemProperties['hibernate.test.validatefailureexpected'] = true + test.systemProperties['hibernate.highlight_sql'] = false + test.systemProperties += System.properties.findAll { it.key.startsWith( "hibernate." ) } + + test.enableAssertions = true + + if ( project.name != 'hibernate-testing' ) { + test.dependsOn ':hibernate-testing:test' + } + + // Allow to exclude specific tests + if ( project.hasProperty( 'excludeTests' ) ) { + test.filter { + excludeTestsMatching project.property('excludeTests').toString() + } + } +} + +test { + // Keep system properties in sync with gradle.properties! + systemProperty 'user.language', 'en' + systemProperty 'user.country', 'US' + systemProperty 'user.timezone', 'UTC' + systemProperty 'file.encoding', 'UTF-8' + // Needed for AdoptOpenJDK on alpine? The problem is similar to this: https://github.com/mockito/mockito/issues/978 + jvmArgs '-XX:+StartAttachListener' + + if ( project.findProperty( 'log-test-progress' )?.toString()?.toBoolean() ) { + // Log a statement for each test. + // Used in the Travis build so that Travis doesn't end up panicking because there's no output for a long time. + testLogging { + events "passed", "skipped", "failed" + exceptionFormat = 'full' + } + } +} + +// Attach tools JAR to the classpath for byteman tests +final File toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar") +if ( toolsJar.exists() ) { + dependencies{ + testImplementation files( toolsJar ) + } +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Bundling + +java { + // Configure the Java "software component" to include javadoc and sources jars in addition to the classes jar. + withJavadocJar() + withSourcesJar() +} + +tasks.withType(Jar).configureEach { + manifest { + attributes( + // Basic JAR manifest attributes + 'Specification-Title': project.name, + 'Specification-Version': project.version, + 'Specification-Vendor': 'Hibernate.org', + 'Implementation-Title': project.name, + 'Implementation-Version': project.version, + 'Implementation-Vendor': 'Hibernate.org', + 'Implementation-Vendor-Id': 'org.hibernate', + 'Implementation-Url': 'https://hibernate.org/orm', + + // Hibernate-specific JAR manifest attributes + 'Hibernate-VersionFamily': hibernateVersion.family, + 'Hibernate-JpaVersion': jpaVersion.name, + + 'Bundle-DocURL': 'https://hibernate.org/orm/releases/7.0/' + ) + } +} + +tasks.named("jar") { + manifest { + attributes( + // Java 9 module name + 'Automatic-Module-Name': java9ModuleName, + + // BND Plugin instructions (for OSGi): + '-reproducible': true, + '-noextraheaders': true, + 'Bundle-Name': project.name, + 'Bundle-SymbolicName': java9ModuleName, + 'Bundle-Vendor': 'Hibernate.org', + 'Bundle-DocURL': "https://hibernate.org/orm/releases/${hibernateVersion.family}", + // This is overridden in some sub-projects + 'Import-Package': [ + // Temporarily support JTA 1.1 -- Karaf and other frameworks still + // use it. Without this, the plugin generates [1.2,2). + 'javax.transaction;version="[1.1,2)"', + // Also import every package referenced in the code + // (note that '*' is resolved at build time to a list of packages) + '*' + ].join( ',' ), + '-exportcontents': "*;version=${project.version}" + ) + } +} + + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Reproducible Builds + +// https://docs.gradle.org/current/userguide/working_with_files.html#sec:reproducible_archives +// Configure archive tasks to produce reproducible archives: +tasks.withType(AbstractArchiveTask).configureEach { + preserveFileTimestamps = false + reproducibleFileOrder = true +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Configurations and Dependencies + +configurations.configureEach { + resolutionStrategy.eachDependency { details -> + //Force the "byte buddy agent" version to match the Byte Buddy version + // we use, as Mockito might pull in a mismatched version transitively + if (details.requested.group == "net.bytebuddy" && details.requested.name == 'byte-buddy-agent') { + details.useVersion libs.versions.byteBuddy.get() + } + } +} \ No newline at end of file diff --git a/local-build-plugins/src/main/groovy/local.javadoc.gradle b/local-build-plugins/src/main/groovy/local.javadoc.gradle new file mode 100644 index 000000000000..69fea6962b0b --- /dev/null +++ b/local-build-plugins/src/main/groovy/local.javadoc.gradle @@ -0,0 +1,50 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +plugins { + id "local.module" +} + +tasks.withType(Javadoc).configureEach { + def currentYear = new GregorianCalendar().get( Calendar.YEAR ) + + inputs.property "ormVersion", project.extensions.ormBuildDetails.hibernateVersion + inputs.property "currentYear", currentYear + + // exclude any generated sources and internal packages + exclude 'org/hibernate/grammars' + include '**/*.java' + + maxMemory = '512m' + + configure( options ) { + windowTitle = "Hibernate Javadocs ($project.name)" + docTitle = "Hibernate Javadocs ($project.name : $project.version)" + stylesheetFile = rootProject.file( "shared/javadoc/stylesheet.css" ) + bottom = "Copyright © 2001-$currentYear Red Hat, Inc. All Rights Reserved." + + // The javadoc folder contains cached versions of the respective element-list files to avoid release issues when servers are down + // When upgrading versions of the libraries, don't forget to update the file contents in the repository + linksOffline 'https://docs.oracle.com/en/java/javase/17/docs/api/', "${project.rootDir}/javadoc/javase17" + linksOffline 'https://jakarta.ee/specifications/bean-validation/3.0/apidocs/', "${project.rootDir}/javadoc/jakarta-validation-3.0" + linksOffline 'https://jakarta.ee/specifications/cdi/4.0/apidocs/', "${project.rootDir}/javadoc/jakarta-cdi-4.0" + linksOffline 'https://jakarta.ee/specifications/platform/9/apidocs/', "${project.rootDir}/javadoc/jakarta-platform-9" + linksOffline 'https://www.javadoc.io/doc/javax.cache/cache-api/1.0.0/', "${project.rootDir}/javadoc/javax-cache-1.0" + + tags( + 'apiNote:a:API Note:', + 'implSpec:a:Implementation Specification:', + 'implNote:a:Implementation Note:', + 'todo:X', + 'remove:a:Removal (deprecation):', + 'settingDefault:f:Default Value:' + ) + + encoding = 'UTF-8' + use = true + quiet() + + addBooleanOption('Xdoclint:none', true) + } +} \ No newline at end of file diff --git a/gradle/group-relocation.gradle b/local-build-plugins/src/main/groovy/local.publishing-group-relocation.gradle similarity index 60% rename from gradle/group-relocation.gradle rename to local-build-plugins/src/main/groovy/local.publishing-group-relocation.gradle index 390c523d4623..3a4cc24df880 100644 --- a/gradle/group-relocation.gradle +++ b/local-build-plugins/src/main/groovy/local.publishing-group-relocation.gradle @@ -1,12 +1,22 @@ + /* * SPDX-License-Identifier: LGPL-2.1-or-later * Copyright Red Hat Inc. and Hibernate Authors */ +plugins { + id "local.publishing" +} + +def oldGroupId = "org.hibernate" + var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension publishingExtension.publications.create("groupRelocation", MavenPublication) { + groupId = oldGroupId + artifactId = project.name + pom { - name = project.name + ' (relocated)' - groupId = 'org.hibernate' + name = "Relocation : ${oldGroupId}:${project.name} -> ${project.group}:${project.name}" + description = "The `${project.name}` module has been relocated to the `${project.group}` group" distributionManagement { relocation { diff --git a/local-build-plugins/src/main/groovy/local.publishing-java-module.gradle b/local-build-plugins/src/main/groovy/local.publishing-java-module.gradle new file mode 100644 index 000000000000..702602215ead --- /dev/null +++ b/local-build-plugins/src/main/groovy/local.publishing-java-module.gradle @@ -0,0 +1,61 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ + +plugins { + id "local.java-module" + id "local.publishing" + id "local.code-quality" +} + +configurations { + javadocSources { + description = "All Java sources for the project's Javadoc" + canBeConsumed = true + canBeResolved = false + visible = false + } +} + +dependencies { + javadocSources sourceSets.main.allJava +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Publishing + +var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension +publishingExtension.publications.named("publishedArtifacts", MavenPublication) { + // Add the Java component to the main publication + from components.java +} + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Releasing + +def releasePrepareTask = tasks.register("releasePrepare") { + group "release" + description "See :release:releasePrepare for details. Here we hook in testing and checks ensure publish-ability" + + dependsOn tasks.check + dependsOn tasks.generateMetadataFileForPublishedArtifactsPublication + dependsOn tasks.generatePomFileForPublishedArtifactsPublication +} + +// used from the h2 CI job +tasks.register("preVerifyRelease") { + group "release-prepare" + description "Delegates to `releasePrepare` task" + + dependsOn releasePrepareTask +} + +tasks.register( 'releasePerform' ) { + group "release-perform" + description "See :release:releasePerform for details. Here we hook in publishing to Sonatype" + + dependsOn tasks.publishToSonatype +} diff --git a/gradle/publishing.gradle b/local-build-plugins/src/main/groovy/local.publishing.gradle similarity index 91% rename from gradle/publishing.gradle rename to local-build-plugins/src/main/groovy/local.publishing.gradle index 2a46feddd17e..6e03840d8dd3 100644 --- a/gradle/publishing.gradle +++ b/local-build-plugins/src/main/groovy/local.publishing.gradle @@ -2,10 +2,11 @@ * SPDX-License-Identifier: LGPL-2.1-or-later * Copyright Red Hat Inc. and Hibernate Authors */ -apply plugin: 'maven-publish' -apply plugin: 'signing' -apply from: rootProject.file( 'gradle/releasable.gradle' ) +plugins { + id "maven-publish" + id "signing" +} // Disable Gradle module metadata publishing until we know what we want. // https://docs.gradle.org/6.0.1/userguide/publishing_gradle_module_metadata.html#sub:disabling-gmm-publication @@ -13,6 +14,10 @@ tasks.withType(GenerateModuleMetadata).configureEach { enabled = false } +if ( !project.description ) { + project.description = "The Hibernate ORM $project.name module" +} + var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -60,11 +65,10 @@ publishingExtension.publications.configureEach { // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // register the "main" publication named `publishedArtifacts` - -publishingExtension.publications.create("publishedArtifacts", MavenPublication) { +publishingExtension.publications.register("publishedArtifacts", MavenPublication) { pom { - name = 'Hibernate ORM - ' + project.name - description = project.description + name = "Hibernate ORM - ${project.name}" + description = project.provider { project.description } } } @@ -72,7 +76,9 @@ publishingExtension.publications.create("publishedArtifacts", MavenPublication) // Create a special local repository used for local testing of PublishToMavenRepository if ( project.hasProperty("local_pub_repo") ) { - // used for + // to use - + // 1. run `gradlew -Plocal_pub_repo publishAllPublicationsToLocalRepoRepository` + // 2. check ${rootProject}/target/maven-repo publishingExtension.repositories { maven { name = "localRepo" diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/env/HibernateVersion.java b/local-build-plugins/src/main/java/org/hibernate/build/HibernateVersion.java similarity index 65% rename from local-build-plugins/src/main/java/org/hibernate/orm/env/HibernateVersion.java rename to local-build-plugins/src/main/java/org/hibernate/build/HibernateVersion.java index b372c4c0944c..a11061984d2b 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/env/HibernateVersion.java +++ b/local-build-plugins/src/main/java/org/hibernate/build/HibernateVersion.java @@ -1,10 +1,8 @@ /* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors */ -package org.hibernate.orm.env; +package org.hibernate.build; import java.io.File; import java.io.FileInputStream; @@ -14,14 +12,10 @@ import java.util.Properties; import java.util.function.Consumer; -import org.gradle.api.Project; - /** * @author Steve Ebersole */ public class HibernateVersion implements Serializable { - public static final String EXT_KEY = "ormVersion"; - public static final String VERSION_KEY = "releaseVersion"; public static final String RELATIVE_FILE = "gradle/version.properties"; private final String fullName; @@ -64,34 +58,22 @@ public boolean isSnapshot() { return isSnapshot; } - public static HibernateVersion from(Project project, File versionFile) { - if ( project.hasProperty( VERSION_KEY ) ) { - final Object version = project.property( VERSION_KEY ); - if ( version != null ) { - return new HibernateVersion( (String) version ); - } - } - - final String fullName = readVersionProperties( versionFile ); - return new HibernateVersion( fullName ); - } - - private static String readVersionProperties(File file) { - if ( !file.exists() ) { + public static HibernateVersion fromVersionFile(File versionFile) { + if ( !versionFile.exists() ) { throw new RuntimeException( "Version file $file.canonicalPath does not exists" ); } final Properties versionProperties = new Properties(); - withInputStream( file, (stream) -> { + withInputStream( versionFile, (stream) -> { try { versionProperties.load( stream ); } catch (IOException e) { - throw new RuntimeException( "Unable to load properties from file - " + file.getAbsolutePath(), e ); + throw new RuntimeException( "Unable to load properties from file - " + versionFile.getAbsolutePath(), e ); } } ); - return versionProperties.getProperty( "hibernateVersion" ); + return new HibernateVersion( versionProperties.getProperty( "hibernateVersion" ) ); } private static void withInputStream(File file, Consumer action) { diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/env/JpaVersion.java b/local-build-plugins/src/main/java/org/hibernate/build/JpaVersion.java similarity index 81% rename from local-build-plugins/src/main/java/org/hibernate/orm/env/JpaVersion.java rename to local-build-plugins/src/main/java/org/hibernate/build/JpaVersion.java index 2d197996d9ec..2783b292ed71 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/env/JpaVersion.java +++ b/local-build-plugins/src/main/java/org/hibernate/build/JpaVersion.java @@ -1,10 +1,8 @@ /* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later - * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors */ -package org.hibernate.orm.env; +package org.hibernate.build; import java.util.Map; @@ -18,11 +16,14 @@ public class JpaVersion { public static final String EXT_KEY = "jakartaJpaVersion"; public static final String VERSION_KEY = "jakartaJpaVersionOverride"; - public static final String DEFAULT_VERSION = "3.2.0"; + public static final String DEFAULT_VERSION = "3.2"; private final String name; private final String osgiName; + /** + * The version - 3.2, 3.1, 2.2, ... + */ public JpaVersion(String version) { this.name = version; this.osgiName = version + ".0"; diff --git a/local-build-plugins/src/main/java/org/hibernate/build/OrmBuildDetails.java b/local-build-plugins/src/main/java/org/hibernate/build/OrmBuildDetails.java new file mode 100644 index 000000000000..40d7126516cf --- /dev/null +++ b/local-build-plugins/src/main/java/org/hibernate/build/OrmBuildDetails.java @@ -0,0 +1,82 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.build; + +import org.gradle.api.Project; +import org.gradle.api.file.RegularFile; +import org.gradle.api.provider.Provider; + +import javax.inject.Inject; +import java.io.File; + +import static org.hibernate.build.HibernateVersion.fromVersionFile; + +/** + * @author Steve Ebersole + */ +public abstract class OrmBuildDetails { + private final ReleaseDetails releaseDetails; + private final Provider versionFileAccess; + private final HibernateVersion hibernateVersion; + + private final JpaVersion jpaVersion; + + private final String databaseName; + + @Inject + public OrmBuildDetails(Project project) { + releaseDetails = new ReleaseDetails( project ); + versionFileAccess = project.provider( () -> new File( project.getRootDir(), HibernateVersion.RELATIVE_FILE ) ); + + hibernateVersion = releaseDetails.getReleaseVersion() != null + ? releaseDetails.getReleaseVersion() + : fromVersionFile( versionFileAccess.get() ); + project.setVersion( hibernateVersion.getFullName() ); + + jpaVersion = JpaVersion.from( project ); + + databaseName = (String) project.property( "db" ); + } + + public Provider getVersionFileAccess() { + return versionFileAccess; + } + + public HibernateVersion getHibernateVersion() { + return hibernateVersion; + } + + public String getHibernateVersionName() { + return getHibernateVersion().getFullName(); + } + + public String getHibernateVersionFamily() { + return getHibernateVersion().getFamily(); + } + + public String getHibernateVersionNameOsgi() { + return getHibernateVersion().getOsgiVersion(); + } + + public ReleaseDetails getReleaseDetails() { + return releaseDetails; + } + + public JpaVersion getJpaVersion() { + return jpaVersion; + } + + public String getJpaVersionName() { + return getJpaVersion().getName(); + } + + public String getJpaVersionNameOsgi() { + return getJpaVersion().getOsgiName(); + } + + public String getDatabaseName() { + return databaseName; + } +} diff --git a/local-build-plugins/src/main/java/org/hibernate/build/ReleaseDetails.java b/local-build-plugins/src/main/java/org/hibernate/build/ReleaseDetails.java new file mode 100644 index 000000000000..deb2cc8cd9c5 --- /dev/null +++ b/local-build-plugins/src/main/java/org/hibernate/build/ReleaseDetails.java @@ -0,0 +1,68 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.build; + +import org.gradle.api.Project; +import org.gradle.api.provider.Provider; + +/** + * @author Steve Ebersole + */ +public class ReleaseDetails { + private final HibernateVersion releaseVersion; + private final HibernateVersion developmentVersion; + private final Provider createTagAccess; + private final Provider tagNameAccess; + + public ReleaseDetails(Project project) { + final Object releaseVersionSetting = project.findProperty( "releaseVersion" ); + final Object developmentVersionSetting = project.findProperty( "developmentVersion" ); + if ( releaseVersionSetting != null ) { + if ( developmentVersionSetting == null ) { + throw new IllegalStateException( "`releaseVersion` with no `developmentVersion`" ); + } + releaseVersion = new HibernateVersion( releaseVersionSetting.toString() ); + developmentVersion = new HibernateVersion( developmentVersionSetting.toString() ); + tagNameAccess = project.provider( () -> determineReleaseTag( releaseVersion.getFullName() ) ); + } + else { + releaseVersion = null; + developmentVersion = null; + tagNameAccess = project.provider( () -> null ); + } + + createTagAccess = project.provider( () -> !project.hasProperty( "noTag" ) ); + } + + public HibernateVersion getReleaseVersion() { + return releaseVersion; + } + + public HibernateVersion getDevelopmentVersion() { + return developmentVersion; + } + + public Provider getCreateTagAccess() { + return createTagAccess; + } + + public boolean shouldCreateTag() { + return getCreateTagAccess().get(); + } + + public Provider getTagNameAccess() { + return tagNameAccess; + } + + public String getTagNameToUse() { + return getTagNameAccess().get(); + } + + private static String determineReleaseTag(String releaseVersion) { + return releaseVersion.endsWith( ".Final" ) + ? releaseVersion.replace( ".Final", "" ) + : releaseVersion; + } +} diff --git a/local-build-plugins/src/main/java/org/hibernate/build/aspects/Aspect.java b/local-build-plugins/src/main/java/org/hibernate/build/aspects/Aspect.java new file mode 100644 index 000000000000..ab6906b7d606 --- /dev/null +++ b/local-build-plugins/src/main/java/org/hibernate/build/aspects/Aspect.java @@ -0,0 +1,16 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.build.aspects; + +import org.gradle.api.Plugin; +import org.gradle.api.Project; + +/** + * An aspect which can be applied to a Project + * + * @author Steve Ebersole + */ +public interface Aspect extends Plugin { +} diff --git a/local-build-plugins/src/main/java/org/hibernate/build/aspects/ModuleAspect.java b/local-build-plugins/src/main/java/org/hibernate/build/aspects/ModuleAspect.java new file mode 100644 index 000000000000..4b0e3e541d18 --- /dev/null +++ b/local-build-plugins/src/main/java/org/hibernate/build/aspects/ModuleAspect.java @@ -0,0 +1,43 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.build.aspects; + +import org.gradle.api.Project; +import org.hibernate.build.HibernateVersion; +import org.hibernate.build.JpaVersion; +import org.hibernate.build.OrmBuildDetails; + +import java.io.File; +import java.util.Map; + +/** + * Any of the projects + * + * @author Steve Ebersole + */ +public class ModuleAspect implements Aspect { + @Override + public void apply(Project target) { + target.getPluginManager().apply( "base" ); + + // read-only details about the build + final OrmBuildDetails ormBuildDetails = target.getExtensions().create("ormBuildDetails", + OrmBuildDetails.class, + target + ); + + target.setGroup( "org.hibernate.orm" ); + target.setVersion( ormBuildDetails.getHibernateVersionName() ); + + target.getLayout().getBuildDirectory().set( target.getLayout().getProjectDirectory().dir( "target" ) ); + + target.getExtensions().add( "jakartaJpaVersion", ormBuildDetails.getJpaVersionNameOsgi() ); + target.getExtensions().add( "db", ormBuildDetails.getDatabaseName() ); + + target.getConfigurations().configureEach( (files) -> { + files.exclude( Map.of( "group", "xml-apis", "module", "xml-apis" ) ); + } ); + } +} diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentProjectPlugin.java b/local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentProjectPlugin.java deleted file mode 100644 index 3d55020c247f..000000000000 --- a/local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentProjectPlugin.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.hibernate.orm.env; - -import java.io.File; - -import org.gradle.api.Plugin; -import org.gradle.api.Project; - -/** - * @author Steve Ebersole - */ -public class EnvironmentProjectPlugin implements Plugin { - - @Override - public void apply(Project project) { - final File versionFile = project.getRootProject().file( HibernateVersion.RELATIVE_FILE ); - project.getExtensions().add( "ormVersionFile", versionFile ); - project.getExtensions().add( HibernateVersion.EXT_KEY, HibernateVersion.from( project, versionFile ) ); - project.getExtensions().add( JpaVersion.EXT_KEY, JpaVersion.from( project ) ); - project.getExtensions().add( "jpaVersion", new JpaVersion( "2.2" ) ); - } -} diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentSettingsPlugin.java b/local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentSettingsPlugin.java index 01997feb3f51..106be9bced69 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentSettingsPlugin.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/env/EnvironmentSettingsPlugin.java @@ -1,11 +1,12 @@ package org.hibernate.orm.env; -import java.util.Map; -import java.util.Objects; - import org.gradle.StartParameter; import org.gradle.api.Plugin; import org.gradle.api.initialization.Settings; +import org.hibernate.build.JpaVersion; + +import java.util.Map; +import java.util.Objects; /** * @author Steve Ebersole @@ -14,7 +15,9 @@ public class EnvironmentSettingsPlugin implements Plugin { @Override public void apply(Settings settings) { - settings.getExtensions().add( JpaVersion.EXT_KEY, JpaVersion.from( settings ) ); + final JpaVersion jpaVersion = JpaVersion.from( settings ); + settings.getExtensions().add( "jpaVersion", jpaVersion ); + settings.getExtensions().add( JpaVersion.EXT_KEY, jpaVersion.getOsgiName() ); settings.getExtensions().add( "db", Objects.requireNonNullElse( getP( settings, "db" ), "h2" ) ); String ciNode = getP( settings, "ci.node" ); if ( ciNode != null ) { diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/env/OrmBuildConfig.java b/local-build-plugins/src/main/java/org/hibernate/orm/env/OrmBuildConfig.java new file mode 100644 index 000000000000..2455fe96f62d --- /dev/null +++ b/local-build-plugins/src/main/java/org/hibernate/orm/env/OrmBuildConfig.java @@ -0,0 +1,18 @@ +/* + * SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.orm.env; + +import org.gradle.api.Project; + +import javax.inject.Inject; + +/** + * @author Steve Ebersole + */ +public class OrmBuildConfig { + @Inject + public OrmBuildConfig(Project project) { + } +} diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java index 47e2a78779d1..a4b88f34993d 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/AbstractJandexAwareTask.java @@ -22,6 +22,7 @@ import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.OutputFile; +import org.hibernate.build.OrmBuildDetails; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationTarget; import org.jboss.jandex.DotName; @@ -41,7 +42,7 @@ public AbstractJandexAwareTask() { setGroup( TASK_GROUP_NAME ); this.indexManager = getProject().provider( () -> getProject().getExtensions().getByType( IndexManager.class ) ); - getInputs().property( "version", getProject().getExtensions().getByName( "ormVersion" ) ); + getInputs().property( "version", getProject().getExtensions().getByType( OrmBuildDetails.class ).getHibernateVersion() ); } @Internal diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java index ba751f5a688a..9658886a9ff3 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/post/DialectReportTask.java @@ -28,7 +28,8 @@ import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.TaskAction; -import org.hibernate.orm.env.HibernateVersion; +import org.hibernate.build.HibernateVersion; +import org.hibernate.build.OrmBuildDetails; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.Index; @@ -133,7 +134,7 @@ private void writeDialectReportHeader(OutputStreamWriter fileWriter) { fileWriter.write( "Supported Dialects along with the minimum supported version of the underlying database.\n\n\n" ); - HibernateVersion ormVersion = (HibernateVersion) getProject().getRootProject().getExtensions().getByName( "ormVersion" ); + HibernateVersion ormVersion = getProject().getExtensions().getByType( OrmBuildDetails.class ).getHibernateVersion(); fileWriter.write( "NOTE: Hibernate version " + ormVersion.getFamily() + "\n\n" ); } diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocGenerationTask.java b/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocGenerationTask.java index a45b53f1a259..f516ed094693 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocGenerationTask.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocGenerationTask.java @@ -6,8 +6,6 @@ */ package org.hibernate.orm.properties; -import javax.inject.Inject; - import org.gradle.api.DefaultTask; import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.Project; @@ -20,10 +18,11 @@ import org.gradle.api.tasks.Nested; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; - -import org.hibernate.orm.env.HibernateVersion; +import org.hibernate.build.OrmBuildDetails; import org.hibernate.orm.properties.jdk17.SettingsCollector; +import javax.inject.Inject; + import static org.hibernate.orm.properties.SettingsDocumentationPlugin.TASK_GROUP_NAME; /** @@ -32,8 +31,6 @@ public class SettingsDocGenerationTask extends DefaultTask { public static final String TASK_NAME = "generateSettingsDoc"; - private final HibernateVersion hibernateVersion; - private final DirectoryProperty javadocDirectory; private final Property publishedDocsUrl; private final Property anchorNameBase; @@ -46,8 +43,7 @@ public SettingsDocGenerationTask(SettingsDocExtension dslExtension, Project proj setGroup( TASK_GROUP_NAME ); setDescription( "Collects descriptions of Hibernate configuration properties in preparation for inclusion in the User Guide" ); - hibernateVersion = (HibernateVersion) project.getExtensions().getByName( HibernateVersion.EXT_KEY ); - getInputs().property( "ormVersion", hibernateVersion ); + getInputs().property( "ormVersion", getProject().getExtensions().getByType( OrmBuildDetails.class ).getHibernateVersion() ); javadocDirectory = project.getObjects().directoryProperty(); javadocDirectory.convention( dslExtension.getJavadocDirectory() ); @@ -94,7 +90,7 @@ public RegularFileProperty getOutputFile() { public void generateSettingsDocumentation() { final String publishedJavadocUrl = publishedDocsUrl.get() + "/" - + hibernateVersion.getFamily() + + getProject().getExtensions().getByType( OrmBuildDetails.class ).getHibernateVersionFamily() + "/javadocs/"; AsciiDocWriter.writeToFile( diff --git a/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocumentationPlugin.java b/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocumentationPlugin.java index 8659503844a7..484ebcf84cb4 100644 --- a/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocumentationPlugin.java +++ b/local-build-plugins/src/main/java/org/hibernate/orm/properties/SettingsDocumentationPlugin.java @@ -8,8 +8,7 @@ import org.gradle.api.Plugin; import org.gradle.api.Project; - -import org.hibernate.orm.env.EnvironmentProjectPlugin; +import org.hibernate.build.aspects.ModuleAspect; import static org.hibernate.orm.properties.SettingsDocExtension.EXTENSION_NAME; import static org.hibernate.orm.properties.SettingsDocGenerationTask.TASK_NAME; @@ -25,7 +24,7 @@ public class SettingsDocumentationPlugin implements Plugin { @Override public void apply(Project project) { // if not already, so we can access HibernateVersion - project.getPluginManager().apply( EnvironmentProjectPlugin.class ); + project.getPluginManager().apply( ModuleAspect.class ); // create and register the DSL extension final SettingsDocExtension dslExtension = new SettingsDocExtension( project ); diff --git a/release/release.gradle b/release/release.gradle index e5b07b329998..1b8bf0af5a38 100644 --- a/release/release.gradle +++ b/release/release.gradle @@ -9,22 +9,188 @@ import groovy.json.JsonSlurper * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -apply from: rootProject.file( 'gradle/module.gradle' ) -apply plugin: 'org.hibernate.orm.build.doc-pub' -apply plugin: 'org.hibernate.orm.build.jdks' -apply plugin: 'idea' +plugins { + id "local.module" + id "org.hibernate.orm.build.doc-pub" + id "org.hibernate.orm.build.jdks" + + id "idea" +} idea.module { } // skip building this when `build` task is run from root, as many of our CI jobs do tasks.build.dependsOn.clear() +tasks.build.enabled false + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Stage - Release Prepare : see `releasePrepare` +// +// This coordinates: +// 1. some pre-release checks +// 2. updating the changelog +// 3. update version.properties to RELEASE_VERSION +// 4. assemble documentation (we want this to run here as a "check") +// 5. git commit (changelog and RELEASE_VERSION) +// 6. update version.properties to DEVELOPMENT_VERSION +// 7. git tag +// 8. git commit (DEVELOPMENT_VERSION) +// +// and at some point in these steps, it assembles documentation. the order is unimportant +// +// NOTE : ideally we'd switch (6) and (7). it works out as-is, but confusing +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +def releaseChecksTask = tasks.register( "releaseChecks" ) { + group 'release-prepare' + description 'Checks and preparation for release' + + doFirst { + logger.lifecycle("Checking that the working tree is clean...") + String uncommittedFiles = executeGitCommand('status', '--porcelain') + if (!uncommittedFiles.isEmpty()) { + throw new GradleException( + "Cannot release because there are uncommitted or untracked files in the working tree.\n" + + "Commit or stash your changes first.\n" + + "Uncommitted files:\n " + + uncommittedFiles + ); + } + + String gitBranchLocal + String gitRemoteLocal + + if (project.hasProperty('gitBranch') && !project.property('gitBranch').isEmpty()) { + gitBranchLocal = project.property('gitBranch') + } + else { + gitBranchLocal = executeGitCommand( 'branch', '--show-current' ).trim() + } + + if (project.hasProperty('gitRemote') && !project.property('gitRemote').isEmpty()) { + gitRemoteLocal = project.property('gitRemote') + } + else { + final String remotes = executeGitCommand( 'remote', 'show' ).trim() + final List tokens = remotes.tokenize() + if ( tokens.size() != 1 ) { + throw new GradleException( "Could not determine `gitRemote` property for `releaseChecks` tasks." ) + } + gitRemoteLocal = tokens.get( 0 ) + } + + project.ext { + gitBranch = gitBranchLocal + gitRemote = gitRemoteLocal + } + + logger.lifecycle("Switching to branch '${project.gitBranch}'...") + executeGitCommand('checkout', project.gitBranch) + + logger.lifecycle("Checking that all commits are pushed...") + String diffWithUpstream = executeGitCommand('diff', '@{u}') + if (!diffWithUpstream.isEmpty()) { + throw new GradleException( + "Cannot perform `ciRelease` tasks because there are un-pushed local commits .\n" + + "Push your commits first." + ); + } + } +} +def changeLogFileTask = tasks.register( "changeLogFile" ) { + group 'release-prepare' + description 'Updates the changelog.txt file based on the change-log report from Jira' + dependsOn releaseChecksTask + + doFirst { + logger.lifecycle( "Appending version `${project.releaseVersion}` to changelog..." ) + ChangeLogFile.update( ormBuildDetails.hibernateVersion.fullName ); + } +} + +def changeToReleaseVersionTask = tasks.register( "changeToReleaseVersion" ) { + group 'release-prepare' + description 'Updates `gradle/version.properties` file to the specified release-version' + + dependsOn releaseChecksTask + + doFirst { + def releaseVersion = ormBuildDetails.releaseDetails.releaseVersion + logger.lifecycle( "Updating version-file to release-version : `${releaseVersion}`" ) + updateVersionFile( releaseVersion ) + } +} + +def gitPreStepsTask = tasks.register( 'gitPreSteps' ) { + group "release-prepare" + description "update changelog, update version file and commit" + + dependsOn releaseChecksTask + dependsOn changeLogFileTask + dependsOn changeToReleaseVersionTask + + doLast { + def releaseVersion = ormBuildDetails.releaseDetails.releaseVersion + logger.lifecycle( "Performing pre-steps Git commit : `${releaseVersion}`" ) + executeGitCommand( 'add', '.' ) + executeGitCommand( 'commit', '-m', "Pre-steps for release : `${releaseVersion.fullName}`" ) + } +} + +def gitPostStepsTask = tasks.register( 'gitPostSteps' ) { + group "release-prepare" + description "possibly create tag. update version-file and commit " + + doFirst { + } + + doLast { + def releaseDetails = ormBuildDetails.releaseDetails + def releaseVersion = releaseDetails.releaseVersion + def developmentVersion = releaseDetails.developmentVersion + + if ( releaseDetails.shouldCreateTag ) { + logger.lifecycle( "Tagging release : `${releaseDetails.tagNameToUse}`..." ) + executeGitCommand( 'tag', '-a', releaseDetails.tagNameToUse, '-m', "Release $releaseVersion.fullName" ) + } + + logger.lifecycle( "Updating version-file to development-version : `${developmentVersion.fullName}`" ) + updateVersionFile( developmentVersion ) + + logger.lifecycle( "Performing post-steps Git commit : `${releaseVersion}`" ) + executeGitCommand( 'add', '.' ) + executeGitCommand( 'commit', '-m', "Post-steps for release : `${releaseVersion.fullName}`" ) + } +} + +void updateVersionFile(String version) { + logger.lifecycle( "Updating `gradle/version.properties` version to `${version}`" ) + ormBuildDetails.versionFileAccess.get().text = "ormBuildDetails.hibernateVersion=${version}" +} + +tasks.register("releasePrepare") { + group "release-prepare" + description "Scripted release 'Release Prepare' stage" + + dependsOn releaseChecksTask + dependsOn "assembleDocumentation" + dependsOn gitPreStepsTask + + finalizedBy gitPostStepsTask +} + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Assemble documentation as part of Release Prepare +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def stageIntegrationGuideTask = tasks.register( "stageIntegrationGuide", Copy ) { group "documentation" - description "Stages the Integration Guide as part of preparing for release" + description "Stages the Integration Guide as part of assembling documentation in preparation for release" + dependsOn ":documentation:renderIntegrationGuides" from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/integrationguide" ) } @@ -33,7 +199,8 @@ def stageIntegrationGuideTask = tasks.register( "stageIntegrationGuide", Copy ) def stageQuickstartTask = tasks.register( "stageQuickstart", Copy ) { group 'documentation' - description "Stages the Getting Started Guide as part of preparing for release" + description "Stages the Getting Started Guide as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderGettingStartedGuides' from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/quickstart" ) } @@ -42,7 +209,8 @@ def stageQuickstartTask = tasks.register( "stageQuickstart", Copy ) { def stageTopicalGuideTask = tasks.register( "stageTopicalGuide", Copy ) { group 'documentation' - description "Stages the Topical Guide as part of preparing for release" + description "Stages the Topical Guide as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderTopicalGuides' from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/topical" ) } @@ -52,7 +220,8 @@ def stageTopicalGuideTask = tasks.register( "stageTopicalGuide", Copy ) { def stageIntroductionGuideTask = tasks.register( "stageIntroductionGuide", Copy ) { group 'documentation' - description "Stages the Introduction Guide as part of preparing for release" + description "Stages the Introduction Guide as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderIntroductionGuides' from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/introduction" ) } @@ -61,7 +230,8 @@ def stageIntroductionGuideTask = tasks.register( "stageIntroductionGuide", Copy def stageQueryGuideTask = tasks.register( "stageQueryGuide", Copy ) { group 'documentation' - description "Stages the Query Language Guide as part of preparing for release" + description "Stages the Query Language Guide as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderQueryLanguageGuides' from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/querylanguage" ) } @@ -70,7 +240,8 @@ def stageQueryGuideTask = tasks.register( "stageQueryGuide", Copy ) { def stageRepositoriesGuideTask = tasks.register( "stageRepositoriesGuide", Copy ) { group 'documentation' - description "Stages the Repositories Guide as part of preparing for release" + description "Stages the Repositories Guide as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderRepositories' from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/repositories" ) } @@ -79,9 +250,8 @@ def stageRepositoriesGuideTask = tasks.register( "stageRepositoriesGuide", Copy def stageUserGuideTask = tasks.register( "stageUserGuide", Copy ) { group 'documentation' - description "Stages the User Guide as part of preparing for release" - dependsOn ':documentation:renderUserGuides' - description "Stages the User Guide as part of preparing for release" + description "Stages the User Guide as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderUserGuides' from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/userguide" ) } @@ -91,7 +261,8 @@ def stageUserGuideTask = tasks.register( "stageUserGuide", Copy ) { def stageMigrationGuideTask = tasks.register( "stageMigrationGuide", Copy ) { group 'documentation' - description "Stages the Migration Guide as part of preparing for release" + description "Stages the Migration Guide as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderMigrationGuide' from project.provider { project( ":documentation" ).layout.buildDirectory.dir( "asciidoc/migration-guide" ) } @@ -99,14 +270,14 @@ def stageMigrationGuideTask = tasks.register( "stageMigrationGuide", Copy ) { } tasks.named( "publishMigrationGuide" ).configure { - dependsOn stageMigrationGuide + dependsOn stageMigrationGuideTask } def stageIncubationReportTask = tasks.register( "stageIncubationReport", Copy ) { task -> group 'documentation' - description "Stages ORM @Incubating report" - dependsOn ':documentation:generateIncubationReport' + description "Stages ORM @Incubating report as part of assembling documentation in preparation for release" + dependsOn ':documentation:generateIncubationReport' tasks.stageOrmReports.dependsOn task from project( ":documentation" ).tasks.generateIncubationReport @@ -115,7 +286,8 @@ def stageIncubationReportTask = tasks.register( "stageIncubationReport", Copy ) def stageInternalsReportTask = tasks.register( "stageInternalsReport", Copy ) { task -> group 'documentation' - description "Stages the @Internal report" + description "Stages the @Internal report as part of assembling documentation in preparation for release" + dependsOn ':documentation:generateInternalsReport' from project( ":documentation" ).tasks.generateInternalsReport @@ -124,7 +296,7 @@ def stageInternalsReportTask = tasks.register( "stageInternalsReport", Copy ) { def stageDeprecationReportTask = tasks.register( "stageDeprecationReport", Copy ) { group 'documentation' - description "Stages the @Deprecated/@Remove report" + description "Stages the @Deprecated/@Remove report as part of assembling documentation in preparation for release" dependsOn ':documentation:generateDeprecationReport' @@ -134,7 +306,7 @@ def stageDeprecationReportTask = tasks.register( "stageDeprecationReport", Copy def stageLoggingReportTask = tasks.register( "stageLoggingReport", Copy ) { task -> group 'documentation' - description "Stages the logging report" + description "Stages the logging report as part of assembling documentation in preparation for release" dependsOn ':documentation:renderLoggingReport' @@ -144,7 +316,8 @@ def stageLoggingReportTask = tasks.register( "stageLoggingReport", Copy ) { task def stageDialectReportTask = tasks.register( "stageDialectReport", Copy ) { task -> group 'documentation' - description "Stages the supported Dialects report" + description "Stages the supported Dialects report as part of assembling documentation in preparation for release" + dependsOn ':documentation:renderDialectReport' from project( ":documentation" ).tasks.renderDialectReport @@ -153,7 +326,7 @@ def stageDialectReportTask = tasks.register( "stageDialectReport", Copy ) { task def stageOrmReportsTask = tasks.register( "stageOrmReports" ) { group 'documentation' - description "Stages all ORM reports as part of preparing for release" + description "Stages all ORM reports as part of assembling documentation in preparation for release" dependsOn ':documentation:generateReports' dependsOn stageIncubationReportTask @@ -165,7 +338,8 @@ def stageOrmReportsTask = tasks.register( "stageOrmReports" ) { def stageJavadocsTask = tasks.register( "stageJavadocs", Copy ) { group 'documentation' - description "Stages the aggregated Javadocs" + description "Stages the aggregated Javadocs as part of assembling documentation in preparation for release" + dependsOn ':documentation:javadoc' from project( ":documentation" ).tasks.javadoc @@ -194,13 +368,27 @@ def assembleDocumentationTask = tasks.register( "assembleDocumentation" ) { dependsOn stageOrmReportsTask } -tasks.named( "uploadDocumentation" ) { - group = "documentation" + + + + + +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Stage - Release Perform : see `releasePerform` +// +// This stage is all about publishing artifacts - +// * On the `:release` project, this means uploading documentation +// * On the `:hibernate-gradle-plugin` project, this means publishing to the Plugin Portal +// * On the published java modules, this means publishing its artifacts to Sonatype +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +def uploadDocumentationTask = tasks.named( "uploadDocumentation" ) { + group = "release-perform" description = "Uploads assembled documentation to the doc server" dependsOn assembleDocumentationTask doFirst { - if ( rootProject.ormVersion.isSnapshot ) { + if ( ormBuildDetails.hibernateVersion.isSnapshot ) { logger.error( "Cannot perform upload of SNAPSHOT documentation" ); throw new RuntimeException( "Cannot perform upload of SNAPSHOT documentation" ); } @@ -214,149 +402,15 @@ tasks.named( "uploadDocumentation" ) { } } -def releaseChecksTask = tasks.register( "releaseChecks" ) { - group 'Release' - description 'Checks and preparation for release' +tasks.register( 'releasePerform' ) { + group = "release-perform" + description "Scripted release 'Release Perform' stage" - doFirst { - logger.lifecycle("Checking that the working tree is clean...") - String uncommittedFiles = executeGitCommand('status', '--porcelain') - if (!uncommittedFiles.isEmpty()) { - throw new GradleException( - "Cannot release because there are uncommitted or untracked files in the working tree.\n" + - "Commit or stash your changes first.\n" + - "Uncommitted files:\n " + - uncommittedFiles - ); - } - - String gitBranchLocal - String gitRemoteLocal - - if (project.hasProperty('gitBranch') && !project.property('gitBranch').isEmpty()) { - gitBranchLocal = project.property('gitBranch') - } - else { - gitBranchLocal = executeGitCommand( 'branch', '--show-current' ).trim() - } - - if (project.hasProperty('gitRemote') && !project.property('gitRemote').isEmpty()) { - gitRemoteLocal = project.property('gitRemote') - } - else { - final String remotes = executeGitCommand( 'remote', 'show' ).trim() - final List tokens = remotes.tokenize() - if ( tokens.size() != 1 ) { - throw new GradleException( "Could not determine `gitRemote` property for `releaseChecks` tasks." ) - } - gitRemoteLocal = tokens.get( 0 ) - } - - project.ext { - gitBranch = gitBranchLocal - gitRemote = gitRemoteLocal - } - - logger.lifecycle("Switching to branch '${project.gitBranch}'...") - executeGitCommand('checkout', project.gitBranch) - - logger.lifecycle("Checking that all commits are pushed...") - String diffWithUpstream = executeGitCommand('diff', '@{u}') - if (!diffWithUpstream.isEmpty()) { - throw new GradleException( - "Cannot perform `ciRelease` tasks because there are un-pushed local commits .\n" + - "Push your commits first." - ); - } - } -} - -def preVerifyReleaseTask = tasks.register( "preVerifyRelease" ) { - group 'Release' - description 'Pre-verifies a release job execution (Run locally before a CI release)' - - dependsOn tasks.clean - dependsOn assembleDocumentationTask -} - -def changeLogFileTask = tasks.register( "changeLogFile" ) { - group 'Release' - description 'Updates the changelog.txt file based on the change-log report from Jira' - dependsOn releaseChecksTask - - doFirst { - logger.lifecycle( "Appending version `${project.releaseVersion}` to changelog..." ) - ChangeLogFile.update( ormVersion.fullName ); - } -} - -def changeToReleaseVersionTask = tasks.register( "changeToReleaseVersion" ) { - group 'Release' - description 'Updates `gradle/version.properties` file to the specified release-version' - - dependsOn releaseChecksTask - - doFirst { - logger.lifecycle( "Updating version-file to release-version : `${project.releaseVersion}`" ) - updateVersionFile( project.releaseVersion ) - } -} - -def gitPreparationForReleaseTask = tasks.register( 'gitPreparationForRelease' ) { - dependsOn releaseChecksTask - dependsOn changeLogFileTask - dependsOn changeToReleaseVersionTask - - doLast { - logger.lifecycle( "Performing pre-steps Git commit : `${project.releaseVersion}`" ) - executeGitCommand( 'add', '.' ) - executeGitCommand( 'commit', '-m', "Pre-steps for release : `${project.ormVersion.fullName}`" ) - } -} - -def changeToDevelopmentVersionTask = tasks.register( 'changeToDevelopmentVersion' ) { - group 'Release' - description 'Updates `gradle/version.properties` file to the specified development-version' - - dependsOn releaseChecksTask - - doFirst { - logger.lifecycle( "Updating version-file to development-version : `${project.developmentVersion}`" ) - updateVersionFile( project.developmentVersion ) - } -} - -def releasePreparePostGitTask = tasks.register( 'gitTasksAfterRelease' ) { - dependsOn changeToDevelopmentVersionTask - - doLast { - if ( project.createTag ) { - logger.lifecycle( "Tagging release : `${project.releaseTag}`..." ) - executeGitCommand( 'tag', '-a', project.releaseTag, '-m', "Release $project.ormVersion.fullName" ) - } - - logger.lifecycle( "Performing post-steps Git commit : `${project.releaseVersion}`" ) - executeGitCommand( 'add', '.' ) - executeGitCommand( 'commit', '-m', "Post-steps for release : `${project.ormVersion.fullName}`" ) - } -} - -void updateVersionFile(String version) { - logger.lifecycle( "Updating `gradle/version.properties` version to `${version}`" ) - project.ormVersionFile.text = "hibernateVersion=${version}" -} - -def publishReleaseArtifactsTask = tasks.register( 'publishReleaseArtifacts' ) { - mustRunAfter gitPreparationForReleaseTask - - dependsOn uploadDocumentation + dependsOn uploadDocumentationTask dependsOn uploadDocumentationDescriptor -} - -def releasePerformPostGitTask = tasks.register( 'gitTasksAfterReleasePerform' ) { doLast { - if ( project.createTag ) { + if ( ormBuildDetails.releaseDetails.shouldCreateTag ) { logger.lifecycle( "Pushing branch and tag to remote `${project.gitRemote}`..." ) executeGitCommand( 'push', '--atomic', project.gitRemote, project.gitBranch, project.releaseTag ) } @@ -367,40 +421,14 @@ def releasePerformPostGitTask = tasks.register( 'gitTasksAfterReleasePerform' ) } } -def releasePrepareTask = tasks.register( 'releasePrepare' ) { - group 'Release' - description 'Performs release preparations on local check-out, including updating changelog' - // we want to assemble the docs here so that we catch problems early (and even during "dry run" for CI releases) - dependsOn assembleDocumentationTask - dependsOn gitPreparationForReleaseTask - finalizedBy releasePreparePostGitTask -} -def releasePerformTask = tasks.register( 'releasePerform' ) { - group 'Release' - description 'Performs a release on local check-out, including updating changelog and ' - dependsOn publishReleaseArtifactsTask - - finalizedBy releasePerformPostGitTask -} +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Utilities +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -def releaseTask = tasks.register( 'release' ) { - group 'Release' - description 'Performs a release on local check-out, including updating changelog and ' - - dependsOn releasePrepareTask - dependsOn releasePerformTask -} - -def ciReleaseTask = tasks.register( 'ciRelease' ) { - group 'Release' - description 'Performs a release: the hibernate version is set and the changelog.txt file updated, the changes are pushed to github, then the release is performed, tagged and the hibernate version is set to the development one.' - - dependsOn releaseTask -} static String executeGitCommand(Object ... subcommand){ List command = ['git'] @@ -522,62 +550,3 @@ class ReleaseNote { } } - -gradle.getTaskGraph().whenReady {tg-> - - if ( ( tg.hasTask( project.tasks.releasePrepare ) || tg.hasTask( project.tasks.releasePerform ) ) - && ! project.getGradle().getStartParameter().isDryRun() ) { - String releaseVersionLocal - String developmentVersionLocal - - def console = tg.hasTask( project.tasks.release ) && !tg.hasTask( project.tasks.ciRelease ) - ? System.console() - : null - - if (project.hasProperty('releaseVersion')) { - releaseVersionLocal = project.property('releaseVersion') - } - else { - if (console) { - // prompt for `releaseVersion` - releaseVersionLocal = console.readLine('> Enter the release version: ') - } - else { - throw new GradleException( - "`release`-related tasks require the following properties: 'releaseVersion', 'developmentVersion'" - ) - } - } - - if (project.hasProperty('developmentVersion')) { - developmentVersionLocal = project.property('developmentVersion') - } - else { - if (console) { - // prompt for `developmentVersion` - developmentVersionLocal = console.readLine('> Enter the next development version: ') - } - else { - throw new GradleException( - "`release`-related tasks require the following properties: 'releaseVersion', 'developmentVersion'" - ) - } - } - - assert releaseVersionLocal != null && developmentVersionLocal != null; - - // set up information for the release-related tasks - project.ext { - releaseVersion = releaseVersionLocal; - developmentVersion = developmentVersionLocal; - createTag = !project.hasProperty('noTag') - releaseTag = project.createTag ? determineReleaseTag(releaseVersionLocal) : '' - } - } -} - -static String determineReleaseTag(String releaseVersion) { - return releaseVersion.endsWith( '.Final' ) - ? releaseVersion.replace( ".Final", "" ) - : releaseVersion; -} diff --git a/tooling/hibernate-ant/hibernate-ant.gradle b/tooling/hibernate-ant/hibernate-ant.gradle index f87270332258..a9da9efd0fe3 100644 --- a/tooling/hibernate-ant/hibernate-ant.gradle +++ b/tooling/hibernate-ant/hibernate-ant.gradle @@ -1,9 +1,11 @@ -description = 'Annotation Processor to generate JPA 2 static metamodel classes' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" + id "org.hibernate.build.version-injection" +} -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) -apply plugin: 'org.hibernate.build.version-injection' +description = 'Annotation Processor to generate JPA 2 static metamodel classes' dependencies { compileOnly libs.ant diff --git a/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle b/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle index aa9fe958bfb2..e167c6de007f 100644 --- a/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle +++ b/tooling/hibernate-gradle-plugin/hibernate-gradle-plugin.gradle @@ -9,16 +9,14 @@ import org.apache.tools.ant.filters.ReplaceTokens plugins { id 'java-gradle-plugin' - id 'com.gradle.plugin-publish' version '1.2.1' + id "local.module" + id "local.javadoc" + id 'com.gradle.plugin-publish' version '1.2.1' // for local publishing id 'maven-publish' } -apply from: rootProject.file( 'gradle/module.gradle' ) -apply from: rootProject.file( 'gradle/javadoc.gradle' ) -apply from: rootProject.file( 'gradle/releasable.gradle' ) - description = "Gradle plugin for integrating Hibernate aspects into your build" dependencies { @@ -67,16 +65,31 @@ test { } } -// Publish to the Gradle Plugin Portal -tasks.release.dependsOn tasks.publishPlugins +def releasePrepareTask = tasks.register("releasePrepare") { + group "release-prepare" + description "See :release:releasePrepare for details. Here we hook in the `check` task." + + dependsOn tasks.check +} + +// used from the h2 CI job +tasks.register("preVerifyRelease") { + group "release-prepare" + description "Delegates to `releasePrepare` task" + + dependsOn releasePrepareTask +} + +tasks.register("releasePerform") { + group "release-perform" + description "See :release:releasePerform for details. Here we hook in publishing to the Plugin Portal" + + dependsOn tasks.publishPlugins +} // local publishing (SNAPSHOT testing) tasks.publish.dependsOn tasks.publishPlugins -tasks.register("publishReleaseArtifacts") { - // mirror for `:release:publishReleaseArtifacts` - dependsOn tasks.release -} // local publishing (SNAPSHOT testing) publishing { @@ -88,21 +101,6 @@ publishing { } } -// local publishing (SNAPSHOT testing), cont. -// - https://github.com/gradle-nexus/publish-plugin/issues/143 -// - https://github.com/gradle-nexus/publish-plugin/pull/144 -gradle.taskGraph.whenReady { - tasks.withType(PublishToMavenRepository) { PublishToMavenRepository t -> - if ( t.repository == null ) { - logger.info( "Task `{}` had null repository", t.path ) - } - else if ( t.repository.name == "sonatype" ) { - logger.debug( "Disabling task `{}` because it publishes to Sonatype", t.path ) - t.enabled = false - } - } -} - processResources { inputs.property( "orm-version", getVersion() ) description = description + " (injected with Hibernate version)" @@ -124,17 +122,23 @@ else { " Using the JDK that runs Gradle for Groovy compilation." ) } -tasks.named( "javadoc", Javadoc ) { - configure( options ) { - windowTitle = "Hibernate Javadocs ($project.name)" - docTitle = "Hibernate Javadocs ($project.name : $project.version)" - } -} - -tasks.publish.enabled !project.ormVersion.isSnapshot -tasks.publishPlugins.enabled !project.ormVersion.isSnapshot +tasks.publish.enabled !ormBuildDetails.hibernateVersion.isSnapshot +tasks.publishPlugins.enabled !ormBuildDetails.hibernateVersion.isSnapshot gradle.taskGraph.whenReady { tg -> + // local publishing (SNAPSHOT testing), cont. + // - https://github.com/gradle-nexus/publish-plugin/issues/143 + // - https://github.com/gradle-nexus/publish-plugin/pull/144 + tasks.withType(PublishToMavenRepository).configureEach {t-> + if (t.repository == null) { + logger.info("Task `{}` had null repository", t.path) + } + else if (t.repository.name == "sonatype") { + logger.debug("Disabling task `{}` because it publishes to Sonatype", t.path) + t.enabled = false + } + } + // verify credentials for publishing the plugin up front to avoid any work (only if we are publishing) if ( tg.hasTask( ":publishPlugins" ) && project.tasks.publishPlugins.enabled ) { // we are publishing the plugin - make sure there is a credentials pair diff --git a/tooling/hibernate-maven-plugin/hibernate-maven-plugin.gradle b/tooling/hibernate-maven-plugin/hibernate-maven-plugin.gradle index f0bb4cc2959c..d968a142933c 100644 --- a/tooling/hibernate-maven-plugin/hibernate-maven-plugin.gradle +++ b/tooling/hibernate-maven-plugin/hibernate-maven-plugin.gradle @@ -1,10 +1,3 @@ -description = 'Maven plugin to integrate aspects of Hibernate into your build.' - -apply from: rootProject.file( 'gradle/java-module.gradle' ) -apply from: rootProject.file( 'gradle/publishing.gradle' ) - -apply plugin: 'org.hibernate.build.maven-embedder' - /* * Hibernate, Relational Persistence for Idiomatic Java * @@ -12,6 +5,14 @@ apply plugin: 'org.hibernate.build.maven-embedder' * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html. */ +plugins { + id "local.java-module" + id "local.publishing" + id "org.hibernate.build.maven-embedder" +} + +description = 'Maven plugin to integrate aspects of Hibernate into your build.' + dependencies { implementation project( ":hibernate-core" ) @@ -21,6 +22,28 @@ dependencies { implementation "org.apache.maven.shared:file-management:3.1.0" } +def releasePrepareTask = tasks.register("releasePrepare") { + group "release-prepare" + description "See :release:releasePrepare for details. Here we hook in the `check` task." + + dependsOn tasks.check +} + +// used from the h2 CI job +tasks.register("preVerifyRelease") { + group "release-prepare" + description "Delegates to `releasePrepare` task" + + dependsOn releasePrepareTask +} + +tasks.register( 'releasePerform' ) { + group "release-perform" + description "See :release:releasePerform for details. Here we hook in publishing to Sonatype" + + dependsOn tasks.publishAllPublicationsToSonatypeRepository +} + var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension publishingExtension.publications.named("publishedArtifacts") { from components.java diff --git a/tooling/metamodel-generator/hibernate-processor.gradle b/tooling/metamodel-generator/hibernate-processor.gradle index 6e2df89dd3e1..e821c565b44b 100644 --- a/tooling/metamodel-generator/hibernate-processor.gradle +++ b/tooling/metamodel-generator/hibernate-processor.gradle @@ -1,22 +1,17 @@ -import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis - /* * Hibernate, Relational Persistence for Idiomatic Java * * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -description = 'Hibernate compile-time tooling' - -apply from: rootProject.file( 'gradle/published-java-module.gradle' ) -apply from: rootProject.file( 'gradle/group-relocation.gradle' ) -apply plugin: 'org.hibernate.build.version-injection' +plugins { + id "local.publishing-java-module" + id "local.publishing-group-relocation" + id "org.hibernate.build.version-injection" +} -//java { -// sourceCompatibility = jdks.versions.baseline.get() -// targetCompatibility = sourceCompatibility -//} +description = 'Hibernate compile-time tooling' sourceSets { quarkusOrmPanache { @@ -147,20 +142,22 @@ compileTestJava { } var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension +def oldGroupId = "org.hibernate" +def oldArtifactId = "hibernate-jpamodelgen" publishingExtension.publications.named("groupRelocation", MavenPublication) { - // org.hibernate:hibernate-jpamodelgen -> org.hibernate.orm:hibernate-processor + artifactId = oldArtifactId pom { - artifactId = 'hibernate-jpamodelgen' - name = 'hibernate-jpamodelgen (relocated)' + name = "Relocation : ${oldGroupId}:${oldArtifactId} -> ${project.group}:${project.name}" + description = "The `${oldArtifactId}` module has been renamed `${project.name}` and moved to the `${project.group}` group-id" } } publishingExtension.publications.register("renameRelocation", MavenPublication) { - // org.hibernate.orm:hibernate-jpamodelgen -> org.hibernate.orm:hibernate-processor + artifactId = oldArtifactId pom { - artifactId = 'hibernate-jpamodelgen' - name = 'hibernate-jpamodelgen (relocated)' + name = "Relocation : ${project.group}:${oldArtifactId} -> ${project.group}:${project.name}" + description = "The `${oldArtifactId}` module has been renamed `${project.name}`" distributionManagement { relocation {