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

Improve how modules are merged - relativePathToOutputDirectory can't handle a module that is not a child #2866

Open
aSemy opened this issue Feb 15, 2023 · 0 comments
Labels
bug configuration An issue/PR related to Dokka's configuration by the user

Comments

@aSemy
Copy link
Contributor

aSemy commented Feb 15, 2023

Describe the bug

DokkaModuleDescription.relativePathToOutputDirectory is used by Dokka when aggregating Dokka Modules into a single directory.

The value is used to create subdirectories in the Dokka output directory. For example, if there are two modules, where relativePathToOutputDirectory is childProjectA one and childProjectB in another, there will be equivalent subdirectories in the result.

build/
├── htmlMultiModule/
│   ├── childProjectA/
│   │   ├── index.html
│   │   └── ...
│   └── childProjectB/
│       ├── index.html
│       └── ...
├── index.html
└── ...

The value of relativePathToOutputDirectory is determined automatically by the relative path between the aggregating project and the module.

This is problematic because it cannot handle modules that are not in child directories. For example, if the aggregating project is not a direct parent of the children

project/
├── docs/
│   └── build.gradle.kts <- Dokka site is created here
├── parentProject/
│   ├── childProjectA/
│   │   └── build.gradle.kts
│   └── childProjectB/
│       └── build.gradle.kts
└── settings.gradle.kts

Additionally:

  • The variable name relativePathToOutputDirectory is confusing - it's more like "the relative path INSIDE the output directory" or "moduleDocPath" or just "modulePath".
  • Is it necessary? Can't the directory default to the module's name?
  • There are no docs! Not in the code, and not on the website. Figuring this out was difficult
  • It is a java.io.File. It's tempting to pass in a relative path (e.g. ../parentProject/childProjectA) or an absolute path (e.g. /usr/x/projects/my-project/docs/build/dokka/childProjectA) - both are wrong. It should just be a plain string.
  • Trying to use a nested path, e.g. relativePathToOutputDirectory = File("some/path") doesn't work because mkdir() is used

Expected behaviour

  • relativePathToOutputDirectory is renamed to be more descriptive,
  • and replaced with a String,
  • or removed and just use DokkaModuleDescription.name instead.
  • mkdir() is replaced with mkdirs()

Installation

  • Build tool: Gradle v7.6
  • Dokka version: 1.7.20

Additional context

Fixing this would help with #2700

@aSemy aSemy added the bug label Feb 15, 2023
aSemy added a commit to aSemy/dokka that referenced this issue Feb 15, 2023
@IgnatBeresnev IgnatBeresnev added the configuration An issue/PR related to Dokka's configuration by the user label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug configuration An issue/PR related to Dokka's configuration by the user
Projects
None yet
Development

No branches or pull requests

2 participants