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

Dokka is parsing file headers as package level KDoc. #3937

Open
philliplbryant opened this issue Nov 26, 2024 · 0 comments
Open

Dokka is parsing file headers as package level KDoc. #3937

philliplbryant opened this issue Nov 26, 2024 · 0 comments
Labels

Comments

@philliplbryant
Copy link

Describe the bug
Placing a copyright header at the top of a package-info.java file results in the copyright header being parsed as documentation instead of the package level documentation. Consider the following:

/*******************************************************************************
 This is an unpublished work of My Company.
 Copyright (c) 2024 My Company. All Rights Reserved.
 ******************************************************************************/

/**
 * This package contains stuff for My Company.
 */
package com.company.my;

Expected behaviour
I expect Dokka to parse the JavaDoc/KDoc comments adjacent to the package declaration. The resulting documentation should read

This package contains stuff for My Company.

however, it reads

***************************************************************************** This is an unpublished work of My Company. Copyright (c) 2018 My Company. All Rights Reserved.

Dokka configuration

dokka {

    // Configure heap size for the Dokka process managed by Gradle
    // https://kotlinlang.org/docs/dokka-migration.html#increase-heap-space
    dokkaGeneratorIsolation = ProcessIsolation {
        maxHeapSize = "4g"
    }

    pluginsConfiguration.html {

        // The default module name is the last element in the project path,
        // leading to duplicate modules names. Override the module name to use
        // the fully qualified module name, dropping the root module name.
        moduleName.set(
            provider {
                project.path.drop(1)
            }
        )

        customAssets.from(
            // Override the logo image by providing a custom version with
            // the same name as the default.
            rootProject.layout.projectDirectory.file(
                "shared-resources/dokka/logo-icon.svg"
            ),
        )

        footerMessage.set(COPYRIGHT_AS_HTML_DIV)
    }

    dokkaSourceSets.configureEach {

        // Default JDK is 1.8
        jdkVersion.set(javaTargetVersion.toInt())

        // Including links report errors
        enableKotlinStdLibDocumentationLink.set(false)

        // Assuming documentation is for private consumption (JRE only),
        // document everything.
        documentedVisibilities.set(
            setOf(
                Internal,
                Private,
                Protected,
                Public,
            )
        )

        sourceLink {
            // This is required when setting remoteUrl
            localDirectory.set(
                project.layout.projectDirectory.dir("src")
            )

            // The path to the source for the project module, relative to
            // the root project directory
            val relPath = provider {
                rootProject.layout.projectDirectory.asFile.toPath()
                    .relativize(
                        project.layout.projectDirectory.asFile.toPath()
                    )
            }

            remoteUrl(
                "https://bitbucket.my.company.com/projects/MC/repos/" +
                        "mycompany/browse/$relPath/src"
            )

            // Suffix used by Bitbucket
            remoteLineSuffix.set("#lines-")
        }
    }
}

Installation

  • Operating system: Windows 10
  • Build tool: Gradle v8.11.1
  • Dokka version: 2.0.0-Beta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant