Hi Kevin, see my comments inline:

On Tue, Feb 9, 2010 at 20:35, Kevin Smith <kevi...@qualitycode.com> wrote:

> On Tue, 2010-02-09 at 17:10 -0800, Antoine Toulme wrote:
> > You can declare a unzip task, and build it:
> > build unzip(_("target/jetty")=>artifact(JETTY))
>
> Thanks for your quick reply.
>
> I was unable to decipher this from what I have read in the docs. I can
> see that it starts with the JETTY artifact, but I don't see how that jar
> would end up being copied to the target directory, where it could be
> unzipped.
>
> But I tried it, and it magically works. The introductory docs are great,
> but what is missing is the intermediate level. I would love to
> understand the fundamental rules that describe why this bit of magic
> actually works. It looks like artifact magically exposes an actual file
> to unzip, but I sure don't see any hint of that in the api docs.
>
> Anyway, here is what I ended up with, which seems to work fine:
>
>  build do
>    dir = _('target', 'jetty')
>    license_name = 'LICENSE.html'
>    unzip(dir=>artifact(JETTY_SPEC)).include("**/#{license_name}")
>    license_file = File.join(dir, 'LICENSE.html')
>    install artifact(JETTY_LICENSE_SPEC).from(license_file)
>    FileUtils::rm_rf dir
>  end
>
> It would be great if you could add something like this to the user
> guide.
>
Could you help us by opening a bug on this ?

>
> >
> > On Tue, Feb 9, 2010 at 17:05, Kevin Smith <kevi...@qualitycode.com>
> wrote:
> > > 2. How to copy artifact files?
> > >
> > > This is closely related to #1. My script creates an ISO image. I would
> > > like to simply copy some artifacts into the ISO directory, but don't
> see
> > > any way to do it. My workaround is to create a zip containing the full
> > > directory structure I want, and then unzipping it into the ISO image.
> > > Seems like it should be easier.
> > >
> > Well, that's pure Ruby, off the top of my head:
> > cp a z
>
> Ok, so now I know how to unzip an artifact (from #1). How to convert an
> artifact into an actual file in _('target') that I can do something
> with? Still can't find it in the docs. The closest I have so far are: I
> could unzip it and then rezip it, or I could include it in a zip and
> then unzip it.
>
You want to convert an artifact into a file ? It's more the other way
around:
Buildr::artifact("group:artifact:extension:version").from(_("target/myfile.zip")

Does it help ?

>
> > > 3. How to specify a dependency for a package task?
> > >
> > > Several times, I have wanted to specify that the package task for a
> > > project should depend on some other task. In one case, I had a master
> > > project and several related projects (which were not buildr subprojects
> > > because I couldn't get those to work the way I wanted). I simply wanted
> > > to create a 'package' target in the master project, which depends on
> the
> > > package targets of the other projects. I can see how to do this for
> > > 'build', but not for 'package'.
> > >
> > You use the enhance method that takes an array as argument:
> >
> > package(:zip).enhance [task1, task2]
>
> I didn't see .enhance anywhere in the docs, so still not quite sure what
> it is supposed to do.
>
The enhance method comes from rake. Everything in buildr is based on rake.

>
> But I'm not sure it matters, because in my case, my master project
> doesn't have a single zip file. I wanted my master project to have an
> "empty" package task, just as you can have an empty build task. When I
> say "buildr package", I want it to invoke several package tasks in other
> projects, each of which create a zip or jar.
>
That sounds like custom stuff. I would rather define a task with a different
name for that.

>
> The final outcome of my project is a jar with an associated sha1 file,
> a .iso file, a .exe file, a zip file, another zip file, and a few other
> files. In my mind, running 'buildr build' shouldn't actually create all
> those final files. I would think I would run 'buildr package', but that
> doesn't seem to work.
>
> So I tried to get my master 'build' task to depend on the other
> packages. It wouldn't be ideal, because sometimes I would just want to
> build enough to test, and other times I would want to take the extra
> time (and prompt the user for passwords) required to create signed jars.
> But I would take a master build task for now, as a starting point.
>
> So far, that hasn't worked either. Here was my latest failed attempt,
> inside the definition of my master project:
>
>  build do
>    jar = project('utils').package(:jar)
>    unzip(_('target/utils')=>jar)
>  end
>
> As far as I can tell, it had no effect whatsoever (no errors either).
>
> Would I have to define 'install' tasks in my non-master projects? If so,
> could I automatically invoke them from master:build? It seems wrong to
> run master:install to get all the other project artifacts in place, and
> then do a master:build after that do pull them all into _('target').
>
You could define an other subproject that would call those.
That's what I would do, and it would depend on the other subprojects.
The main project is not called because it contains "nothing", no source
files in particular.

>
> Kevin
>
>
>

Reply via email to