You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by da...@dotech.com on 2004/04/01 14:55:23 UTC

hotswap via ant

I'd like to not only build (using Ant) when I'm using VIM, but hotdeploy the
class changes to a running app. I use ant.vim and it works very nicely. Then, I
wrote a hotswap client using JDI. Now, I can run that via the commandline, but
I'd rather integrate it into Ant.
I toyed with doing a separate task, but I thought I'd just end up redoing some
code that was already in <javac>. So, for a proof of concept, I've added some
attributes to the <javac> task and am in the process of finishing the
connections to the hot swap code. Basicly, once the compile is done, if hotswap
was enabled, it would connect to the VM and push those class files over.

First, does anyone have any better idea of how I could integrate the hotswap
feature into Ant?
Second, is there a good way to get a list of the actual fully qualified class
names that were compiled? I have the list of files, but I'd have to try to
parse out the class name, which I don't have a good solution for yet. I just
really need the classes dir (destDir) and the names of all the classes to be
replaced in the VM.

Thanks,
David



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by David Kavanagh <da...@dotech.com>.
I just finished coding it to work for shared memory or host/port. I had 
tested those with my helper class, but not from ant before.
I have failonerror in there also. I'm trying to borrow from other 
taskdefs as much as possible. both to maintain consistency and to re-use 
already debugged code!
I was going to update one class at a time, but I could do it either way. 
Do you think it is worth making it an option on the task?

As far as querying the VM capabilities. I have tried with jdk1.4.1_06 
and it supports class replacement, but not adding methods. So, I only 
test for the first.
BTW, I'm going to play with the <outofdate> task from ant-contrib as the 
preferred way to build the list of classes. If changes are made to 
<tstamp> and the <date> targets to support finer granularity, that could 
work also.

David

Thus Spoke Peter Leschev:

>Hi David,
>
>                    Looking good!
>
>            A couple of suggestions:
>                - Currently it looks like you can only pass the port for the
>VM's debug port. It would be useful if you can specify a host as well (just
>default it to localhost so the user doesn't have to specify it if they don't
>need it).
>                - How does the task handle failure*? Does the task fail the
>build if the hotswap fails? Having this configurable would be good.
>                - Do you call defineClasses for each class, or do you group
>the whole update into one big defineClasses call? Calling it for each class
>ensures you update as many classes as possible (and are able to skip the
>dodgy* updates), but I'm sure it would be slower than doing one whole
>update.
>
>Regards,
>Pete
>
>* failure could occur if the class has changed in such a way (deleting a
>method for example) that the VM currently doesn't support.
>
>----- Original Message ----- 
>From: "David Kavanagh" <da...@dotech.com>
>To: "Matt Benson" <gu...@yahoo.com>
>Cc: "Ant Developers List" <de...@ant.apache.org>
>Sent: Saturday, April 03, 2004 2:14 AM
>Subject: Re: hotswap via ant
>
>
>  
>
>>It's Alive! Now, I just need some help working out the file selection
>>part. (which is using existing Ant constructs).
>>Here is a sample of my build file.
>>
>><target name="hotswap" depends="init" description="Compile and Hotswap
>>changed classes">
>>    <taskdef name="hotswap"
>>classname="org.apache.tools.ant.taskdefs.Hotswap"/>
>>    <mkdir dir="${build.classes.dir}"/>
>>    <tstamp>
>>        <format property="class.stamp" pattern="MM/dd/yyyy hh:mm" />
>>    </tstamp>
>>    <echo message="timestamp = ${class.stamp}"/>
>>    <javac .../>
>>    <hotswap verbose="true" hotswap="true" hsaddress="9000">
>>        <fileset dir="${build.classes.dir}" includes="**/*.class">
>>            <date datetime="${class.stamp} AM" when="after"/>
>>        </fileset>
>>    </hotswap>
>></target>
>>
>>This is an example of the timestamp that is returned. Is there a way to
>>get this to use seconds as well? The granularity doesn't seem good
>>enough for my purpose.
>>     [echo] timestamp = 04/02/2004 11:07
>>
>>In the <date>, it requires the AM or PM part, which I'm just putting in
>>by hand (which isn't good either). Is there a better way to select files
>>that have changed in the classes dir since the javac has run?
>>
>>Once I get this worked out, I'll clean up the task a little and make it
>>available for everyone to try. (and provide some docs as well!)
>>
>>Thanks,
>>David
>>
>>PS. I tested this by coding a specific class filename, since the date
>>thing isn't working yet.
>>
>>Thus Spoke Matt Benson:
>>
>>    
>>
>>>http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect
>>>
>>>You would have to use a nested <format> element in
>>>your <tstamp> to create the date in the right format
>>>for the date selector, but aside from that I can't see
>>>any problems...
>>>
>>>-Matt
>>>
>>>--- dak@dotech.com wrote:
>>>
>>>
>>>      
>>>
>>>>This sounds good to me! The less grunt work I have
>>>>to do in my task, the better!
>>>>I grabbed teh 1.6.1 source release and built it. If
>>>>you could point me to the
>>>><date> file selector you mention, it would help me a
>>>>lot. I just poked around
>>>>and it didn't jump out at me. I would like it if my
>>>>task could just deal with a
>>>>list of class files provided via some built-in
>>>>filtering means.
>>>>
>>>>Thanks,
>>>>David
>>>>
>>>>Quoting Matt Benson <gu...@yahoo.com>:
>>>>
>>>>
>>>>
>>>>        
>>>>
>>>>>Basically you should make any task as atomic as
>>>>>possible.  So all your task would need to know
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>about
>>>>
>>>>
>>>>        
>>>>
>>>>>is a <fileset>.  Then it becomes the user's
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>problem
>>>>
>>>>
>>>>        
>>>>
>>>>>how to select which files to include.  One way
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>might
>>>>
>>>>
>>>>        
>>>>
>>>>>be to use a <tstamp>
>>>>>to set a baseline time, then compile, then use a
>>>>><date> file selector to get the updated classes.
>>>>>Another way might use ant-contrib's <outofdate> to
>>>>>determine which sources should be recompiled.  You
>>>>>could then compile only those sources to some
>>>>>temporary build area, then hotswap only those
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>classes.
>>>>
>>>>
>>>>        
>>>>
>>>>>The point is that others have designed ways in
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>which
>>>>
>>>>
>>>>        
>>>>
>>>>>the files can be selected, so you gain maximum
>>>>>flexibility (and minimum RESPONSIBILITY) the less
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>your
>>>>
>>>>
>>>>        
>>>>
>>>>>Task is expected to do.
>>>>>
>>>>>-Matt
>>>>>
>>>>>--- dak@dotech.com wrote:
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>>>When I was toying with a separate task, I
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>wondered
>>>>
>>>>
>>>>        
>>>>
>>>>>>if <uptodate> could be use
>>>>>>somehow to create a <fileset>. I don't see now,
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>but
>>>>
>>>>
>>>>        
>>>>
>>>>>>that would sure be a nice
>>>>>>feature. Then, if I could assign an ID so I
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>could
>>>>
>>>>
>>>>        
>>>>
>>>>>>make a <fileset> of files
>>>>>>that aren't uptodate, run the compile, then take
>>>>>>that same <fileset> as input
>>>>>>to the <hotswap> target.
>>>>>>The idea of a timestamp file could work. The
>>>>>>sequence might be something like.
>>>>>><touch file="timestamp"/>
>>>>>><javac .../>
>>>>>><hotswap classesdir="foo" host="localhost"
>>>>>>port="9000" timefile="timestamp">
>>>>>> <patternset>
>>>>>>    ... some pattern to apply to the classes
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>dir
>>>>
>>>>
>>>>        
>>>>
>>>>>>...
>>>>>> </patternset>
>>>>>></hotswap>
>>>>>>
>>>>>>That way, the hotswap task would check the files
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>in
>>>>
>>>>
>>>>        
>>>>
>>>>>>the classes dir based on the
>>>>>>patternset and/or the timestamp.
>>>>>>
>>>>>>Seriously, I'm open to feedback. I might as well
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>do
>>>>
>>>>
>>>>        
>>>>
>>>>>>it right the first time!
>>>>>>
>>>>>>David
>>>>>>
>>>>>>Quoting Steve Loughran <st...@iseran.com>:
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>Yahoo! Small Business $15K Web Design Giveaway
>>>http://promotions.yahoo.com/design_giveaway/
>>>
>>>
>>>      
>>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>  
>

Re: hotswap via ant

Posted by Peter Leschev <pe...@leschev.com>.
Hi David,

                    Looking good!

            A couple of suggestions:
                - Currently it looks like you can only pass the port for the
VM's debug port. It would be useful if you can specify a host as well (just
default it to localhost so the user doesn't have to specify it if they don't
need it).
                - How does the task handle failure*? Does the task fail the
