@@ -130,29 +130,77 @@ tasks.register<UpdateDataConnectExecutableVersionsTask>("updateJson") {
130
130
)
131
131
workDirectory.set(project.layout.buildDirectory.dir(" updateJson" ))
132
132
133
- val singleVersion: String? = project.providers.gradleProperty(" version" ).orNull
133
+ val propertyNames =
134
+ object {
135
+ val version = " version"
136
+ val versions = " versions"
137
+ val updateMode = " updateMode"
138
+ val defaultVersion = " defaultVersion"
139
+ }
140
+
141
+ val singleVersion: String? = project.providers.gradleProperty(propertyNames.version).orNull
134
142
val multipleVersions: List <String >? =
135
- project.providers.gradleProperty(" versions" ).orNull?.split(' ,' )
143
+ project.providers.gradleProperty(propertyNames. versions).orNull?.split(' ,' )
136
144
versions.set(
137
145
buildList {
138
146
singleVersion?.let { add(it) }
139
147
multipleVersions?.let { addAll(it) }
140
- if (isEmpty()) {
141
- throw Exception (" bm6d5ezxzd 'version' or 'versions' property must be specified" )
142
- }
143
148
}
144
149
)
145
150
151
+ doFirst {
152
+ if (versions.get().isEmpty()) {
153
+ logger.warn(
154
+ " WARNING: no '${propertyNames.version} ' or '${propertyNames.versions} ' specified " +
155
+ " for task '$name '; no versions will be added to ${jsonFile.get()} . " +
156
+ " Try specifying something like '-P${propertyNames.version} =1.2.3' or " +
157
+ " '-P${propertyNames.versions} =1.2.3,4.5.6' on the gradle command line " +
158
+ " if you want to add versions (warning code bm6d5ezxzd)"
159
+ )
160
+ }
161
+ }
162
+
146
163
updateMode.set(
147
- project.providers.gradleProperty(" updateMode" ).map {
164
+ project.providers.gradleProperty(propertyNames. updateMode).map {
148
165
when (it) {
149
166
" overwrite" -> UpdateDataConnectExecutableVersionsTask .UpdateMode .Overwrite
150
167
" update" -> UpdateDataConnectExecutableVersionsTask .UpdateMode .Update
151
168
else ->
152
- throw Exception (" ahe4zadcjs 'updateMode' must be 'overwrite' or 'update', but got: $it " )
169
+ throw Exception (
170
+ " Invalid '${propertyNames.updateMode} ' specified for task '$name ': $it . " +
171
+ " Valid values are 'update' and 'overwrite'. " +
172
+ " Try specifying '-P${propertyNames.updateMode} =update' or " +
173
+ " '-P${propertyNames.updateMode} =overwrite' on the gradle command line. " +
174
+ " (error code v2e3cfqbnf)"
175
+ )
153
176
}
154
177
}
155
178
)
156
179
157
- defaultVersion.set(project.providers.gradleProperty(" defaultVersion" ))
180
+ doFirst {
181
+ if (! updateMode.isPresent) {
182
+ logger.warn(
183
+ " WARNING: no '${propertyNames.updateMode} ' specified for task '$name '; " +
184
+ " the default update mode of 'update' will be used when updating ${jsonFile.get()} . " +
185
+ " Try specifying '-P${propertyNames.updateMode} =update' or " +
186
+ " '-P${propertyNames.updateMode} =overwrite' on the gradle command line " +
187
+ " if you want a different update mode, or just want to be explicit about " +
188
+ " which update mode is in effect (warning code tjyscqmdne)"
189
+ )
190
+ }
191
+ }
192
+
193
+ defaultVersion.set(project.providers.gradleProperty(propertyNames.defaultVersion))
194
+
195
+ doFirst {
196
+ if (! defaultVersion.isPresent) {
197
+ logger.warn(
198
+ " WARNING: no '${propertyNames.defaultVersion} ' specified for task '$name '; " +
199
+ " the default version will not be updated in ${jsonFile.get()} . " +
200
+ " Try specifying something like '-P${propertyNames.defaultVersion} =1.2.3' " +
201
+ " on the gradle command line if you want to update the default version " +
202
+ " (warning code vqrbrktx9f)"
203
+ )
204
+ }
205
+ }
158
206
}
0 commit comments