[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
+10 -12
View File
@@ -121,9 +121,7 @@ task clean {
dependsOn "${it.path}:clean"
}
}
doLast {
delete "${buildDir.absolutePath}"
}
delete(layout.buildDirectory)
}
defaultTasks 'konanRun'
@@ -166,7 +164,7 @@ private def uploadBenchmarkResultToArtifactory(String fileName) {
buildProperties.load(new FileInputStream(teamcityConfig))
def password = buildProperties.getProperty("artifactory.apikey")
MPPTools.uploadFileToArtifactory("${artifactoryUrl}", "${artifactoryRepo}",
uploadedFile, "${buildDir.absolutePath}/${fileName}", password)
uploadedFile, layout.buildDirectory.file(fileName).get().asFile.toString(), password)
}
}
@@ -176,7 +174,7 @@ task registerExternalBenchmarks {
def reports = externalReports.split(';')
def jsonReports = []
reports.each {
def reportFile = new File(buildDir, it)
def reportFile = layout.buildDirectory.file(it).get().asFile
if (!reportFile.exists())
return
@@ -222,14 +220,14 @@ task registerExternalBenchmarks {
properties += ["codeSize": MPPTools.toCodeSizeBenchmark(codeSize, status, name)]
}
def output = MPPTools.createJsonReport(properties)
def jsonFile = new File(buildDir, it.replace(".txt", ".json"))
def jsonFile = layout.buildDirectory.file(it.replace(".txt", ".json")).get().asFile
jsonFile.write(output)
jsonReports.add(jsonFile)
}
def merged = MPPTools.mergeReports(jsonReports)
if (!merged.isEmpty()) {
mkdir buildDir.absolutePath
new File(buildDir, externalBenchmarksReport).write(merged)
mkdir layout.buildDirectory.get().asFile.absolutePath
layout.buildDirectory.file(externalBenchmarksReport).get().asFile.write(merged)
uploadBenchmarkResultToArtifactory(externalBenchmarksReport)
}
}
@@ -269,14 +267,14 @@ registerExternalBenchmarks.finalizedBy registerExternalBuild
def mergeReports(String fileName) {
def reports = []
subprojects.each {
def reportFile = new File("${it.buildDir.absolutePath}/${fileName}")
def reportFile = it.layout.buildDirectory.file(fileName).get().asFile
if (reportFile.exists()) {
reports.add(reportFile)
}
}
def output = MPPTools.mergeReports(reports)
mkdir buildDir.absolutePath
new File("${buildDir.absolutePath}/${fileName}").write(output)
mkdir layout.buildDirectory.get().asFile.absolutePath
new File("${layout.buildDirectory.get().asFile.absolutePath}/${fileName}").write(output)
}
task mergeNativeReports {
@@ -313,7 +311,7 @@ task teamCityStat(type:Exec) {
"--artifactory-url", "https://repo.labs.intellij.net/kotlin-native-benchmarks",
"--teamcity-url", "http://buildserver.labs.intellij.net",
"--server-url", findProperty("kotlin.native.performance.server.url")?.toString() ?: "http://localhost:3000",
"${buildDir.absolutePath}/${nativeJson}"
"${layout.buildDirectory.file(nativeJson).get().asFile}"
}
task cinterop {