build if the hotswap fails? Having this configurable would be good.
                - Do you call defineClasses for each class, or do you group
the whole update into one big defineClasses call? Calling it for each class
ensures you update as many classes as possible (and are able to skip the
dodgy* updates), but I'm sure it would be slower than doing one whole
update.

Regards,
Pete

* failure could occur if the class has changed in such a way (deleting a
method for example) that the VM currently doesn't support.

----- Original Message ----- 
From: "David Kavanagh" <da...@dotech.com>
To: "Matt Benson" <gu...@yahoo.com>
Cc: "Ant Developers List" <de...@ant.apache.org>
Sent: Saturday, April 03, 2004 2:14 AM
Subject: Re: hotswap via ant


> It's Alive! Now, I just need some help working out the file selection
> part. (which is using existing Ant constructs).
> Here is a sample of my build file.
>
> <target name="hotswap" depends="init" description="Compile and Hotswap
> changed classes">
>     <taskdef name="hotswap"
> classname="org.apache.tools.ant.taskdefs.Hotswap"/>
>     <mkdir dir="${build.classes.dir}"/>
>     <tstamp>
>         <format property="class.stamp" pattern="MM/dd/yyyy hh:mm" />
>     </tstamp>
>     <echo message="timestamp = ${class.stamp}"/>
>     <javac .../>
>     <hotswap verbose="true" hotswap="true" hsaddress="9000">
>         <fileset dir="${build.classes.dir}" includes="**/*.class">
>             <date datetime="${class.stamp} AM" when="after"/>
>         </fileset>
>     </hotswap>
> </target>
>
> This is an example of the timestamp that is returned. Is there a way to
> get this to use seconds as well? The granularity doesn't seem good
> enough for my purpose.
>      [echo] timestamp = 04/02/2004 11:07
>
> In the <date>, it requires the AM or PM part, which I'm just putting in
> by hand (which isn't good either). Is there a better way to select files
> that have changed in the classes dir since the javac has run?
>
> Once I get this worked out, I'll clean up the task a little and make it
> available for everyone to try. (and provide some docs as well!)
>
> Thanks,
> David
>
> PS. I tested this by coding a specific class filename, since the date
> thing isn't working yet.
>
> Thus Spoke Matt Benson:
>
> >http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect
> >
> >You would have to use a nested <format> element in
> >your <tstamp> to create the date in the right format
> >for the date selector, but aside from that I can't see
> >any problems...
> >
> >-Matt
> >
> >--- dak@dotech.com wrote:
> >
> >
> >>This sounds good to me! The less grunt work I have
> >>to do in my task, the better!
> >>I grabbed teh 1.6.1 source release and built it. If
> >>you could point me to the
> >><date> file selector you mention, it would help me a
> >>lot. I just poked around
> >>and it didn't jump out at me. I would like it if my
> >>task could just deal with a
> >>list of class files provided via some built-in
> >>filtering means.
> >>
> >>Thanks,
> >>David
> >>
> >>Quoting Matt Benson <gu...@yahoo.com>:
> >>
> >>
> >>
> >>>Basically you should make any task as atomic as
> >>>possible.  So all your task would need to know
> >>>
> >>>
> >>about
> >>
> >>
> >>>is a <fileset>.  Then it becomes the user's
> >>>
> >>>
> >>problem
> >>
> >>
> >>>how to select which files to include.  One way
> >>>
> >>>
> >>might
> >>
> >>
> >>>be to use a <tstamp>
> >>>to set a baseline time, then compile, then use a
> >>><date> file selector to get the updated classes.
> >>>Another way might use ant-contrib's <outofdate> to
> >>>determine which sources should be recompiled.  You
> >>>could then compile only those sources to some
> >>>temporary build area, then hotswap only those
> >>>
> >>>
> >>classes.
> >>
> >>
> >>> The point is that others have designed ways in
> >>>
> >>>
> >>which
> >>
> >>
> >>>the files can be selected, so you gain maximum
> >>>flexibility (and minimum RESPONSIBILITY) the less
> >>>
> >>>
> >>your
> >>
> >>
> >>>Task is expected to do.
> >>>
> >>>-Matt
> >>>
> >>>--- dak@dotech.com wrote:
> >>>
> >>>
> >>>>When I was toying with a separate task, I
> >>>>
> >>>>
> >>wondered
> >>
> >>
> >>>>if <uptodate> could be use
> >>>>somehow to create a <fileset>. I don't see now,
> >>>>
> >>>>
> >>but
> >>
> >>
> >>>>that would sure be a nice
> >>>>feature. Then, if I could assign an ID so I
> >>>>
> >>>>
> >>could
> >>
> >>
> >>>>make a <fileset> of files
> >>>>that aren't uptodate, run the compile, then take
> >>>>that same <fileset> as input
> >>>>to the <hotswap> target.
> >>>>The idea of a timestamp file could work. The
> >>>>sequence might be something like.
> >>>><touch file="timestamp"/>
> >>>><javac .../>
> >>>><hotswap classesdir="foo" host="localhost"
> >>>>port="9000" timefile="timestamp">
> >>>>  <patternset>
> >>>>     ... some pattern to apply to the classes
> >>>>
> >>>>
> >>dir
> >>
> >>
> >>>>...
> >>>>  </patternset>
> >>>></hotswap>
> >>>>
> >>>>That way, the hotswap task would check the files
> >>>>
> >>>>
> >>in
> >>
> >>
> >>>>the classes dir based on the
> >>>>patternset and/or the timestamp.
> >>>>
> >>>>Seriously, I'm open to feedback. I might as well
> >>>>
> >>>>
> >>do
> >>
> >>
> >>>>it right the first time!
> >>>>
> >>>>David
> >>>>
> >>>>Quoting Steve Loughran <st...@iseran.com>:
> >>>>
> >>>>
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Small Business $15K Web Design Giveaway
> >http://promotions.yahoo.com/design_giveaway/
> >
> >
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by David Kavanagh <da...@dotech.com>.
never mind about the <outofdate>, solved my own problem!

Thus Spoke David Kavanagh:

> Matt,
> Have you used the <outofdate> target from ant-contrib? I'm not having 
> any luck. I have 0.6 (and even tried building it myself from the 
> sources).
> I have run the <stopwatch> task, so I know the library is being picked 
> up. I get this error when it hits my <outofdate> target.
>
> BUILD FAILED
> C:\view\dkavanag\1411_view\payx\inc\inc_comm.xml:115: 
> C:\view\dkavanag\1411_view
> \payx\payentry\dev\1.4 not found.
>
> Here is what my build.xml looks like (part of it anyway)
>
>    <outofdate verbose="true" property="doswap" 
> outputtargets="swap.classes">
>        <sourcefiles>
>            <fileset dir="${build.source}" includes="**/*.java"/>
>        </sourcefiles>
>        <mapper type="regexp" from="^(.*)\.java$$" 
> to="../${build.classes.dir}/\1.class"/>
>    </outofdate>
>
> Line 115 is that first line in the <outofdate> task.
>
> Any pointers would be great. I think I'm done with the <hotswap> task 
> itself... just like to test with the supporting cast...
>
> David
>
> Thus Spoke Matt Benson:
>
>> You should be able to use the date pattern "MM/dd/yyyy
>> hh:mm a" to add the AM/PM to your date.  That's wild
>> that the date selector doesn't use seconds.  Two
>> possibilities come to mind:
>>
>> -sleep for a minute after generating the timestamp. :(
>> -use ant-contrib's <outofdate> task to set a
>> comma-delimited list of out-of-date target files into
>> a property, to be used as the includes attribute of a
>> <fileset>.
>>
>> In Ant, two things that would also make sense:
>> -Add a format attribute to the date selector,
>> defaulting to the current one.
>> -Add a millis attribute to <tstamp>, incompatible with
>> its pattern attribute.
>>
>> -Matt
>>
>> --- David Kavanagh <da...@dotech.com> wrote:
>>  
>>
>>> It's Alive! Now, I just need some help working out
>>> the file selection part. (which is using existing Ant constructs).
>>> Here is a sample of my build file.
>>>
>>> <target name="hotswap" depends="init"
>>> description="Compile and Hotswap changed classes">
>>>    <taskdef name="hotswap" 
>>> classname="org.apache.tools.ant.taskdefs.Hotswap"/>
>>>    <mkdir dir="${build.classes.dir}"/>      <tstamp>
>>>        <format property="class.stamp"
>>> pattern="MM/dd/yyyy hh:mm" />
>>>    </tstamp>
>>>    <echo message="timestamp = ${class.stamp}"/>
>>>    <javac .../>
>>>    <hotswap verbose="true" hotswap="true"
>>> hsaddress="9000">
>>>        <fileset dir="${build.classes.dir}"
>>> includes="**/*.class">
>>>            <date datetime="${class.stamp} AM"
>>> when="after"/>
>>>        </fileset>
>>>    </hotswap>
>>> </target>
>>>
>>> This is an example of the timestamp that is
>>> returned. Is there a way to get this to use seconds as well? The 
>>> granularity
>>> doesn't seem good enough for my purpose.
>>>     [echo] timestamp = 04/02/2004 11:07
>>>
>>> In the <date>, it requires the AM or PM part, which
>>> I'm just putting in by hand (which isn't good either). Is there a 
>>> better
>>> way to select files that have changed in the classes dir since the 
>>> javac
>>> has run?
>>>
>>> Once I get this worked out, I'll clean up the task a
>>> little and make it available for everyone to try. (and provide some
>>> docs as well!)
>>>
>>> Thanks,
>>> David
>>>
>>> PS. I tested this by coding a specific class
>>> filename, since the date thing isn't working yet.
>>>
>>> Thus Spoke Matt Benson:
>>>
>>>
>>> http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect
>>>   
>>>
>>>> You would have to use a nested <format> element in
>>>> your <tstamp> to create the date in the right
>>>>     
>>>
>>> format
>>>   
>>>
>>>> for the date selector, but aside from that I can't
>>>>     
>>>
>>> see
>>>   
>>>
>>>> any problems...
>>>>
>>>> -Matt
>>>>
>>>> --- dak@dotech.com wrote:
>>>>
>>>>
>>>>     
>>>>
>>>>> This sounds good to me! The less grunt work I have
>>>>> to do in my task, the better!
>>>>> I grabbed teh 1.6.1 source release and built it.
>>>>>       
>>>>
>>> If
>>>   
>>>
>>>>> you could point me to the
>>>>> <date> file selector you mention, it would help me
>>>>>       
>>>>
>>> a
>>>   
>>>
>>>>> lot. I just poked around
>>>>> and it didn't jump out at me. I would like it if
>>>>>       
>>>>
>>> my
>>>   
>>>
>>>>> task could just deal with a
>>>>> list of class files provided via some built-in
>>>>> filtering means.
>>>>>
>>>>> Thanks,
>>>>> David
>>>>>
>>>>> Quoting Matt Benson <gu...@yahoo.com>:
>>>>>
>>>>>  
>>>>>       
>>>>>
>>>>>> Basically you should make any task as atomic as
>>>>>> possible.  So all your task would need to know
>>>>>>    
>>>>>>         
>>>>>
>>>>> about
>>>>>  
>>>>>       
>>>>>
>>>>>> is a <fileset>.  Then it becomes the user's
>>>>>>    
>>>>>>         
>>>>>
>>>>> problem
>>>>>  
>>>>>       
>>>>>
>>>>>> how to select which files to include.  One way
>>>>>>    
>>>>>>         
>>>>>
>>>>> might
>>>>>  
>>>>>       
>>>>>
>>>>>> be to use a <tstamp>
>>>>>> to set a baseline time, then compile, then use a
>>>>>> <date> file selector to get the updated classes. Another way 
>>>>>> might use ant-contrib's <outofdate>
>>>>>>         
>>>>>
>>> to
>>>   
>>>
>>>>>> determine which sources should be recompiled.         
>>>>>
>>> You
>>>   
>>>
>>>>>> could then compile only those sources to some
>>>>>> temporary build area, then hotswap only those
>>>>>>    
>>>>>>         
>>>>>
>>>>> classes.
>>>>>  
>>>>>       
>>>>>
>>>>>> The point is that others have designed ways in
>>>>>>    
>>>>>>         
>>>>>
>>>>> which
>>>>>  
>>>>>       
>>>>>
>>>>>> the files can be selected, so you gain maximum
>>>>>> flexibility (and minimum RESPONSIBILITY) the less
>>>>>>    
>>>>>>         
>>>>>
>>>>> your
>>>>>  
>>>>>       
>>>>>
>>>>>> Task is expected to do.
>>>>>>
>>>>>> -Matt
>>>>>>
>>>>>> --- dak@dotech.com wrote:
>>>>>>    
>>>>>>         
>>>>>>
>>>>>>> When I was toying with a separate task, I
>>>>>>>      
>>>>>>>           
>>>>>>
>>>>> wondered
>>>>>  
>>>>>       
>>>>>
>>>>>>> if <uptodate> could be use
>>>>>>> somehow to create a <fileset>. I don't see now,
>>>>>>>      
>>>>>>>           
>>>>>>
>>>>> but
>>>>>  
>>>>>       
>>>>>
>>>>>>> that would sure be a nice
>>>>>>> feature. Then, if I could assign an ID so I
>>>>>>>      
>>>>>>>           
>>>>>>
>>>>> could
>>>>>  
>>>>>       
>>>>>
>>>>>>> make a <fileset> of files
>>>>>>> that aren't uptodate, run the compile, then take
>>>>>>> that same <fileset> as input
>>>>>>> to the <hotswap> target.
>>>>>>> The idea of a timestamp file could work. The
>>>>>>> sequence might be something like.
>>>>>>> <touch file="timestamp"/>
>>>>>>> <javac .../>
>>>>>>> <hotswap classesdir="foo" host="localhost"
>>>>>>> port="9000" timefile="timestamp">
>>>>>>> <patternset>
>>>>>>>    ... some pattern to apply to the classes
>>>>>>>      
>>>>>>>           
>>>>>>
>>>>> dir
>>>>>  
>>>>>       
>>>>>
>>>>>>> ...
>>>>>>> </patternset>
>>>>>>> </hotswap>
>>>>>>>
>>>>>>> That way, the hotswap task would check the files
>>>>>>>      
>>>>>>>           
>>>>>>
>>>>> in
>>>>>  
>>>>>       
>>>>>
>>>>>>> the classes dir based on the
>>>>>>> patternset and/or the timestamp.
>>>>>>>
>>>>>>> Seriously, I'm open to feedback. I might as well
>>>>>>>      
>>>>>>>           
>>>>>>
>>>>> do
>>>>>  
>>>>>       
>>>>>
>>>>>>> it right the first time!
>>>>>>>
>>>>>>>           
>>>>>>
>> === message truncated ===
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> Yahoo! Small Business $15K Web Design Giveaway 
>> http://promotions.yahoo.com/design_giveaway/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>> For additional commands, e-mail: dev-help@ant.apache.org
>>  
>>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by David Kavanagh <da...@dotech.com>.
Matt,
Have you used the <outofdate> target from ant-contrib? I'm not having 
any luck. I have 0.6 (and even tried building it myself from the sources).
I have run the <stopwatch> task, so I know the library is being picked 
up. I get this error when it hits my <outofdate> target.

BUILD FAILED
C:\view\dkavanag\1411_view\payx\inc\inc_comm.xml:115: 
C:\view\dkavanag\1411_view
\payx\payentry\dev\1.4 not found.

Here is what my build.xml looks like (part of it anyway)

    <outofdate verbose="true" property="doswap" 
outputtargets="swap.classes">
        <sourcefiles>
            <fileset dir="${build.source}" includes="**/*.java"/>
        </sourcefiles>
        <mapper type="regexp" from="^(.*)\.java$$" 
to="../${build.classes.dir}/\1.class"/>
    </outofdate>

Line 115 is that first line in the <outofdate> task.

Any pointers would be great. I think I'm done with the <hotswap> task 
itself... just like to test with the supporting cast...

David

Thus Spoke Matt Benson:

>You should be able to use the date pattern "MM/dd/yyyy
>hh:mm a" to add the AM/PM to your date.  That's wild
>that the date selector doesn't use seconds.  Two
>possibilities come to mind:
>
>-sleep for a minute after generating the timestamp. :(
>-use ant-contrib's <outofdate> task to set a
>comma-delimited list of out-of-date target files into
>a property, to be used as the includes attribute of a
><fileset>.
>
>In Ant, two things that would also make sense:
>-Add a format attribute to the date selector,
>defaulting to the current one.
>-Add a millis attribute to <tstamp>, incompatible with
>its pattern attribute.
>
>-Matt
>
>--- David Kavanagh <da...@dotech.com> wrote:
>  
>
>>It's Alive! Now, I just need some help working out
>>the file selection 
>>part. (which is using existing Ant constructs).
>>Here is a sample of my build file.
>>
>><target name="hotswap" depends="init"
>>description="Compile and Hotswap 
>>changed classes">
>>    <taskdef name="hotswap" 
>>classname="org.apache.tools.ant.taskdefs.Hotswap"/>
>>    <mkdir dir="${build.classes.dir}"/>   
>>    <tstamp>
>>        <format property="class.stamp"
>>pattern="MM/dd/yyyy hh:mm" />
>>    </tstamp>
>>    <echo message="timestamp = ${class.stamp}"/>
>>    <javac .../>
>>    <hotswap verbose="true" hotswap="true"
>>hsaddress="9000">
>>        <fileset dir="${build.classes.dir}"
>>includes="**/*.class">
>>            <date datetime="${class.stamp} AM"
>>when="after"/>
>>        </fileset>
>>    </hotswap>
>></target>
>>
>>This is an example of the timestamp that is
>>returned. Is there a way to 
>>get this to use seconds as well? The granularity
>>doesn't seem good 
>>enough for my purpose.
>>     [echo] timestamp = 04/02/2004 11:07
>>
>>In the <date>, it requires the AM or PM part, which
>>I'm just putting in 
>>by hand (which isn't good either). Is there a better
>>way to select files 
>>that have changed in the classes dir since the javac
>>has run?
>>
>>Once I get this worked out, I'll clean up the task a
>>little and make it 
>>available for everyone to try. (and provide some
>>docs as well!)
>>
>>Thanks,
>>David
>>
>>PS. I tested this by coding a specific class
>>filename, since the date 
>>thing isn't working yet.
>>
>>Thus Spoke Matt Benson:
>>
>>
>>http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect
>>    
>>
>>>You would have to use a nested <format> element in
>>>your <tstamp> to create the date in the right
>>>      
>>>
>>format
>>    
>>
>>>for the date selector, but aside from that I can't
>>>      
>>>
>>see
>>    
>>
>>>any problems...
>>>
>>>-Matt
>>>
>>>--- dak@dotech.com wrote:
>>> 
>>>
>>>      
>>>
>>>>This sounds good to me! The less grunt work I have
>>>>to do in my task, the better!
>>>>I grabbed teh 1.6.1 source release and built it.
>>>>        
>>>>
>>If
>>    
>>
>>>>you could point me to the
>>>><date> file selector you mention, it would help me
>>>>        
>>>>
>>a
>>    
>>
>>>>lot. I just poked around
>>>>and it didn't jump out at me. I would like it if
>>>>        
>>>>
>>my
>>    
>>
>>>>task could just deal with a
>>>>list of class files provided via some built-in
>>>>filtering means.
>>>>
>>>>Thanks,
>>>>David
>>>>
>>>>Quoting Matt Benson <gu...@yahoo.com>:
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>>>Basically you should make any task as atomic as
>>>>>possible.  So all your task would need to know
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>about
>>>>   
>>>>
>>>>        
>>>>
>>>>>is a <fileset>.  Then it becomes the user's
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>problem
>>>>   
>>>>
>>>>        
>>>>
>>>>>how to select which files to include.  One way
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>might
>>>>   
>>>>
>>>>        
>>>>
>>>>>be to use a <tstamp>
>>>>>to set a baseline time, then compile, then use a
>>>>><date> file selector to get the updated classes. 
>>>>>Another way might use ant-contrib's <outofdate>
>>>>>          
>>>>>
>>to
>>    
>>
>>>>>determine which sources should be recompiled. 
>>>>>          
>>>>>
>>You
>>    
>>
>>>>>could then compile only those sources to some
>>>>>temporary build area, then hotswap only those
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>classes.
>>>>   
>>>>
>>>>        
>>>>
>>>>>The point is that others have designed ways in
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>which
>>>>   
>>>>
>>>>        
>>>>
>>>>>the files can be selected, so you gain maximum
>>>>>flexibility (and minimum RESPONSIBILITY) the less
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>your
>>>>   
>>>>
>>>>        
>>>>
>>>>>Task is expected to do.
>>>>>
>>>>>-Matt
>>>>>
>>>>>--- dak@dotech.com wrote:
>>>>>     
>>>>>
>>>>>          
>>>>>
>>>>>>When I was toying with a separate task, I
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>wondered
>>>>   
>>>>
>>>>        
>>>>
>>>>>>if <uptodate> could be use
>>>>>>somehow to create a <fileset>. I don't see now,
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>but
>>>>   
>>>>
>>>>        
>>>>
>>>>>>that would sure be a nice
>>>>>>feature. Then, if I could assign an ID so I
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>could
>>>>   
>>>>
>>>>        
>>>>
>>>>>>make a <fileset> of files
>>>>>>that aren't uptodate, run the compile, then take
>>>>>>that same <fileset> as input
>>>>>>to the <hotswap> target.
>>>>>>The idea of a timestamp file could work. The
>>>>>>sequence might be something like.
>>>>>><touch file="timestamp"/>
>>>>>><javac .../>
>>>>>><hotswap classesdir="foo" host="localhost"
>>>>>>port="9000" timefile="timestamp">
>>>>>> <patternset>
>>>>>>    ... some pattern to apply to the classes
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>dir
>>>>   
>>>>
>>>>        
>>>>
>>>>>>...
>>>>>> </patternset>
>>>>>></hotswap>
>>>>>>
>>>>>>That way, the hotswap task would check the files
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>in
>>>>   
>>>>
>>>>        
>>>>
>>>>>>the classes dir based on the
>>>>>>patternset and/or the timestamp.
>>>>>>
>>>>>>Seriously, I'm open to feedback. I might as well
>>>>>>       
>>>>>>
>>>>>>            
>>>>>>
>>>>do
>>>>   
>>>>
>>>>        
>>>>
>>>>>>it right the first time!
>>>>>>
>>>>>>            
>>>>>>
>=== message truncated ===
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Small Business $15K Web Design Giveaway 
>http://promotions.yahoo.com/design_giveaway/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>  
>

Re: hotswap via ant

Posted by Matt Benson <gu...@yahoo.com>.
You should be able to use the date pattern "MM/dd/yyyy
hh:mm a" to add the AM/PM to your date.  That's wild
that the date selector doesn't use seconds.  Two
possibilities come to mind:

-sleep for a minute after generating the timestamp. :(
-use ant-contrib's <outofdate> task to set a
comma-delimited list of out-of-date target files into
a property, to be used as the includes attribute of a
<fileset>.

In Ant, two things that would also make sense:
-Add a format attribute to the date selector,
defaulting to the current one.
-Add a millis attribute to <tstamp>, incompatible with
its pattern attribute.

-Matt

--- David Kavanagh <da...@dotech.com> wrote:
> It's Alive! Now, I just need some help working out
> the file selection 
> part. (which is using existing Ant constructs).
> Here is a sample of my build file.
> 
> <target name="hotswap" depends="init"
> description="Compile and Hotswap 
> changed classes">
>     <taskdef name="hotswap" 
> classname="org.apache.tools.ant.taskdefs.Hotswap"/>
>     <mkdir dir="${build.classes.dir}"/>   
>     <tstamp>
>         <format property="class.stamp"
> pattern="MM/dd/yyyy hh:mm" />
>     </tstamp>
>     <echo message="timestamp = ${class.stamp}"/>
>     <javac .../>
>     <hotswap verbose="true" hotswap="true"
> hsaddress="9000">
>         <fileset dir="${build.classes.dir}"
> includes="**/*.class">
>             <date datetime="${class.stamp} AM"
> when="after"/>
>         </fileset>
>     </hotswap>
> </target>
> 
> This is an example of the timestamp that is
> returned. Is there a way to 
> get this to use seconds as well? The granularity
> doesn't seem good 
> enough for my purpose.
>      [echo] timestamp = 04/02/2004 11:07
> 
> In the <date>, it requires the AM or PM part, which
> I'm just putting in 
> by hand (which isn't good either). Is there a better
> way to select files 
> that have changed in the classes dir since the javac
> has run?
> 
> Once I get this worked out, I'll clean up the task a
> little and make it 
> available for everyone to try. (and provide some
> docs as well!)
> 
> Thanks,
> David
> 
> PS. I tested this by coding a specific class
> filename, since the date 
> thing isn't working yet.
> 
> Thus Spoke Matt Benson:
> 
>
>http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect
> >
> >You would have to use a nested <format> element in
> >your <tstamp> to create the date in the right
> format
> >for the date selector, but aside from that I can't
> see
> >any problems...
> >
> >-Matt
> >
> >--- dak@dotech.com wrote:
> >  
> >
> >>This sounds good to me! The less grunt work I have
> >>to do in my task, the better!
> >>I grabbed teh 1.6.1 source release and built it.
> If
> >>you could point me to the
> >><date> file selector you mention, it would help me
> a
> >>lot. I just poked around
> >>and it didn't jump out at me. I would like it if
> my
> >>task could just deal with a
> >>list of class files provided via some built-in
> >>filtering means.
> >>
> >>Thanks,
> >>David
> >>
> >>Quoting Matt Benson <gu...@yahoo.com>:
> >>
> >>    
> >>
> >>>Basically you should make any task as atomic as
> >>>possible.  So all your task would need to know
> >>>      
> >>>
> >>about
> >>    
> >>
> >>>is a <fileset>.  Then it becomes the user's
> >>>      
> >>>
> >>problem
> >>    
> >>
> >>>how to select which files to include.  One way
> >>>      
> >>>
> >>might
> >>    
> >>
> >>>be to use a <tstamp>
> >>>to set a baseline time, then compile, then use a
> >>><date> file selector to get the updated classes. 
> >>>Another way might use ant-contrib's <outofdate>
> to
> >>>determine which sources should be recompiled. 
> You
> >>>could then compile only those sources to some
> >>>temporary build area, then hotswap only those
> >>>      
> >>>
> >>classes.
> >>    
> >>
> >>> The point is that others have designed ways in
> >>>      
> >>>
> >>which
> >>    
> >>
> >>>the files can be selected, so you gain maximum
> >>>flexibility (and minimum RESPONSIBILITY) the less
> >>>      
> >>>
> >>your
> >>    
> >>
> >>>Task is expected to do.
> >>>
> >>>-Matt
> >>>
> >>>--- dak@dotech.com wrote:
> >>>      
> >>>
> >>>>When I was toying with a separate task, I
> >>>>        
> >>>>
> >>wondered
> >>    
> >>
> >>>>if <uptodate> could be use
> >>>>somehow to create a <fileset>. I don't see now,
> >>>>        
> >>>>
> >>but
> >>    
> >>
> >>>>that would sure be a nice
> >>>>feature. Then, if I could assign an ID so I
> >>>>        
> >>>>
> >>could
> >>    
> >>
> >>>>make a <fileset> of files
> >>>>that aren't uptodate, run the compile, then take
> >>>>that same <fileset> as input
> >>>>to the <hotswap> target.
> >>>>The idea of a timestamp file could work. The
> >>>>sequence might be something like.
> >>>><touch file="timestamp"/>
> >>>><javac .../>
> >>>><hotswap classesdir="foo" host="localhost"
> >>>>port="9000" timefile="timestamp">
> >>>>  <patternset>
> >>>>     ... some pattern to apply to the classes
> >>>>        
> >>>>
> >>dir
> >>    
> >>
> >>>>...
> >>>>  </patternset>
> >>>></hotswap>
> >>>>
> >>>>That way, the hotswap task would check the files
> >>>>        
> >>>>
> >>in
> >>    
> >>
> >>>>the classes dir based on the
> >>>>patternset and/or the timestamp.
> >>>>
> >>>>Seriously, I'm open to feedback. I might as well
> >>>>        
> >>>>
> >>do
> >>    
> >>
> >>>>it right the first time!
> >>>>
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by David Kavanagh <da...@dotech.com>.
It's Alive! Now, I just need some help working out the file selection 
part. (which is using existing Ant constructs).
Here is a sample of my build file.

<target name="hotswap" depends="init" description="Compile and Hotswap 
changed classes">
    <taskdef name="hotswap" 
classname="org.apache.tools.ant.taskdefs.Hotswap"/>
    <mkdir dir="${build.classes.dir}"/>   
    <tstamp>
        <format property="class.stamp" pattern="MM/dd/yyyy hh:mm" />
    </tstamp>
    <echo message="timestamp = ${class.stamp}"/>
    <javac .../>
    <hotswap verbose="true" hotswap="true" hsaddress="9000">
        <fileset dir="${build.classes.dir}" includes="**/*.class">
            <date datetime="${class.stamp} AM" when="after"/>
        </fileset>
    </hotswap>
</target>

This is an example of the timestamp that is returned. Is there a way to 
get this to use seconds as well? The granularity doesn't seem good 
enough for my purpose.
     [echo] timestamp = 04/02/2004 11:07

In the <date>, it requires the AM or PM part, which I'm just putting in 
by hand (which isn't good either). Is there a better way to select files 
that have changed in the classes dir since the javac has run?

Once I get this worked out, I'll clean up the task a little and make it 
available for everyone to try. (and provide some docs as well!)

Thanks,
David

PS. I tested this by coding a specific class filename, since the date 
thing isn't working yet.

Thus Spoke Matt Benson:

>http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect
>
>You would have to use a nested <format> element in
>your <tstamp> to create the date in the right format
>for the date selector, but aside from that I can't see
>any problems...
>
>-Matt
>
>--- dak@dotech.com wrote:
>  
>
>>This sounds good to me! The less grunt work I have
>>to do in my task, the better!
>>I grabbed teh 1.6.1 source release and built it. If
>>you could point me to the
>><date> file selector you mention, it would help me a
>>lot. I just poked around
>>and it didn't jump out at me. I would like it if my
>>task could just deal with a
>>list of class files provided via some built-in
>>filtering means.
>>
>>Thanks,
>>David
>>
>>Quoting Matt Benson <gu...@yahoo.com>:
>>
>>    
>>
>>>Basically you should make any task as atomic as
>>>possible.  So all your task would need to know
>>>      
>>>
>>about
>>    
>>
>>>is a <fileset>.  Then it becomes the user's
>>>      
>>>
>>problem
>>    
>>
>>>how to select which files to include.  One way
>>>      
>>>
>>might
>>    
>>
>>>be to use a <tstamp>
>>>to set a baseline time, then compile, then use a
>>><date> file selector to get the updated classes. 
>>>Another way might use ant-contrib's <outofdate> to
>>>determine which sources should be recompiled.  You
>>>could then compile only those sources to some
>>>temporary build area, then hotswap only those
>>>      
>>>
>>classes.
>>    
>>
>>> The point is that others have designed ways in
>>>      
>>>
>>which
>>    
>>
>>>the files can be selected, so you gain maximum
>>>flexibility (and minimum RESPONSIBILITY) the less
>>>      
>>>
>>your
>>    
>>
>>>Task is expected to do.
>>>
>>>-Matt
>>>
>>>--- dak@dotech.com wrote:
>>>      
>>>
>>>>When I was toying with a separate task, I
>>>>        
>>>>
>>wondered
>>    
>>
>>>>if <uptodate> could be use
>>>>somehow to create a <fileset>. I don't see now,
>>>>        
>>>>
>>but
>>    
>>
>>>>that would sure be a nice
>>>>feature. Then, if I could assign an ID so I
>>>>        
>>>>
>>could
>>    
>>
>>>>make a <fileset> of files
>>>>that aren't uptodate, run the compile, then take
>>>>that same <fileset> as input
>>>>to the <hotswap> target.
>>>>The idea of a timestamp file could work. The
>>>>sequence might be something like.
>>>><touch file="timestamp"/>
>>>><javac .../>
>>>><hotswap classesdir="foo" host="localhost"
>>>>port="9000" timefile="timestamp">
>>>>  <patternset>
>>>>     ... some pattern to apply to the classes
>>>>        
>>>>
>>dir
>>    
>>
>>>>...
>>>>  </patternset>
>>>></hotswap>
>>>>
>>>>That way, the hotswap task would check the files
>>>>        
>>>>
>>in
>>    
>>
>>>>the classes dir based on the
>>>>patternset and/or the timestamp.
>>>>
>>>>Seriously, I'm open to feedback. I might as well
>>>>        
>>>>
>>do
>>    
>>
>>>>it right the first time!
>>>>
>>>>David
>>>>
>>>>Quoting Steve Loughran <st...@iseran.com>:
>>>>        
>>>>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Small Business $15K Web Design Giveaway 
>http://promotions.yahoo.com/design_giveaway/
>  
>

Re: hotswap via ant

Posted by Matt Benson <gu...@yahoo.com>.
http://ant.apache.org/manual/CoreTypes/selectors.html#dateselect

You would have to use a nested <format> element in
your <tstamp> to create the date in the right format
for the date selector, but aside from that I can't see
any problems...

-Matt

--- dak@dotech.com wrote:
> This sounds good to me! The less grunt work I have
> to do in my task, the better!
> I grabbed teh 1.6.1 source release and built it. If
> you could point me to the
> <date> file selector you mention, it would help me a
> lot. I just poked around
> and it didn't jump out at me. I would like it if my
> task could just deal with a
> list of class files provided via some built-in
> filtering means.
> 
> Thanks,
> David
> 
> Quoting Matt Benson <gu...@yahoo.com>:
> 
> > Basically you should make any task as atomic as
> > possible.  So all your task would need to know
> about
> > is a <fileset>.  Then it becomes the user's
> problem
> > how to select which files to include.  One way
> might
> > be to use a <tstamp>
> > to set a baseline time, then compile, then use a
> > <date> file selector to get the updated classes. 
> > Another way might use ant-contrib's <outofdate> to
> > determine which sources should be recompiled.  You
> > could then compile only those sources to some
> > temporary build area, then hotswap only those
> classes.
> >  The point is that others have designed ways in
> which
> > the files can be selected, so you gain maximum
> > flexibility (and minimum RESPONSIBILITY) the less
> your
> > Task is expected to do.
> > 
> > -Matt
> > 
> > --- dak@dotech.com wrote:
> > > When I was toying with a separate task, I
> wondered
> > > if <uptodate> could be use
> > > somehow to create a <fileset>. I don't see now,
> but
> > > that would sure be a nice
> > > feature. Then, if I could assign an ID so I
> could
> > > make a <fileset> of files
> > > that aren't uptodate, run the compile, then take
> > > that same <fileset> as input
> > > to the <hotswap> target.
> > > The idea of a timestamp file could work. The
> > > sequence might be something like.
> > > <touch file="timestamp"/>
> > > <javac .../>
> > > <hotswap classesdir="foo" host="localhost"
> > > port="9000" timefile="timestamp">
> > >   <patternset>
> > >      ... some pattern to apply to the classes
> dir
> > > ...
> > >   </patternset>
> > > </hotswap>
> > > 
> > > That way, the hotswap task would check the files
> in
> > > the classes dir based on the
> > > patternset and/or the timestamp.
> > > 
> > > Seriously, I'm open to feedback. I might as well
> do
> > > it right the first time!
> > > 
> > > David
> > > 
> > > Quoting Steve Loughran <st...@iseran.com>:


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by da...@dotech.com.
This sounds good to me! The less grunt work I have to do in my task, the better!
I grabbed teh 1.6.1 source release and built it. If you could point me to the
<date> file selector you mention, it would help me a lot. I just poked around
and it didn't jump out at me. I would like it if my task could just deal with a
list of class files provided via some built-in filtering means.

Thanks,
David

Quoting Matt Benson <gu...@yahoo.com>:

> Basically you should make any task as atomic as
> possible.  So all your task would need to know about
> is a <fileset>.  Then it becomes the user's problem
> how to select which files to include.  One way might
> be to use a <tstamp>
> to set a baseline time, then compile, then use a
> <date> file selector to get the updated classes. 
> Another way might use ant-contrib's <outofdate> to
> determine which sources should be recompiled.  You
> could then compile only those sources to some
> temporary build area, then hotswap only those classes.
>  The point is that others have designed ways in which
> the files can be selected, so you gain maximum
> flexibility (and minimum RESPONSIBILITY) the less your
> Task is expected to do.
> 
> -Matt
> 
> --- dak@dotech.com wrote:
> > When I was toying with a separate task, I wondered
> > if <uptodate> could be use
> > somehow to create a <fileset>. I don't see now, but
> > that would sure be a nice
> > feature. Then, if I could assign an ID so I could
> > make a <fileset> of files
> > that aren't uptodate, run the compile, then take
> > that same <fileset> as input
> > to the <hotswap> target.
> > The idea of a timestamp file could work. The
> > sequence might be something like.
> > <touch file="timestamp"/>
> > <javac .../>
> > <hotswap classesdir="foo" host="localhost"
> > port="9000" timefile="timestamp">
> >   <patternset>
> >      ... some pattern to apply to the classes dir
> > ...
> >   </patternset>
> > </hotswap>
> > 
> > That way, the hotswap task would check the files in
> > the classes dir based on the
> > patternset and/or the timestamp.
> > 
> > Seriously, I'm open to feedback. I might as well do
> > it right the first time!
> > 
> > David
> > 
> > Quoting Steve Loughran <st...@iseran.com>:

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by Matt Benson <gu...@yahoo.com>.
Basically you should make any task as atomic as
possible.  So all your task would need to know about
is a <fileset>.  Then it becomes the user's problem
how to select which files to include.  One way might
be to use a <tstamp>
to set a baseline time, then compile, then use a
<date> file selector to get the updated classes. 
Another way might use ant-contrib's <outofdate> to
determine which sources should be recompiled.  You
could then compile only those sources to some
temporary build area, then hotswap only those classes.
 The point is that others have designed ways in which
the files can be selected, so you gain maximum
flexibility (and minimum RESPONSIBILITY) the less your
Task is expected to do.

-Matt

--- dak@dotech.com wrote:
> When I was toying with a separate task, I wondered
> if <uptodate> could be use
> somehow to create a <fileset>. I don't see now, but
> that would sure be a nice
> feature. Then, if I could assign an ID so I could
> make a <fileset> of files
> that aren't uptodate, run the compile, then take
> that same <fileset> as input
> to the <hotswap> target.
> The idea of a timestamp file could work. The
> sequence might be something like.
> <touch file="timestamp"/>
> <javac .../>
> <hotswap classesdir="foo" host="localhost"
> port="9000" timefile="timestamp">
>   <patternset>
>      ... some pattern to apply to the classes dir
> ...
>   </patternset>
> </hotswap>
> 
> That way, the hotswap task would check the files in
> the classes dir based on the
> patternset and/or the timestamp.
> 
> Seriously, I'm open to feedback. I might as well do
> it right the first time!
> 
> David
> 
> Quoting Steve Loughran <st...@iseran.com>:
> 
> > dak@dotech.com wrote:
> > > I'd like to not only build (using Ant) when I'm
> using VIM, but hotdeploy
> > the
> > > class changes to a running app. I use ant.vim
> and it works very nicely.
> > Then, I
> > > wrote a hotswap client using JDI. Now, I can run
> that via the commandline,
> > but
> > > I'd rather integrate it into Ant.
> > > I toyed with doing a separate task, but I
> thought I'd just end up redoing
> > some
> > > code that was already in <javac>. So, for a
> proof of concept, I've added
> > some
> > > attributes to the <javac> task and am in the
> process of finishing the
> > > connections to the hot swap code. Basicly, once
> the compile is done, if
> > hotswap
> > > was enabled, it would connect to the VM and push
> those class files over.
> > > 
> > > First, does anyone have any better idea of how I
> could integrate the
> > hotswap
> > > feature into Ant?
> > > Second, is there a good way to get a list of the
> actual fully qualified
> > class
> > > names that were compiled? I have the list of
> files, but I'd have to try to
> > > parse out the class name, which I don't have a
> good solution for yet. I
> > just
> > > really need the classes dir (destDir) and the
> names of all the classes to
> > be
> > > replaced in the VM.
> > > 
> > 
> > Better to make it a separate task, if possible.
> > One problem with getting a list of compiled
> classes is that the compiler 
> > (be it javac, jikes, etc), makes its own mind up.
> So not even javac knows.
> > 
> > A separate <hotswap> task could take a fileset of
> classes, and maybe 
> > some timestamp file; all files after the timestamp
> file are deployed & 
> > the timestamp file is touched.
> > 
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> dev-help@ant.apache.org
> > 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> dev-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> dev-help@ant.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by da...@dotech.com.
When I was toying with a separate task, I wondered if <uptodate> could be use
somehow to create a <fileset>. I don't see now, but that would sure be a nice
feature. Then, if I could assign an ID so I could make a <fileset> of files
that aren't uptodate, run the compile, then take that same <fileset> as input
to the <hotswap> target.
The idea of a timestamp file could work. The sequence might be something like.
<touch file="timestamp"/>
<javac .../>
<hotswap classesdir="foo" host="localhost" port="9000" timefile="timestamp">
  <patternset>
     ... some pattern to apply to the classes dir ...
  </patternset>
</hotswap>

That way, the hotswap task would check the files in the classes dir based on the
patternset and/or the timestamp.

Seriously, I'm open to feedback. I might as well do it right the first time!

David

Quoting Steve Loughran <st...@iseran.com>:

> dak@dotech.com wrote:
> > I'd like to not only build (using Ant) when I'm using VIM, but hotdeploy
> the
> > class changes to a running app. I use ant.vim and it works very nicely.
> Then, I
> > wrote a hotswap client using JDI. Now, I can run that via the commandline,
> but
> > I'd rather integrate it into Ant.
> > I toyed with doing a separate task, but I thought I'd just end up redoing
> some
> > code that was already in <javac>. So, for a proof of concept, I've added
> some
> > attributes to the <javac> task and am in the process of finishing the
> > connections to the hot swap code. Basicly, once the compile is done, if
> hotswap
> > was enabled, it would connect to the VM and push those class files over.
> > 
> > First, does anyone have any better idea of how I could integrate the
> hotswap
> > feature into Ant?
> > Second, is there a good way to get a list of the actual fully qualified
> class
> > names that were compiled? I have the list of files, but I'd have to try to
> > parse out the class name, which I don't have a good solution for yet. I
> just
> > really need the classes dir (destDir) and the names of all the classes to
> be
> > replaced in the VM.
> > 
> 
> Better to make it a separate task, if possible.
> One problem with getting a list of compiled classes is that the compiler 
> (be it javac, jikes, etc), makes its own mind up. So not even javac knows.
> 
> A separate <hotswap> task could take a fileset of classes, and maybe 
> some timestamp file; all files after the timestamp file are deployed & 
> the timestamp file is touched.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: hotswap via ant

Posted by Steve Loughran <st...@iseran.com>.
dak@dotech.com wrote:
> I'd like to not only build (using Ant) when I'm using VIM, but hotdeploy the
> class changes to a running app. I use ant.vim and it works very nicely. Then, I
> wrote a hotswap client using JDI. Now, I can run that via the commandline, but
> I'd rather integrate it into Ant.
> I toyed with doing a separate task, but I thought I'd just end up redoing some
> code that was already in <javac>. So, for a proof of concept, I've added some
> attributes to the <javac> task and am in the process of finishing the
> connections to the hot swap code. Basicly, once the compile is done, if hotswap
> was enabled, it would connect to the VM and push those class files over.
> 
> First, does anyone have any better idea of how I could integrate the hotswap
> feature into Ant?
> Second, is there a good way to get a list of the actual fully qualified class
> names that were compiled? I have the list of files, but I'd have to try to
> parse out the class name, which I don't have a good solution for yet. I just
> really need the classes dir (destDir) and the names of all the classes to be
> replaced in the VM.
> 

Better to make it a separate task, if possible.
One problem with getting a list of compiled classes is that the compiler 
(be it javac, jikes, etc), makes its own mind up. So not even javac knows.

A separate <hotswap> task could take a fileset of classes, and maybe 
some timestamp file; all files after the timestamp file are deployed & 
the timestamp file is touched.




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org