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

Merge Dokkatoo into Dokka Gradle Plugin #3695

Merged
merged 78 commits into from
Aug 13, 2024
Merged

Merge Dokkatoo into Dokka Gradle Plugin #3695

merged 78 commits into from
Aug 13, 2024

Conversation

adam-enko
Copy link
Member

@adam-enko adam-enko commented Jul 17, 2024

Merge Dokkatoo into Dokka repo, and rename it to dokka-gradle-plugin.

DGP-classic has been retained, and can be toggled on/off via a property. (The used name is a placeholder, and can be re-implemented).

The DGP-classic source code has been organised into src/classicMain and src/classicTest to help keep it separated, and to prevent mixing it.

Only Dokkatoo's HTML format has been copied. GFM, Javadoc, and Jekyll were excluded.

TODO:

  • Rename
    • package dev.adamko... -> org.jetbrains...
    • Dokkatoo -> Dokka
    • enableDokkatoo -> something else...
  • kotlinx-coroutines test breaks. Need to update Coroutines.
    e: /private/var/folders/_3/ps18c9f56bx2j4fyxt0z7sn40000gp/T/junit17292292638531040000/project/buildSrc/src/main/kotlin/Dokka.kt: (18, 20): Class 'org.jetbrains.dokka.gradle.AbstractDokkaLeafTask' was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.5.1.
    UPDATE: fixed by using Java Toolchains & release flag

^OSIP-355

- delete old Dokkatoo dir
- Add up-to-date Dokkatoo

Tests pass. Still need to rename Dokkatoo->Dokka, update formatting, change package, plugin ID, disable non-HTML, update integration tests, add copyright header.
- convert dokka-subprojects to be an included build (otherwise DGP can't depend on dokka-core)
- rename dokka-core to match the artifact ID (easier to understand dependencies and error messages)
- merge DGP-classic into dokka-gradle-plugin
- add flag to toggle between DPG-classic and Dokkatoo
- Update Dokkatoo code to be Java-8 compatible
Gradle TestKit stores logs in memory and this makes the tests slower gradle/gradle#23965
- tidy up implementation
- use build service to avoid `subprojects {}` (prepare for Project Isolation)

gradle/gradle#22335
avoid issues with TestKit buffering logs in memory gradle/gradle#23965
@adam-enko adam-enko added the runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin label Jul 17, 2024
@whyoleg whyoleg self-requested a review August 1, 2024 11:07
Copy link
Collaborator

@whyoleg whyoleg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine from my side!

I've added some comments, but they are mostly out of curiosity about some Gradle usages.
I have no objections to merge it in current state and resolve anything else later

dokka-runners/dokka-gradle-plugin/build.gradle.kts Outdated Show resolved Hide resolved
dokka-runners/dokka-gradle-plugin/build.gradle.kts Outdated Show resolved Hide resolved
* Code taken from the Kotlin Gradle plugin:
* https://github.com/JetBrains/kotlin/blob/70e15b281cb43379068facb82b8e4bcb897a3c4f/buildSrc/src/main/kotlin/GradleCommon.kt#L72
*/
fun Configuration.excludeGradleCommonDependencies() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see it in new configuration—please apply the same logic in new build script

Copy link
Member Author

@adam-enko adam-enko Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build config has been reworked so that the dependencies aren't added, so this exclusion does nothing.

If you run ./gradlew :dokka-gradle-plugin:publishDokkaPluginMarkerMavenPublicationToDevMavenRepo and check dokka-runners/dokka-gradle-plugin/build/dev-maven-repo/org/jetbrains/dokka/dokka-gradle-plugin/2.0.20-SNAPSHOT/dokka-gradle-plugin-2.0.20-SNAPSHOT.pom, then there's no conflicting dependencies.

We should make a test for this though... I've created a task.

https://youtrack.jetbrains.com/issue/KT-70503/Add-test-to-verify-Dokka-Plugin-does-not-expose-conflicting-dependencies

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

serialization brings stdlib as a transitive dependency, that is why we need this code block

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried hard to try and discover what the issue is, but I wasn't able to discover what could go wrong. Whenever Dokka was added as a buildSrc dependency, the kotlin-stdlib and other dependencies were correctly constrained to the embedded Gradle version.

When this exclusions config was added in #2570, at the time DGP used kotlin("jvm") to build the project. This is probably what caused the issue, and the exclusions helped with that. (KGP is also built with kotlin("jvm").) DGP no longer uses kotlin("jvm"), so I don't believe it's necessary. However, out of an abundance of caution, I've added the exclusions.

Copy link
Collaborator

@whyoleg whyoleg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some small minor remarks

dokka-runners/dokka-gradle-plugin/build.gradle.kts Outdated Show resolved Hide resolved
dokka-runners/dokka-gradle-plugin/build.gradle.kts Outdated Show resolved Hide resolved
# Conflicts:
#	dokka-integration-tests/gradle/src/testTemplateProjectConfiguration/kotlin/ConfigurationTest.kt
#	gradle/libs.versions.toml
@adam-enko adam-enko merged commit a3d5d43 into master Aug 13, 2024
14 checks passed
@adam-enko adam-enko deleted the adam/merge-dokkatoo branch August 13, 2024 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runner: Gradle plugin An issue/PR related to Dokka's Gradle plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants