[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
+3 -3
View File
@@ -13,17 +13,17 @@ val commonMainSources by task<Sync> {
"$rootDir/libraries/kotlin.test/common/src/main/kotlin",
"$rootDir/libraries/kotlin.test/annotations-common/src/main/kotlin"
)
into("$buildDir/commonMainSources")
into(layout.buildDirectory.dir("commonMainSources"))
}
val commonTestSources by task<Sync> {
from("$rootDir/libraries/kotlin.test/common/src/test/kotlin")
into("$buildDir/commonTestSources")
into(layout.buildDirectory.dir("commonTestSources"))
}
val jsMainSources by task<Sync> {
from("$rootDir/libraries/kotlin.test/js/src/main/kotlin")
into("$buildDir/jsMainSources")
into(layout.buildDirectory.dir("jsMainSources"))
}
kotlin {
+12 -12
View File
@@ -19,12 +19,12 @@ node {
val jsMainSources by task<Sync> {
from("$rootDir/libraries/kotlin.test/js/it/src")
into("$buildDir/jsMainSources")
into(layout.buildDirectory.dir("jsMainSources"))
}
val jsSources by task<Sync> {
from("$rootDir/libraries/kotlin.test/js/it/js")
into("$buildDir/jsSources")
into(layout.buildDirectory.dir("jsSources"))
}
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
@@ -75,7 +75,7 @@ val populateNodeModules = tasks.register<Copy>("populateNodeModules") {
}
}
into("${buildDir}/node_modules")
into(layout.buildDirectory.dir("node_modules"))
}
fun createFrameworkTest(name: String): TaskProvider<NpmTask> {
@@ -83,12 +83,12 @@ fun createFrameworkTest(name: String): TaskProvider<NpmTask> {
dependsOn(compileTestDevelopmentExecutableKotlinJs, populateNodeModules, "npmInstall")
val testName = name
val lowerName = name.lowercase()
val tcOutput = project.file("$buildDir/tc-${lowerName}.log")
val stdOutput = "$buildDir/test-${lowerName}.log"
val errOutput = "$buildDir/test-${lowerName}.err.log"
val exitCodeFile = project.file("$buildDir/test-${lowerName}.exit-code")
val tcOutput = layout.buildDirectory.file("tc-${lowerName}.log")
val stdOutput = layout.buildDirectory.file("test-${lowerName}.log")
val errOutput = layout.buildDirectory.file("test-${lowerName}.err.log")
val exitCodeFile = layout.buildDirectory.file("test-${lowerName}.exit-code")
// inputs.files(sourceSets.test.output)
inputs.dir("${buildDir}/node_modules")
inputs.dir(layout.buildDirectory.dir("node_modules"))
outputs.files(tcOutput, stdOutput, errOutput, exitCodeFile)
args.set(listOf("run", "test-$lowerName"))
@@ -98,12 +98,12 @@ fun createFrameworkTest(name: String): TaskProvider<NpmTask> {
execOverrides {
isIgnoreExitValue = true
standardOutput = FileOutputStream(stdOutput)
errorOutput = FileOutputStream(errOutput)
standardOutput = FileOutputStream(stdOutput.get().asFile)
errorOutput = FileOutputStream(errOutput.get().asFile)
}
doLast {
println(tcOutput.readText())
if (exitCodeFile.readText() != "0" /* && !rootProject.ignoreTestFailures*/) {
println(tcOutput.get().asFile.readText())
if (exitCodeFile.get().asFile.readText() != "0" /* && !rootProject.ignoreTestFailures*/) {
throw GradleException("$testName integration test failed")
}