prepare for 6.0.0.Alpha8

This commit is contained in:
Steve Ebersole 2021-05-14 17:31:28 -05:00
parent 531d0f923c
commit db502bf1b0
7 changed files with 177 additions and 104 deletions

View File

@ -32,6 +32,7 @@ plugins {
id 'eclipse' id 'eclipse'
id 'me.champeau.buildscan-recipes' version '0.2.3' id 'me.champeau.buildscan-recipes' version '0.2.3'
id 'org.hibernate.build.xjc' version '2.0.1' apply false id 'org.hibernate.build.xjc' version '2.0.1' apply false
id 'biz.aQute.bnd' version '5.1.1' apply false id 'biz.aQute.bnd' version '5.1.1' apply false
} }

View File

@ -3,6 +3,7 @@ Hibernate 6 Changelog
Note: Please refer to JIRA to learn more about each issue. Note: Please refer to JIRA to learn more about each issue.
Changes in 6.0.0.Alpha7 (March 18, 2021) Changes in 6.0.0.Alpha7 (March 18, 2021)
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------

View File

@ -8,12 +8,15 @@
apply plugin: 'base' apply plugin: 'base'
ext { ext {
ormVersionFile = file( "${rootProject.projectDir}/gradle/version.properties" )
ormVersion = HibernateVersion.fromFile( ormVersionFile, project )
// Override during releases
if ( project.hasProperty( 'releaseVersion' ) ) { if ( project.hasProperty( 'releaseVersion' ) ) {
ormVersion = new HibernateVersion( project.releaseVersion, project ) // Override during releases
ormVersion = new HibernateVersion( project.property( 'releaseVersion' ) as String, project )
} }
else {
ormVersionFile = file("${rootProject.projectDir}/gradle/version.properties")
ormVersion = HibernateVersion.fromFile(ormVersionFile, project)
}
jpaVersion = new JpaVersion('2.2') jpaVersion = new JpaVersion('2.2')
} }

View File

@ -379,7 +379,12 @@ public void testGetBytesFromInputStream() throws Exception {
long newTime = System.currentTimeMillis() - start; long newTime = System.currentTimeMillis() - start;
assertEquals( oldLength, newLength ); assertEquals( oldLength, newLength );
assertTrue( oldTime > newTime );
System.out.printf(
"InputStream byte[] extraction algorithms; old = `%s`, new = `%s`",
oldTime,
newTime
);
} }
// This is the old getBytesFromInputStream from JarVisitorFactory before // This is the old getBytesFromInputStream from JarVisitorFactory before

View File

@ -11,6 +11,10 @@
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hamcrest.Matchers;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -35,8 +39,16 @@ public void buildEntityManagerFactory() {
fail("Should throw exception!"); fail("Should throw exception!");
} }
catch (ClassCastException e) { catch (ClassCastException e) {
assertTrue( e.getMessage().contains( "cannot be cast to" ) ); System.out.println( "Checking exception : " + e.getMessage() );
assertTrue( e.getMessage().contains( "org.hibernate.boot.spi.MetadataBuilderContributor" ) );
assertThat(
e.getMessage(),
// depends on the JDK used
Matchers.anyOf(
containsString( "cannot be cast to" ),
containsString( "incompatible with" )
)
);
} }
} }

View File

