cdsap / Talaiot

Simple and extensible plugin to track task times in your Gradle Project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't use filter param in Groovy: No signature of method: build_xxx.talaiot() is applicable for argument types: (build_xxx$_run_closure4) values

RHMDHDYT opened this issue · comments

I'm using the basic config and it works:

build.gradle:

buildscript {
...
}

plugins {
    id "io.github.cdsap.talaiot" version "1.5.1"
}

talaiot {
    publishers {
        influxDbPublisher {
            dbName = "***DB"
            url = "https://***/"
            taskMetricName = "task"
            buildMetricName = "build"
        }
    }
    filter {
        threshold {
            minExecutionTime = 5
        }
    }
}

But, when I add more filter param like tasks:

talaiot {
    publishers {
        influxDbPublisher {
            dbName = "***DB"
            url = "https://***/"
            taskMetricName = "task"
            buildMetricName = "build"
        }
    }
    filter {
        tasks {
            excludes = arrayOf("help", "clean :*")
        }
        threshold {
            minExecutionTime = 5
        }
    }
}

or build:

    filter {
        threshold {
            minExecutionTime = 5
        }
        build {
            success = true
            requestedTasks {
                excludes = arrayOf("help", "clean :*")
            }
        }
    }

It throws an error on Gradle sync:

A problem occurred evaluating root project 'my-app'.
> No signature of method: build_ai4x85wfvn5fqap5qnl8twexr.talaiot() is applicable for argument types: (build_ai4x85wfvn5fqap5qnl8twexr$_run_closure4) values: [build_ai4x85wfvn5fqap5qnl8twexr$_run_closure4@5e41a40d]
  Possible solutions: wait(), wait(long), split(groovy.lang.Closure)
  	at build_ai4x85wfvn5fqap5qnl8twexr.run(/Users/rahmad/Projects/my-app/build.gradle:325)

the line 325 pointing on talaiot { tag

Does anyone know what I missed?

Hi, you have mentioned you are using Groovy to define your builds.
The code showed:

 excludes = arrayOf("help", "clean :*")

works for kts build files. If you are using Groovy you need to use something like:

excludes = ["help", "clean :*"]

you're right @cdsap, my mistake. I did the change and it works. But I realize that minExecutionTime = 5 doesn't filter any task below 5 minutes, it's still uploaded to InfluxDB. I turned on the log and didn't found anything suspicious. Do you know why it's not working properly?

hi @RHMDHDYT the value is expressed in milliseconds(long)

ah i see, thanks @cdsap for the assistance