-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
77 changes: 77 additions & 0 deletions
77
dokka-subprojects/plugin-base/src/test/kotlin/translators/KMPTest.kt
This file contains 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,77 @@ | ||
/* | ||
* Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | ||
*/ | ||
|
||
package translators | ||
|
||
import org.jetbrains.dokka.model.* | ||
import org.jetbrains.dokka.model.doc.* | ||
import utils.AbstractModelTest | ||
import utils.assertNotNull | ||
import utils.comments | ||
import utils.docs | ||
import java.io.File | ||
import kotlin.test.Test | ||
|
||
class KMPTest : AbstractModelTest("/src/main/kotlin/comment/Test.kt", "comment") { | ||
|
||
/// copy-pasted UTILS | ||
private fun getResourceAbsolutePath(resourcePath: String): String { | ||
val resource = object {}.javaClass.classLoader.getResource(resourcePath)?.file | ||
?: throw IllegalArgumentException("Resource not found: $resourcePath") | ||
|
||
return File(resource).absolutePath | ||
} | ||
|
||
val configuration = dokkaConfiguration { | ||
sourceSets { | ||
/* val common = sourceSet { | ||
sourceRoots = listOf("src/common/kotlin") | ||
analysisPlatform = "common" | ||
name = "common" | ||
}*/ | ||
sourceSet { | ||
sourceRoots = listOf("src/androidMain/kotlin") | ||
analysisPlatform = "jvm" | ||
name = "android-example" | ||
classpath = listOf(getResourceAbsolutePath("jars/jvmAndroidLib-jvm.jar")) | ||
// dependentSourceSets = setOf(common.value.sourceSetID) | ||
} | ||
sourceSet { | ||
sourceRoots = listOf("src/jvmMain/kotlin") | ||
analysisPlatform = "jvm" | ||
name = "jvm-example" | ||
classpath = listOf(getResourceAbsolutePath("jars/jvmAndroidLib-jvm-copy.jar")) | ||
// dependentSourceSets = setOf(common.value.sourceSetID) | ||
} | ||
|
||
} | ||
} | ||
|
||
@Test | ||
fun `unresolved Firebase in the android source set with the same renamed jar`() { | ||
inlineModelTest( | ||
""" | ||
|/src/androidMain/kotlin/main.kt | ||
|package example | ||
|import Firebase | ||
| | ||
|fun android(f: Firebase){} | ||
| | ||
|/src/jvmMain/kotlin/main.kt | ||
|package example | ||
|import Firebase | ||
| | ||
|fun jvm(f: Firebase){} | ||
""", | ||
configuration = configuration | ||
) { | ||
with((this / "example" / "android").cast<DFunction>()) { | ||
parameters[0].type is UnresolvedBound // <------- here | ||
} | ||
with((this / "example" / "jvm").cast<DFunction>()) { | ||
parameters[0].type is GenericTypeConstructor | ||
} | ||
} | ||
} | ||
} |
Binary file added
BIN
+996 Bytes
dokka-subprojects/plugin-base/src/test/resources/jars/jvmAndroidLib-jvm-copy.jar
Binary file not shown.
Binary file added
BIN
+996 Bytes
dokka-subprojects/plugin-base/src/test/resources/jars/jvmAndroidLib-jvm.jar
Binary file not shown.