Files
kotlin-fork/kotlin-native/dependencies/build.gradle.kts
T
Alexander Shabalin 4922223bec [K/N] Refactor :kotlin-native:dependencies
Move K/N dependencies handling logic into gradle plugins:

`NativeDependenciesDownloader` is instantiated in
`:kotlin-native:dependencies` and provides a single configuration that
contains all directories with the dependencies. The configuration has
a variant for each target.

`NativeDependencies` is instantiated by projects that require native
dependencies (i.e. previously used to depend on
`:kotlin-native:dependencies:update`). This plugin creates a configuration
that by default depends on `:kotlin-native:dependencies`. Its extension
provides `llvmDependency`, `libffiDependency`, `hostPlatformDependency`,
`targetDependency()` to depend on the parts needed for the project and
provides accessors `llvmPath`, `libffiPath`, `hostPlatform` that are
safe to use during configuration time, but which do not automatically
resolve those dependencies.

`llvmDir`, `*LibffiDir` properties on `:kotlin-native` are removed
completely, as their use is replaced by `NativeDependencies`. As a
consequence, `evaluationDependsOn(":kotlin-native:dependencies")` is
also gone.

All direct dependencies on `:kotlin-native:dependencies:update` are
replaced with dependencies on specific parts via `NativeDependencies`
2023-10-18 10:53:12 +00:00

35 lines
1003 B
Kotlin

/*
* Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
import java.io.File
import org.jetbrains.kotlin.konan.target.allTargetsWithSanitizers
plugins {
id("native-dependencies-downloader")
id("native-dependencies")
}
nativeDependenciesDownloader {
repositoryURL.set("https://cache-redirector.jetbrains.com/download.jetbrains.com/kotlin/native")
dependenciesDirectory.set(rootProject.project(":kotlin-native").property("dependenciesDir") as File)
allTargets {}
}
/**
* Download all dependencies.
*/
val update by tasks.registering {
platformManager.allTargetsWithSanitizers.forEach {
dependsOn(nativeDependencies.targetDependency(it))
}
}
// TODO: This sort of task probably belongs to :kotlin-native
val rmDotKonan by tasks.registering(Delete::class) {
val dir = System.getenv("KONAN_DATA_DIR") ?: "${System.getProperty("user.home")}/.konan"
delete(dir)
}