Skip to content

Commit 59139f7

Browse files
authored
fix: Fix gradle dependency resolution (#11984)
Fix dependsOn() resolution of the vaadinPrepareFrontend task Closes #11943
1 parent 5cb2290 commit 59139f7

3 files changed

Lines changed: 17 additions & 11 deletions

File tree

‎flow-plugins/flow-gradle-plugin/src/main/kotlin/com/vaadin/gradle/GradlePluginAdapter.kt‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ internal class GradlePluginAdapter(val project: Project, private val isBeforePro
8383
}
8484

8585
override fun getJarFiles(): MutableSet<File> {
86-
val jarFiles = project.configurations
87-
.getByName("runtimeClasspath")
88-
.resolve()
89-
.filter { it.name.endsWith(".jar", true) }
86+
val jarFiles: Set<File> = project.configurations.runtimeClasspath.jars.toSet()
9087
return jarFiles.toMutableSet()
9188
}
9289

‎flow-plugins/flow-gradle-plugin/src/main/kotlin/com/vaadin/gradle/VaadinPrepareFrontendTask.kt‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,7 @@ public open class VaadinPrepareFrontendTask : DefaultTask() {
4343
// the Vaadin classpath scanning will not work properly. See
4444
// https://github.com/vaadin/vaadin-gradle-plugin/issues/38
4545
// for more details.
46-
val dependentProjectTasks: List<Task> = project.configurations.getByName("runtimeClasspath")
47-
.allDependencies
48-
.withType(ProjectDependency::class.java)
49-
.toList()
50-
.map { it.dependencyProject }
51-
.mapNotNull { it.tasks.findByName("assemble") }
52-
dependsOn(*dependentProjectTasks.toTypedArray())
46+
dependsOn(project.configurations.runtimeClasspath.jars)
5347
}
5448

5549
@TaskAction

‎flow-plugins/flow-gradle-plugin/src/main/kotlin/com/vaadin/gradle/VaadinUtils.kt‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616
package com.vaadin.gradle
1717

18+
19+
import org.gradle.api.artifacts.Configuration
20+
import org.gradle.api.artifacts.ConfigurationContainer
21+
import org.gradle.api.file.FileCollection
1822
import com.vaadin.flow.function.SerializableSupplier
1923
import com.vaadin.flow.server.frontend.FrontendTools
2024
import com.vaadin.flow.server.frontend.FrontendToolsSettings
@@ -70,3 +74,14 @@ internal fun VaadinFlowPluginExtension.createFrontendTools(): FrontendTools {
7074
return FrontendTools(settings)
7175
}
7276

77+
/**
78+
* Returns the "runtimeClasspath" file collection.
79+
*/
80+
internal val ConfigurationContainer.runtimeClasspath: Configuration
81+
get() = getByName("runtimeClasspath")
82+
83+
/**
84+
* Returns only jar files from given file collection.
85+
*/
86+
internal val Configuration.jars: FileCollection
87+
get() = filter { it.name.endsWith(".jar", true) }

0 commit comments

Comments
 (0)