Skip to content

Commit b92d0c2

Browse files
sebersolembladel
authored andcommitted
1 parent f6c6827 commit b92d0c2

24 files changed

+266
-291
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ buildscript {
1111
// }
1212

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

2221
plugins {
2322
id 'org.hibernate.build.xjc-jakarta' version '1.0.2' apply false
23+
id "org.hibernate.build.version-injection" version "2.0.0" apply false
2424
id 'org.hibernate.matrix-test' version '3.1.1' apply false
2525
id 'org.hibernate.orm.database-service' apply false
2626
id 'biz.aQute.bnd' version '6.3.1' apply false

documentation/documentation.gradle

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ configurations {
7979
}
8080

8181
javadocSources {
82-
description = 'Source files to be built by the javadoc tool'
82+
description = 'All Java sources for the aggregated Javadocs'
83+
canBeConsumed = false
84+
canBeResolved = true
85+
visible = false
8386
}
8487
}
8588

gradle/group-relocation.gradle

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* SPDX-License-Identifier: LGPL-2.1-or-later
3+
* Copyright Red Hat Inc. and Hibernate Authors
4+
*/
5+
var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension
6+
publishingExtension.publications.create("groupRelocation", MavenPublication) {
7+
pom {
8+
name = project.name + ' (relocated)'
9+
groupId = 'org.hibernate'
10+
11+
distributionManagement {
12+
relocation {
13+
groupId = project.group
14+
artifactId = project.name
15+
version = project.version
16+
}
17+
}
18+
}
19+
}

gradle/java-module.gradle

-15
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,6 @@ dependencies {
143143
}
144144
}
145145

146-
configurations {
147-
javadocSources {
148-
canBeConsumed = true
149-
canBeResolved = false
150-
visible = false
151-
description = 'Configuration for accessing the sources that should be included in the javadoc for the project'
152-
}
153-
}
154-
155-
artifacts {
156-
sourceSets.main.allJava.srcDirs.each { srcDir ->
157-
javadocSources srcDir
158-
}
159-
}
160-
161146
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162147
// Compilation
163148

gradle/javadoc.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ tasks.named( "javadoc", Javadoc ) {
5656
}
5757
}
5858

