[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
This commit is contained in:
Alexander.Likhachev
2023-06-07 18:04:34 +02:00
committed by Space Team
parent 3affe78ae5
commit 58490ea184
+7
View File
@@ -361,6 +361,13 @@ fun Project.publishProjectJars(projects: List<String>, 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