[Gradle] Fix warnings in NativePerformanceReport

^KT-56904 In Progress
This commit is contained in:
Yahor Berdnikau
2023-12-19 22:00:13 +01:00
committed by Space Team
parent 705c9b50a9
commit acf3f2a3a1
@@ -45,7 +45,7 @@ open class NativePerformanceReport : DefaultTask() {
// Get compile task and associated with it other compile tasks. // Get compile task and associated with it other compile tasks.
private fun getAllExecutedTasks(compilation: KotlinCompilation<*>): List<Task> { private fun getAllExecutedTasks(compilation: KotlinCompilation<*>): List<Task> {
val tasks = mutableListOf(compilation.compileKotlinTask as Task) val tasks = mutableListOf(compilation.compileTaskProvider.get() as Task)
compilation.associatedCompilations.toList().forEach { compilation.associatedCompilations.toList().forEach {
tasks += getAllExecutedTasks(it) tasks += getAllExecutedTasks(it)
} }
@@ -73,15 +73,15 @@ open class NativePerformanceReport : DefaultTask() {
} }
private fun getPerformanceCompilerOptions() = private fun getPerformanceCompilerOptions() =
(compilerFlagsFromBinary() + binary.linkTask.compilation.kotlinOptions.freeCompilerArgs) (compilerFlagsFromBinary() + binary.linkTask.toolOptions.freeCompilerArgs.get())
.filter { it in listOf("-g", "-opt", "-Xg0") }.map { "\"$it\"" } .filter { it in listOf("-g", "-opt", "-Xg0") }.map { "\"$it\"" }
@TaskAction @TaskAction
fun generate() { fun generate() {
val compileTasks = if (settings.includeAssociatedTasks) val compileTasks = if (settings.includeAssociatedTasks)
getAllExecutedTasks(binary.linkTask.compilation) getAllExecutedTasks(binary.compilation)
else else
listOf(binary.linkTask.compilation.compileKotlinTask) listOf(binary.compilation.compileTaskProvider.get())
val allExecutedTasks = listOf(binary.linkTask) + compileTasks val allExecutedTasks = listOf(binary.linkTask) + compileTasks
val upToDateTasks = allExecutedTasks.filter { it.state.upToDate }.map { it.name } val upToDateTasks = allExecutedTasks.filter { it.state.upToDate }.map { it.name }
if (upToDateTasks.isNotEmpty()) { if (upToDateTasks.isNotEmpty()) {