Skip to content

Commit 53cdd08

Browse files
committed
Revert "HHH-18912 - ORM release process"
This reverts commit 57b9191.
1 parent cff14d9 commit 53cdd08

27 files changed

+250
-286
lines changed

build.gradle

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

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

2122
plugins {
2223
id 'org.hibernate.build.xjc-jakarta' version '2.0.3' 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

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

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

gradle/group-relocation.gradle

-19
This file was deleted.

gradle/java-module.gradle

+15
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,21 @@ dependencies {
151151
}
152152
}
153153

154+
configurations {
155+
javadocSources {
156+
canBeConsumed = true
157+
canBeResolved = false
158+
visible = false
159+
description = 'Configuration for accessing the sources that should be included in the javadoc for the project'
160+
}
161+
}
162+
163+
artifacts {
164+
sourceSets.main.allJava.srcDirs.each { srcDir ->
165+
javadocSources srcDir
166+
}
167+
}
168+
154169
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
155170
// Compilation
156171

gradle/javadoc.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ tasks.named( "javadoc", Javadoc ) {
5959
}
6060
}
6161

62-
tasks.register("javadocJar", Jar) {
62+
task javadocJar(type: Jar) {
6363
from project.tasks.javadoc.outputs
6464
manifest {
6565
attributes(

gradle/published-java-module.gradle

+137-13
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,18 @@
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' )
89
apply from: rootProject.file( 'gradle/java-module.gradle' )
9-
apply from: rootProject.file( 'gradle/publishing.gradle' )
10+
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
1011

11-
tasks.register("publishReleaseArtifacts") {
12-
// mirror for `:release:publishReleaseArtifacts`
13-
dependsOn tasks.release
14-
}
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
1516

1617
configurations {
1718
javadocSources {
18-
description = "All Java sources for the project's Javadoc"
19-
canBeConsumed = true
20-
canBeResolved = false
21-
visible = false
19+
description 'Used to aggregate javadocs for the whole project'
2220
}
2321
}
2422

@@ -38,16 +36,127 @@ java {
3836
withSourcesJar()
3937
}
4038

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

42108
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43-
// Publishing
109+
// Signing
110+
44111

112+
def signingKey = resolveSigningKey()
113+
def signingPassphrase = resolveSigningPassphrase()
114+
115+
var signingExtension = project.getExtensions().getByType(SigningExtension) as SigningExtension
45116
var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension
46-
publishingExtension.publications.named("publishedArtifacts", MavenPublication) {
47-
// Add the Java component to the main publication
48-
from components.java
117+
signingExtension.sign publishingExtension.publications.publishedArtifacts
118+
signingExtension.useInMemoryPgpKeys(signingKey, signingPassphrase)
119+
120+
gradle.taskGraph.whenReady { TaskExecutionGraph graph ->
121+
boolean wasPublishingRequested = false
122+
123+
graph.allTasks.each {task ->
124+
if ( task instanceof PublishToMavenRepository ) {
125+
wasPublishingRequested = true
126+
}
127+
}
128+
129+
if ( wasPublishingRequested ) {
130+
def ossrhUser = System.getenv().get( "ORG_GRADLE_PROJECT_sonatypeUsername" )
131+
def ossrhPass = System.getenv().get( "ORG_GRADLE_PROJECT_sonatypePassword" )
132+
if ( ossrhUser == null || ossrhPass == null ) {
133+
throw new RuntimeException( "Cannot perform publishing to OSSRH without credentials." )
134+
}
135+
logger.lifecycle "Publishing {} : {} : {}", project.group, project.name, project.version
136+
signingExtension.required = true
137+
}
138+
else if ( signingKey == null || signingPassphrase == null ) {
139+
tasks.withType( Sign ).each { t-> t.enabled = false }
140+
}
141+
}
142+
143+
static String resolveSigningKey() {
144+
var key = System.getenv().get( "SIGNING_GPG_PRIVATE_KEY" )
145+
if ( key != null ) {
146+
return key
147+
}
148+
149+
var keyFile = System.getenv().get( "SIGNING_GPG_PRIVATE_KEY_PATH" )
150+
if ( keyFile != null ) {
151+
return new File( keyFile ).text
152+
}
153+
154+
return null
49155
}
50156

157+
static String resolveSigningPassphrase() {
158+
return System.getenv().get( "SIGNING_GPG_PASSPHRASE" )
159+
}
51160

52161

53162
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -62,6 +171,21 @@ tasks.release.dependsOn tasks.test, tasks.publishToSonatype
62171
tasks.preVerifyRelease.dependsOn build
63172
tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication
64173
tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication
174+
tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication
65175

66176
tasks.publishToSonatype.mustRunAfter test
67177

178+
179+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180+
// Ancillary tasks
181+
182+
task showPublications {
183+
doFirst {
184+
project.publishing.publications.each { publication ->
185+
println "Publication (${publication.name}): ${publication.groupId}:${publication.artifactId}:${publication.version}"
186+
publication.artifacts.each { artifact ->
187+
println " > ${artifact}"
188+
}
189+
}
190+
}
191+
}

gradle/publishing-pom.gradle

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
5+
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
6+
*/
7+
8+
apply plugin: 'maven-publish'
9+
10+
// Disable Gradle module metadata publishing until we know what we want.
11+
// https://docs.gradle.org/6.0.1/userguide/publishing_gradle_module_metadata.html#sub:disabling-gmm-publication
12+
tasks.withType(GenerateModuleMetadata) {
13+
enabled = false
14+
}
15+
16+
publishing {
17+
publications {
18+
publishedArtifacts( MavenPublication ) {
19+
pom {
20+
name = 'Hibernate ORM - ' + project.name
21+
description = project.description
22+
url = 'https://hibernate.org/orm'
23+
24+
organization {
25+
name = 'Hibernate.org'
26+
url = 'https://hibernate.org'
27+
}
28+
29+
licenses {
30+
license {
31+
name = 'GNU Library General Public License v2.1 or later'
32+
url = 'https://www.opensource.org/licenses/LGPL-2.1'
33+
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
34+
distribution = 'repo'
35+
}
36+
}
37+
38+
scm {
39+
url = 'https://github.com/hibernate/hibernate-orm'
40+
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git'
41+
developerConnection = 'scm:git:[email protected]:hibernate/hibernate-orm.git'
42+
}
43+
44+
issueManagement {
45+
system = 'jira'
46+
url = 'https://hibernate.atlassian.net/browse/HHH'
47+
}
48+
49+
developers {
50+
developer {
51+
id = 'hibernate-team'
52+
name = 'The Hibernate Development Team'
53+
organization = 'Hibernate.org'
54+
organizationUrl = 'https://hibernate.org'
55+
}
56+
}
57+
58+
}
59+
60+
}
61+
}
62+
63+
}

0 commit comments

Comments
 (0)