From 58490ea184629fe4f50cea996a2fcfac9de20375 Mon Sep 17 00:00:00 2001 From: "Alexander.Likhachev" Date: Wed, 7 Jun 2023 18:04:34 +0200 Subject: [PATCH] [Build] Configure sourcesJar task dependencies explicitly The `sourcesJar` task uses outputs of code generation tasks, thus it should be declared, so Gradle would know that's not a misconfiguration. https://docs.gradle.org/8.1/userguide/validation_problems.html#implicit_dependency #KTI-1221 In Progress --- buildSrc/src/main/kotlin/artifacts.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/buildSrc/src/main/kotlin/artifacts.kt b/buildSrc/src/main/kotlin/artifacts.kt index aadf2989852..34826078f7e 100644 --- a/buildSrc/src/main/kotlin/artifacts.kt +++ b/buildSrc/src/main/kotlin/artifacts.kt @@ -361,6 +361,13 @@ fun Project.publishProjectJars(projects: List, libraryDependencies: List } sourcesJar { + for (projectPath in projects) { + val projectTasks = project(projectPath).tasks + if (projectTasks.names.any { it == "compileKotlin" }) { + // this is needed in order to declare explicit dependency on code generation tasks + dependsOn(projectTasks.named("compileKotlin").map { it.dependsOn }) + } + } from { projects.map { project(it).mainSourceSet.allSource