-
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.
Use compileDependencyFiles for getting compilation dependencies (#3147)
Co-authored-by: vmishenev <[email protected]>
- Loading branch information
Showing
4 changed files
with
60 additions
and
3 deletions.
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
39 changes: 39 additions & 0 deletions
39
...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,39 @@ | ||
@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 | ||
*/ | ||
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