Kotlin / dokka

API documentation engine for Kotlin
https://kotl.in/dokka
Apache License 2.0
3.45k stars 411 forks source link

Failed to resolve inter-module dependencies: Cannot change dependencies of dependency configuration #3068

Closed JesusMcCloud closed 1 year ago

JesusMcCloud commented 1 year ago

Describe the bug Dokka fails to correctly resolve task dependencies in a multi-module multiplatform project with inter-module dependencies. This results in a build failure. Note that this is a true multiplatform project with JVM and iOS targets.

The full error message is:

Cannot change dependencies of dependency configuration ':vclib-openid:iosMainImplementationDependenciesMetadata' after task dependencies have been resolved

However, this also happens when manually invoking dokkaHtml for individual modules.

Expected behaviour Dokka correctly resolves task dependencies of all modules and executes them as required to produce documentation.

To Reproduce

git clone --recursive -b tmp/dokkaFailKGP1.9 git@github.com:a-sit-plus/kmm-vc-library.git
./gradlew dokkaHtmlMultiModule

Dokka configuration Note: we introduced the the inter-module Dokka-related task dependencies when upgrading to Gradle 8.1, because these dependencies were reported to be implicit and needed to be made explicit for the Dokka tasks to successfully run. The only custom configuration we really depend on is manually setting the output directory of Dokka to reference it for publishing HTML documentation on https://a-sit-plus.github.io/kmm-vc-library/.
(This is also the reason why we manually declared the publishing tasks' dependencies on the signing tasks.)

Note: Removing these manual declarations of Dokka-related task dependencies does not impact the behaviour.

I'm also satisfied with a workaround as a stop-gap solution so we can upgrade to Kotlin 1.9. Everything worked fine with KGP 1.8.20 (Except Gradle 8.1 promoting some warnings to errors compared to Gradle 7.6, requiring the previously mentioned manual specification of task dependencies.)

JesusMcCloud commented 1 year ago

Potentially related: #2679 #3063 #3059 (but again: this is a true multiplatform project targeting JVM and iOS, so I am not certain)

JesusMcCloud commented 1 year ago

Also: yes the iOS builds fail (see https://github.com/a-sit-plus/kmm-vc-library/actions/runs/5505772958/jobs/10033568404) but this is something to be sorted out independently.

JesusMcCloud commented 1 year ago

Thanks @whyoleg! org.jetbrains.dokka.classpath.excludePlatformDependencyFiles=true works nicely as a stop-gap solution for our project that initially triggered the issue. (But I do understand that the underlying issue is not fixed yet)

IgnatBeresnev commented 1 year ago

Dokka 1.9.0 has been released, and it includes some workarounds for this problem. See the following issue for details:


To avoid the spread of information and have updates in a single place, I'll close this issue and a few others as duplicates in favour of #3153.