|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
17 |
| -import com.google.firebase.dataconnect.gradle.plugin.UpdateDataConnectExecutableVersionsTask |
18 | 17 | import org.gradle.kotlin.dsl.withType
|
19 | 18 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
20 | 19 | import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
@@ -113,98 +112,3 @@ tasks.withType<KotlinJvmCompile>().configureEach {
|
113 | 112 | compilerOptions.freeCompilerArgs.add("-Xexplicit-api=strict")
|
114 | 113 | }
|
115 | 114 | }
|
116 |
| - |
117 |
| -// Adds a Gradle task that updates the JSON file that stores the list of Data Connect |
118 |
| -// executable versions. |
119 |
| -// |
120 |
| -// Example 1: Add versions 1.4.3 and 1.4.4 to the JSON file, and set 1.4.4 as the default: |
121 |
| -// ../../gradlew -Pversions=1.4.3,1.4.4 -PdefaultVersion=1.4.4 updateJson --info |
122 |
| -// |
123 |
| -// Example 2: Add version 1.2.3 to the JSON file, but do not change the default version: |
124 |
| -// ../../gradlew -Pversion=1.2.3 updateJson --info |
125 |
| -// |
126 |
| -// The `--info` argument can be omitted; it merely controls the level of log output. |
127 |
| -tasks.register<UpdateDataConnectExecutableVersionsTask>("updateJson") { |
128 |
| - outputs.upToDateWhen { false } |
129 |
| - jsonFile.set( |
130 |
| - project.layout.projectDirectory.file( |
131 |
| - "../gradleplugin/plugin/src/main/resources/com/google/firebase/dataconnect/gradle/" + |
132 |
| - "plugin/DataConnectExecutableVersions.json" |
133 |
| - ) |
134 |
| - ) |
135 |
| - workDirectory.set(project.layout.buildDirectory.dir("updateJson")) |
136 |
| - |
137 |
| - val propertyNames = |
138 |
| - object { |
139 |
| - val version = "version" |
140 |
| - val versions = "versions" |
141 |
| - val updateMode = "updateMode" |
142 |
| - val defaultVersion = "defaultVersion" |
143 |
| - } |
144 |
| - |
145 |
| - val singleVersion: String? = project.providers.gradleProperty(propertyNames.version).orNull |
146 |
| - val multipleVersions: List<String>? = |
147 |
| - project.providers.gradleProperty(propertyNames.versions).orNull?.split(',') |
148 |
| - versions.set( |
149 |
| - buildList { |
150 |
| - singleVersion?.let { add(it) } |
151 |
| - multipleVersions?.let { addAll(it) } |
152 |
| - } |
153 |
| - ) |
154 |
| - |
155 |
| - doFirst { |
156 |
| - if (versions.get().isEmpty()) { |
157 |
| - logger.warn( |
158 |
| - "WARNING: no '${propertyNames.version}' or '${propertyNames.versions}' specified " + |
159 |
| - "for task '$name'; no versions will be added to ${jsonFile.get()}. " + |
160 |
| - "Try specifying something like '-P${propertyNames.version}=1.2.3' or " + |
161 |
| - "'-P${propertyNames.versions}=1.2.3,4.5.6' on the gradle command line " + |
162 |
| - "if you want to add versions (warning code bm6d5ezxzd)" |
163 |
| - ) |
164 |
| - } |
165 |
| - } |
166 |
| - |
167 |
| - updateMode.set( |
168 |
| - project.providers.gradleProperty(propertyNames.updateMode).map { |
169 |
| - when (it) { |
170 |
| - "overwrite" -> UpdateDataConnectExecutableVersionsTask.UpdateMode.Overwrite |
171 |
| - "update" -> UpdateDataConnectExecutableVersionsTask.UpdateMode.Update |
172 |
| - else -> |
173 |
| - throw Exception( |
174 |
| - "Invalid '${propertyNames.updateMode}' specified for task '$name': $it. " + |
175 |
| - "Valid values are 'update' and 'overwrite'. " + |
176 |
| - "Try specifying '-P${propertyNames.updateMode}=update' or " + |
177 |
| - "'-P${propertyNames.updateMode}=overwrite' on the gradle command line. " + |
178 |
| - "(error code v2e3cfqbnf)" |
179 |
| - ) |
180 |
| - } |
181 |
| - } |
182 |
| - ) |
183 |
| - |
184 |
| - doFirst { |
185 |
| - if (!updateMode.isPresent) { |
186 |
| - logger.warn( |
187 |
| - "WARNING: no '${propertyNames.updateMode}' specified for task '$name'; " + |
188 |
| - "the default update mode of 'update' will be used when updating ${jsonFile.get()}. " + |
189 |
| - "Try specifying '-P${propertyNames.updateMode}=update' or " + |
190 |
| - "'-P${propertyNames.updateMode}=overwrite' on the gradle command line " + |
191 |
| - "if you want a different update mode, or just want to be explicit about " + |
192 |
| - "which update mode is in effect (warning code tjyscqmdne)" |
193 |
| - ) |
194 |
| - } |
195 |
| - } |
196 |
| - |
197 |
| - defaultVersion.set(project.providers.gradleProperty(propertyNames.defaultVersion)) |
198 |
| - |
199 |
| - doFirst { |
200 |
| - if (!defaultVersion.isPresent) { |
201 |
| - logger.warn( |
202 |
| - "WARNING: no '${propertyNames.defaultVersion}' specified for task '$name'; " + |
203 |
| - "the default version will not be updated in ${jsonFile.get()}. " + |
204 |
| - "Try specifying something like '-P${propertyNames.defaultVersion}=1.2.3' " + |
205 |
| - "on the gradle command line if you want to update the default version " + |
206 |
| - "(warning code vqrbrktx9f)" |
207 |
| - ) |
208 |
| - } |
209 |
| - } |
210 |
| -} |
0 commit comments