5
5
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
6
6
*/
7
7
8
- apply from : rootProject. file( ' gradle/releasable.gradle' )
9
8
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' )
11
10
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
+ }
16
15
17
16
configurations {
18
17
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
20
22
}
21
23
}
22
24
@@ -36,127 +38,16 @@ java {
36
38
withSourcesJar()
37
39
}
38
40
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
-
107
41
108
42
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
109
- // Signing
110
-
111
-
112
- def signingKey = resolveSigningKey()
113
- def signingPassphrase = resolveSigningPassphrase()
43
+ // Publishing
114
44
115
- var signingExtension = project. getExtensions(). getByType(SigningExtension ) as SigningExtension
116
45
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
155
49
}
156
50
157
- static String resolveSigningPassphrase () {
158
- return System . getenv(). get( " SIGNING_GPG_PASSPHRASE" )
159
- }
160
51
161
52
162
53
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -171,21 +62,6 @@ tasks.release.dependsOn tasks.test, tasks.publishToSonatype
171
62
tasks. preVerifyRelease. dependsOn build
172
63
tasks. preVerifyRelease. dependsOn generateMetadataFileForPublishedArtifactsPublication
173
64
tasks. preVerifyRelease. dependsOn generatePomFileForPublishedArtifactsPublication
174
- tasks. preVerifyRelease. dependsOn generatePomFileForRelocationPomPublication
175
65
176
66
tasks. publishToSonatype. mustRunAfter test
177
67
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
- }
0 commit comments