[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`
This commit is contained in:
Alexander Shabalin
2023-08-28 11:55:32 +02:00
committed by Space Team
parent 9de791b9ac
commit 4922223bec
23 changed files with 519 additions and 186 deletions
+3 -3
View File
@@ -29,14 +29,14 @@ native {
val obj = if (isWindows) "obj" else "o"
val cxxflags = mutableListOf("--std=c++17", "-g",
"-Isrc/main/include",
"-I${project.findProperty("llvmDir")}/include",
"-I$llvmDir/include",
"-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
if (libclangextEnabled) {
cxxflags += "-DLIBCLANGEXT_ENABLE=1"
}
suffixes {
(".cpp" to ".$obj") {
tool(*platformManager.hostPlatform.clangForJni.clangCXX("").toTypedArray())
tool(*hostPlatform.clangForJni.clangCXX("").toTypedArray())
flags(*cxxflags.toTypedArray(), "-c", "-o", ruleOut(), ruleInFirst())
}
}
@@ -47,7 +47,7 @@ native {
}
val objSet = sourceSets["main"]!!.transform(".cpp" to ".$obj")
target(lib("clangext"), objSet) {
tool(*platformManager.hostPlatform.clangForJni.llvmAr("").toTypedArray())
tool(*hostPlatform.clangForJni.llvmAr("").toTypedArray())
flags("-qcv", ruleOut(), *ruleInAll())
}
}