Hi again,

Did you use the emma plugin I've created
(http://github.com/breskeby/gradleplugins/blob/master/emmaPlugin/emma.gradle)
or did you add your own tasks to add emma support in your build. If the
snippet below is all you've added to get emma working, I wonder how you
instrument your code to trace your code coverage.

If the snippet you posted:
--------------------

 ant.emma(enabled:"true"){
      report(sourcepathref:"src.path"){
        fileset(dir:"."){
          include(name:"**/metadata.emma")
        }
        fileset(dir:"."){
          include(name:"**/coverage.ec")
        }
        html(outfile:"coverage.html")
        xml(outfile:"coverage/coverage.xml")
        txt(outfile:"coverage/coverage.txt")
      }
    }
--------------------


is all you've added to your build file, emma won't recognize your
coverage, since the instrumenting part is missing.
Did you have a look at
http://github.com/breskeby/gradleplugins/blob/master/emmaPlugin/emma.gradle
? There I've reconfigured the test task to instrument the production
code just before running the tests and create the emma reports directly
after the test execution.
It seems, that sonar just needs the created metadata file, so maybe
report creation isn't needed here.

On the sonarsource page they list a sample pom.xml you have to create to
get sonar working with non maven projects (a weird sentence I know). in
their sample pom.xml they have a build section with informations about
the src path etc.

I would love to see you're sonar integration working, since I plan to
introduce this tool at work too.


regards,
René

Did you instrument Am 20.10.10 01:32, schrieb Thomas Carlier:
> Hi Rene:
>
> I tried a whole bunch renaming schemes without success.
>
> The closest I got to making this work was renaming the metadata file:
> metadata.emma -> coverage.em.  The file uploads successfully (mvn
> sonar:sonar), but the Sonar server shows "0%" coverage for every
> package/class that I have unit tests for.  The coverage field is blank for
> packages with no unit tests, so It does seem to at least partially read the
> file.
>
> There are no options that I can see in Sonar for setting the emma file type.
>
> --- Tom C.
>
> On Tue, Oct 19, 2010 at 4:02 PM, Rene Groeschke <[email protected]> wrote:
>
>>  Hi thomas,
>> It seems, that the sonar emma plugin expects the emma report in a file
>> called "coverage.em". I'm not sure about the content type, but I would
>> try to rename the output file of the xml report to coverage.em instead
>> of coverage.xml and see if this fits sonars needs.
>>
>> regards,
>> René
>>
>> Am 19.10.10 20:59, schrieb Thomas Carlier:
>>> The emma.gradle plugin seems to be producing different kinds of coverage
>>> files than Sonar is expecting.
>>>
>>> I'm getting this error:
>>>
>>> Embedded error: java.io.IOException: input file does not exist:
>>> [/work/bzr/components/hc.co/coverage/coverage.em]
>>>
>>> with this in build.gradle to create the report files
>>>
>>>     ant.emma(enabled:"true"){
>>>       report(sourcepathref:"src.path"){
>>>         fileset(dir:"."){
>>>           include(name:"**/metadata.emma")
>>>         }
>>>         fileset(dir:"."){
>>>           include(name:"**/coverage.ec")
>>>         }
>>>         html(outfile:"coverage.html")
>>>         xml(outfile:"coverage/coverage.xml")
>>>         txt(outfile:"coverage/coverage.txt")
>>>       }
>>>     }
>>>
>>> and this in my pom.xml
>>>
>>>   <properties>
>>>     <sonar.phase>generate-sources</sonar.phase>
>>>     <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
>>>     <sonar.surefire.reportsPath></sonar.surefire.reportsPath>
>>>     <sonar.core.codeCoveragePlugin>emma</sonar.core.codeCoveragePlugin>
>>>     <sonar.emma.reportPath>coverage</sonar.emma.reportPath>
>>>   </properties>
>>>
>>> any ideas?
>>>
>>> --- Tom C.
>>>
>>>
>>> On Mon, Oct 18, 2010 at 11:37 PM, Rene Groeschke <[email protected]
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> the more elegant way to customize your pom file is to use the maven
>>>> polyglot groovy builder:
>>>> ________________________
>>>> apply plugin:'java'
>>>> apply plugin:'maven'
>>>>
>>>> group = 'org.acme'
>>>> version = '0.1-SNAPSHOT'
>>>>
>>>> task exportPom << {
>>>>    pom {
>>>>                project {
>>>>                        properties{
>>>>                                'sonar.dynamicAnalysis' 'false'
>>>>                        }
>>>>            }
>>>>    }.writeTo("pom.xml")
>>>> }
>>>> ________________________
>>>>
>>>> some people report some problems while using this builder (e.g: see
>>>>
>>>>
>> http://gradle.markmail.org/search/?q=withXml#query:withXml+page:1+mid:rq3xbbvi32glmi4v+state:results
>>>> )
>>>>
>>>> but with the withXml hook you have full control of the created xml
>> output.
>>>> regards,
>>>> René
>>>>
>>>> Am Mo, 18.10.2010, 22:30, schrieb Rene Groeschke:
>>>>> Hi Thomas,
>>>>> according to the description at
>>>>> http://docs.codehaus.org/display/SONAR/Analyzing+Java+Projects you
>>>>> definitely need a pom.xml to get sonar working.
>>>>>
>>>>> exporting and manipulating a pom.xml with gradle is easy. you can start
>>>>> with this snippet:
>>>>>
>>>>> --------------
>>>>> apply plugin:'java' apply plugin:'maven'
>>>>>
>>>>> group = 'org.acme' version = '0.1-SNAPSHOT'
>>>>>
>>>>>
>>>>> def SONAR_PROP_DYN_ALIAS = """\ <properties>
>>>>> <sonar.dynamicAnalysis>false</sonar.dynamicAnalysis>
>>>>> </properties>
>>>>> """
>>>>>
>>>>>
>>>>> task exportPom << { pom { withXml { xmlProvider -> def xml =
>>>>> xmlProvider.asString() xml.insert(xml.lastIndexOf('</project>'),
>>>>> SONAR_PROP_DYN_ALIAS)
>>>>> }
>>>>> }.writeTo("pom.xml")
>>>>> }
>>>>> --------------
>>>>>
>>>>>
>>>>>
>>>>> regards, René
>>>>>
>>>>>
>>>>> ps.: I had a look on the sonar mvn plugin. maybe we could port it to
>>>>> support gradle more nativly. any volunteers?
>>>>>
>>>>> bye bye
>>>>>
>>>>>
>>>>>
>>>>> Am 18.10.10 20:26, schrieb Thomas Carlier:
>>>>>
>>>>>> Hi Rene:
>>>>>>
>>>>>>
>>>>>> That's what I've found out so far.  I've been hoping to find a gradle
>>>>>> plugin that would make the necessary maven calls to Sonar.  Otherwise,
>>>>>> I'm thinking
>>>>>> it would be nice to have an 'export to pom.xml' command within gradle
>> so
>>>>>> we wouldn't have to maintain 2 configuration files, just to use Sonar.
>>>>>> (yes,
>>>>>> we really want to use Sonar *and* stay with gradle).
>>>>>>
>>>>>> I hope someone can help me find my way through the maze of (what seems
>>>>>> to be) disconnected technologies.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>>
>>>>>> --- Tom C.
>>>>>>
>>>>>>
>>>>>> On Sat, Oct 16, 2010 at 5:26 AM, Rene Groeschke <[email protected]>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>> Hi Tom,
>>>>>>> sorry, I've mixed up Sonar and Nexus by Sonartype. I think you mean
>>>>>>> http://www.sonarsource.org/. I can't find an API description on how
>>>>>>> to deploy your measures to Sonar. It seems to be hardly wired with
>>>>>>> maven.
>>>>>>>
>>>>>>> regards, René
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Am 16.10.10 13:29, schrieb Thomas Carlier:
>>>>>>>
>>>>>>>> Hi Rene:
>>>>>>>>
>>>>>>>>
>>>>>>>> Sonar is not an artifact repository.  It's an open source quality
>>>>>>>>
>>>>>>> management
>>>>>>>> platform, dedicated to continuously analyze and measure technical
>>>>>>> quality,
>>>>>>>> from the project portfolio to the class method.
>>>>>>>>
>>>>>>>> I'd like to use it for tracking the emma code coverage trends over
>>>>>>>> time
>>>>>>> (and
>>>>>>>
>>>>>>>> other code health metrics).
>>>>>>>>
>>>>>>>> --- Tom C.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Oct 14, 2010 at 8:26 PM, Rene Groeschke
>>>>>>>> <[email protected]>
>>>>>>>>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>> Hi Thomas,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> there was a discussion on how to do handle/upload a custom
>>>>>>>>> produced file (DLL in this example) with gradle and artifactory on
>>>>>>>>> this mailinglist. Take a look at
>>>>>>>>> http://markmail.org/message/niseybxbjynckr2c
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> regards, René
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Am 15.10.10 02:40, schrieb Thomas Carlier:
>>>>>>>>>
>>>>>>>>>> I have my gradle build producing emma code coverage reports and
>>>>>>>>>> I'd
>>>>>>>>>>
>>>>>>> like
>>>>>>>>> to
>>>>>>>>>> upload them to a Sonar server.
>>>>>>>>>>
>>>>>>>>>> Can anyone help me understand the syntax for this?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks,
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --- Tom C.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> ------------------------------------
>>>>>>>>> Rene Groeschke
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [email protected] http://www.breskeby.com
>>>>>>>>> http://twitter.com/breskeby
>>>>>>>>> ------------------------------------
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -----------------------------------------------------------------
>>>>>>>>> ----
>>>>>>>>> To unsubscribe from this list, please visit:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> http://xircles.codehaus.org/manage_email
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>> --
>>>>>>> ------------------------------------
>>>>>>> Rene Groeschke
>>>>>>>
>>>>>>>
>>>>>>> [email protected] http://www.breskeby.com
>>>>>>> http://twitter.com/breskeby
>>>>>>> ------------------------------------
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>  To unsubscribe from this list, please visit:
>>>>>>>
>>>>>>>
>>>>>>> http://xircles.codehaus.org/manage_email
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>> --
>>>>> ------------------------------------
>>>>> Rene Groeschke
>>>>>
>>>>>
>>>>> [email protected] http://www.breskeby.com
>>>>> http://twitter.com/breskeby
>>>>> ------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>
>>>>> http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>    http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>
>> --
>> ------------------------------------
>> Rene Groeschke
>>
>> [email protected]
>> http://www.breskeby.com
>> http://twitter.com/breskeby
>> ------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>


-- 
------------------------------------
Rene Groeschke

[email protected]
http://www.breskeby.com
http://twitter.com/breskeby
------------------------------------


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to