Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ plugins {
// Releasing

tasks.register( 'releasePrepare' ) {
group "release-prepare"
description "Scripted release 'Release Prepare' stage. " +
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
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
3 changes: 0 additions & 3 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 15 additions & 14 deletions hibernate-core/hibernate-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jar {
}

ext {
jaxbTargetDir = project.file( "${buildDir}/generated/sources/xjc/main" )
jaxbTargetDir = project.layout.buildDirectory.dir("generated/sources/xjc/main").get().asFile
}

sourceSets {
Expand Down Expand Up @@ -144,11 +144,11 @@ versionInjection {
into( 'org.hibernate.Version', 'initVersion' )
}

task copyBundleResourcesXml (type: Copy) {
tasks.register('copyBundleResourcesXml', Copy) {
inputs.property( "db", db )
inputs.property( "dbHost", dbHost )
ext {
bundlesTargetDir = file( "${buildDir}/bundles" )
bundlesTargetDir = layout.buildDirectory.dir("bundles").get().asFile
// Escape
bundleTokens = [
'db.dialect' : dbBundle[db]['db.dialect'].replace("&", "&"),
Expand All @@ -159,7 +159,7 @@ task copyBundleResourcesXml (type: Copy) {
'jdbc.datasource' : dbBundle[db]['jdbc.datasource'].replace("&", "&"),
'connection.init_sql' : dbBundle[db]['connection.init_sql'].replace("&", "&")
]
ext.bundleTokens['buildDirName'] = project.relativePath( buildDir )
ext.bundleTokens['buildDirName'] = project.relativePath( layout.buildDirectory.asFile.get() )
}

from('src/test/bundles/templates') {
Expand All @@ -173,13 +173,13 @@ task copyBundleResourcesXml (type: Copy) {
}
}

task copyBundleResourcesNonXml (type: Copy) {
tasks.register('copyBundleResourcesNonXml', Copy) {
inputs.property( "db", db )
ext {
bundlesTargetDir = file( "${buildDir}/bundles" )
bundlesTargetDir = layout.buildDirectory.dir("bundles").get().asFile
// Escape
bundleTokens = dbBundle[db]
ext.bundleTokens['buildDirName'] = project.relativePath( buildDir )
ext.bundleTokens['buildDirName'] = project.relativePath(layout.buildDirectory.asFile.get())
}

from('src/test/bundles/templates') {
Expand All @@ -193,7 +193,7 @@ task copyBundleResourcesNonXml (type: Copy) {
}
}

task copyBundleResources (type: Copy) {
tasks.register('copyBundleResources', Copy) {
inputs.property( "db", db )
dependsOn tasks.copyBundleResourcesXml
dependsOn tasks.copyBundleResourcesNonXml
Expand All @@ -208,7 +208,8 @@ sourcesJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

task testJar(type: Jar, dependsOn: testClasses) {
tasks.register('testJar', Jar) {
dependsOn testClasses
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set( 'test' )
from sourceSets.test.output
Expand All @@ -234,9 +235,9 @@ tasks.register( "generateAnnotationClasses", JavaCompile ) {
destinationDirectory.set( project.layout.buildDirectory.dir( "generated/sources/annotations/" ) )
}

task generateEnversStaticMetamodel(
type: JavaCompile,
description: "Generate the Hibernate Envers revision entity static metamodel classes." ) {
tasks.register('generateEnversStaticMetamodel', JavaCompile) {
description = "Generate the Hibernate Envers revision entity static metamodel classes."

source = sourceSets.main.java
// we only want to include these specific classes for metamodel generation.
// if envers adds any additional revision entity classes, they must be listed here.
Expand All @@ -253,10 +254,10 @@ task generateEnversStaticMetamodel(
]

// put static metamodel classes back out to the source tree since they're version controlled.
destinationDirectory = new File( "${projectDir}/src/main/java" )
destinationDirectory = layout.projectDirectory.dir("src/main/java").asFile
}

tasks.withType( Test.class ).each { test ->
tasks.withType( Test.class ).configureEach { test ->
test.systemProperty 'file.encoding', 'utf-8'
// Allow creating a function in HSQLDB for this Java method
test.systemProperty 'hsqldb.method_class_names', 'org.hibernate.orm.test.jpa.transaction.TransactionTimeoutTest.sleep'
Expand Down
2 changes: 1 addition & 1 deletion hibernate-envers/hibernate-envers.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ configurations {
}
}

tasks.withType( Test.class ).each { test ->
tasks.withType( Test.class ).configureEach { test ->
// see GradleParallelTestingResolver for how the test worker id is resolved in JDBC configs
if ( project.db == "h2" || project.db == "hsqldb" || project.db == "pgsql_ci" || project.db == "edb_ci"
|| project.db == "oracle_ci" || project.db == "oracle_xe_ci" || project.db == "mysql_ci" || project.db == "mariadb_ci"
Expand Down
4 changes: 2 additions & 2 deletions hibernate-platform/hibernate-platform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ dependencies {


tasks.register("releasePrepare") {
group "release-prepare"
description "See :release:releasePrepare for details."
group = "release-prepare"
description = "See :release:releasePrepare for details."

dependsOn tasks.generateMetadataFileForPublishedArtifactsPublication
dependsOn tasks.generatePomFileForPublishedArtifactsPublication
Expand Down
2 changes: 1 addition & 1 deletion local-build-plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repositories {

group = 'org.hibernate.build'
version = '1.0.0-SNAPSHOT'
buildDir = "target"
layout.buildDirectory.set(file("target"))

dependencies {
implementation gradleApi()
Expand Down
83 changes: 40 additions & 43 deletions local-build-plugins/src/main/groovy/local.java-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ sourceSets {
test {
resources {
configure( srcDir('src/test/resources') ) {
filter {
include '*.properties'
include '*.xml'
include '**/*.properties'
include '**/*.xml'
filter {
include '*.properties'
include '*.xml'
include '**/*.properties'
include '**/*.xml'
}
}
}
Expand Down Expand Up @@ -179,12 +179,12 @@ processTestResources {
}
copy {
from file( 'src/test/resources' )
into file( "${buildDir}/resources/test" )
into layout.buildDirectory.dir("resources/test").get().asFile
exclude 'src/test/resources/hibernate.properties'
}
copy {
from file( 'src/test/resources/hibernate.properties' )
into file( "${buildDir}/resources/test" )
into layout.buildDirectory.dir("resources/test").get().asFile
filter( ReplaceTokens, tokens: dbBundle[db] )
}
}
Expand All @@ -194,7 +194,7 @@ processTestResources {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Testing

tasks.withType( Test.class ).each { test ->
tasks.withType( Test.class ).configureEach { test ->
test.useJUnitPlatform()

// Byteman needs this property to be set, https://developer.jboss.org/thread/274997
Expand Down Expand Up @@ -244,8 +244,8 @@ test {
// 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 {
displayGranularity 1
events "passed", "skipped", "failed"
displayGranularity = 1
events = ["passed", "skipped", "failed"]
exceptionFormat = 'full'
}
}
Expand All @@ -254,7 +254,7 @@ test {
// Attach tools JAR to the classpath for byteman tests
final File toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
if ( toolsJar.exists() ) {
dependencies{
dependencies {
testImplementation files( toolsJar )
}
}
Expand All @@ -269,7 +269,7 @@ java {
withSourcesJar()
}

tasks.withType(Jar).configureEach {
tasks.withType(Jar).configureEach {jarTask ->
manifest {
attributes(
// Basic JAR manifest attributes
Expand All @@ -289,41 +289,38 @@ tasks.withType(Jar).configureEach {
'Bundle-Vendor': 'Hibernate.org',
'Bundle-DocURL': "https://hibernate.org/orm/releases/${hibernateVersion.family}"
)
if ("jar".equals(jarTask.name)) {
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,
// 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}"
)
}
}
}

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,
// 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}"
)
}
metaInf {
from(rootProject.projectDir, {
include "LICENSE.txt"
})
if ("jar".equals(jarTask.name)) {
metaInf {
from(rootProject.projectDir, {
include "LICENSE.txt"
})
}
}
}



// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Reproducible Builds

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package org.hibernate.build.xjc;

import com.sun.tools.xjc.XJCListener;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.xml.sax.SAXParseException;

/**
Expand All @@ -15,12 +15,12 @@
*/
public class XjcListenerImpl extends XJCListener {
private final String schemaName;
private final Project project;
private final Logger logger;
private boolean hadErrors;

public XjcListenerImpl(String schemaName, Project project) {
public XjcListenerImpl(String schemaName, Logger logger) {
this.schemaName = schemaName;
this.project = project;
this.logger = logger;
}

public boolean hadErrors() {
Expand All @@ -29,33 +29,33 @@ public boolean hadErrors() {

@Override
public void generatedFile(String fileName, int current, int total) {
project.getLogger().info( "XJC generated file ({}) : {}", schemaName, fileName );
logger.info( "XJC generated file ({}) : {}", schemaName, fileName );
}

@Override
public void message(String msg) {
project.getLogger().info( "XJC message ({}) : {}", schemaName, msg );
logger.info( "XJC message ({}) : {}", schemaName, msg );
}

@Override
public void info(SAXParseException exception) {
project.getLogger().info( "XJC info ({})", schemaName, exception );
logger.info( "XJC info ({})", schemaName, exception );
}

@Override
public void warning(SAXParseException exception) {
project.getLogger().warn( "XJC warning ({})",schemaName, exception );
logger.warn( "XJC warning ({})",schemaName, exception );
}

@Override
public void error(SAXParseException exception) {
hadErrors = true;
project.getLogger().error( "XJC error ({})", schemaName, exception );
logger.error( "XJC error ({})", schemaName, exception );
}

@Override
public void fatalError(SAXParseException exception) {
hadErrors = true;
project.getLogger().error( "XJC fatal error ({})", schemaName, exception );
logger.error( "XJC fatal error ({})", schemaName, exception );
}
}
Loading