Skip to content

Commit

Permalink
Extract classpath from KotlinSharedNativeCompilation as well (#2664)
Browse files Browse the repository at this point in the history
* Extract classpath from `KotlinSharedNativeCompilation` as well

* Enhance mpp integration test

* Enable HMPP for old Kotlin in integration test

* Add comments
  • Loading branch information
vmishenev committed Sep 26, 2022
1 parent a816e91 commit ee8e730
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
Expand Up @@ -14,6 +14,14 @@ kotlin {
macosX64("macos")
js()
sourceSets {
val commonMain by sourceSets.getting
val linuxMain by sourceSets.getting
val macosMain by sourceSets.getting
val desktopMain by sourceSets.creating {
dependsOn(commonMain)
linuxMain.dependsOn(this)
macosMain.dependsOn(this)
}
named("commonMain") {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
Expand All @@ -26,8 +34,8 @@ tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
configureEach {
externalDocumentationLink {
url.set(URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/"))
//packageListUrl.set(URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/package-list"))
url.set(URL("https://kotlinlang.org/api/kotlinx.coroutines/"))
//packageListUrl.set(URL("https://kotlinlang.org/api/kotlinx.coroutines/package-list"))
}
}
}
Expand Down
@@ -1 +1,5 @@
dokka_it_kotlin_version=1.7.10
#these flags are enabled by default since 1.6.20.
#remove when this test is executed with Kotlin >= 1.6.20
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
@@ -0,0 +1,11 @@
package it.mpp0

import kotlinx.cinterop.CPointed
import kotlinx.cinterop.CPointer

/**
* Will print the raw value
*/
fun CPointer<CPointed>.customExtension() {
println(this.rawValue)
}
@@ -0,0 +1,5 @@
package it.mpp0

actual class ExpectedClass {
actual val platform: String = "linux"
}
Expand Up @@ -5,7 +5,7 @@ import org.gradle.api.file.FileCollection
import org.jetbrains.dokka.gradle.isAndroidTarget
import org.jetbrains.dokka.utilities.cast
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeCompilation
import org.jetbrains.kotlin.gradle.plugin.mpp.AbstractKotlinNativeCompilation
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCommonCompilation
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

Expand Down Expand Up @@ -42,7 +42,7 @@ private fun Project.compileClasspathOf(compilation: KotlinCompilation): FileColl
return compilation.compileKotlinTask.cast<KotlinCompile>().classpath
}

val platformDependencyFiles: FileCollection = (compilation as? KotlinNativeCompilation)
val platformDependencyFiles: FileCollection = (compilation as? AbstractKotlinNativeCompilation)
?.target?.project?.configurations
?.findByName(compilation.defaultSourceSet.implementationMetadataConfigurationName)
?: files()
Expand Down

0 comments on commit ee8e730

Please sign in to comment.