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: FileTasks as dependencies
Date Thu, 17 Nov 2011 18:05:50 GMT
Actually, now that I checked compile.with and tested it, I know that it
should work "as-is".

Your previous example/test:

compile.with file( _("test.txt") ) do |t|
  File.open(t.name, 'w') {|f| f.write("test") }
end

is wrong because it passes the block to compile.with.    If you separate
the task creation and pass it as an argument to compile.with, it will work.

  test_txt = file( _("test.txt") ) do |t|
    File.open(t.name, 'w') { |f| f.write("test") }
  end

  compile.with test_txt

so you can remove your haxelib.invoke call from your haxelib method and
simply return the task.

alex

On Thu, Nov 17, 2011 at 9:50 AM, Dominic Graefen
<dominic.graefen@gmail.com>wrote:

> Okay, one problem persists:
> It will now of course also download the library when an unrelated task is
> invoked like "clean".
>
> Would monkey patching be the only way to get this working in compile.with?
>
>
> --
> Dominic Graefen
> Freelance: Interactive Developer / Creative Technologist
> devboy.org
>
>
> On Thursday, November 17, 2011 at 5:22 PM, Dominic Graefen wrote:
>
> > Ahh, just looked at how project() does it, and the task is invoked
> manually.
> >
> >   def haxelib spec
> >     haxelib = HaxeLib.lookup(spec)
> >     haxelib.invoke
> >     haxelib
> >   end
> >
> >
> > Does the trick then ;)
> >
> > Thanks
> >
> > --
> > Dominic Graefen
> > Freelance: Interactive Developer / Creative Technologist
> > devboy.org (http://devboy.org)
> >
> >
> > On Thursday, November 17, 2011 at 5:21 PM, Dominic Graefen wrote:
> >
> > > But I want to provide a nicer API, like:
> > > compile.with haxelib("nodejs:0.6")
> > > And I got this working:
> > > compile.from haxelib("nodejs:0.6")
> > >
> > > --
> > > Dominic Graefen
> > > Freelance: Interactive Developer / Creative Technologist
> > > devboy.org (http://devboy.org)
> > >
> > >
> > > On Thursday, November 17, 2011 at 5:15 PM, Alex Boisvert wrote:
> > >
> > > > Try,
> > > >
> > > > compile.enhance [ ... tasks ... ]
> > > >
> > > > to add task prerequisites/dependencies to it.
> > > >
> > > > alex
> > > >
> > > > On Thu, Nov 17, 2011 at 8:01 AM, Dominic Graefen
> > > > <dominic.graefen@gmail.com (mailto:dominic.graefen@gmail.com)>wrote:
> > > >
> > > > > Hey guys,
> > > > >
> > > > > I need to implement a way to install dependencies that are not
> maven
> > > > > artifacts, as the language (haXe) uses its own package-manager.
> > > > > Now I found out that compile.with won't invoke FileTasks:
> > > > >
> > > > > compile.with file( _("test.txt") ) do |t|
> > > > > File.open(t.name (http://t.name), 'w') {|f| f.write("test") }
> > > > > end
> > > > >
> > > > >
> > > > > But compile.from works fine:
> > > > >
> > > > > compile.from file( _("test.txt") ) do |t|
> > > > > File.open(t.name (http://t.name), 'w') {|f| f.write("test") }
> > > > > end
> > > > >
> > > > >
> > > > > Now I am wondering on how to implement this?
> > > > > ActAsArtifact & Artifact have too many maven hooks to be suitable
> for this
> > > > > package manager.
> > > > >
> > > > > My current attempt can be found here:
> > > > >
> https://github.com/devboy/buildr-hx/blob/636b9d148818745bd8b097cefb7e49e37ecf86fb/lib/buildr/hx/core/haxe_lib.rb
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> >
>
>

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