@@ -36,6 +36,58 @@ final String docWebsiteRelativePath = "reactive/documentation/${projectVersion.f
36
36
// The location of the docs when the website has been cloned
37
37
final Directory docWebsiteReactiveFolder = project. layout. buildDirectory. dir( " docs-website/${ docWebsiteRelativePath} " ). get()
38
38
39
+ def releaseChecksTask = tasks. register( " releaseChecks" ) {
40
+ description ' Checks and preparation for release'
41
+ group ' Release'
42
+
43
+ doFirst {
44
+ logger. lifecycle(" Checking that the working tree is clean..." )
45
+ String uncommittedFiles = executeGitCommand(' status' , ' --porcelain' )
46
+ if (! uncommittedFiles. isEmpty()) {
47
+ throw new GradleException (
48
+ " Cannot release because there are uncommitted or untracked files in the working tree.\n " +
49
+ " Commit or stash your changes first.\n " +
50
+ " Uncommitted files:\n " +
51
+ uncommittedFiles
52
+ )
53
+ }
54
+
55
+ String gitBranchLocal = project. hasProperty( ' gitBranch' ) && ! project. property( ' gitBranch' ). isEmpty()
56
+ ? project. property( ' gitBranch' )
57
+ : executeGitCommand( ' branch' , ' --show-current' ). trim()
58
+
59
+ String gitRemoteLocal
60
+ if ( project. hasProperty( ' gitRemote' ) && ! project. property( ' gitRemote' ). isEmpty() ) {
61
+ gitRemoteLocal = project. property( ' gitRemote' )
62
+ }
63
+ else {
64
+ final String remotes = executeGitCommand( ' remote' , ' show' ). trim()
65
+ final List<String > tokens = remotes. tokenize()
66
+ if ( tokens. size() != 1 ) {
67
+ throw new GradleException ( " Could not determine `gitRemote` property for `releaseChecks` tasks." )
68
+ }
69
+ gitRemoteLocal = tokens. get( 0 )
70
+ }
71
+
72
+ project. ext {
73
+ gitBranch = gitBranchLocal
74
+ gitRemote = gitRemoteLocal
75
+ }
76
+
77
+ logger. lifecycle( " Switching to branch '${ project.gitBranch} '..." )
78
+ executeGitCommand( ' checkout' , project. gitBranch )
79
+
80
+ logger. lifecycle( " Checking that all commits are pushed..." )
81
+ String diffWithUpstream = executeGitCommand( ' diff' , ' @{u}' )
82
+ if ( ! diffWithUpstream. isEmpty() ) {
83
+ throw new GradleException (
84
+ " Cannot perform `ciRelease` tasks because there are un-pushed local commits .\n " +
85
+ " Push your commits first."
86
+ )
87
+ }
88
+ }
89
+ }
90
+
39
91
/**
40
92
* Assembles all documentation into the {buildDir}/documentation directory.
41
93
*/
@@ -70,9 +122,22 @@ def sparseCheckoutDocumentationTask = tasks.register( 'sparseCheckoutDocumentati
70
122
/**
71
123
* Update the docs on the cloned website
72
124
*/
125
+ def changeToReleaseVersionTask = tasks. register( ' changeToReleaseVersion' ) {
126
+ description ' Updates `gradle/version.properties` file to the specified release-version'
127
+ group ' Release'
128
+
129
+ dependsOn releaseChecksTask
130
+
131
+ doFirst {
132
+ logger. lifecycle( " Updating version-file to release-version : `${ project.releaseVersion} `" )
133
+ updateVersionFile( " ${ project.releaseVersion} " )
134
+ }
135
+ }
136
+
73
137
def updateDocumentationTask = tasks. register( ' updateDocumentation' ) {
74
138
description " Update the documentation on the cloned static website"
75
139
dependsOn assembleDocumentationTask, sparseCheckoutDocumentationTask
140
+ mustRunAfter changeToReleaseVersion
76
141
77
142
// copy documentation outputs into target/documentation:
78
143
// * this is used in building the dist bundles
@@ -124,70 +189,6 @@ def uploadDocumentationTask = tasks.register( 'uploadDocumentation' ) {
124
189
}
125
190
}
126
191
127
- def releaseChecksTask = tasks. register( " releaseChecks" ) {
128
- description ' Checks and preparation for release'
129
- group ' Release'
130
-
131
- doFirst {
132
- logger. lifecycle(" Checking that the working tree is clean..." )
133
- String uncommittedFiles = executeGitCommand(' status' , ' --porcelain' )
134
- if (! uncommittedFiles. isEmpty()) {
135
- throw new GradleException (
136
- " Cannot release because there are uncommitted or untracked files in the working tree.\n " +
137
- " Commit or stash your changes first.\n " +
138
- " Uncommitted files:\n " +
139
- uncommittedFiles
140
- )
141
- }
142
-
143
- String gitBranchLocal = project. hasProperty( ' gitBranch' ) && ! project. property( ' gitBranch' ). isEmpty()
144
- ? project. property( ' gitBranch' )
145
- : executeGitCommand( ' branch' , ' --show-current' ). trim()
146
-
147
- String gitRemoteLocal
148
- if ( project. hasProperty( ' gitRemote' ) && ! project. property( ' gitRemote' ). isEmpty() ) {
149
- gitRemoteLocal = project. property( ' gitRemote' )
150
- }
151
- else {
152
- final String remotes = executeGitCommand( ' remote' , ' show' ). trim()
153
- final List<String > tokens = remotes. tokenize()
154
- if ( tokens. size() != 1 ) {
155
- throw new GradleException ( " Could not determine `gitRemote` property for `releaseChecks` tasks." )
156
- }
157
- gitRemoteLocal = tokens. get( 0 )
158
- }
159
-
160
- project. ext {
161
- gitBranch = gitBranchLocal
162
- gitRemote = gitRemoteLocal
163
- }
164
-
165
- logger. lifecycle( " Switching to branch '${ project.gitBranch} '..." )
166
- executeGitCommand( ' checkout' , project. gitBranch )
167
-
168
- logger. lifecycle( " Checking that all commits are pushed..." )
169
- String diffWithUpstream = executeGitCommand( ' diff' , ' @{u}' )
170
- if ( ! diffWithUpstream. isEmpty() ) {
171
- throw new GradleException (
172
- " Cannot perform `ciRelease` tasks because there are un-pushed local commits .\n " +
173
- " Push your commits first."
174
- )
175
- }
176
- }
177
- }
178
-
179
- def changeToReleaseVersionTask = tasks. register( ' changeToReleaseVersion' ) {
180
- description ' Updates `gradle/version.properties` file to the specified release-version'
181
- group ' Release'
182
-
183
- dependsOn releaseChecksTask
184
-
185
- doFirst {
186
- logger. lifecycle( " Updating version-file to release-version : `${ project.releaseVersion} `" )
187
- updateVersionFile( " ${ project.releaseVersion} " )
188
- }
189
- }
190
-
191
192
def gitPreparationForReleaseTask = tasks. register( ' gitPreparationForRelease' ) {
192
193
dependsOn releaseChecksTask, changeToReleaseVersionTask
193
194
finalizedBy updateDocumentationTask
@@ -254,7 +255,7 @@ def releasePrepareTask = tasks.register( "releasePrepare" ) {
254
255
description " On a local checkout, performs all the changes required for the release, website updates included"
255
256
group " Release"
256
257
257
- dependsOn assembleDocumentationTask, gitPreparationForReleaseTask
258
+ dependsOn gitPreparationForReleaseTask
258
259
259
260
finalizedBy releasePreparePostGitTask
260
261
}
0 commit comments