1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16- @file:OptIn(ExperimentalStdlibApi ::class )
17-
1816package com.squareup.wire.gradle
1917
2018import com.squareup.wire.VERSION
@@ -31,7 +29,6 @@ import java.util.concurrent.atomic.AtomicBoolean
3129import org.gradle.api.Plugin
3230import org.gradle.api.Project
3331import org.gradle.api.artifacts.UnknownConfigurationException
34- import org.gradle.api.internal.file.FileOrUriNotationConverter
3532import org.gradle.api.tasks.SourceSet
3633import org.gradle.api.tasks.SourceSetContainer
3734import org.gradle.api.tasks.compile.JavaCompile
@@ -195,20 +192,15 @@ class WirePlugin : Plugin<Project> {
195192 task.group = GROUP
196193 task.description = " Generate protobuf implementation for ${source.name} "
197194
198- var addedSourcesDependencies = 0
199195 // Flatten all the input files here. Changes to any of them will cause the task to re-run.
200196 for (rootSet in protoSourceProtoRootSets) {
201197 task.source(rootSet.configuration)
202- val sourceDirectoriesAndLocalJars = rootSet.sourceDirectoriesAndLocalJars.toTypedArray()
203- addedSourcesDependencies + = sourceDirectoriesAndLocalJars.size
204- task.source(* sourceDirectoriesAndLocalJars)
205198 }
206199 // We only want to add ProtoPath sources if we have other sources already. The WireTask
207200 // would otherwise run even through we have no sources.
208- if (addedSourcesDependencies > 0 ) {
201+ if (! task.source.isEmpty ) {
209202 for (rootSet in protoPathProtoRootSets) {
210203 task.source(rootSet.configuration)
211- task.source(* rootSet.sourceDirectoriesAndLocalJars.toTypedArray())
212204 }
213205 }
214206
@@ -339,13 +331,9 @@ class WirePlugin : Plugin<Project> {
339331 }
340332
341333 private fun defaultSourceFolders (source : Source ): Set <String > {
342- val parser = FileOrUriNotationConverter .parser()
343- return source.sourceSets.map { " src/$it /proto" }.filter { path ->
344- val converted = parser.parseNotation(path) as File
345- val file =
346- if (! converted.isAbsolute) File (project.projectDir, converted.path) else converted
347- return @filter file.exists()
348- }.toSet()
334+ return source.sourceSets.map { " src/$it /proto" }
335+ .filter { path -> File (project.projectDir, path).exists() }
336+ .toSet()
349337 }
350338
351339 internal companion object {
0 commit comments