In <https://api.openrndr.org/> the version display...
# dokka
a
In https://api.openrndr.org/ the version displayed at the top
0.1.0-dev.1+c35ad28
is not what I would like. How is that version string decided? is it gradle, dokka, something else? The hash part is correct coming from the latest commit. When I run the
dokkaHtmlMultimodule
gradle task locally the version in the produced html files is
0.4.1
. This and this files are involved. Dokka version is 1.7.10. In the github action logs I can read
Copy code
> Configure project :
Inferred project: openrndr, version: 0.1.0-dev.1+c35ad28
โœ… 1
g
Dokka's HTML format has default template. The template uses variable (in context of FreeMarker syntax, obviously)
<@version/>
to display the version you are talking about (it is mentioned at the very bottom of HTML output format docs; also you can see its usage in default template here). Dokka's docs also says that you can change the template variable via versioning plugin by specifiying corresponding parameter
version
of the plugin in your build script.
a
Thank you, very useful ๐Ÿ™‚ After looking into it, I guess my question about Gradle, not Dokka: Why is Gradle passing a different
@version
value when ran locally vs ran on github.
i
^ this is one way of fixing it, but it should be simpler than that as the version is taken from
moduleVersion
configuration property Try adding this to the root buildscript file:
Copy code
tasks.withType<DokkaMultiModuleTask>().configureEach {
    moduleVersion.set("HEADER_VERSION_HERE")
}
a
Exactly what I was going to reply ๐Ÿ™‚ Ignore the received value and pass the one I want, right?
i
So the version itself is taken from
moduleVersion
of the MultiModule task configuration.
How is that version string decided?
The default value of
moduleVersion
is
project.version.toString()
, javadoc: Project#getVersion() How it's chosen and why it's different for github actions is beyond my understanding of Gradle, unfortunately ๐Ÿ™‚ But yeah, you can just override
moduleVersion
with your own value
Perhaps,
version.toString()
is wrong on Dokka's end, as it can be any
Object
with any
toString()
implementation - that would explain the hash part. Although I'm not sure what types exactly Gradle can return, and what can override it.
a
Thank you for the details!
I'll just leave here how it looks locally:
0.4.1-dev.57.uncommitted+c39fefc
It also includes the hash of the last git commit.
j
@Ignat Beresnev are you picking it in configuration phase? Maybe the version is a property which is not set when dokka is picking it as it should be unwrapped on the task
Copy code
@Input
val moduleVersion: Property<String> = project.objects.safeProperty<String>()
        .safeConvention(project.version.toString())
changing that to this should fix the issue
Copy code
@Input
val moduleVersion: Property<String> = project.objects.safeProperty<String>()
        .safeConvention(project.provider { project.version.toString() })
a
On our side, this and this commits helped fix this. Now the version shown in the api website looks good ๐Ÿ™‚