packaging an application with third party dependencies

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

packaging an application with third party dependencies

Rene Groeschke
Hello gradle.

In my spare time I try to move my eclipse rcp releng project from pde-
build to gradle.

I use the following lines of gradle script to package my whole  
application including third party eclipse bundles:

        dependencies {
                addFlatDirResolver('lib',  
target_plugins).addArtifactPattern(target_plugins+'/
[artifact]_[revision].[ext]')
                compile rcp_bundles
        }

        dists {
                zip() {
                        files(dependencies.resolve("runtime")) // add dependencies to zip
                }
        }


but this produces the following error message:
       
        Build file '/Users/Rene/workspaces/sandbox/gradle/
com.breskeby.samples.gradlercp.rcp/build.gradle' line(s): 38, 37, 36

        A problem occurred evaluating project :.
        Cause: [Ljava.util.ArrayList;

The line which causes this error is:
        file(dependencies.resolve("runtime"))

anybody an idea?

rgds,
René Groeschke
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: packaging an application with third party dependencies

Adam Murdoch-2


Rene Groeschke wrote:

> Hello gradle.
>
> In my spare time I try to move my eclipse rcp releng project from
> pde-build to gradle.
>
> I use the following lines of gradle script to package my whole
> application including third party eclipse bundles:
>
>     dependencies {
>         addFlatDirResolver('lib',
> target_plugins).addArtifactPattern(target_plugins+'/[artifact]_[revision].[ext]')
>
>         compile rcp_bundles
>     }
>
>     dists {
>         zip() {
>             files(dependencies.resolve("runtime")) // add dependencies
> to zip        
>         }
>     }
>
>
> but this produces the following error message:
>    
>     Build file
> '/Users/Rene/workspaces/sandbox/gradle/com.breskeby.samples.gradlercp.rcp/build.gradle'
> line(s): 38, 37, 36
>
>     A problem occurred evaluating project :.
>     Cause: [Ljava.util.ArrayList;
>
> The line which causes this error is:
>     file(dependencies.resolve("runtime"))
>
> anybody an idea?
>

This error is because the return type of resolve() is List, and the
parameter of files() is String[].

To work around this, you can do something like:

files(dependencies.resolve("runtime") as String[])

One thing to note is that the closure passed to zip() is executed when
the project is evaluated, not when the zip task is executed. Not
everything in the 'runtime' configuration will necessarily available at
that point, if the configuration includes dependencies from other
projects. In that case, you need something like:

dists {
    zip() {
        doFirst { task ->
            task.files(dependencies.resolve("runtime"))
    }
}

It would be good if we had a nicer way to include the artifacts from a
configuration in an archive which dealt with the above issues. For
example, if we had a Configuration domain object and it implemented
FileCollection, you could just add the configuration object to the archive.


Adam

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: packaging an application with third party dependencies

Rene Groeschke
Thanks Adam,
I will try it this evening. one thing to mention is, that the snippet

' file(dependencies.resolve("runtime")) '

is taken from the gradle userguide pdf. should be updated.

have a nice day,
René Groeschke

Am Di, 7.10.2008, 01:42, schrieb Adam Murdoch:
>

>
> Rene Groeschke wrote:
>
>> Hello gradle.
>>
>>
>> In my spare time I try to move my eclipse rcp releng project from
>> pde-build to gradle.
>>
>> I use the following lines of gradle script to package my whole
>> application including third party eclipse bundles:
>>
>> dependencies { addFlatDirResolver('lib',
>> target_plugins).addArtifactPattern(target_plugins+'/[artifact]_[revisio
>> n].[ext]')
>>
>> compile rcp_bundles }
>>
>>
>> dists { zip() { files(dependencies.resolve("runtime")) // add
>> dependencies to zip }
>> }
>>
>>
>>
>> but this produces the following error message:
>>
>> Build file
>> '/Users/Rene/workspaces/sandbox/gradle/com.breskeby.samples.gradlercp.rc
>> p/build.gradle' line(s): 38, 37, 36
>>
>>
>> A problem occurred evaluating project :.
>> Cause: [Ljava.util.ArrayList;
>>
>>
>> The line which causes this error is:
>> file(dependencies.resolve("runtime"))
>>
>> anybody an idea?
>>
>
> This error is because the return type of resolve() is List, and the
> parameter of files() is String[].
>
> To work around this, you can do something like:
>
>
> files(dependencies.resolve("runtime") as String[])
>
> One thing to note is that the closure passed to zip() is executed when
> the project is evaluated, not when the zip task is executed. Not everything
> in the 'runtime' configuration will necessarily available at that point,
> if the configuration includes dependencies from other projects. In that
> case, you need something like:
>
> dists { zip() { doFirst { task ->
> task.files(dependencies.resolve("runtime")) }
> }
>
>
> It would be good if we had a nicer way to include the artifacts from a
> configuration in an archive which dealt with the above issues. For example,
> if we had a Configuration domain object and it implemented FileCollection,
> you could just add the configuration object to the archive.
>
>
> Adam
>
>
> ---------------------------------------------------------------------
> 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


Reply | Threaded
Open this post in threaded view
|

Re: packaging an application with third party dependencies

Adam Murdoch-2
In reply to this post by Adam Murdoch-2


Adam Murdoch wrote:
>
>
> files(dependencies.resolve("runtime") as String[])
>

'as String[]' should be 'as File[]'


Adam

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: packaging an application with third party dependencies

Adam Murdoch-2
In reply to this post by Rene Groeschke


[hidden email] wrote:
> Thanks Adam,
> I will try it this evening. one thing to mention is, that the snippet
>
> ' file(dependencies.resolve("runtime")) '
>
> is taken from the gradle userguide pdf. should be updated.
>
>  

I've added a JIRA issue for this: http://jira.codehaus.org/browse/GRADLE-256


Adam

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: packaging an application with third party dependencies

hans_d
Administrator
In reply to this post by Adam Murdoch-2

On Oct 7, 2008, at 1:42 AM, Adam Murdoch wrote:

<snip>

> It would be good if we had a nicer way to include the artifacts  
> from a configuration in an archive which dealt with the above  
> issues. For example, if we had a Configuration domain object and it  
> implemented FileCollection, you could just add the configuration  
> object to the archive.

That would be very cool. I have added the idea to the Jira issue of  
creating a Configuration domain object: http://jira.codehaus.org/ 
browse/GRADLE-171

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





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

    http://xircles.codehaus.org/manage_email