buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: Subprojects
Date Sat, 27 Mar 2010 05:18:17 GMT
On Sat, Mar 20, 2010 at 8:54 AM, Alex Boisvert <alex.boisvert@gmail.com>wrote:

> On Sat, Mar 20, 2010 at 2:12 AM, Peter Donald <peter@realityforge.org>wrote:
>
>> On Sat, Mar 20, 2010 at 5:51 PM, Antoine Toulme <antoine@lunar-ocean.com>
>> wrote:
>> > I would say you call compile.invoke somewhere... anyhow we can't help
>> you
>> > without your Buildfile.
>>
>> Thanks. Found it. Almost all of my projects have a "dist" target that
>> basically roles all the generated artifacts into one big zip and I
>> have been doing it something like the following. My question is how do
>> I change it so that the includes are deferred until the package is
>> called on this project rather than as the project file is parsed?
>>
>>    package(:zip).tap do |zip|
>>      prefix = "#{id}-#{version}"
>>      zip.include( Buildr.artifacts([PAX_RUNNER]).each(&:invoke),
>> :path => "#{prefix}/bin")
>>      zip.include( Buildr.artifacts(EQUINOX).each(&:invoke), :path =>
>> "#{prefix}/equinox")
>>
>>      to_deploy = [OSGI_CORE, OSGI_COMPENDIUM, PAX_LOGGING,
>> PAX_LOGGING_SERVICE, CONFIG_ADMIN_SERVICE, PAX_CONFMAN] +
>>          [BND_ANNOTATIONS, JMS] + projects('link', 'connection',
>> 'com.sun.messaging.mq.imq', 'routes')
>>
>>      zip.include( Buildr.artifacts(to_deploy).each(&:invoke), :path
>> => "#{prefix}/lib")
>>      zip.include( _('src/main/etc/*'), :path => "#{prefix}")
>>    end
>>
>
> You need to wire dependencies between tasks.   Instead of calling
> task.invoke(), use task.enhance() on the task which depends this task.
>
>
> package(:zip).tap do |zip|
>   prefix = "#{id}-#{version}"
>
>   artifact(PAX_RUNNER).tap do |a|
>     zip.enhance a
>     zip.include a, :path => "#{prefix}/bin")
>   end
>
>   artifact(EQUINOX).tap do |a|
>     zip.enhance a
>     zip.include a, :path => "#{prefix}/equinox")
>   end
>
>   libs = [OSGI_CORE, OSGI_COMPENDIUM, PAX_LOGGING,
>
>           PAX_LOGGING_SERVICE, CONFIG_ADMIN_SERVICE,
>           PAX_CONFMAN, BND_ANNOTATIONS, JMS].map { |a| artifact(a) }
>   libs += projects('link', 'connection',
>
>                    'com.sun.messaging.mq.imq',
>                    'routes').map(&:packages)
>   zip.enhance libs
>   zip.include libs, :path => "#{prefix}/lib"
>
>
>   zip.include _('src/main/etc/*'), :path => prefix
> end
>
> It wouldn't be a bad idea to have zip.include accept tasks and
> automatically wire things up.  I'll look into this later.
>

Courtesy of Antoine Toulme and I, the above no longer requires calling
enhance(), artifact() or packages() on trunk and becomes the more succinct,

package(:zip).tap do |zip|
  prefix = "#{id}-#{version}"

  zip.include PAX_RUNNER, :path => "#{prefix}/bin")
  zip.include EQUINOX,    :path => "#{prefix}/equinox")

  libs = [OSGI_CORE, OSGI_COMPENDIUM, PAX_LOGGING,
          PAX_LOGGING_SERVICE, CONFIG_ADMIN_SERVICE,
          PAX_CONFMAN, BND_ANNOTATIONS, JMS]

  libs += projects('link', 'connection',
                   'com.sun.messaging.mq.imq',
                   'routes')
  zip.include libs, :path => "#{prefix}/lib"

  zip.include _('src/main/etc/*'), :path => prefix
end

alex

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message