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 'me.champeau.buildscan-recipes' version '0.2.3'
id 'org.hibernate.build.xjc' version '2.0.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.
Changes in 6.0.0.Alpha7 (March 18, 2021)
------------------------------------------------------------------------------------------------------------------------

View File

@ -8,12 +8,15 @@
apply plugin: 'base'
ext {
ormVersionFile = file( "${rootProject.projectDir}/gradle/version.properties" )
ormVersion = HibernateVersion.fromFile( ormVersionFile, project )
// Override during releases
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')
}

View File

@ -379,7 +379,12 @@ public class JarVisitorTest extends PackagingTestCase {
long newTime = System.currentTimeMillis() - start;
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

View File

@ -11,6 +11,10 @@ import org.hibernate.dialect.H2Dialect;
import org.hibernate.testing.RequiresDialect;
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.fail;
@ -35,8 +39,16 @@ public class SqlFunctionMetadataBuilderContributorIllegalClassArgumentTest
fail("Should throw exception!");
}
catch (ClassCastException e) {
assertTrue( e.getMessage().contains( "cannot be cast to" ) );
assertTrue( e.getMessage().contains( "org.hibernate.boot.spi.MetadataBuilderContributor" ) );
System.out.println( "Checking exception : " + e.getMessage() );
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: 'distribution'
ext {
if ( !project.hasProperty( 'gitRemote' ) ) {
gitRemote = 'origin'
}
}
idea.module {
}
@ -25,48 +20,17 @@ idea.module {
final File documentationDir = mkdir( "${project.buildDir}/documentation" )
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.
*
* Depends on building the docs
*/
task assembleDocumentation(type: Task, dependsOn: [rootProject.project( 'documentation' ).tasks.buildDocsForPublishing]) {
description = 'Assembles all documentation into the {buildDir}/documentation directory'
task assembleDocumentation {
group 'Release'
description 'Assembles all documentation into the {buildDir}/documentation directory'
dependsOn rootProject.project( 'documentation' ).tasks.buildDocsForPublishing
doLast {
// 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
*/
task uploadDocumentation(type:Exec, dependsOn: assembleDocumentation) {
description = "Uploads documentation to the JBoss doc server"
task uploadDocumentation(type:Exec) {
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}";
@ -246,12 +213,19 @@ distTar.compression = Compression.GZIP
/**
* "virtual" task for building both types of dist bundles
*/
task buildBundles(type: Task, dependsOn: [distZip,distTar]) {
description = "Builds all release bundles"
task buildBundles {
group 'Release'
description 'Builds all release bundles'
dependsOn distZip
dependsOn distTar
}
task uploadBundlesSourceForge(type: Exec, dependsOn: buildBundles) {
description = "Uploads release bundles to SourceForge"
task uploadBundlesSourceForge(type: Exec) {
group 'Release'
description 'Uploads release bundles to SourceForge'
dependsOn buildBundles
final String url = "frs.sourceforge.net:/home/frs/project/hibernate/hibernate-orm/${version}";
@ -284,11 +258,16 @@ artifacts {
bundles distZip
}
task release( dependsOn: [releaseChecks, uploadDocumentation, uploadBundlesSourceForge] )
task releaseChecks {
group 'Release'
description
}
task changeLogFile( dependsOn: [releaseChecks] ) {
group = "Release"
description = "Updates the changelog.txt file"
task changeLogFile {
group 'Release'
description 'Updates the changelog.txt file based on the change-log report from Jira'
dependsOn project.tasks.releaseChecks
doFirst {
logger.lifecycle( "Appending version '${project.releaseVersion}' to changelog..." )
@ -296,10 +275,13 @@ task changeLogFile( dependsOn: [releaseChecks] ) {
}
}
task addVersionCommit( dependsOn: [changeLogFile] ) {
group = "Release"
description = "Adds a commit for the released version and push the changes to github"
doFirst{
task addVersionCommit {
group "Release"
description "Adds a commit for setting the released version"
dependsOn project.tasks.releaseChecks
doFirst {
logger.lifecycle( "Updating version to '${project.releaseVersion}'..." )
project.ormVersionFile.text = "hibernateVersion=${project.releaseVersion}"
@ -308,20 +290,43 @@ task addVersionCommit( dependsOn: [changeLogFile] ) {
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 ->
if ( !this.name.equals( subProject.name ) ) {
if ( project.name != subProject.name ) {
if ( subProject.tasks.findByName( 'release' ) ) {
this.tasks.release.dependsOn( subProject.tasks.release )
subProject.tasks.release.mustRunAfter( this.tasks.addVersionCommit )
project.tasks.publishReleaseArtifacts.dependsOn( subProject.tasks.release )
subProject.tasks.release.dependsOn( releaseChecks )
subProject.tasks.release.mustRunAfter( releaseChecks )
}
}
}
task ciRelease( dependsOn: [releaseChecks, addVersionCommit, release] ) {
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."
task ciReleaseChecks {
dependsOn releaseChecks
}
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 {
String tag = null
if ( !project.hasProperty( 'noTag' ) ) {
@ -349,6 +354,7 @@ task ciRelease( dependsOn: [releaseChecks, addVersionCommit, release] ) {
}
}
}
ciRelease.mustRunAfter addVersionCommit
static String executeGitCommand(Object ... subcommand){
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 {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.14.0'
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' )
apply from: rootProject.file( 'gradle/libraries.gradle' )
apply from: rootProject.file( 'gradle/javadoc.gradle' )
description = "Gradle plugin for integrating Hibernate aspects into your build"
ext {
pluginId = 'org.hibernate.orm'
pluginVersion = project.version
//noinspection GrUnresolvedAccess
publishKey = credentials.'hibernate.gradle.publish.key'
//noinspection GrUnresolvedAccess
publishSecret = credentials.'hibernate.gradle.publish.secret'
if ( publishKey != null && publishSecret != null ) {
project.'gradle.publish.key' = publishKey
project.'gradle.publish.secret' = publishSecret
// 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' )
}
}
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 localGroovy()
}
@ -77,8 +76,6 @@ processResources {
}
task release
if ( project.version.toString().endsWith( '-SNAPSHOT' ) ) {
tasks.publishPlugins.enabled = false
tasks.release.dependsOn tasks.publish
@ -88,16 +85,6 @@ else {
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 {
doFirst {
if ( credentials.hibernatePluginPortalUsername == null ) {
@ -109,7 +96,6 @@ tasks.publishPlugins {
}
}
publishing {
publications {
plugin( MavenPublication ) {