marcingrzejszczak / gradle-test-profiler

created with @AChudzik. The idea of this plugin is to perform profiling of your tests. You will be able to see your test execution times sorted in the descending manner together with an information about a module and the class name from which the test was executed.
Apache License 2.0
25 stars 11 forks source link

Plugin should not be order dependent #39

Closed ben-manes closed 9 years ago

ben-manes commented 9 years ago

If the plugin is applied prior to the java plugin the build fails because the test task has not yet been added. This can be resolved by using afterEvaluate to complete at the end of the configuration phase.

Caused by: org.gradle.api.UnknownTaskException: Task with name 'test' not found in project ':caffeine'.
    at org.gradle.api.internal.tasks.DefaultTaskCollection.createNotFoundException(DefaultTaskCollection.java:85)
    at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:192)
    at org.gradle.api.internal.tasks.DefaultTaskCollection.getByName(DefaultTaskCollection.java:34)
    at org.gradle.api.tasks.TaskCollection$getByName$0.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at com.blogspot.toomuchcoding.testprofiler.BuildBreaker.createAfterCompilationTestTaskModifier(BuildBreaker.groovy:34)
    at com.blogspot.toomuchcoding.testprofiler.BuildBreaker.performBuildBreakingLogic(BuildBreaker.groovy:27)
    at com.blogspot.toomuchcoding.testprofiler.TestProfilerPlugin.performBuildBreakingLogic(TestProfilerPlugin.groovy:76)
    at com.blogspot.toomuchcoding.testprofiler.TestProfilerPlugin.apply(TestProfilerPlugin.groovy:48)
    at com.blogspot.toomuchcoding.testprofiler.TestProfilerPlugin.apply(TestProfilerPlugin.groovy)
marcingrzejszczak commented 9 years ago

Fixed in 0.3.1 ! Thanks :)

snekse commented 9 years ago

I seem to be getting the reverse problem. Task 'profileTests' not found in project

I would have thought that applying both the Java plugin and this plugin would be enough to have the task defined. Any thoughts?

marcingrzejszczak commented 9 years ago

Can you show me your sample application? Do you have the code somewhere?

snekse commented 9 years ago

I'll try to get a sample app going, but it's fairly straight forward. It's a multi-module app if that matters.

marcingrzejszczak commented 9 years ago

THat's too little information cause I've successfully applied the plugin to a gigantic multi-module app. So with the sample app I'll be able to debug the issue.