Added caches to default mode for running compile-only benchmarks
This commit is contained in:
committed by
LepilkinaElena
parent
e34344e4e7
commit
ac0301444b
@@ -15,6 +15,7 @@ import org.gradle.api.execution.TaskExecutionListener
|
|||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
||||||
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
|
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink
|
||||||
|
import org.jetbrains.kotlin.konan.target.HostManager
|
||||||
import org.jetbrains.report.*
|
import org.jetbrains.report.*
|
||||||
import org.jetbrains.report.json.*
|
import org.jetbrains.report.json.*
|
||||||
import java.nio.file.Paths
|
import java.nio.file.Paths
|
||||||
@@ -128,14 +129,19 @@ fun mergeReports(reports: List<File>): String {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCompileOnlyBenchmarksOpts(project: Project, defaultCompilerOpts: List<String>) =
|
fun getCompileOnlyBenchmarksOpts(project: Project, defaultCompilerOpts: List<String>): List<String> {
|
||||||
(project.findProperty("nativeBuildType") as String?)?.let {
|
val dist = project.file(project.findProperty("kotlin.native.home") ?: "dist")
|
||||||
if (it.equals("RELEASE", true))
|
val useCache = !project.hasProperty("disableCompilerCaches")
|
||||||
listOf("-opt")
|
val cacheOption = "-Xcache-directory=$dist/klib/cache/${HostManager.host.name}-gSTATIC"
|
||||||
else if (it.equals("DEBUG", true))
|
.takeIf { useCache && PlatformInfo.isMac() } // TODO: remove target condition when we have cache support for other targets.
|
||||||
listOf("-g")
|
return (project.findProperty("nativeBuildType") as String?)?.let {
|
||||||
else listOf()
|
if (it.equals("RELEASE", true))
|
||||||
} ?: defaultCompilerOpts
|
listOf("-opt")
|
||||||
|
else if (it.equals("DEBUG", true))
|
||||||
|
listOfNotNull("-g", cacheOption)
|
||||||
|
else listOf()
|
||||||
|
} ?: defaultCompilerOpts + listOfNotNull(cacheOption?.takeIf { !defaultCompilerOpts.contains("-opt") })
|
||||||
|
}
|
||||||
|
|
||||||
// Find file with set name in directory.
|
// Find file with set name in directory.
|
||||||
fun findFile(fileName: String, directory: String): String? =
|
fun findFile(fileName: String, directory: String): String? =
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ compileBenchmark {
|
|||||||
compilerOpts = buildOpts
|
compilerOpts = buildOpts
|
||||||
buildSteps {
|
buildSteps {
|
||||||
step("runKonanc") {
|
step("runKonanc") {
|
||||||
command("$dist/bin/konanc$toolSuffix", "$projectDir/src/main/kotlin/main.kt", "-o", "$buildDir/program$binarySuffix", *(buildOpts.toTypedArray()))
|
command("$dist/bin/konanc$toolSuffix", "$projectDir/src/main/kotlin/main.kt", "-o",
|
||||||
|
"$buildDir/program$binarySuffix", *(buildOpts.toTypedArray()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user