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 should provide gradle-idiomatic way to aggregate documentation #1752

Open
triplem opened this issue Feb 18, 2021 · 6 comments
Open

dokka should provide gradle-idiomatic way to aggregate documentation #1752

triplem opened this issue Feb 18, 2021 · 6 comments
Labels
enhancement An issue for a feature or an overall improvement runner: gradle plugin v2 Issues fixed by Dokka Gradle Plugin v2 - see https://github.com/Kotlin/dokka/issues/3131 runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Milestone

Comments

@triplem
Copy link

triplem commented Feb 18, 2021

In gradle 6.8.x (and most probably before this already) gradle provides an "idiomatic" way to define aggregrations of reports without task-dependencies. This is mainly done using configurations, for an example see https://docs.gradle.org/release-nightly/samples/sample_structuring_software_projects.html.

Expected Behavior

The dokka Task should support this idiomatic way and should (best case) provide some detailed documentation on how to apply this pattern to an existing project.

Current Behavior

The current plugin implementation does not provide a nice and simple way to implement a report-aggregation, without any task-dependencies without a rootProject-build. The plugin does apply this already, but only to the root-project, so there is no real way to construct a project using the idiomatic structure.

@triplem triplem added the enhancement An issue for a feature or an overall improvement label Feb 18, 2021
@MarcinAman MarcinAman added this to the Stable milestone Apr 26, 2021
@kamildoleglo
Copy link
Contributor

@triplem can you point me to the specific part of the documentation and/or the example you linked that explains this "idiomatic way"? I can't find any example of report-aggregation there

@kamildoleglo kamildoleglo added the awaiting response An issue/PR that cannot be completed without additional information or a discussion label May 10, 2021
@vlsi
Copy link

vlsi commented Dec 1, 2021

I wonder if this issue has been resolved with Dokka 1.4+, see #157 (comment)

@vlsi
Copy link

vlsi commented Dec 1, 2021

It turns out that Dokka uses is cross-project configuration which is a no-no:

internal val childDokkaTasks: Set<AbstractDokkaTask>
get() = childDokkaTaskPaths
.mapNotNull { path -> project.tasks.findByPath(path) }

The suggested approach is as follows:

  1. Every "child" project declares its outputs. For instance, it can share that "ok, I can expose dokka partial result if anyone asks"
  2. Then, "aggregator" project declares dependencies, and basically consumes the outputs.

That avoids cross-project access, and it abstracts the dependencies.


The sample project should have something like "coverage aggregation".
Here's a sample:
a) "Declare a dependency" (==specify what we want to aggregate): https://github.com/jjohannes/idiomatic-gradle/blob/d8677b0242e360a1c5a0a349ada55efb078995ec/aggregation/package-server/build.gradle.kts#L7
b) "aggregation itself": https://github.com/jjohannes/idiomatic-gradle/blob/d8677b0242e360a1c5a0a349ada55efb078995ec/build-logic/packaging/src/main/kotlin/com.example.jacoco-aggregation.gradle.kts The notable part is that it uses packaging configuration to resolve both coverage data and source directories items
c) "exposing coverage data": https://github.com/jjohannes/idiomatic-gradle/blob/c7e5fb096eeed56e37fdd50ed0809af4d6e17b6d/build-logic/java-convention/src/main/kotlin/com.example.jacoco.gradle.kts#L23-L25


I used the same pattern in https://github.com/allure-framework/allure-gradle#aggregating-results-from-multiple-projects, and I think it is nice.

As a side-note, I split allure-gradle into several plugins, see https://github.com/allure-framework/allure-gradle#technical-details
That does help to separate concerns, and it allows the users to customize or override the behavior.

@rnett
Copy link
Contributor

rnett commented Dec 18, 2021

There's some aggregation stuff that looks like it's targeted for 7.4 as an incubator, see this sample and this one from the nightly docs.

@vmishenev vmishenev added the runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin label Aug 3, 2022
@yalishevant yalishevant modified the milestones: Stable, Backlog Nov 7, 2022
@eskatos
Copy link
Contributor

eskatos commented Jan 14, 2023

I second this feature request. This would make it possible to use dokka in existing projects. Without it dokka forces users to restructure their build. For some projects this is a no-go.

@IgnatBeresnev IgnatBeresnev removed this from the Stable milestone Feb 24, 2023
@IgnatBeresnev IgnatBeresnev removed the awaiting response An issue/PR that cannot be completed without additional information or a discussion label Feb 24, 2023
@aSemy
Copy link
Contributor

aSemy commented Mar 16, 2023

Hi all 👋 I've been working on Dokkatoo, which is a completely new Gradle Plugin for running Dokka, and it's compatible with the Gradle API and correctly supports aggregation across subprojects.

I'm working with the Dokka team, and we plan to merge Dokkatoo into the Dokka core project eventually. Until then, Dokkatoo is available now on the Gradle Plugin Portal. There are still some TODOs and rough edges, so I'd appreciate feedback and help!

@IgnatBeresnev IgnatBeresnev added this to the Gradle runner 2.0 milestone Aug 17, 2023
@adam-enko adam-enko added the runner: gradle plugin v2 Issues fixed by Dokka Gradle Plugin v2 - see https://github.com/Kotlin/dokka/issues/3131 label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An issue for a feature or an overall improvement runner: gradle plugin v2 Issues fixed by Dokka Gradle Plugin v2 - see https://github.com/Kotlin/dokka/issues/3131 runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

No branches or pull requests