Skip to content
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

Custom module name leads to hidden packages for maven runner #3011

Closed
atyrin opened this issue May 24, 2023 · 2 comments · Fixed by #3019
Closed

Custom module name leads to hidden packages for maven runner #3011

atyrin opened this issue May 24, 2023 · 2 comments · Fixed by #3019
Labels
bug regression An issue/bug that appeared after recent changes runner: CLI An issue/PR related to Dokka's CLI runner runner: Maven plugin An issue/PR related to Dokka's Maven plugin

Comments

@atyrin
Copy link
Contributor

atyrin commented May 24, 2023

Configure the Dokka Maven plugin with custom module name:

<plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>1.8.10</version>
<!--                <version>1.7.20</version>-->
                <executions>
                    <execution>
                        <phase>pre-site</phase>
                        <goals>
                            <goal>dokka</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>
                    <moduleName>Dokka Maven Project</moduleName>
                </configuration>
            </plugin>

As a result, rendered documentation will filter out all sources:
image

The issue appeared in 1.8.10. For 1.7.20, it works fine. Also, it does not reproduce for Gradle runner.

@atyrin atyrin added bug runner: Maven plugin An issue/PR related to Dokka's Maven plugin labels May 24, 2023
@atyrin
Copy link
Contributor Author

atyrin commented May 24, 2023

As I see in Gradle filters has the original module name
image

In Maven, it is replaced by the new name
image

@IgnatBeresnev IgnatBeresnev added the regression An issue/bug that appeared after recent changes label May 24, 2023
@IgnatBeresnev
Copy link
Member

This happens only for Maven module names that contain a space. The CLI runner is also affected.

Bug explanation

In the Maven runner, the moduleName property is set as DokkaSourceSetID#scopeId, so in the case above it'll be Dokka Maven Project. In the Gradle runner it is set to the task path, so in the simplest case it'll be just dokkaHtml.

Note: DokkaSourceSetID defines toString() as

override fun toString(): String {
    return "$scopeId/$sourceSetName"
}

Then there's this code. If a table entry belongs to multiple source sets, this code sets multiple space separated values for data-filterable-set - this can be seen on the screenshot above.

attributes["data-filterable-current"] = contextNode.sourceSets.joinToString(" ") {
it.sourceSetIDs.merged.toString()
}
attributes["data-filterable-set"] = contextNode.sourceSets.joinToString(" ") {
it.sourceSetIDs.merged.toString()
}

When everything is rendered, the following JS code splits these values by space, and then checks whether they are among the active filters:

let platformList = elem.getAttribute("data-filterable-set").split(' ').filter(v => -1 !== sourcesetList.indexOf(v))
elem.setAttribute("data-filterable-current", platformList.join(' '))

So if moduleName is set to Dokka Maven Project, its DokkaSourceSetID.toString() will be Dokka Maven Project/JVM - this value will be set for activeFilters.

However, when the actual filtering happens, in the JS code it'll be split as [Dokka, Maven, Project] instead of a single entry.

This leads to the table entry being hidden, as if the filter for it is not currently active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug regression An issue/bug that appeared after recent changes runner: CLI An issue/PR related to Dokka's CLI runner runner: Maven plugin An issue/PR related to Dokka's Maven plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants