19
19
20
20
package publishing
21
21
22
- import io.github.gradlenexus.publishplugin.NexusPublishExtension
23
22
import io.github.gradlenexus.publishplugin.NexusPublishPlugin
24
- import io.github.gradlenexus.publishplugin.internal.StagingRepositoryDescriptorRegistryBuildService
25
23
import org.gradle.api.Project
26
- import org.gradle.api.services.BuildServiceRegistration
24
+ import org.gradle.api.tasks.Delete
27
25
import org.gradle.api.tasks.Exec
28
26
import org.gradle.kotlin.dsl.apply
29
- import org.gradle.kotlin.dsl.named
30
27
import org.gradle.kotlin.dsl.register
31
28
import org.gradle.plugins.signing.Sign
32
29
@@ -41,11 +38,22 @@ internal fun configureOnRootProject(project: Project) =
41
38
val isRelease = project.hasProperty(" release" )
42
39
val isSigning = isRelease || project.hasProperty(" signArtifacts" )
43
40
41
+ val cleanDistributionsDir = tasks.register<Delete >(" cleanDistributionsDir" )
42
+ cleanDistributionsDir.configure {
43
+ outputs.cacheIf { false }
44
+
45
+ val e = project.extensions.getByType(PublishingHelperExtension ::class .java)
46
+ delete(e.distributionDir)
47
+ }
48
+
44
49
val sourceTarball = tasks.register<Exec >(" sourceTarball" )
45
50
sourceTarball.configure {
46
51
group = " build"
47
52
description =
48
53
" Generate a source tarball for a release to be uploaded to dist.apache.org/repos/dist"
54
+ outputs.cacheIf { false }
55
+
56
+ dependsOn(cleanDistributionsDir)
49
57
50
58
val e = project.extensions.getByType(PublishingHelperExtension ::class .java)
51
59
doFirst { mkdir(e.distributionDir) }
@@ -84,129 +92,4 @@ internal fun configureOnRootProject(project: Project) =
84
92
}
85
93
sourceTarball.configure { finalizedBy(signSourceTarball) }
86
94
}
87
-
88
- val releaseEmailTemplate = tasks.register(" releaseEmailTemplate" )
89
- releaseEmailTemplate.configure {
90
- group = " publishing"
91
- description =
92
- " Generate release-vote email subject + body, including the staging repository URL, if run during the Maven release."
93
-
94
- mustRunAfter(" initializeApacheStagingRepository" )
95
-
96
- doFirst {
97
- val e = project.extensions.getByType(PublishingHelperExtension ::class .java)
98
- val asfName = e.asfProjectName.get()
99
-
100
- val gitInfo = MemoizedGitInfo .gitInfo(rootProject)
101
- val gitCommitId = gitInfo[" Apache-Polaris-Build-Git-Head" ]
102
-
103
- val repos = project.extensions.getByType(NexusPublishExtension ::class .java).repositories
104
- val repo = repos.iterator().next()
105
-
106
- val stagingRepositoryUrlRegistryRegistration =
107
- gradle.sharedServices.registrations.named<
108
- BuildServiceRegistration <StagingRepositoryDescriptorRegistryBuildService , * >
109
- > (
110
- " stagingRepositoryUrlRegistry"
111
- )
112
- val staginRepoUrl =
113
- if (stagingRepositoryUrlRegistryRegistration.isPresent) {
114
- val stagingRepositoryUrlRegistryBuildServiceRegistration =
115
- stagingRepositoryUrlRegistryRegistration.get()
116
- val stagingRepositoryUrlRegistryService =
117
- stagingRepositoryUrlRegistryBuildServiceRegistration.getService()
118
- if (stagingRepositoryUrlRegistryService.isPresent) {
119
- val registry = stagingRepositoryUrlRegistryService.get().registry
120
- try {
121
- val stagingRepoDesc = registry.get(repo.name)
122
- val stagingRepoId = stagingRepoDesc.stagingRepositoryId
123
- " https://repository.apache.org/content/repositories/$stagingRepoId /"
124
- } catch (e: IllegalStateException ) {
125
- " NO STAGING REPOSITORY ($e )"
126
- }
127
- } else {
128
- " NO STAGING REPOSITORY (no registry service) !!"
129
- }
130
- } else {
131
- " NO STAGING REPOSITORY (no build service) !!"
132
- }
133
-
134
- val asfProjectName = fetchAsfProjectName(asfName)
135
-
136
- val versionNoRc = version.toString().replace(" -rc-?[0-9]+" .toRegex(), " " )
137
-
138
- val subjectFile = e.distributionFile(" vote-email-subject.txt" ).relativeTo(projectDir)
139
- val bodyFile = e.distributionFile(" vote-email-body.txt" ).relativeTo(projectDir)
140
-
141
- val emailSubject = " [VOTE] Release $asfProjectName $version "
142
- subjectFile.writeText(emailSubject)
143
-
144
- val emailBody =
145
- """
146
- Hi everyone,
147
-
148
- I propose that we release the following RC as the official
149
- $asfProjectName $versionNoRc release.
150
-
151
- * This corresponds to the tag: apache-$asfName -$version
152
- * https://github.com/apache/$asfName /commits/apache-$asfName -$version
153
- * https://github.com/apache/$asfName /tree/$gitCommitId
154
-
155
- The release tarball, signature, and checksums are here:
156
- * https://dist.apache.org/repos/dist/dev/incubator/$asfName /apache-$asfName -$version
157
-
158
- You can find the KEYS file here:
159
- * https://dist.apache.org/repos/dist/release/incubator/$asfName /KEYS
160
-
161
- Convenience binary artifacts are staged on Nexus. The Maven repository URL is:
162
- * $staginRepoUrl
163
-
164
- Please download, verify, and test.
165
-
166
- Please vote in the next 72 hours.
167
-
168
- [ ] +1 Release this as Apache $asfName $version
169
- [ ] +0
170
- [ ] -1 Do not release this because...
171
-
172
- Only PPMC members and mentors have binding votes, but other community members are
173
- encouraged to cast non-binding votes. This vote will pass if there are
174
- 3 binding +1 votes and more binding +1 votes than -1 votes.
175
-
176
- NB: if this vote pass, a new vote has to be started on the Incubator general mailing
177
- list.
178
-
179
- Thanks
180
- Regards
181
- """
182
-
183
- logger.lifecycle(
184
- """
185
-
186
-
187
- The email for your release vote mail:
188
- -------------------------------------
189
-
190
- Suggested subject: (also in file $subjectFile )
191
-
192
- $emailSubject
193
-
194
- Suggested body: (also in file $bodyFile )
195
-
196
- $emailBody
197
-
198
- """
199
- .trimIndent()
200
- )
201
- bodyFile.writeText(emailBody.trimIndent())
202
- }
203
- }
204
-
205
- if (isRelease) {
206
- sourceTarball.configure { finalizedBy(releaseEmailTemplate) }
207
- }
208
-
209
- afterEvaluate {
210
- tasks.named(" closeApacheStagingRepository" ) { mustRunAfter(releaseEmailTemplate) }
211
- }
212
95
}
0 commit comments