Hi Assaf

Thanks for clarifying these points. I understand now!

The method call to .enhance {...} is cool. I didn't see it documented on the
rdoc for 1.2.10 - am I looking in the wrong place? The only enhance() I can
see is for JPA.

Dave


Assaf Arkin wrote:
> 
> On 1/20/08, dhpeterson <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> Hi everyone,
>>
>> I've been playing around packaging a non-maven dependency for use within
>> a
>> buildr project. Specifically, I'm using an SMTP library called Ristretto,
>> which is not available in a POM format.
>>
>> An extract of my Rakefile is below:
>>
>> ===
>> ...
>> RISTRETTO_URL       =
>> "
>> http://internap.dl.sourceforge.net/sourceforge/columba/ristretto-1.0-bin.zip
>> "
>> ...
>>
>>
>> define "proj" do
>>
>>   # ristretto packager
>>   ristretto_zip = download("temp/ristretto.zip"=>RISTRETTO_URL)
>>   ristretto_jar =
>> file("temp/ristretto/ristretto-1.0-bin/ristretto-1.0-all.jar
>> "=>unzip("temp/ristretto"=>ristretto_zip))
>>   RISTRETTO = artifact("ristretto:ristretto:jar:1.0").from(ristretto_jar)
>>
>>   define "delivery" do
>>     ...
>>     compile.with RISTRETTO
>>
>>   end
>> end
>>
>> ===
>>
>>
>> After some trial and error, the above Rakefile is now working ... but I
>> have
>> some questions in relation to what I have done:
>>
>>
>> 1. Unzip paths
>>
>> When I download into the (top-level) /temp directory, it seems that I can
>> only unzip when I specify a sub-directory within temp/, i.e.
>>
>> unzip("temp/ristretto"=>ristretto_zip)
>>
>> The ristretto zipfile unpacks with a top-level directory of
>> "ristretto-1.0-bin", but if I specify the following unzip command:
>>
>> unzip("temp"=>ristretto_zip)
>>
>> no unzip operation seems to occur within the temp/ directory.
>>
>> Is this a bug in unzip() or something I am doing wrong?
> 
> 
> The unzip task is basically a file dependency between the target directory
> and Zip file.  If the target directory doesn't exist, or the Zip file is
> newer than the target directory, the task runs and unzips.
> 
> 
> 2. Location of dependency scripting
>>
>>
>> I tried putting the ristretto building commands in several different
>> scopes
>> before I had success.
>>
>> When I tried to put them inside the define "delivery" block (i.e. within
>> the
>> project that actually requires the dependency), I observed that the
>> download() command worked successfully (file downloaded into
>> /temp/ristretto.zip), but the unzip() command went looking for the files
>> in
>> /delivery/temp/ instead.
> 
> 
> I think I know what the bug is with download putting it in /temp instead
> of
> /delivery/temp.
> 
> 
> I did try to experiment with _() (path-to) in order to build up the right
>> path strings but I did not have any success.
>>
>> When I tried moving all the dep scripting outside of the main project
>> task
>> altogether (i.e. at the top of the Rakefile where all my other artifacts
>> are
>> defined), I ran into trouble also. The compile.with RISTRETTO task within
>> the sub-project wasn't able to understand some of the definitions.
>>
>> The exact error I received when the tasks were moved outside the main
>> define
>> block was:
>>
>> rake aborted!
>> Don't know how to build task
>> '/home/peterson/workspace/returnity/temp/xyz/ristretto-1.0-bin/ristretto-
>> 1.0-all.jar'
>>
>>
>> In the end, I found that it worked when I put the scripting within the
>> outer
>> project block (define "proj" do ... end), but outside of the actual
>> sub-project (define "delivery" do ... end) that uses the dep.
>>
>>
>> 3. Cleanup
>>
>> Any idea how I can clean-up the contents of temp/ after the script has
>> built
>> and installed the custom dependency? Where should I hook this in to the
>> build process?
> 
> 
> One option is to enhance the clean task:
> 
> clean do
>   rm_rf 'temp'
> end
> 
> Another option is to do it immediately after copying the JAR, by enhancing
> the artifact task itself:
> 
> artifact("ristretto:ristretto:jar:1.0").from(ristretto_jar).enhance {
> rm_rf
> 'temp' }
> 
> Assaf
> 
> As I'm still very new to Buildr, any tips/hints on how to handle these
>> issues would be much appreciated!
>>
>>
>> Dave
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Packaging-non-maven-deps-using-buildr-tp14989567p14989567.html
>> Sent from the Buildr - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Packaging-non-maven-deps-using-buildr-tp14989567p15010391.html
Sent from the Buildr - User mailing list archive at Nabble.com.

Reply via email to