59-
task javadocJar(type: Jar) {
59+
tasks.register("javadocJar", Jar) {
6060
from project.tasks.javadoc.outputs
6161
manifest {
6262
attributes(

gradle/published-java-module.gradle

+14-163
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
66
*/
77

8-
apply from: rootProject.file( 'gradle/releasable.gradle' )
98
apply from: rootProject.file( 'gradle/java-module.gradle' )
10-
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
9+
apply from: rootProject.file( 'gradle/publishing.gradle' )
1110

12-
apply plugin: 'signing'
13-
14-
// Make sure that the publishReleaseArtifacts task of the release module runs the release task of this sub module
15-
tasks.getByPath( ':release:publishReleaseArtifacts' ).dependsOn tasks.release
11+
tasks.register("publishReleaseArtifacts") {
12+
// mirror for `:release:publishReleaseArtifacts`
13+
dependsOn tasks.release
14+
}
1615

1716
configurations {
1817
javadocSources {
19-
description 'Used to aggregate javadocs for the whole project'
18+
description = "All Java sources for the project's Javadoc"
19+
canBeConsumed = true
20+
canBeResolved = false
21+
visible = false
2022
}
2123
}
2224

@@ -35,152 +37,16 @@ java {
3537
withSourcesJar()
3638
}
3739

38-
publishing {
39-
publications {
40-
// main publication
41-
publishedArtifacts {
42-
from components.java
43-
}
44-
45-
// relocation for the published artifacts based on the old groupId
46-
relocationPom( MavenPublication ) {
47-
pom {
48-
name = project.name + ' - relocation'
49-
groupId = 'org.hibernate'
50-
artifactId = project.name
51-
version = project.version
52-
53-
description = project.description
54-
url = 'https://hibernate.org/orm'
55-
56-
organization {
57-
name = 'Hibernate.org'
58-
url = 'https://hibernate.org'
59-
}
60-
61-
licenses {
62-
license {
63-
name = 'GNU Library General Public License v2.1 or later'
64-
url = 'https://www.opensource.org/licenses/LGPL-2.1'
65-
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
66-
distribution = 'repo'
67-
}
68-
}
69-
70-
scm {
71-
url = 'https://github.com/hibernate/hibernate-orm'
72-
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git'
73-
developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git'
74-
}
75-
76-
developers {
77-
developer {
78-
id = 'hibernate-team'
79-
name = 'The Hibernate Development Team'
80-
organization = 'Hibernate.org'
81-
organizationUrl = 'https://hibernate.org'
82-
}
83-
}
84-
85-
issueManagement {
86-
system = 'jira'
87-
url = 'https://hibernate.atlassian.net/browse/HHH'
88-
}
89-
90-
distributionManagement {
91-
relocation {
92-
groupId = 'org.hibernate.orm'
93-
artifactId = project.name
94-
version = project.version
95-
}
96-
}
97-
}
98-
}
99-
}
100-
}
101-
10240

10341
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104-
// Signing
105-
106-
def signPublicationsTask = tasks.register('signPublications') {
107-
description "Grouping task which executes all Sign tasks"
108-
109-
dependsOn tasks.withType( Sign )
110-
}
111-
112-
tasks.named( "publishPublishedArtifactsPublicationToSonatypeRepository" ) {
113-
// publishing depends on signing
114-
dependsOn signPublicationsTask
115-
}
116-
117-
tasks.register('sign') {
118-
description "Pseudonym for :signPublications"
119-
dependsOn signPublicationsTask
120-
}
121-
122-
var signingExtension = project.getExtensions().getByType(SigningExtension) as SigningExtension
123-
signingExtension.sign publishing.publications.publishedArtifacts
124-
125-
gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
126-
boolean wasSigningRequested = false
127-
boolean wasPublishingRequested = false
128-
129-
graph.allTasks.each {task ->
130-
if ( task instanceof Sign ) {
131-
wasSigningRequested = true
132-
}
133-
else if ( task instanceof PublishToMavenRepository ) {
134-
wasPublishingRequested = true
135-
}
136-
}
137-
138-
if ( wasPublishingRequested ) {
139-
def ossrhUser = System.getenv().get( "ORG_GRADLE_PROJECT_sonatypeUsername" )
140-
def ossrhPass = System.getenv().get( "ORG_GRADLE_PROJECT_sonatypePassword" )
141-
if ( ossrhUser == null || ossrhPass == null ) {
142-
throw new RuntimeException( "Cannot perform publishing to OSSRH without credentials." )
143-
}
144-
logger.lifecycle "Publishing {} : {} : {}", project.group, project.name, project.version
145-
}
146-
147-
if ( wasSigningRequested || wasPublishingRequested ) {
148-
// signing was explicitly requested and/or we are publishing to Sonatype OSSRH
149-
// - we need the signing to happen
150-
signingExtension.required = true
151-
152-
var signingKey = resolveSigningKey()
153-
var signingPassword = resolveSigningPassphrase()
154-
signingExtension.useInMemoryPgpKeys( signingKey, signingPassword )
155-
}
156-
else {
157-
// signing was not explicitly requested and we are not publishing to OSSRH,
158-
// - disable all Sign tasks
159-
tasks.withType( Sign ).each { t-> t.enabled = false }
160-
}
161-
}
162-
163-
static String resolveSigningKey() {
164-
var key = System.getenv().get( "SIGNING_GPG_PRIVATE_KEY" )
165-
if ( key != null ) {
166-
return key
167-
}
168-
169-
var keyFile = System.getenv().get( "SIGNING_GPG_PRIVATE_KEY_PATH" )
170-
if ( keyFile != null ) {
171-
return new File( keyFile ).text
172-
}
42+
// Publishing
17343

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

177-
static String resolveSigningPassphrase() {
178-
var passphrase = System.getenv().get( "SIGNING_GPG_PASSPHRASE" )
179-
if ( passphrase == null ) {
180-
throw new RuntimeException( "Cannot perform signing without GPG details." )
181-
}
182-
return passphrase
183-
}
18450

18551

18652
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -195,21 +61,6 @@ tasks.release.dependsOn tasks.test, tasks.publishToSonatype
19561
tasks.preVerifyRelease.dependsOn build
19662
tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication
19763
tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication
198-
tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication
19964

20065
tasks.publishToSonatype.mustRunAfter test
20166

202-
203-
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
204-
// Ancillary tasks
205-
206-
task showPublications {
207-
doFirst {
208-
project.publishing.publications.each { publication ->
209-
println "Publication (${publication.name}): ${publication.groupId}:${publication.artifactId}:${publication.version}"
210-
publication.artifacts.each { artifact ->
211-
println " > ${artifact}"
212-
}
213-
}
214-
}
215-
}

gradle/publishing-pom.gradle

-63
This file was deleted.

0 commit comments

Comments
 (0)