@@ -67,17 +67,28 @@ ext.testArtifact = { p, String name = "test" ->
67
67
}
68
68
69
69
tasks. register(" updateCIBwcVersions" ) {
70
- doLast {
71
- File yml = file(" .ci/bwcVersions" )
72
- yml. text = " "
73
- yml << " BWC_VERSION:\n "
74
- BuildParams . bwcVersions. indexCompatible. each {
75
- yml << " - \" $it \"\n "
70
+ def writeVersions = { File file , List<Version > versions ->
71
+ file. text = " "
72
+ file << " BWC_VERSION:\n "
73
+ versions. each {
74
+ file << " - \" $it \"\n "
76
75
}
77
76
}
77
+ doLast {
78
+ writeVersions(file(" .ci/bwcVersions" ), BuildParams . bwcVersions. indexCompatible)
79
+ writeVersions(file(" .ci/snapshotBwcVersions" ), BuildParams . bwcVersions. unreleasedIndexCompatible)
80
+ }
78
81
}
79
82
80
83
tasks. register(" verifyVersions" ) {
84
+ def verifyCiYaml = { File file , List<Version > versions ->
85
+ String ciYml = file. text
86
+ versions. each {
87
+ if (ciYml. contains(" \" $it \"\n " ) == false ) {
88
+ throw new Exception (" ${ file} is outdated, run `./gradlew updateCIBwcVersions` and check in the results" )
89
+ }
90
+ }
91
+ }
81
92
doLast {
82
93
if (gradle. startParameter. isOffline()) {
83
94
throw new GradleException (" Must run in online mode to verify versions" )
@@ -93,12 +104,8 @@ tasks.register("verifyVersions") {
93
104
.collect { Version . fromString(it) }
94
105
)
95
106
}
96
- String ciYml = file(" .ci/bwcVersions" ). text
97
- BuildParams . bwcVersions. indexCompatible. each {
98
- if (ciYml. contains(" \" $it \"\n " ) == false ) {
99
- throw new Exception (" .ci/bwcVersions is outdated, run `./gradlew updateCIBwcVersions` and check in the results" );
100
- }
101
- }
107
+ verifyCiYaml(file(" .ci/bwcVersions" ), BuildParams . bwcVersions. indexCompatible)
108
+ verifyCiYaml(file(" .ci/snapshotBwcVersions" ), BuildParams . bwcVersions. unreleasedIndexCompatible)
102
109
}
103
110
}
104
111
0 commit comments