On Tuesday, 2 October 2012 17:13:15 UTC+1, Thomas Nagy wrote:
> On Tue, Oct 2, 2012 at 2:03 PM, Mihai Rotaru wrote:
> > I'm working on a waf tool for htmlcompressor.
> > However, I'm having trouble understanding how the tool system works. The
> > wiki page on creating tools
> > is too high-level for me, since it assumes knowledge of waf's inner
> > workings.
> > My intention is to make a basic tool which would allow usage like the
> > following:
> > sources = ['index.html']
> > def configure( ctx ):
> > ctx.load( 'htmlcompressor' )
> > def build( bld ):
> > bld.compress_html( sources )
> > I have attached what I have so far, but it's not working. I created the
> task
> > class,
> > but how do I use it in the build function ?
> You could call bld(source='foo.html') for example, but since your tool
> does not specify output files, it would not work. Try something like
> this instead:
> @waflib.Configure.conf
> def compress_html(ctx, lst)
> for x in lst:
> bld(rule='java -jar ${HTML_COMPRESSOR} ${SRC} -o ${TGT}',
> source=x, target="html/%s" % x)
> Thomas