Thanks, Adam. That looks very useful indeed. I will be adding that very soon.
Val
On Feb 23, 2011, at 3:06 PM, Adam Murdoch wrote:
>
> On 24/02/2011, at 12:46 AM, Kolovos, Val (Orbitz) wrote:
>
>> I'm a little confused about how the 'applyFrom' in the buildscript section
>> works, then, because when I use the coberturainit.gradle script from github,
>> the plugin is applied correctly, but it doesn't appear that it's classes are
>> made available to the rest of the build script.
>
> That's right. Classes from an applied script are not visible outside that
> script. This is probably something we will change before the Gradle 1.0
> release.
>
> There is a simple workaround that works pretty well. In the applied script
> you can do something like:
>
> project.GenerateCoverageReportTask = GenerateCoverageReportTask.class
>
> Then, in the applying script you can simply do:
>
> task generateCoverage(type: GenerateCoverageReportTask)
>
>
>> So, for example, I have the following build.gradle file:
>>
>> buildscript {
>> apply from:
>> 'https://github.com/valkolovos/gradle_cobertura/raw/master/ivy/gradle_cobertura/gradle_cobertura/1.0-rc4/coberturainit.gradle'
>> }
>>
>> repositories {
>> mavenCentral()
>> }
>>
>> dependencies {
>> testCompile 'junit:junit:4.8.2'
>> }
>>
>> cobertura {
>> coverageDatafile = file('cobertura.ser')
>> }
>>
>> When I run 'gradle cobertura', everything works fine, but as soon as I add
>> the line that Merlyn was trying to add (adding a
>> GenerateCoverageReportTask), I get the "Could not find property 'com'" error.
>>
>> Can someone help me clear this up?
>>
>> Thanks,
>>
>> Val
>>
>>
>> On Feb 22, 2011, at 6:15 PM, Merlyn Albery-Speyer wrote:
>>
>>> Thanks, Rene. That worked. Perhaps an optimization was introduced at
>>> some point that broke the way gradle-cobertura configures itself? (The
>>> build.gradle I used was directly from the github project page for the
>>> plugin).
>>>
>>> On Tue, Feb 22, 2011 at 3:43 PM, Rene Groeschke <[email protected]> wrote:
>>>> Hi Merlyn,
>>>> I've took a look at your problem.There is either a problem with the
>>>> coperturainit.gradle script you applied in your snippet or there's a
>>>> classloading issue you run into.
>>>> You can replace your buildscript section with the following one to get
>>>> the The the following should work:
>>>>
>>>> ...
>>>> buildscript {
>>>> def basePath =
>>>> 'https://github.com/valkolovos/gradle_cobertura/raw/master/ivy'
>>>> repositories {
>>>> mavenCentral()
>>>> add(new org.apache.ivy.plugins.resolver.URLResolver()) {
>>>> name = 'cobertura'
>>>> addArtifactPattern
>>>> "${basePath}/[organization]/[module]/[revision]/[artifact]-[revision].[ext]"
>>>> addIvyPattern
>>>> "${basePath}/[organization]/[module]/[revision]/ivy.xml"
>>>> }
>>>> }
>>>> dependencies {
>>>> classpath "gradle_cobertura:gradle_cobertura:1.0-rc4"
>>>> }
>>>> }
>>>> apply plugin: com.orbitz.gradle.cobertura.CoberturaPlugin
>>>> ...
>>>>
>>>> Am 23.02.11 00:12, schrieb Merlyn Albery-Speyer:
>>>>> More info. If I comment out the generate task and run dependencies I
>>>>> see a cobertura configuration that does include cobertura itself, but
>>>>> not any gradle-cobertura reference:
>>>>>
>>>>> cobertura
>>>>> ....
>>>>> \--- net.sourceforge.cobertura:cobertura:1.9.4.1 [default]
>>>>> +--- log4j:log4j:1.2.14 [compile,master,runtime]
>>>>> +--- oro:oro:2.0.8 [compile,master,runtime]
>>>>> +--- asm:asm:3.0 [compile,master,runtime]
>>>>> +--- asm:asm-tree:3.0 [compile,master,runtime]
>>>>> | \--- asm:asm:3.0 [compile,master,runtime]
>>>>> \--- org.apache.ant:ant:1.7.0 [compile,master,runtime]
>>>>> \--- org.apache.ant:ant-launcher:1.7.0 [compile,master,runtime]
>>>>>
>>>>> *with* the generate task included I see this on the gradle debug output:
>>>>>
>>>>> 14:36:56.947 [DEBUG]
>>>>> [org.gradle.api.internal.artifacts.ivyservice.DefaultIvyReportConverter]
>>>>> Timing: Translating report for configuration configuration 'classpath'
>>>>> took 0.069 secs
>>>>> 14:36:57.021 [DEBUG]
>>>>> [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper]
>>>>> clientModule: no namespace defined: using system
>>>>> 14:36:57.024 [DEBUG]
>>>>> [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper]
>>>>> [NOT REQUIRED]
>>>>> gradle_cobertura#gradle_cobertura;1.0-rc4!gradle_cobertura.jar
>>>>>
>>>>> Perhaps gradle behaviour has changed since this plugin was written? Is
>>>>> anyone using the plugin with gradle 0.9.2?
>>>>>
>>>>> $ gradle -v
>>>>>
>>>>> ------------------------------------------------------------
>>>>> Gradle 0.9.2
>>>>> ------------------------------------------------------------
>>>>>
>>>>> Gradle build time: Sunday, 23 January 2011 01:34:21 PM EST
>>>>> Groovy: 1.7.6
>>>>> Ant: Apache Ant version 1.8.1 compiled on April 30 2010
>>>>> Ivy: 2.2.0
>>>>> JVM: 1.6.0_22 (Apple Inc. 17.1-b03-307)
>>>>> OS: Mac OS X 10.5.8 x86_64
>>>>>
>>>>> Cheers,
>>>>> Merlyn
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>
>
> --
> Adam Murdoch
> Gradle Developer
> http://www.gradle.org
> CTO, Gradleware Inc. - Gradle Training, Support, Consulting
> http://www.gradleware.com
>