@@ -70,6 +70,8 @@ dependencies {
7070
7171 testImplementation(project(" :firebase-dataconnect:testutil" ))
7272 testImplementation(libs.androidx.test.junit)
73+ testImplementation(libs.kotest.assertions)
74+ testImplementation(libs.kotest.property)
7375 testImplementation(libs.kotlin.coroutines.test)
7476 testImplementation(libs.mockk)
7577 testImplementation(libs.robolectric)
@@ -84,6 +86,7 @@ dependencies {
8486 androidTestImplementation(libs.kotest.assertions)
8587 androidTestImplementation(libs.kotest.property)
8688 androidTestImplementation(libs.kotlin.coroutines.test)
89+ androidTestImplementation(libs.testonly.three.ten.abp)
8790 androidTestImplementation(libs.truth)
8891 androidTestImplementation(libs.truth.liteproto.extension)
8992 androidTestImplementation(libs.turbine)
@@ -127,29 +130,77 @@ tasks.register<UpdateDataConnectExecutableVersionsTask>("updateJson") {
127130 )
128131 workDirectory.set(project.layout.buildDirectory.dir(" updateJson" ))
129132
130- 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
131142 val multipleVersions: List <String >? =
132- project.providers.gradleProperty(" versions" ).orNull?.split(' ,' )
143+ project.providers.gradleProperty(propertyNames. versions).orNull?.split(' ,' )
133144 versions.set(
134145 buildList {
135146 singleVersion?.let { add(it) }
136147 multipleVersions?.let { addAll(it) }
137- if (isEmpty()) {
138- throw Exception (" bm6d5ezxzd 'version' or 'versions' property must be specified" )
139- }
140148 }
141149 )
142150
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+
143163 updateMode.set(
144- project.providers.gradleProperty(" updateMode" ).map {
164+ project.providers.gradleProperty(propertyNames. updateMode).map {
145165 when (it) {
146166 " overwrite" -> UpdateDataConnectExecutableVersionsTask .UpdateMode .Overwrite
147167 " update" -> UpdateDataConnectExecutableVersionsTask .UpdateMode .Update
148168 else ->
149- 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+ )
150176 }
151177 }
152178 )
153179
154- 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+ }
155206}
0 commit comments