HHH-12190 - General tidying of Gradle scripts

This commit is contained in:
Steve Ebersole 2018-01-17 22:47:31 -06:00
parent ed2f17722f
commit 8e6332a964
3 changed files with 69 additions and 61 deletions

View File

@ -9,6 +9,7 @@ apply from: rootProject.file( 'gradle/java-module.gradle' )
apply plugin: 'maven-publish'
apply plugin: 'maven-publish-auth'
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -148,64 +149,3 @@ task release( dependsOn: publish ) {
println "Starting release for $project.name:$project.version"
}
}
afterEvaluate {
// delay pom customization until project evaluation is complete
PublishingExtension gradlePublishingExtension = project.extensions.getByType( PublishingExtension )
Set<MavenPublication> mavenPublications = gradlePublishingExtension.publications.withType( MavenPublication )
if ( mavenPublications.size() <= 0 || mavenPublications.size() > 1 ) {
throw new GradleException( "Expecting just a single MavenPublication [$project.path], but found " + mavenPublications.size() + " : " + mavenPublications*.name )
}
project.configure( mavenPublications.first() ) {
pom.withXml {
asNode().appendNode( 'name', "Hibernate ORM - $project.name" )
asNode().appendNode( 'description', project.description )
Node lgplLicenseNode = asNode().appendNode( "licenses" ).appendNode( "license" )
lgplLicenseNode.appendNode( 'name', 'GNU Lesser General Public License' )
lgplLicenseNode.appendNode( 'url', 'http://www.gnu.org/licenses/lgpl-2.1.html' )
lgplLicenseNode.appendNode(
'comments',
'See discussion at http://hibernate.org/license for more details.'
)
lgplLicenseNode.appendNode( 'distribution', 'repo' )
asNode().children().last() + {
url 'http://hibernate.org'
organization {
name 'Hibernate.org'
url 'http://hibernate.org'
}
issueManagement {
system 'jira'
url 'https://hibernate.atlassian.net/browse/HHH'
}
scm {
url 'http://github.com/hibernate/hibernate-orm'
connection 'scm:git:http://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 'http://hibernate.org'
}
}
}
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
// rather than 'compile'; fix that.
if ( asNode().dependencies != null && asNode().dependencies.size() > 0 ) {
asNode().dependencies[0].dependency.each {
it.scope[0].value = 'compile'
}
}
}
}
}

View File

@ -0,0 +1,67 @@
/*
* 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
*/
afterEvaluate {
// delay pom customization until project evaluation is complete
PublishingExtension gradlePublishingExtension = project.extensions.getByType( PublishingExtension )
Set<MavenPublication> mavenPublications = gradlePublishingExtension.publications.withType( MavenPublication )
if ( mavenPublications.size() <= 0 || mavenPublications.size() > 1 ) {
throw new GradleException( "Expecting just a single MavenPublication [$project.path], but found " + mavenPublications.size() + " : " + mavenPublications*.name )
}
project.configure( mavenPublications.first() ) {
pom.withXml {
asNode().appendNode( 'name', "Hibernate ORM - $project.name" )
asNode().appendNode( 'description', project.description )
Node lgplLicenseNode = asNode().appendNode( "licenses" ).appendNode( "license" )
lgplLicenseNode.appendNode( 'name', 'GNU Lesser General Public License' )
lgplLicenseNode.appendNode( 'url', 'http://www.gnu.org/licenses/lgpl-2.1.html' )
lgplLicenseNode.appendNode(
'comments',
'See discussion at http://hibernate.org/license for more details.'
)
lgplLicenseNode.appendNode( 'distribution', 'repo' )
asNode().children().last() + {
url 'http://hibernate.org'
organization {
name 'Hibernate.org'
url 'http://hibernate.org'
}
issueManagement {
system 'jira'
url 'https://hibernate.atlassian.net/browse/HHH'
}
scm {
url 'http://github.com/hibernate/hibernate-orm'
connection 'scm:git:http://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 'http://hibernate.org'
}
}
}
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
// rather than 'compile'; fix that.
if ( asNode().dependencies != null && asNode().dependencies.size() > 0 ) {
asNode().dependencies[0].dependency.each {
it.scope[0].value = 'compile'
}
}
}
}
}

View File

@ -14,6 +14,7 @@ apply from: rootProject.file( 'gradle/libraries.gradle' )
apply plugin: 'maven-publish'
apply plugin: 'maven-publish-auth'
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
apply plugin: 'build-dashboard'
apply plugin: 'project-report'