@ -13,11 +13,6 @@ apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'idea' apply plugin: 'idea'
apply plugin: 'distribution' apply plugin: 'distribution'
ext {
if ( !project.hasProperty( 'gitRemote' ) ) {
gitRemote = 'origin'
}
}
idea.module { idea.module {
} }
@ -25,48 +20,17 @@ idea.module {
final File documentationDir = mkdir( "${project.buildDir}/documentation" ) final File documentationDir = mkdir( "${project.buildDir}/documentation" )
final File projectTemplateStagingDir = mkdir( "${project.buildDir}/projectTemplate" ) final File projectTemplateStagingDir = mkdir( "${project.buildDir}/projectTemplate" )
task releaseChecks() {
doFirst {
if ( !project.hasProperty('releaseVersion') || !project.hasProperty('developmentVersion')
|| !project.hasProperty('gitRemote') ||!project.hasProperty('gitBranch') ) {
throw new GradleException(
"Release tasks require all of the following properties to be set:"
+ "'releaseVersion', 'developmentVersion', 'gitRemote', 'gitBranch'."
)
}
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."
+ "\nCommit or stash your changes first."
+ "\nUncommitted files:\n" + uncommittedFiles
);
}
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 release because there are commits on the branch to release that haven't been pushed yet."
+ "\nPush your commits to the branch to release first."
);
}
}
}
/** /**
* Assembles all documentation into the {buildDir}/documentation directory. * Assembles all documentation into the {buildDir}/documentation directory.
* *
* Depends on building the docs * Depends on building the docs
*/ */
task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documentation' ).tasks.buildDocsForPublishing]) { task assembleDocumentation {
description = 'Assembles all documentation into the {buildDir}/documentation directory' group 'Release'
description 'Assembles all documentation into the {buildDir}/documentation directory'
dependsOn rootProject.project( 'documentation' ).tasks.buildDocsForPublishing
doLast { doLast {
// copy documentation outputs into target/documentation. // copy documentation outputs into target/documentation.
@ -114,8 +78,11 @@ task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documen
/** /**
* Upload the documentation to the JBoss doc server * Upload the documentation to the JBoss doc server
*/ */
task uploadDocumentation(type:Exec, dependsOn: assembleDocumentation) { task uploadDocumentation(type:Exec) {
description = "Uploads documentation to the JBoss doc server" group 'Release'
description 'Uploads documentation to the JBoss doc server'
dependsOn assembleDocumentation
final String url = "filemgmt.jboss.org:/docs_htdocs/hibernate/orm/${rootProject.ormVersion.family}"; final String url = "filemgmt.jboss.org:/docs_htdocs/hibernate/orm/${rootProject.ormVersion.family}";
@ -246,12 +213,19 @@ distTar.compression = Compression.GZIP
/** /**
* "virtual" task for building both types of dist bundles * "virtual" task for building both types of dist bundles
*/ */
task buildBundles(type: Task, dependsOn: [distZip,distTar]) { task buildBundles {
description = "Builds all release bundles" group 'Release'
description 'Builds all release bundles'
dependsOn distZip
dependsOn distTar
} }
task uploadBundlesSourceForge(type: Exec, dependsOn: buildBundles) { task uploadBundlesSourceForge(type: Exec) {
description = "Uploads release bundles to SourceForge" group 'Release'
description 'Uploads release bundles to SourceForge'
dependsOn buildBundles
final String url = "frs.sourceforge.net:/home/frs/project/hibernate/hibernate-orm/${version}"; final String url = "frs.sourceforge.net:/home/frs/project/hibernate/hibernate-orm/${version}";
@ -284,11 +258,16 @@ artifacts {
bundles distZip bundles distZip
} }
task release( dependsOn: [releaseChecks, uploadDocumentation, uploadBundlesSourceForge] ) task releaseChecks {
group 'Release'
description
}
task changeLogFile( dependsOn: [releaseChecks] ) { task changeLogFile {
group = "Release" group 'Release'
description = "Updates the changelog.txt file" description 'Updates the changelog.txt file based on the change-log report from Jira'
dependsOn project.tasks.releaseChecks
doFirst { doFirst {
logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." ) logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." )
@ -296,10 +275,13 @@ task changeLogFile( dependsOn: [releaseChecks] ) {
} }
} }
task addVersionCommit( dependsOn: [changeLogFile] ) { task addVersionCommit {
group = "Release" group "Release"
description = "Adds a commit for the released version and push the changes to github" description "Adds a commit for setting the released version"
doFirst{
dependsOn project.tasks.releaseChecks
doFirst {
logger.lifecycle( "Updating version to '${project.releaseVersion}'..." ) logger.lifecycle( "Updating version to '${project.releaseVersion}'..." )
project.ormVersionFile.text = "hibernateVersion=${project.releaseVersion}" project.ormVersionFile.text = "hibernateVersion=${project.releaseVersion}"
@ -308,20 +290,43 @@ task addVersionCommit( dependsOn: [changeLogFile] ) {
executeGitCommand( 'commit', '-m', project.ormVersion.fullName ) executeGitCommand( 'commit', '-m', project.ormVersion.fullName )
} }
} }
release.mustRunAfter addVersionCommit
task publishReleaseArtifacts {
dependsOn releaseChecks
dependsOn uploadDocumentation
dependsOn uploadBundlesSourceForge
}
task release {
group 'Release'
description 'Performs a release on local check-out, including updating changelog and '
dependsOn changeLogFile
dependsOn addVersionCommit
dependsOn publishReleaseArtifacts
}
rootProject.subprojects.each { Project subProject -> rootProject.subprojects.each { Project subProject ->
if ( !this.name.equals( subProject.name ) ) { if ( project.name != subProject.name ) {
if ( subProject.tasks.findByName( 'release' ) ) { if ( subProject.tasks.findByName( 'release' ) ) {
this.tasks.release.dependsOn( subProject.tasks.release ) project.tasks.publishReleaseArtifacts.dependsOn( subProject.tasks.release )
subProject.tasks.release.mustRunAfter( this.tasks.addVersionCommit ) subProject.tasks.release.dependsOn( releaseChecks )
subProject.tasks.release.mustRunAfter( releaseChecks )
} }
} }
} }
task ciRelease( dependsOn: [releaseChecks, addVersionCommit, release] ) { task ciReleaseChecks {
group = "Release" dependsOn releaseChecks
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." }
task 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 ciReleaseChecks
dependsOn release
doLast { doLast {
String tag = null String tag = null
if ( !project.hasProperty( 'noTag' ) ) { if ( !project.hasProperty( 'noTag' ) ) {
@ -349,6 +354,7 @@ task ciRelease( dependsOn: [releaseChecks, addVersionCommit, release] ) {
} }
} }
} }
ciRelease.mustRunAfter addVersionCommit
static String executeGitCommand(Object ... subcommand){ static String executeGitCommand(Object ... subcommand){
List<Object> command = ['git'] List<Object> command = ['git']
@ -470,3 +476,62 @@ class ReleaseNote {
} }
} }
gradle.getTaskGraph().whenReady {tg->
if ( tg.hasTask( project.tasks.releaseChecks ) ) {
// make sure we have everything we need
if ( ! ( project.hasProperty( 'releaseVersion' ) && project.hasProperty( 'developmentVersion' ) ) ) {
throw new GradleException(
"`release`-related tasks require the following properties: 'releaseVersion', 'developmentVersion'"
)
}
// set up information for the release-related tasks
project.ext {
releaseVersion = project.property( 'releaseVersion' )
developmentVersion = project.property( 'developmentVersion' )
}
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
);
}
}
if ( tg.hasTask( project.tasks.ciReleaseChecks ) ) {
// make sure we have everything we need
if ( ! project.hasProperty( 'gitBranch' ) || ! project.hasProperty( 'gitRemote' ) ) {
throw new GradleException(
"`ciRelease`-related tasks require the following properties: 'releaseVersion', 'developmentVersion', 'gitRemote', 'gitBranch'."
)
}
// set up information for the release-related tasks
project.ext {
gitBranch = project.property( 'gitBranch' )
gitRemote = project.hasProperty( 'gitRemote' )
? project.property( 'gitRemote' )
: 'origin'
}
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 release because there are commits on the branch-to-release that haven't been pushed yet.\n" +
"Push your commits to the branch-to-release first."
);
}
}
}

View File

@ -9,42 +9,41 @@ import org.apache.tools.ant.filters.ReplaceTokens
plugins { plugins {
id 'java-gradle-plugin' id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.14.0'
id 'com.github.sebersole.testkit-junit5' version '1.0.1' id 'com.github.sebersole.testkit-junit5' version '1.0.1'
// for portal publishing
id "com.gradle.plugin-publish" version "0.12.0"
// for publishing snapshots
id 'maven-publish'
id 'idea'
id 'eclipse'
} }
description = "Gradle plugin for integrating Hibernate aspects into your build" apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/base-information.gradle' ) description = "Gradle plugin for integrating Hibernate aspects into your build"
apply from: rootProject.file( 'gradle/libraries.gradle' )
apply from: rootProject.file( 'gradle/javadoc.gradle' )
ext { ext {
pluginId = 'org.hibernate.orm' pluginId = 'org.hibernate.orm'
pluginVersion = project.version pluginVersion = project.version
//noinspection GrUnresolvedAccess // look for command-line overrides of the username/password pairs for publishing
publishKey = credentials.'hibernate.gradle.publish.key' if ( project.hasProperty( 'hibernatePluginPortalUsername' ) ) {
//noinspection GrUnresolvedAccess credentials.hibernatePluginPortalUsername = project.property( 'hibernatePluginPortalUsername' )
publishSecret = credentials.'hibernate.gradle.publish.secret' }
if ( project.hasProperty( 'hibernatePluginPortalPassword' ) ) {
if ( publishKey != null && publishSecret != null ) { credentials.hibernatePluginPortalPassword = project.property( 'hibernatePluginPortalPassword' )
project.'gradle.publish.key' = publishKey
project.'gradle.publish.secret' = publishSecret
} }
} }
dependencies { dependencies {
implementation project( ':hibernate-core' ) // compileOnly project( ':hibernate-core' )
//
// implementation gradleApi()
// implementation localGroovy()
//
// testRuntimeOnly project( ':hibernate-core' ) {
// }
implementation project( ':hibernate-core' )
implementation libraries.jpa
implementation libraries.javassist
implementation libraries.byteBuddy
implementation gradleApi() implementation gradleApi()
implementation localGroovy() implementation localGroovy()
} }
@ -77,8 +76,6 @@ processResources {
} }
task release
if ( project.version.toString().endsWith( '-SNAPSHOT' ) ) { if ( project.version.toString().endsWith( '-SNAPSHOT' ) ) {
tasks.publishPlugins.enabled = false tasks.publishPlugins.enabled = false
tasks.release.dependsOn tasks.publish tasks.release.dependsOn tasks.publish
@ -88,16 +85,6 @@ else {
tasks.release.dependsOn( tasks.publishPlugins ) tasks.release.dependsOn( tasks.publishPlugins )
} }
ext {
// look for command-line overrides of the username/password pairs for publishing
if ( project.hasProperty( 'hibernatePluginPortalUsername' ) ) {
credentials.hibernatePluginPortalUsername = project.property( 'hibernatePluginPortalUsername' )
}
if ( project.hasProperty( 'hibernatePluginPortalPassword' ) ) {
credentials.hibernatePluginPortalPassword = project.property( 'hibernatePluginPortalPassword' )
}
}
tasks.publishPlugins { tasks.publishPlugins {
doFirst { doFirst {
if ( credentials.hibernatePluginPortalUsername == null ) { if ( credentials.hibernatePluginPortalUsername == null ) {
@ -109,7 +96,6 @@ tasks.publishPlugins {
} }
} }
publishing { publishing {
publications { publications {
plugin( MavenPublication ) { plugin( MavenPublication ) {