HHH-14513 Move publishing release artifacts from BinTray

This commit is contained in:
Andrea Boriero 2021-04-29 15:50:25 +02:00
parent c096b463ee
commit 9bcf10fb3f
6 changed files with 79 additions and 99 deletions

View File

@ -22,7 +22,7 @@ buildscript {
plugins {
id 'me.champeau.buildscan-recipes' version '0.2.3'
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
id 'nu.studer.credentials' version '2.1' apply false
id 'nu.studer.credentials' version '2.1'
id 'org.hibernate.build.xjc' version '2.0.1' apply false
id 'org.hibernate.build.maven-repo-auth' version '3.0.3' apply false
id 'biz.aQute.bnd' version '5.1.1' apply false
@ -33,10 +33,22 @@ ext {
sonatypeOssrhPassword = project.findProperty( 'SONATYPE_OSSRH_PASSWORD' )
}
// nexusPublishing uses group and version
// as defaults
group = project.group
version = project.version
File versionFile = file( "${rootProject.projectDir}/gradle/version.properties" )
ext {
ormVersionFile = versionFile
ormVersion = HibernateVersion.fromFile( versionFile, project )
// Override during releases
if ( project.hasProperty( 'releaseVersion' ) ) {
ormVersion = new HibernateVersion( project.releaseVersion, project )
}
jpaVersion = new JpaVersion('2.2')
}
// The Gradle Nexus Publish Plugin must be applied to the root project and requires group and version
group = 'org.hibernate'
version = project.ormVersion.fullName
nexusPublishing {
repositories {
@ -60,13 +72,11 @@ allprojects {
}
apply plugin: 'idea'
group = project.group
version = project.version
// minimize changes, at least for now (gradle uses 'build' by default)..
buildDir = "target"
apply from: rootProject.file( 'gradle/base-information.gradle' )
group = 'org.hibernate'
version = project.ormVersion.fullName
}
@ -125,6 +135,66 @@ buildScanRecipes {
recipe 'git-commit', baseUrl: 'https://github.com/hibernate/hibernate-orm/tree'
}
class JpaVersion {
/** The *normal* name (1.0, 2.0, ..) */
final String name;
final String osgiName
JpaVersion(String version){
this.name = version
this.osgiName = version + ".0"
}
@Override
String toString() {
return name
}
}
class HibernateVersion {
final String fullName
final String majorVersion
final String family
final String osgiVersion
final boolean isSnapshot
HibernateVersion(String fullName, Project project) {
this.fullName = fullName
final String[] hibernateVersionComponents = fullName.split( '\\.' )
this.majorVersion = hibernateVersionComponents[0]
this.family = hibernateVersionComponents[0] + '.' + hibernateVersionComponents[1]
this.isSnapshot = fullName.endsWith( '-SNAPSHOT' )
this.osgiVersion = isSnapshot ? family + '.' + hibernateVersionComponents[2] + '.SNAPSHOT' : fullName
}
static HibernateVersion fromFile(File file, Project project){
def fullName = readVersionProperties(file)
return new HibernateVersion(fullName, project)
}
private static String readVersionProperties(File file) {
if ( !file.exists() ) {
throw new GradleException( "Version file $file.canonicalPath does not exists" )
}
Properties versionProperties = new Properties()
file.withInputStream {
stream -> versionProperties.load( stream )
}
return versionProperties.hibernateVersion
}
@Override
String toString() {
return this.fullName
}
}
//idea {
// project {
// jdkName = gradle.ext.baselineJavaVersion

View File

@ -1,83 +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'
File versionFile = file( "${rootProject.projectDir}/gradle/version.properties" )
ext {
ormVersionFile = versionFile
ormVersion = HibernateVersion.fromFile( versionFile, project )
// Override during releases
if ( project.hasProperty( 'releaseVersion' ) ) {
ormVersion = new HibernateVersion( project.releaseVersion, project )
}
jpaVersion = new JpaVersion('2.2')
}
group = 'org.hibernate'
version = project.ormVersion.fullName
class JpaVersion {
/** The *normal* name (1.0, 2.0, ..) */
final String name;
final String osgiName
JpaVersion(String version){
this.name = version
this.osgiName = version + ".0"
}
@Override
String toString() {
return name
}
}
class HibernateVersion {
final String fullName
final String majorVersion
final String family
final String osgiVersion
final boolean isSnapshot
HibernateVersion(String fullName, Project project) {
this.fullName = fullName
final String[] hibernateVersionComponents = fullName.split( '\\.' )
this.majorVersion = hibernateVersionComponents[0]
this.family = hibernateVersionComponents[0] + '.' + hibernateVersionComponents[1]
this.isSnapshot = fullName.endsWith( '-SNAPSHOT' )
this.osgiVersion = isSnapshot ? family + '.' + hibernateVersionComponents[2] + '.SNAPSHOT' : fullName
}
static HibernateVersion fromFile(File file, Project project){
def fullName = readVersionProperties(file)
return new HibernateVersion(fullName, project)
}
private static String readVersionProperties(File file) {
if ( !file.exists() ) {
throw new GradleException( "Version file $file.canonicalPath does not exists" )
}
Properties versionProperties = new Properties()
file.withInputStream {
stream -> versionProperties.load( stream )
}
return versionProperties.hibernateVersion
}
@Override
String toString() {
return this.fullName
}
}

View File

@ -21,7 +21,6 @@ import org.apache.tools.ant.filters.ReplaceTokens
* Support for modules that contain Java code
*/
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply from: rootProject.file( 'gradle/libraries.gradle' )
apply from: rootProject.file( 'gradle/databases.gradle' )

View File

@ -5,9 +5,6 @@
* 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' )
apply plugin: 'maven-publish'
apply plugin: 'org.hibernate.build.maven-repo-auth'

View File

@ -7,7 +7,6 @@
description = '(deprecated - use org.infinispan:infinispan-hibernate-cache-v53 instead)'
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
apply plugin: 'maven-publish'

View File

@ -8,8 +8,6 @@ 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 <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'idea'
apply plugin: 'distribution'