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

Gradle plugin v2 with versioning plugin requires olderVersionsDir to exist #3966

Open
jeffdgr8 opened this issue Dec 19, 2024 · 1 comment
Open
Labels
bug runner: gradle plugin v2 Issues fixed by Dokka Gradle Plugin v2 - see https://github.com/Kotlin/dokka/issues/3131

Comments

@jeffdgr8
Copy link

Describe the bug
With the Dokka Gradle plugin v2, using the versioning plugin and configuring olderVersionsDir to a directory path that doesn't currently exist, the task :dokkaGeneratePublicationHtml fails with the error:

A problem was found with the configuration of task ':dokkaGeneratePublicationHtml' (type 'DokkaGeneratePublicationTask').

  • In plugin 'org.jetbrains.dokka.gradle.DokkaBasePlugin_Decorated' type 'org.jetbrains.dokka.gradle.tasks.DokkaGeneratePublicationTask' property 'generator.pluginsConfiguration.versioning$1.olderVersionsDir' specifies directory '.../docs/older' which doesn't exist.

This was not an error before the v2 Gradle plugin.

Expected behaviour
My project configures the :dokkaGeneratePublicationHtml task with a doFirst lambda that moves the older version directory to the configured path. So the files are present when the task runs, but not before it runs.

It should not be an error to configure this path to a currently non-existent directory. It's undesirable to have the empty directory exist in the file system when the code expects it to only exist temporarily while the API docs are being generated.

To Reproduce
Configure a project with the versioning plugin and set olderVersionsDir to a non-existent path. Then run :dokkaGenerate to see the error.

Dokka configuration
Configuration of dokka used to reproduce the bug

dependencies {
    dokkaPlugin(libs.dokka.versioning)
}

tasks.dokkaGeneratePublicationHtml {
    dokka.pluginsConfiguration.versioning {
        olderVersionsDir = projectDir.resolve("some/non-existent/dir")
        // ...
    }
}

Installation

  • Operating system: macOS
  • Build tool: Gradle v8.11.1
  • Dokka version: 2.0.0

Additional context
Reproducible with my library, Kotbase by removing this line of code: tempOlderDir.mkdir().

@jeffdgr8 jeffdgr8 added the bug label Dec 19, 2024
@whyoleg whyoleg added the runner: gradle plugin v2 Issues fixed by Dokka Gradle Plugin v2 - see https://github.com/Kotlin/dokka/issues/3131 label Dec 19, 2024
@adam-enko
Copy link
Member

Thanks for the report, this looks like something that we can fix easily by replacing @InputDirectory with @InputFiles.

gradle/gradle#2016 (comment)

@get:InputDirectory
@get:PathSensitive(RELATIVE)
@get:Optional
abstract val olderVersionsDir: DirectoryProperty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug runner: gradle plugin v2 Issues fixed by Dokka Gradle Plugin v2 - see https://github.com/Kotlin/dokka/issues/3131
Projects
None yet
Development

No branches or pull requests

3 participants