Hi guys, I have an issue while generating the doc ...
# dokka
j
Hi guys, I have an issue while generating the doc in a JS subproject. Dokka is somehow trying to unzip JS files for some reason, and this fails the build:
Copy code
> Task :krossbow-engine-webstompjs:dokka
WARN: error in opening zip file: /home/travis/build/joffrey-bion/krossbow/build/js/node_modules/sockjs-client/lib/entry.js
java.util.zip.ZipException: error in opening zip file
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(ZipFile.java:225)
    .......
	at org.jetbrains.dokka.AnalysisEnvironment.createCoreEnvironment(AnalysisEnvironment.kt:89)
	at org.jetbrains.dokka.Utilities.DokkaAnalysisModule.configure(DokkaModules.kt:35)
    .....
	at org.jetbrains.dokka.DokkaGenerator.appendSourceModule(DokkaGenerator.kt:86)
	at org.jetbrains.dokka.DokkaGenerator.generate(DokkaGenerator.kt:41)
	at org.jetbrains.dokka.DokkaBootstrapImpl.generate(DokkaBootstrapImpl.kt:75)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    .....
	at org.jetbrains.dokka.gradle.DokkaTask.generate(DokkaTask.kt:177)
The full stacktrace can be seen here: https://travis-ci.org/joffrey-bion/krossbow/jobs/620861213#L1116 (need to manually go to line 1116 because it is collapsed) Any idea why this is happening?
k
It’s in fact the Kotlin compiler that tries to unzip your
.js
files as
.zip
files for some reason. TBH I have no idea why. Did you set the analysis platform to`js`?
j
Not in the dokka configuration, but the gradle build is using the Kotlin JS plugin. I was trying the minimal config first, hoping it would pick up what it needed on its own:
Copy code
tasks.dokka {
    outputFormat = "markdown"
    outputDirectory = "$buildDir/javadoc"
}
Because at first, this was in the root build script, not in the JS subproject, but in the end I figured I may need to configure each project independently.
k
Oh, I see. Yeah, so that’s probably why this is happening. In fact for the multiplatform project you have to define each platform you want to document IIRC (this was my idea of doing that, I see now that it’s not intuitive, it’ll be fixed), eg:
Copy code
tasks.dokka {
    outputFormat = "markdown"
    outputDirectory = "$buildDir/javadoc"
   multiplatform{
      js{}
      jvm{}
   }
}
j
But this subproject is not multiplatform, it's just JS. There are other subprojects in the multi-module build that are multiplatform, and for which I needed no configuration at all for dokka.
k
Oh, so that’s strange. Try to set the analysis platform explicitly:
Copy code
tasks.dokka {
    outputFormat = "markdown"
    outputDirectory = "$buildDir/javadoc"
    configuration { 
       platform = "js"
    }
}
j
Thanks, I'll try that
Didn't seem to solve the issue 😞
k
That’s not good. Can you file an issue on GitHub with this?
j
Sure, I'll try to create a minimal project to reproduce this first, so that it's easier to debug, because my setup is quite complex in that project.