[Build] Migrate most of the build logic from Project.buildDir usage

It's going to be deprecated in Gradle 8.3

There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242
^KTI-1473 In Progress
This commit is contained in:
Alexander.Likhachev
2023-10-11 22:42:51 +02:00
committed by Space Team
parent b784544f8d
commit a19bd2ed2e
69 changed files with 328 additions and 306 deletions
@@ -22,7 +22,7 @@ plugins {
val libclangextProject = project(":kotlin-native:libclangext")
val libclangextTask = libclangextProject.path + ":build"
val libclangextDir = libclangextProject.buildDir
val libclangextDir = libclangextProject.layout.buildDirectory.get().asFile
val libclangextIsEnabled = libclangextProject.findProperty("isEnabled")!! as Boolean
@@ -148,8 +148,8 @@ val nativelibs = project.tasks.register<Copy>("nativelibs") {
val clangstubsSolib = solib("clangstubs")
dependsOn(clangstubsSolib)
from("$buildDir/$clangstubsSolib")
into("$buildDir/nativelibs/")
from(layout.buildDirectory.dir(clangstubsSolib))
into(layout.buildDirectory.dir("nativelibs"))
}
kotlinNativeInterop {
@@ -183,7 +183,7 @@ tasks.withType<Test>().configureEach {
dependsOn(projectsWithNativeLibs.map { "${it.path}:nativelibs" })
dependsOn(nativeDependencies.llvmDependency)
systemProperty("java.library.path", projectsWithNativeLibs.joinToString(File.pathSeparator) {
File(it.buildDir, "nativelibs").absolutePath
it.layout.buildDirectory.dir("nativelibs").get().asFile.absolutePath
})
systemProperty("kotlin.native.llvm.libclang", "${nativeDependencies.llvmPath}/" + if (HostManager.hostIsMingw) {
@@ -192,7 +192,7 @@ tasks.withType<Test>().configureEach {
"lib/${System.mapLibraryName("clang")}"
})
systemProperty("kotlin.native.interop.indexer.temp", File(buildDir, "testTemp"))
systemProperty("kotlin.native.interop.indexer.temp", layout.buildDirectory.dir("testTemp").get().asFile)
}
// Please note that list of headers should be fixed manually.
@@ -202,14 +202,14 @@ tasks.register("updatePrebuilt") {
doLast {
copy {
from("$buildDir/nativeInteropStubs/clang/kotlin") {
from(layout.buildDirectory.dir("nativeInteropStubs/clang/kotlin")) {
include("clang/clang.kt")
}
into("prebuilt/nativeInteropStubs/kotlin")
}
copy {
from("$buildDir/interopTemp") {
from(layout.buildDirectory.dir("interopTemp")) {
include("clangstubs.c")
}
into("prebuilt/nativeInteropStubs/c")