-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error class: unknown class
in KMP Multi-module project
#57
Comments
Thanks for the report. From looking at the For example, the generated function It might be caused by this line, which filters out non-project dependencies from the classpath, and I can't remember why I put it in... It can probably be removed without issue. dokkatoo/modules/dokkatoo-plugin/src/main/kotlin/adapters/DokkatooKotlinAdapter.kt Line 229 in 8f735f0
|
I've done a quick hacky test and it looks like removing dokkatoo/modules/dokkatoo-plugin/src/main/kotlin/adapters/DokkatooKotlinAdapter.kt Line 229 in 8f735f0
I'll push a fix soon and you can try the snapshot @chrisbanes |
Ha, yeah I just tried the same thing and it works as expected. Thanks for the quick response! |
Just tried out more of the built docs and while the references are now fixed, but it seems that some of the links don't work (the linked docs don't exist). A key example is in |
Sorry, I don't understand what you mean. Could you share a screenshot of the docs, and a link to the source code of the missing classes? When I look in Redwood's current docs, I can see And the same function in the Dokkatoo generated docs |
Try and click on those links, most will |
Gotcha, I see what you mean. Clicking on
While it should link to
I'll have a look around but I'm not sure what the cause might be. Dokkatoo is basically a fancy wrapper around the Dokka config, so presumably Dokkatoo is generating slightly incorrect config. The trick is to figure out why Dokkatoo is trying to link to |
Does the Dokka plugin output a JSON file like Dokkatoo? We have a working Dokka setup so should be pretty easy to diff if it exists |
Unfortunately not Kotlin/dokka#2873, but it is possible to add a breakpoint in Dokka and debug into the code - but it's not very convenient |
Interestingly if I remove the subproject logic and add explicit dependencies then the links seems to work // docs/build.gradle
//rootProject.subprojects.each {
// if (it.name == name) return
// evaluationDependsOn(it.path)
//
// // Each submodule needs to have the dokkatoo plugin applied
// if (!it.plugins.hasPlugin('dev.adamko.dokkatoo-html')) return
//
// dependencies {
// dokkatoo(project(it.path))
// }
//}
dependencies {
dokkatoo projects.redwoodTreehouseComposeui
dokkatoo projects.redwoodTreehouseHost
// Need to manually depend on this due to https://github.com/adamko-dev/dokkatoo/issues/14
dokkatooPluginHtml("org.jetbrains.dokka:all-modules-page-plugin:1.8.10")
//dokkatooPluginHtml("org.jetbrains.dokka:templating-plugin:1.8.10") // shouldn't be necessary
} |
Ah interesting! I'll have a play around and see if I can get it to work somehow. |
However, if I add all dependencies manually, then clicking dependencies {
// dokkatoo projects.redwoodCli
dokkatoo projects.redwoodCompose
dokkatoo projects.redwoodComposeTesting
dokkatoo projects.redwoodFlexbox
dokkatoo projects.redwoodGradlePlugin
dokkatoo projects.redwoodLayoutApi
//dokkatoo projects.redwoodLayoutApiDensity
dokkatoo projects.redwoodLayoutCompose
dokkatoo projects.redwoodLayoutComposeui
dokkatoo projects.redwoodLayoutDom
dokkatoo projects.redwoodLayoutLayoutmodifiers
dokkatoo projects.redwoodLayoutSchema
// dokkatoo projects.redwoodLayoutSharedTest
dokkatoo projects.redwoodLayoutTesting
dokkatoo projects.redwoodLayoutUiview
dokkatoo projects.redwoodLayoutView
dokkatoo projects.redwoodLayoutWidget
dokkatoo projects.redwoodProtocol
dokkatoo projects.redwoodProtocolCompose
dokkatoo projects.redwoodProtocolWidget
dokkatoo projects.redwoodRuntime
dokkatoo projects.redwoodSchema
// dokkatoo projects.redwoodToolingCodegen
// dokkatoo projects.redwoodToolingLint
// dokkatoo projects.redwoodToolingSchema
dokkatoo projects.redwoodTreehouse
dokkatoo projects.redwoodTreehouseComposeui
dokkatoo projects.redwoodTreehouseComposeuiInsets
dokkatoo projects.redwoodTreehouseConfiguration
dokkatoo projects.redwoodTreehouseGuest
dokkatoo projects.redwoodTreehouseGuestCompose
dokkatoo projects.redwoodTreehouseHost
dokkatoo projects.redwoodTreehouseLazylayoutApi
dokkatoo projects.redwoodTreehouseLazylayoutCompose
dokkatoo projects.redwoodTreehouseLazylayoutComposeui
dokkatoo projects.redwoodTreehouseLazylayoutPaging
dokkatoo projects.redwoodTreehouseLazylayoutSchema
dokkatoo projects.redwoodTreehouseLazylayoutTesting
dokkatoo projects.redwoodTreehouseLazylayoutUiview
dokkatoo projects.redwoodTreehouseLazylayoutView
dokkatoo projects.redwoodTreehouseLazylayoutWidget
dokkatoo projects.redwoodWidget
dokkatoo projects.redwoodWidgetCompose
// Need to manually depend on this due to https://github.com/adamko-dev/dokkatoo/issues/14
dokkatooPluginHtml("org.jetbrains.dokka:all-modules-page-plugin:1.8.10")
// dokkatooPluginHtml("org.jetbrains.dokka:templating-plugin:1.8.10")
} |
Any tips on how to debug/breakpoint this? I've tried a few things and can't get it to break. I guess diff'ing the configuration is the only way we're going to track this down. |
Hmm no sorry, I thought there was a thread in the Dokka issue board explaining, but I can't find it any more. You could try asking on the Dokkatoo and Dokka should generate identical content, so while even if it's not possible to check the JSON configuration, you can do a diff on I've done some digging and unfortunately I haven't found an answer. One thing that I thought was interesting is that the EDIT: never mind, I had disabled most of the subprojects, the package-lists are actually the same Dokka's package-list
Dokkatoo's package-list
|
I've done a lot of digging over the weekend, and I came up with something to show the Dokka configuration.
Now run Dokka and Dokkatoo!
I've compared the Dokka config of // ID of the problematic source set
"displayName": "iosArm64",
"sourceSetID": {
"scopeId": ":redwood-widget:dokkaHtmlPartial",
"sourceSetName": "iosArm64Main"
}, In Dokka the classpath contains a lot of Kotlin Native files, but these are completely absent from the Dokkatoo config. // why are these classpath files missing in Dokkatoo?
"classpath": [
...
"/Users/me/.local/share/konan/kotlin-native-prebuilt-macos-x86_64-1.8.20/klib/platform/ios_arm64/org.jetbrains.kotlin.native.platform.CoreFoundation",
"/Users/me/.local/share/konan/kotlin-native-prebuilt-macos-x86_64-1.8.20/klib/platform/ios_arm64/org.jetbrains.kotlin.native.platform.Network",
"/Users/me/.local/share/konan/kotlin-native-prebuilt-macos-x86_64-1.8.20/klib/platform/ios_arm64/org.jetbrains.kotlin.native.platform.QuartzCore",
"/Users/me/.local/share/konan/kotlin-native-prebuilt-macos-x86_64-1.8.20/klib/platform/ios_arm64/org.jetbrains.kotlin.native.platform.MLCompute",
"/Users/me/.local/share/konan/kotlin-native-prebuilt-macos-x86_64-1.8.20/klib/platform/ios_arm64/org.jetbrains.kotlin.native.platform.SafetyKit",
"/Users/me/.local/share/konan/kotlin-native-prebuilt-macos-x86_64-1.8.20/klib/platform/ios_arm64/org.jetbrains.kotlin.native.platform.Security",
"/Users/me/.local/share/konan/kotlin-native-prebuilt-macos-x86_64-1.8.20/klib/platform/ios_arm64/org.jetbrains.kotlin.native.platform.CloudKit",
...
] In the Dokka config the "dependentSourceSets": [
{
"scopeId": ":redwood-widget:dokkaHtmlPartial",
"sourceSetName": "iosMain"
},
{
"scopeId": ":redwood-widget:dokkaHtmlPartial",
"sourceSetName": "commonMain"
}
], While in Dokkatoo // why is iosMain missing?
"dependentSourceSets": [
{
"scopeId": ":redwood-widget:dokkaHtmlPartial",
"sourceSetName": "commonMain"
}
], I'm not sure what to do about this! The Dokka config that extracts the source set/dependencies information is not compatible with Gradle configuration cache, which Dokkatoo needs to adhere to. |
Interesting! This might be the same issue which is blocking upgrade to Gradle 8.x: cashapp/redwood#823 I haven't looked too deeply, but it seems that the KMP plugin does some interesting things wrt Gradle tasks, and Dokka has explicit support for KMP projects. |
Hmm yes, they are probably related. My guess is the error is caused by Dokka fetching the dependencies using the Kotlin Compile task But Dokkatoo won't do this, because it's not compatible with Gradle config-cache. |
tl;dr:
I found a bug in Dokkatoo that explains why some The dokkatoo/modules/dokkatoo-plugin/src/main/kotlin/dokka/parameters/DokkaSourceSetIdSpec.kt Lines 37 to 38 in c74dd56
So when two are put into the The other issue is that the Kotlin Native files are missing from the classpath. This can be fixed by adding a dependency onto the appropriate Configuration, I'm inclined to believe this is caused by improper configuration in the Kotlin Gradle Plugin. The This is not an easy problem to fix (or at least, not an easy problem to figure out how to fix - KGP is complicated!). The task is breaking project-isolation and not sharing files using Configurations. So, as a workaround, the task can be manually disabled tasks.matching {
"CInteropMetadataDependencyTransformationTask" in (it::class.qualifiedName ?: "")
}.configureEach {
enabled = false
} Perhaps there's a clever way of disabling the task when the documentation is being generated? tasks.matching {
"CInteropMetadataDependencyTransformationTask" in (it::class.qualifiedName ?: "")
}.configureEach {
// disable the IDE task when generating documentation
enabled = gradle.taskGraph.allTasks.none {
it is dev.adamko.dokkatoo.tasks.DokkatooTask || it is org.jetbrains.dokka.gradle.AbstractDokkaTask
}
} But the last hurdle... when I try disabling the |
This should be fixed by #76. Redwood managed to get Dokka working, so I'll close this issue. If there are any more improvements or problems with how Dokkatoo handles Android projects, leave a comment or make a new issue. |
Follow on from #50 (comment).
Repro: cashapp/redwood#936
Things tried:
dokka_parameters.json
and I can't see any reference to local project dependency JARs.plugins
instead ofapply plugin
. Same result.Could not create domain object 'commonMain' (DokkaSourceSetSpec)
The text was updated successfully, but these errors were encountered: