Pretty cool.

You guys feel free to do what you want with respect to the addon 
implementation.  I'm just glad to have gotten something relatively un-hideous 
to work.


On Aug 27, 2010, at 10:28 AM, Alex Boisvert wrote:

> On Thu, Aug 26, 2010 at 9:18 PM, Mark Petrovic <[email protected]> wrote:
> 
>> This works:
>> 
>>   xjcOutput=path_to('target/generated-sources/xjc')
>>   xjc = file(xjcOutput => sources) do |dir|
>>     ant('xjc') do |ant|
>>       mkdir_p xjcOutput
>>       cp = Buildr.artifacts("javax.xml.bind:jaxb-api:jar:2.2.1",
>> "com.sun.xml.bind:jaxb-impl:jar:2.2.1",
>>                             "com.sun.xml.bind:jaxb-xjc:jar:2.2.1").each(&
>> :invoke).map(& :name).join(File::PATH_SEPARATOR)
>>       ant.taskdef :name=>"xjc", :classname=>"com.sun.tools.xjc.XJCTask",
>> :classpath=>cp
>>       ant.xjc :schema=>path_to("src/main/resources/c.xsd"),
>> :destdir=>path_to(xjcOutput), :package=>"org.foo.api"
>>     end
>>   end
>> 
>> How does it look?
>> 
> 
> Another improvement you could do is wire the artifact download as
> dependencies instead of calling invoke() on them directly.  This is the
> spirit of rake -- everything in the dependency graph.
> 
> To do so, you can define your artifacts outside the task,
> 
> XJC_DEPENDENCIES = %w{
> javax.xml.bind:jaxb-api:jar:2.2.1
> com.sun.xml.bind:jaxb-impl:jar:2.2.1
> com.sun.xml.bind:jaxb-xjc:jar:2.2.1
> }
> 
> xjc = file(xjcOutput => [sources] + Buildr.artifacts(XJC_DEPENDENCIES)) do
> |dir|
>   ...
> end
> 
> alex


--
Mark Petrovic


Reply via email to