Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Dokka multiproject example using Gradle #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kamildoleglo
Copy link
Contributor

No description provided.

dokka {
externalDocumentationLink {
url = new URL("file://${project(":projectA").buildDir}/dokka/project-a/")
packageListUrl = new URL(url, "package-list")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work when publishing this documentation online? Does this create relative URLs? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well actually that depends. Some links are created as relative, regardless of this config, but some are not. For example the "all types" page is created with absolute paths, but the links in specific class pages are created with relative paths. I think it'll change in future versions of Dokka.
As for the publishing - I think you can set the URL to your domain (http://example.com/...) and create package list URL with local path (file://projectname/...) and that should work.
I didn't test it, though

@nateridderman-lilly
Copy link

nateridderman-lilly commented Jun 24, 2020

This fails for me when run locally.

$ ./gradlew.bat :projectA:dokka :projectB:dokka --stacktrace
> Task :projectB:dokka FAILED

...

1) Error injecting constructor, java.lang.RuntimeException: Exception while loading package-list from ExternalDocumentationLinkImpl(url=file://C:/Code/kotlin-examples/gradle/dokka-multiproject-gradle-example/projectA/build/dokka/project-a/, packageListUrl=file://C:/Code/kotlin-examples/gradle/dokka-multiproject-gradle-example/projectA/build/dokka/project-a/package-list)

...

Caused by: java.net.UnknownHostException: C
        at org.jetbrains.dokka.PackageListProvider.loadPackageList(ExternalDocumentationLinkResolver.kt:137)
        at org.jetbrains.dokka.PackageListProvider.<init>(ExternalDocumentationLinkResolver.kt:57)
        ... 83 more

@kamildoleglo
Copy link
Contributor Author

The package-list from projectA has not been generated yet, that's probably why this error occurs. You should run ./gradlew dokka or ./gradlew :projectA:dokka && ./gradlew :projectB:dokka if you wanted to run separate tasks (although that's not the point of this example)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants