Skip to content
Draft
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
afb8b31
Fix compatibility with changes in KGP
whyoleg Aug 15, 2025
20cabc8
Merge branch 'master' into whyoleg/kgp-2.2.20-compatibility
adam-enko Aug 26, 2025
3296827
WIP update KotlinAdapter, to determine whether an AGP source set is '…
adam-enko Aug 26, 2025
6ed6540
tidy
adam-enko Aug 27, 2025
144405d
tidy
adam-enko Aug 27, 2025
a869239
Avoid `java.lang.NoClassDefFoundError` in `findExtensionLenient`.
adam-enko Aug 28, 2025
e8cd21e
limit fetching data unlesss KGP >= 2.2.10
adam-enko Aug 28, 2025
4fbeeed
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko Aug 28, 2025
f8a02d6
fix android variant typecheck
adam-enko Aug 28, 2025
f08f6ad
rm unnecessary `typealias AndroidComponentsExtension`
adam-enko Sep 15, 2025
3663dce
move comment about 'string based class comparison' to relevant part o…
adam-enko Sep 15, 2025
efa359a
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko Nov 3, 2025
d744657
bump tested KGP 2.2 version
adam-enko Nov 4, 2025
6642dab
add tested KGP 2.3 version
adam-enko Nov 4, 2025
5554f87
remove condition usage of AndroidComponentsExtension
adam-enko Nov 4, 2025
5bf6681
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko Nov 4, 2025
6fca413
add more docs for `collectAndroidVariants`
adam-enko Nov 4, 2025
acd43cb
rm old kdoc reference
adam-enko Nov 4, 2025
0758d2e
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko Nov 4, 2025
1f92f05
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko Nov 10, 2025
c50bd2e
Support AGP with Kotlin BuiltIn
adam-enko Nov 10, 2025
2450422
update comment about `kotlin("jvm") apply false` in test
adam-enko Nov 10, 2025
ee6ac18
Update test for inaccessible `KotlinBasePlugin` class
adam-enko Nov 10, 2025
02b4c49
Integration tests: support AGP 9 testing and version filtering
adam-enko Nov 10, 2025
747573f
Add tests for AGP 9, and update other AGP tests
adam-enko Nov 10, 2025
614dd9e
convert `collectAndroidVariants` to extension function `SetProperty<A…
adam-enko Nov 10, 2025
e6a3030
remove unnecessary provider-wrapping from bootClasspath
adam-enko Nov 10, 2025
af5b000
add necessary provider-wrapping from bootClasspath
adam-enko Nov 11, 2025
9ee88a1
react to all Android plugins
adam-enko Nov 11, 2025
ebb6753
remove unused `AndroidVariantInfo.compileConfiguration`
adam-enko Nov 11, 2025
f39398f
simplify PluginIds - collect them into groups, and hide the actual pl…
adam-enko Nov 11, 2025
30cbe5d
also create `applyTo` util function to JavaAdapter, to make it simila…
adam-enko Nov 11, 2025
2fa5e98
rm unused `#android.builtInKotlin=true` properties from test projects
adam-enko Nov 11, 2025
ee4d15f
remove `withHostTestBuilder {}.configure {}` - it's probably redundant?
adam-enko Nov 11, 2025
dfd6e8f
removed unused source-set configuration
adam-enko Nov 11, 2025
995d9e0
lower minimum AGP version from 9 to the latest 8.x version, since `co…
adam-enko Nov 11, 2025
8ac04b4
fix duplicated 'project' in log messages (displayName already starts …
adam-enko Nov 11, 2025
7c996f5
Remove unnecessary source/target Java compatibility in `it-android-0`…
adam-enko Nov 11, 2025
eb281ca
Update AGP Component publishable check.
adam-enko Nov 11, 2025
7ffbd31
updated tested AGP to latest alpha
adam-enko Nov 11, 2025
b645398
fix duplicated 'project' in log messages (displayName already starts …
adam-enko Nov 11, 2025
7014f39
add `com.android.kotlin.multiplatform.library` as an Android plugin
adam-enko Nov 11, 2025
30faa76
tidy `findExtensionLenient`, remove redundant catches from findAndroi…
adam-enko Nov 11, 2025
aee7a4b
update `it-android-kotlin-mp-builtin` test data
adam-enko Nov 11, 2025
0bbcce2
update tested AGP versions: add 8.13 and bump patch versions
adam-enko Nov 12, 2025
4ebd56f
agp 8.13 needs Gradle 8.13-9.0.0
adam-enko Nov 12, 2025
a5eb2d7
Remove AndroidKmpLibrary
adam-enko Nov 17, 2025
cc62d32
add link to AGP issue regarding bootClasspath failure
adam-enko Nov 17, 2025
18578b9
DGP tests: support KGP version filtering
adam-enko Nov 17, 2025
0262759
polish kotlinCompileDependencyFiles
adam-enko Nov 17, 2025
8e6e534
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko Nov 18, 2025
d82f4a9
DGP integration tests: Add `@TestsKotlinJvm` tag
adam-enko Nov 18, 2025
43b2f7b
DGP integration tests: Move `@WithGradleProperties` to tags
adam-enko Nov 18, 2025
6d2c0d8
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko Nov 18, 2025
494e37f
Merge branch 'adam/feat/DGP-IT-move-gradle-properties' into adam/supp…
adam-enko Nov 18, 2025
5e4e2e9
wip
adam-enko Nov 18, 2025
c14fa65
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko Nov 19, 2025
64231af
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko Nov 20, 2025
7219760
simplify AGP version filtering
adam-enko Nov 20, 2025
c6397f2
remove AndroidKotlinBuiltIn, and `android.builtInKotlin`. Enabling it…
adam-enko Nov 20, 2025
90d8de8
add tests for the generated versions, to make sure the versions are g…
adam-enko Nov 20, 2025
42f6f10
variantsCompileClasspath: fix kdoc comment
adam-enko Nov 20, 2025
c61692e
revert SemVer changes
adam-enko Nov 20, 2025
9058143
update TestVersionsSourceTest
adam-enko Nov 20, 2025
c4bacd5
update default `kotlinBuiltIn`
adam-enko Nov 20, 2025
ea99612
remove unnecessary `project.plugins.withType<DokkaBasePlugin>().all { }`
adam-enko Nov 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ idea {
"dokka-integration-tests/gradle/projects/it-multiplatform-android-jvm/expectedData",
"dokka-integration-tests/gradle/projects/it-android-compose/expectedData",
"dokka-integration-tests/gradle/projects/it-kotlin-multiplatform/expectedData",
"dokka-integration-tests/gradle/projects/it-android-kotlin-jvm-builtin/expectedData",
"dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData",

"examples/gradle/dokka-versioning-multimodule-example/previousDocVersions/",
"examples/gradle-v2/versioning-multimodule-example/docs/previousDocVersions/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ plugins {
android {
defaultConfig {
minSdkVersion(21)
setCompileSdkVersion(29)
setCompileSdkVersion(30)
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2014-2025 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("com.android.library") version "/* %{AGP_VERSION} */"
id("org.jetbrains.dokka") version "/* %{DGP_VERSION} */"
}

android {
namespace = "org.jetbrains.dokka.it.android"
compileSdk = 33
defaultConfig {
minSdk = 21
}
}

dependencies {
implementation("androidx.appcompat:appcompat:1.1.0")
}

// WORKAROUND https://github.com/Kotlin/dokka/issues/3701
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you expand on why this happens?
We don't have this issue with a KGP+AGP8 combination AFAIK

Copy link
Member Author

@adam-enko adam-enko Nov 11, 2025

Choose a reason for hiding this comment

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

Without it when I run gradle :dokka-integration-tests:gradle:test I see a failure for org.jetbrains.dokka.it.gradle.AndroidKotlinJvmBuiltInTest.

Execution failed for task ':dokkaGeneratePublicationHtml'.
> A failure occurred while executing org.jetbrains.dokka.gradle.workers.DokkaGeneratorWorker
   > Pre-generation validity check failed: Source sets 'debug' and 'release' have the common source roots: /private/var/folders/_3/ps18c9f56bx2j4fyxt0z7sn40000gp/T/gradle-test17356012250814683624/generate-dokka-HTML-DokkaGradleProjectRunner-/agp-9.0.0-alpha13_dgp-2.1.0-SNAPSHOT_gradle-9.1.0_kgp-2.1.21/src/main/java. Every Kotlin source file should belong to only one source set (module). 
     Also, please consider reporting your user case: https://github.com/Kotlin/dokka/issues/3701

Copy link
Member Author

@adam-enko adam-enko Nov 11, 2025

Choose a reason for hiding this comment

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

Okay, I see your point now! DGP's logic for determining the publishability is flawed. Currently debug has hasPublishedComponent=true, but this is incorrect.

I'll try and update DGP's logic...

Copy link
Member Author

@adam-enko adam-enko Nov 11, 2025

Choose a reason for hiding this comment

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

Updated.

DGP also checks to see if Variant.buildType == "release". This means the debug source sets are filtered out.

(Side note: in DGP 2.1.0 they aren't filtered out, but fortunately they don't have any extant source roots, so they're ignored!)

I think this is the best choice. Users might add custom buildTypes, but it's unlikely they'll want them documented. Even if they do, they can just document them manually.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently debug has hasPublishedComponent=true, but this is incorrect.

This might be correct, I see no problems here, as AGP/KGP allow to publish both of them. :)

The only issue I see is that those AGP-related source sets have intersected source roots by default.
And if those debug and release related sources have the same source roots coming from AGP, it feels like this is a bug in AGP9 with built-in kotlin.

Copy link
Member Author

Choose a reason for hiding this comment

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

iiuc the release and debug variants are typically two different compilations of the same source code, so it's usually redundant to document both of them.

I asked the AGP devs:

Suppose a project has build type debug, release and flavors demo, full
https://developer.android.com/build/build-variants#product-flavors. Then we will have 4 main components (or variants): demoDebug, demoRelease, fullDebug, fullRelease. Each variant has a corresponding KotlinCompilation.
Meanwhile, the source sets would be: main, debug, release, demo, full, demoDebug, demoRelease, fullDebug, fullRelease.
Variant demoDebug uses source sets: main, debug, demo, demoDebug. Similarly for other variants.
So any 2 variants will always have a shared source set and cause the above error.

Just to clarify: we're discussing setting a sensible default here. If users want to document non-release source sets, then it's easy to enable them in DGP. But then they'll need to determine how to handle the shared source sets.

If we wanted to make it complicated, then DGP could try and filter out the duplicate source roots automatically? But this sounds like a separate feature request. I'd like to find out if it's a common request, and what would be required.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Here is what I see in it-android-kotlin-jvm-builtin with AGP 9.0.0-alpha14:

// added in build script
android.sourceSets.all {
    println(name)
    println("  kotlin: ${kotlin.directories}")
    println("  java: ${java.directories}")
}

output:

androidTest
  kotlin: [src/androidTest/java, src/androidTest/kotlin]
  java: [src/androidTest/java]
androidTestDebug
  kotlin: [src/androidTestDebug/java, src/androidTestDebug/kotlin]
  java: [src/androidTestDebug/java]
androidTestRelease
  kotlin: [src/androidTestRelease/java, src/androidTestRelease/kotlin]
  java: [src/androidTestRelease/java]
debug
  kotlin: [src/debug/java, src/debug/kotlin]
  java: [src/debug/java]
main
  kotlin: [src/main/java, src/main/kotlin]
  java: [src/main/java]
release
  kotlin: [src/release/java, src/release/kotlin]
  java: [src/release/java]
test
  kotlin: [src/test/java, src/test/kotlin]
  java: [src/test/java]
testDebug
  kotlin: [src/testDebug/java, src/testDebug/kotlin]
  java: [src/testDebug/java]
testFixtures
  kotlin: [src/testFixtures/java, src/testFixtures/kotlin]
  java: [src/testFixtures/java]
testFixturesDebug
  kotlin: [src/testFixturesDebug/java, src/testFixturesDebug/kotlin]
  java: [src/testFixturesDebug/java]
testFixturesRelease
  kotlin: [src/testFixturesRelease/java, src/testFixturesRelease/kotlin]
  java: [src/testFixturesRelease/java]
testRelease
  kotlin: [src/testRelease/java, src/testRelease/kotlin]
  java: [src/testRelease/java]

I don't see intersected source roots here by default - this is what I would expect for Dokka.
The same happens with kotlin.sourceSets in that project:

kotlin.sourceSets.all {
    println(name)
    println("  kotlin: ${kotlin.srcDirs.map { it.relativeTo(projectDir) }}")
}

output:

androidTest
  kotlin: [src/androidTest/kotlin]
androidTestDebug
  kotlin: [src/androidTestDebug/kotlin]
androidTestRelease
  kotlin: [src/androidTestRelease/kotlin]
debug
  kotlin: [src/debug/kotlin]
main
  kotlin: [src/main/kotlin]
release
  kotlin: [src/release/kotlin]
test
  kotlin: [src/test/kotlin]
testDebug
  kotlin: [src/testDebug/kotlin]
testFixtures
  kotlin: [src/testFixtures/kotlin]
testFixturesDebug
  kotlin: [src/testFixturesDebug/kotlin]
testFixturesRelease
  kotlin: [src/testFixturesRelease/kotlin]
testRelease
  kotlin: [src/testRelease/kotlin]
debugAndroidTest
  kotlin: [src/debugAndroidTest/kotlin]
debugUnitTest
  kotlin: [src/debugUnitTest/kotlin]

And so there should be no problems with intersected source roots, as the Dokka source sets should have the same data there.
So for me, it feels like we have a problem in our adapter logic.

Dokka might not work well with variants; that's true, but it should not be an issue here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oleg and I discussed. It's strange if a source set has shared roots. It's a change in behaviour in AGP 9 compared to 8. It might affect other aspects, like IDE import.

DGP is a little bit protected because DGP filters out directories that don't exist on disk. But we should wait for a response from AGP developers.

Copy link
Member Author

Choose a reason for hiding this comment

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

Created an AGP issue https://issuetracker.google.com/issues/461736989

However, there's some confusion about how best to proceed. Previously the AGP devs were told not to use KotlinSourceSet at all https://issuetracker.google.com/issues/386221070. Registering all srcDirs was done to help compiler plugins, but considering the previous request they thought the best solution is to stop registering any srcDirs and support compiler plugins another way.

Discussions are ongoing...

afterEvaluate {
dokka.dokkaSourceSets
.matching { it.name == "debug" }
.configureEach {
sourceRoots.setFrom(emptyList<String>())
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading