Skip to content

Commit f3e834c

Browse files
authored
DPG IT: Test com.android.kotlin.multiplatform.library with Kotlin Multiplatform (#4359)
Add a simple test for a Android KMP library project. It's just a simple test without extended KMP targets to keep it simpler. There are other projects for testing KMP targets. The main point of this test is to verify DGP can extract info (especially `android.jar`) from the Android KMP library plugin. There's a workaround for an AGP8 bug that will be fixed in AGP9. Fix #4211
1 parent 02211ee commit f3e834c

File tree

72 files changed

+8756
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+8756
-0
lines changed

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ idea {
126126
"dokka-integration-tests/gradle/projects/it-multiplatform-android-jvm/expectedData",
127127
"dokka-integration-tests/gradle/projects/it-android-compose/expectedData",
128128
"dokka-integration-tests/gradle/projects/it-kotlin-multiplatform/expectedData",
129+
"dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData",
129130

130131
"examples/gradle/dokka-versioning-multimodule-example/previousDocVersions/",
131132
"examples/gradle-v2/versioning-multimodule-example/docs/previousDocVersions/",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2014-2025 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
plugins {
6+
id("com.android.kotlin.multiplatform.library") version "/* %{AGP_VERSION} */"
7+
id("org.jetbrains.dokka") version "/* %{DGP_VERSION} */"
8+
kotlin("multiplatform") version "/* %{KGP_VERSION} */"
9+
}
10+
11+
kotlin {
12+
androidLibrary {
13+
namespace = "com.example.kmpfirstlib"
14+
compileSdk = 33
15+
minSdk = 24
16+
17+
withDeviceTestBuilder {
18+
sourceSetTreeName = "test"
19+
}
20+
}
21+
22+
sourceSets {
23+
androidMain {
24+
dependencies {
25+
implementation("androidx.appcompat:appcompat:1.1.0")
26+
}
27+
}
28+
}
29+
}
30+
31+
val agpMajorVersion: Int = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.split('.').first().toInt()
32+
if (agpMajorVersion < 9) {
33+
// AGP 8 uses KotlinTarget JVM instead of AndroidJVM.
34+
// This is an AGP 8 bug - it's fixed in AGP 9.
35+
// For AGP <9, workaround the bug by manually enabling the Android documentation link.
36+
dokka.dokkaSourceSets.configureEach {
37+
enableAndroidDocumentationLink.set(true)
38+
}
39+
}

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/abstract-class-kotlin.svg

Lines changed: 26 additions & 0 deletions
Loading

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/abstract-class.svg

Lines changed: 22 additions & 0 deletions
Loading

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/anchor-copy-icon.svg

Lines changed: 6 additions & 0 deletions
Loading

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/annotation-kotlin.svg

Lines changed: 13 additions & 0 deletions
Loading

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/annotation.svg

Lines changed: 9 additions & 0 deletions
Loading

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/arrow-down.svg

Lines changed: 3 additions & 0 deletions
Loading

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/burger.svg

Lines changed: 5 additions & 0 deletions
Loading

dokka-integration-tests/gradle/projects/it-android-kotlin-mp-builtin/expectedData/html/images/check.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)