Skip to content

Commit 57b9191

Browse files
sebersolembladel
authored andcommitted
1 parent b752ad9 commit 57b9191

27 files changed

+286
-250
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 '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

+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
@@ -151,21 +151,6 @@ 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-
169154
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
170155
// Compilation
171156

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-
task javadocJar(type: Jar) {
62+
tasks.register("javadocJar", Jar) {
6363
from project.tasks.javadoc.outputs
6464
manifest {
6565
attributes(

gradle/published-java-module.gradle

+13-137
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

@@ -36,127 +38,16 @@ java {
3638
withSourcesJar()
3739
}
3840

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-
10741

10842
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109-
// Signing
110-
111-
112-
def signingKey = resolveSigningKey()
113-
def signingPassphrase = resolveSigningPassphrase()
43+
// Publishing
11444

115-
var signingExtension = project.getExtensions().getByType(SigningExtension) as SigningExtension
11645
var publishingExtension = project.getExtensions().getByType(PublishingExtension) as PublishingExtension
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
46+
publishingExtension.publications.named("publishedArtifacts", MavenPublication) {
47+
// Add the Java component to the main publication
48+
from components.java
15549
}
15650

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

16152

16253
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -171,21 +62,6 @@ tasks.release.dependsOn tasks.test, tasks.publishToSonatype
17162
tasks.preVerifyRelease.dependsOn build
17263
tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication
17364
tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication
174-
tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication
17565

17666
tasks.publishToSonatype.mustRunAfter test
17767

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
This file was deleted.

0 commit comments

Comments
 (0)