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