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