https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
a

Adam S

02/04/2023, 6:26 PM
I’m working on the Dokka Gradle Plugin refactor, and I’ve got safe cross-project configuration working, except it looks like some of the HTML processing isn’t working. In the HTML files I can see
PathToRootSubstitutionCommand
comments, but the
###
substitution isn’t triggered
<!--[+]cmd:{"@class":"org.jetbrains.dokka.base.templating.PathToRootSubstitutionCommand","pattern":"###","default":""}-->    <link href="###images/logo-icon.svg" rel="icon" type="image/svg">
I also see in the Dokka logs that some of the ‘extension points’ aren’t working
Unused extension points found: ExtensionPoint: org.jetbrains.dokka.base.DokkaBase/externalClasslikesTranslator, ExtensionPoint: org.jetbrains.dokka.base.DokkaBase/externalDocumentablesProvider, ExtensionPoint: org.jetbrains.dokka.base.DokkaBase/immediateHtmlCommandConsumer
I’ll put the full JSON config that’s being used to trigger the Dokka Generator in the thread - is it missing something?
this is the config for a project with two subprojects
.
├── my-project/
│   ├── subproject-hello/
│   │   └── build.gradle.kts
│   └── subproject-goodbye/
│       └── build.gradle.kts
├── setttings.gradle.kts
└── build.gradle.kts
these are the files generated in the root project (there’s no
styles
dir…)
and this is the classpath I’m using to run the Dokka Generator
dokka-core-1.7.20.jar
markdown-jvm-0.3.1.jar
dokka-analysis-1.7.20.jar
kotlin-analysis-intellij-1.7.20.jar
dokka-base-1.7.20.jar
kotlin-analysis-compiler-1.7.20.jar
kotlinx-html-jvm-0.8.0.jar
freemarker-2.3.31.jar
jackson-dataformat-xml-2.12.7.jar
jackson-module-jaxb-annotations-2.12.7.jar
jackson-databind-2.12.7.jar
jackson-annotations-2.12.7.jar
jackson-core-2.12.7.jar
jackson-module-kotlin-2.12.7.jar
kotlin-reflect-1.7.20.jar
jsoup-1.14.3.jar
kotlinx-coroutines-core-jvm-1.6.3.jar
kotlin-stdlib-jdk8-1.7.20.jar
kotlin-stdlib-jdk7-1.7.20.jar
kotlin-stdlib-1.7.20.jar
kotlin-stdlib-common-1.7.20.jar
woodstox-core-6.2.4.jar
stax2-api-4.2.1.jar
annotations-13.0.jar
jakarta.xml.bind-api-2.3.2.jar
jakarta.activation-api-1.2.1.jar
the result is that the generated
index.html
doesn’t have any styling
i

Ignat Beresnev

02/04/2023, 10:38 PM
I’m working on the Dokka Gradle Plugin refactor
Hi! Is it for #2839? I described in more detail how HTML documentation should be generated for multimodule projects here: https://github.com/Kotlin/dokka/issues/2770#issuecomment-1347673833 If you read it, I'm sure it'll clear some things up. TLDR: You need to run each module separately with
delayTemplateSubstitution = true
, and then in the last multi-module task apply the
templating
and
all-modules-page
plugins, and pass all modules into the
DokkaConfiguration#modules
option. (sorry if you've done that already in the json config, can't go over it at the moment)
a

Adam S

02/04/2023, 10:41 PM
Hi! Is it for #2839?
yes that’s right
I’ll read through that info, thanks
I don’t think that way the current plugin works is comparable though, the new way is more like how the CLI works.
(at least I think)
i

Ignat Beresnev

02/04/2023, 10:43 PM
It's extremely difficult to build multimodule documentation with the CLI runner... it basically requires separate runs for each submodule and then another one for the final result
a

Adam S

02/04/2023, 10:45 PM
is it that difficult? I thought that basically each subproject would have a sourceSet. So there would be a sourceSet for •
src/main/kotlin
, • and
subproject-alpha/src/main/kotlin
, • and
subproject-beta/src/main/kotlin
i

Ignat Beresnev

02/04/2023, 10:55 PM
I wish 🥲 The comment that I linked above explains it well
a

Adam S

02/04/2023, 11:02 PM
yeah boiiiii styles are working
I had
delayTemplateSubstitution
set to
true
for some reason
I understand there’s a difference between sourceSets and modules I assumed that a Gradle project with multiple subprojects could effectively be handled by Dokka Generator with a single dokka-conf.json, with one sourceSet per subproject. Dokka Generator would create a standalone site that contains all sourceSets. And there’s also Dokka Modules, which I assume are standalone instances of Dokka sites.
how I’ve set it up is that (assume dokka2 plugin is applied to all subprojects) • each subproject will produce a
dokka-configuration.json
, that at minimum contains its own sources, e.g.
src/main/kotlin
• subprojects can depend on other subprojects
dependencies {
  dokka(project(":some:subproject"))
}
• by default,
dokka-configuration.json
files from other subprojects will be merged into this project’s
dokka-configuration.json
(which was already the case in one of current subprojects tasks) • and then the Dokka Generator only runs once
however, subprojects can also depend on a Dokka Module,
dependencies {
  dokkaModule(project(":some:subproject"))
}
this will trigger a Dokka Generator in
:some:subproject
, and produce a Dokka HTML site in
./some/subproject/build/dokka-output
- which the consuming project can then receive and merge into its
dokka-configuration.json
, and pass that along to Dokka Generator (so Dokka Generator will run twice)
i

Ignat Beresnev

02/04/2023, 11:35 PM
With the current architecture of Dokka, each child module needs to be run independently with its own settings, in which
delayTemplateSubstitution
is set to true. These runs would use the single-module generator, but delay resolving some links (the commands you saw). In the end, once all child modules have their "partial" documentation generated (with the commands), Dokka is run once again with the
all-modules-page
plugin (unites all modules into a single website) and the
templating
plugin (resolves unresolved links/commands relative to the single resulting documentation) I'm not sure what you're proposing would work, but I don't have much information to tell right now If you want, I'd be down to have a call where I can explain the inner workings in more detail, and maybe answer some of your questions. I can do it in text, it'll just take longer, and this part isn't documented anywhere 😞
a

Adam S

02/05/2023, 10:50 AM
okay cool, I think I can do that… when I figured out I can do is print the DokkaConfigurationImpl JSON from the current plugin, and then make sure the new plugin matches it
I am right in thinking that even in a Gradle build with a single project, the following would work to create a final Dokka HTML Publication? 1. run
./gradlew dokkaGenerateHtml
2. Get Dokka parameters from build.gradle 3. Create the Dokka JSON parameters (used to execute Dokka Generator)
./build/dokka-config/html/dokka-params.json
4. Produce a Dokka Module into
./build/dokka/html-module/
by executing Dokka Generator using
dokka-params.json
, BUT without
all-modules-page
and
templating
5. Create the final Dokka HTML Publication into
./build/dokka/html
by running Dokka Generator again WITH
all-modules-page
and
templating
so Dokka Generator would run twice for single projects, but the benefit is given multiple projects it’s easy for step 5 to additionally trigger steps 1-4 in other subprojects, and gather the results