-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add hidden workaround for native dependencies
- Loading branch information
1 parent
9d7c372
commit 4096e7d
Showing
4 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
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
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
40 changes: 40 additions & 0 deletions
40
...gin/src/main/kotlin/org/jetbrains/dokka/gradle/kotlin/KotlinNativeDistributionAccessor.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,40 @@ | ||
@file:Suppress("INVISIBLE_REFERENCE") | ||
package org.jetbrains.dokka.gradle.kotlin | ||
|
||
import java.io.File | ||
import org.gradle.api.Project | ||
import org.jetbrains.kotlin.commonizer.KonanDistribution | ||
import org.jetbrains.kotlin.commonizer.platformLibsDir | ||
import org.jetbrains.kotlin.commonizer.stdlib | ||
import org.jetbrains.kotlin.compilerRunner.konanHome | ||
import org.jetbrains.kotlin.konan.target.KonanTarget | ||
|
||
/** | ||
* Provides access to the Kotlin/Native distribution components: | ||
* * [stdlibDir] -- stdlib directory | ||
* * [platformDependencies] -- list of directories to platform dependencies | ||
* | ||
* It uses Kotlin Gradle Plugin API that is guaranteed to be present in: | ||
* 1.5 <= kotlinVersion <= 1.9 | ||
* | ||
* It should not be used with Kotlin versions later than 1.9 | ||
*/ | ||
// https://github.com/Kotlin/dokka/pull/3147 | ||
internal class KotlinNativeDistributionAccessor( | ||
project: Project | ||
) { | ||
private val konanDistribution = KonanDistribution( | ||
@Suppress("INVISIBLE_MEMBER") | ||
project.konanHome | ||
) | ||
|
||
val stdlibDir: File = konanDistribution.stdlib | ||
|
||
fun platformDependencies(target: KonanTarget): List<File> = konanDistribution | ||
.platformLibsDir | ||
.resolve(target.name) | ||
.listLibraryFiles() | ||
|
||
private fun File.listLibraryFiles(): List<File> = listFiles().orEmpty() | ||
.filter { it.isDirectory || it.extension == "klib" } | ||
} |
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