Skip to content
Closed
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ buildscript {
// }

dependencies {
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
// classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
classpath 'de.thetaphi:forbiddenapis:3.2'
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1'
Expand All @@ -21,6 +20,7 @@ buildscript {

plugins {
id 'org.hibernate.build.xjc-jakarta' version '1.0.2' apply false
id "org.hibernate.build.version-injection" version "2.0.0" apply false
id 'org.hibernate.matrix-test' version '3.1.1' apply false
id 'org.hibernate.orm.database-service' apply false
id 'biz.aQute.bnd' version '6.3.1' apply false
Expand Down
5 changes: 4 additions & 1 deletion documentation/documentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ configurations {
}

javadocSources {
description = 'Source files to be built by the javadoc tool'
description = 'All Java sources for the aggregated Javadocs'
canBeConsumed = false
canBeResolved = true
visible = false
}
}

Expand Down
19 changes: 19 additions & 0 deletions gradle/group-relocation.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright Red Hat Inc. and Hibernate Authors
*/
var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension
publishingExtension.publications.create("groupRelocation", MavenPublication) {
pom {
name = project.name + ' (relocated)'
groupId = 'org.hibernate'

distributionManagement {
relocation {
groupId = project.group
artifactId = project.name
version = project.version
}
}
}
}
15 changes: 0 additions & 15 deletions gradle/java-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,6 @@ dependencies {
}
}

configurations {
javadocSources {
canBeConsumed = true
canBeResolved = false
visible = false
description = 'Configuration for accessing the sources that should be included in the javadoc for the project'
}
}

artifacts {
sourceSets.main.allJava.srcDirs.each { srcDir ->
javadocSources srcDir
}
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Compilation

Expand Down
2 changes: 1 addition & 1 deletion gradle/javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ tasks.named( "javadoc", Javadoc ) {
}
}

task javadocJar(type: Jar) {
tasks.register("javadocJar", Jar) {
from project.tasks.javadoc.outputs
manifest {
attributes(
Expand Down
177 changes: 14 additions & 163 deletions gradle/published-java-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/

apply from: rootProject.file( 'gradle/releasable.gradle' )
apply from: rootProject.file( 'gradle/java-module.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
apply from: rootProject.file( 'gradle/publishing.gradle' )

apply plugin: 'signing'

// Make sure that the publishReleaseArtifacts task of the release module runs the release task of this sub module
tasks.getByPath( ':release:publishReleaseArtifacts' ).dependsOn tasks.release
tasks.register("publishReleaseArtifacts") {
// mirror for `:release:publishReleaseArtifacts`
dependsOn tasks.release
}

configurations {
javadocSources {
description 'Used to aggregate javadocs for the whole project'
description = "All Java sources for the project's Javadoc"
canBeConsumed = true
canBeResolved = false
visible = false
}
}

Expand All @@ -35,152 +37,16 @@ java {
withSourcesJar()
}

publishing {
publications {
// main publication
publishedArtifacts {
from components.java
}

// relocation for the published artifacts based on the old groupId
relocationPom( MavenPublication ) {
pom {
name = project.name + ' - relocation'
groupId = 'org.hibernate'
artifactId = project.name
version = project.version

description = project.description
url = 'https://hibernate.org/orm'

organization {
name = 'Hibernate.org'
url = 'https://hibernate.org'
}

licenses {
license {
name = 'GNU Library General Public License v2.1 or later'
url = 'https://www.opensource.org/licenses/LGPL-2.1'
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
distribution = 'repo'
}
}

scm {
url = 'https://github.com/hibernate/hibernate-orm'
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git'
developerConnection = 'scm:git:[email protected]:hibernate/hibernate-orm.git'
}

developers {
developer {
id = 'hibernate-team'
name = 'The Hibernate Development Team'
organization = 'Hibernate.org'
organizationUrl = 'https://hibernate.org'
}
}

issueManagement {
system = 'jira'
url = 'https://hibernate.atlassian.net/browse/HHH'
}

distributionManagement {
relocation {
groupId = 'org.hibernate.orm'
artifactId = project.name
version = project.version
}
}
}
}
}
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Signing

def signPublicationsTask = tasks.register('signPublications') {
description "Grouping task which executes all Sign tasks"

dependsOn tasks.withType( Sign )
}

tasks.named( "publishPublishedArtifactsPublicationToSonatypeRepository" ) {
// publishing depends on signing
dependsOn signPublicationsTask
}

tasks.register('sign') {
description "Pseudonym for :signPublications"
dependsOn signPublicationsTask
}

var signingExtension = project.getExtensions().getByType(SigningExtension) as SigningExtension
signingExtension.sign publishing.publications.publishedArtifacts

gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
boolean wasSigningRequested = false
boolean wasPublishingRequested = false

graph.allTasks.each {task ->
if ( task instanceof Sign ) {
wasSigningRequested = true
}
else if ( task instanceof PublishToMavenRepository ) {
wasPublishingRequested = true
}
}

if ( wasPublishingRequested ) {
def ossrhUser = System.getenv().get( "ORG_GRADLE_PROJECT_sonatypeUsername" )
def ossrhPass = System.getenv().get( "ORG_GRADLE_PROJECT_sonatypePassword" )
if ( ossrhUser == null || ossrhPass == null ) {
throw new RuntimeException( "Cannot perform publishing to OSSRH without credentials." )
}
logger.lifecycle "Publishing {} : {} : {}", project.group, project.name, project.version
}

if ( wasSigningRequested || wasPublishingRequested ) {
// signing was explicitly requested and/or we are publishing to Sonatype OSSRH
// - we need the signing to happen
signingExtension.required = true

var signingKey = resolveSigningKey()
var signingPassword = resolveSigningPassphrase()
signingExtension.useInMemoryPgpKeys( signingKey, signingPassword )
}
else {
// signing was not explicitly requested and we are not publishing to OSSRH,
// - disable all Sign tasks
tasks.withType( Sign ).each { t-> t.enabled = false }
}
}

static String resolveSigningKey() {
var key = System.getenv().get( "SIGNING_GPG_PRIVATE_KEY" )
if ( key != null ) {
return key
}

var keyFile = System.getenv().get( "SIGNING_GPG_PRIVATE_KEY_PATH" )
if ( keyFile != null ) {
return new File( keyFile ).text
}
// Publishing

throw new RuntimeException( "Cannot perform signing without GPG details." )
var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension
publishingExtension.publications.named("publishedArtifacts", MavenPublication) {
// Add the Java component to the main publication
from components.java
}

static String resolveSigningPassphrase() {
var passphrase = System.getenv().get( "SIGNING_GPG_PASSPHRASE" )
if ( passphrase == null ) {
throw new RuntimeException( "Cannot perform signing without GPG details." )
}
return passphrase
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -195,21 +61,6 @@ tasks.release.dependsOn tasks.test, tasks.publishToSonatype
tasks.preVerifyRelease.dependsOn build
tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication
tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication
tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication

tasks.publishToSonatype.mustRunAfter test


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Ancillary tasks

task showPublications {
doFirst {
project.publishing.publications.each { publication ->
println "Publication (${publication.name}): ${publication.groupId}:${publication.artifactId}:${publication.version}"
publication.artifacts.each { artifact ->
println " > ${artifact}"
}
}
}
}
63 changes: 0 additions & 63 deletions gradle/publishing-pom.gradle

This file was deleted.

Loading
Loading