-
Notifications
You must be signed in to change notification settings - Fork 470
Support AGP with Kotlin Built-in #4295
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
Draft
adam-enko
wants to merge
66
commits into
master
Choose a base branch
from
adam/support-agp-kotlin-builtin
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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 20cabc8
Merge branch 'master' into whyoleg/kgp-2.2.20-compatibility
adam-enko 3296827
WIP update KotlinAdapter, to determine whether an AGP source set is '…
adam-enko 6ed6540
tidy
adam-enko 144405d
tidy
adam-enko a869239
Avoid `java.lang.NoClassDefFoundError` in `findExtensionLenient`.
adam-enko e8cd21e
limit fetching data unlesss KGP >= 2.2.10
adam-enko 4fbeeed
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko f8a02d6
fix android variant typecheck
adam-enko f08f6ad
rm unnecessary `typealias AndroidComponentsExtension`
adam-enko 3663dce
move comment about 'string based class comparison' to relevant part o…
adam-enko efa359a
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko d744657
bump tested KGP 2.2 version
adam-enko 6642dab
add tested KGP 2.3 version
adam-enko 5554f87
remove condition usage of AndroidComponentsExtension
adam-enko 5bf6681
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko 6fca413
add more docs for `collectAndroidVariants`
adam-enko acd43cb
rm old kdoc reference
adam-enko 0758d2e
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko 1f92f05
Merge branch 'master' into adam/kgp-2.2.20-compatibility
adam-enko c50bd2e
Support AGP with Kotlin BuiltIn
adam-enko 2450422
update comment about `kotlin("jvm") apply false` in test
adam-enko ee6ac18
Update test for inaccessible `KotlinBasePlugin` class
adam-enko 02b4c49
Integration tests: support AGP 9 testing and version filtering
adam-enko 747573f
Add tests for AGP 9, and update other AGP tests
adam-enko 614dd9e
convert `collectAndroidVariants` to extension function `SetProperty<A…
adam-enko e6a3030
remove unnecessary provider-wrapping from bootClasspath
adam-enko af5b000
add necessary provider-wrapping from bootClasspath
adam-enko 9ee88a1
react to all Android plugins
adam-enko ebb6753
remove unused `AndroidVariantInfo.compileConfiguration`
adam-enko f39398f
simplify PluginIds - collect them into groups, and hide the actual pl…
adam-enko 30cbe5d
also create `applyTo` util function to JavaAdapter, to make it simila…
adam-enko 2fa5e98
rm unused `#android.builtInKotlin=true` properties from test projects
adam-enko ee4d15f
remove `withHostTestBuilder {}.configure {}` - it's probably redundant?
adam-enko dfd6e8f
removed unused source-set configuration
adam-enko 995d9e0
lower minimum AGP version from 9 to the latest 8.x version, since `co…
adam-enko 8ac04b4
fix duplicated 'project' in log messages (displayName already starts …
adam-enko 7c996f5
Remove unnecessary source/target Java compatibility in `it-android-0`…
adam-enko eb281ca
Update AGP Component publishable check.
adam-enko 7ffbd31
updated tested AGP to latest alpha
adam-enko b645398
fix duplicated 'project' in log messages (displayName already starts …
adam-enko 7014f39
add `com.android.kotlin.multiplatform.library` as an Android plugin
adam-enko 30faa76
tidy `findExtensionLenient`, remove redundant catches from findAndroi…
adam-enko aee7a4b
update `it-android-kotlin-mp-builtin` test data
adam-enko 0bbcce2
update tested AGP versions: add 8.13 and bump patch versions
adam-enko 4ebd56f
agp 8.13 needs Gradle 8.13-9.0.0
adam-enko a5eb2d7
Remove AndroidKmpLibrary
adam-enko cc62d32
add link to AGP issue regarding bootClasspath failure
adam-enko 18578b9
DGP tests: support KGP version filtering
adam-enko 0262759
polish kotlinCompileDependencyFiles
adam-enko 8e6e534
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko d82f4a9
DGP integration tests: Add `@TestsKotlinJvm` tag
adam-enko 43b2f7b
DGP integration tests: Move `@WithGradleProperties` to tags
adam-enko 6d2c0d8
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko 494e37f
Merge branch 'adam/feat/DGP-IT-move-gradle-properties' into adam/supp…
adam-enko 5e4e2e9
wip
adam-enko c14fa65
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko 64231af
Merge branch 'master' into adam/support-agp-kotlin-builtin
adam-enko 7219760
simplify AGP version filtering
adam-enko c6397f2
remove AndroidKotlinBuiltIn, and `android.builtInKotlin`. Enabling it…
adam-enko 90d8de8
add tests for the generated versions, to make sure the versions are g…
adam-enko 42f6f10
variantsCompileClasspath: fix kdoc comment
adam-enko c61692e
revert SemVer changes
adam-enko 9058143
update TestVersionsSourceTest
adam-enko c4bacd5
update default `kotlinBuiltIn`
adam-enko ea99612
remove unnecessary `project.plugins.withType<DokkaBasePlugin>().all { }`
adam-enko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
dokka-integration-tests/gradle/projects/it-android-kotlin-jvm-builtin/build.gradle.kts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| afterEvaluate { | ||
| dokka.dokkaSourceSets | ||
| .matching { it.name == "debug" } | ||
| .configureEach { | ||
| sourceRoots.setFrom(emptyList<String>()) | ||
| } | ||
| } | ||
26 changes: 26 additions & 0 deletions
26
...t-android-kotlin-jvm-builtin/expectedData/html/images/abstract-class-kotlin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions
22
...jects/it-android-kotlin-jvm-builtin/expectedData/html/images/abstract-class.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions
6
...cts/it-android-kotlin-jvm-builtin/expectedData/html/images/anchor-copy-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
...ts/it-android-kotlin-jvm-builtin/expectedData/html/images/annotation-kotlin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
.../projects/it-android-kotlin-jvm-builtin/expectedData/html/images/annotation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
.../projects/it-android-kotlin-jvm-builtin/expectedData/html/images/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
...adle/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/burger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...radle/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...rojects/it-android-kotlin-jvm-builtin/expectedData/html/images/checkbox-off.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...projects/it-android-kotlin-jvm-builtin/expectedData/html/images/checkbox-on.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
...rojects/it-android-kotlin-jvm-builtin/expectedData/html/images/class-kotlin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
...radle/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/class.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...e/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/copy-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...radle/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
...projects/it-android-kotlin-jvm-builtin/expectedData/html/images/enum-kotlin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
...gradle/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/enum.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
...ects/it-android-kotlin-jvm-builtin/expectedData/html/images/exception-class.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
...projects/it-android-kotlin-jvm-builtin/expectedData/html/images/field-value.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
...jects/it-android-kotlin-jvm-builtin/expectedData/html/images/field-variable.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions
8
...adle/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/filter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
...le/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/function.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
...jects/it-android-kotlin-jvm-builtin/expectedData/html/images/go-to-top-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions
3
...le/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/homepage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
...cts/it-android-kotlin-jvm-builtin/expectedData/html/images/interface-kotlin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions
9
...e/projects/it-android-kotlin-jvm-builtin/expectedData/html/images/interface.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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:testI see a failure fororg.jetbrains.dokka.it.gradle.AndroidKotlinJvmBuiltInTest.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
debughashasPublishedComponent=true, but this is incorrect.I'll try and update DGP's logic...
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
debugandreleaserelated sources have the same source roots coming from AGP, it feels like this is a bug in AGP9 with built-in kotlin.There was a problem hiding this comment.
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:
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.
There was a problem hiding this comment.
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-builtinwith AGP 9.0.0-alpha14:output:
I don't see intersected source roots here by default - this is what I would expect for Dokka.
The same happens with
kotlin.sourceSetsin that project:kotlin.sourceSets.all { println(name) println(" kotlin: ${kotlin.srcDirs.map { it.relativeTo(projectDir) }}") }output:
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...