dcsimg
Make2Ant
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Leslie_Chaim
Posted On:   Wednesday, October 1, 2003 07:04 AM

I really did some arm-twisting about a year ago... Knowing noting about Ant, I wrote this Makefile to handle all the various tasks (or targets). Given all the built in tasks from Ant could have made things easier. I wonder if there's any tool/utility which can convert Makfiles to Ant build scripts? Assuming there are none, I have some questions that I will keep on adding to this post as they come up. Thanks in advance for you assistance and guidance and comments. This is a target from the Makefile: ALL_SERVERS = UnixServ1 UnixServ2 UnixServ3 UnixServ4 install2prod: test $$(whoami) = "ops" # You must be ops to do the install @echo installing p   More>>

I really did some arm-twisting about a year ago...


Knowing noting about Ant, I wrote this Makefile to handle all the various tasks (or targets). Given all the built in tasks from Ant could have made things easier. I wonder if there's any tool/utility which can convert Makfiles to Ant build scripts?


Assuming there are none, I have some questions that I will keep on adding to this post as they come up. Thanks in advance for you assistance and guidance and comments.


This is a target from the Makefile:

			
ALL_SERVERS = UnixServ1 UnixServ2 UnixServ3 UnixServ4

install2prod:
test $$(whoami) = "ops" # You must be ops to do the install
@echo installing prod in /ops/daemon/app_dist to ${ALL_SERVERS}
cp -r classes/ app_dist_prod/bin/
cp app_dist.pl app_dist_prod/bin/
@for sys in ${ALL_SERVERS};
do
echo Installing on $$sys;
remsh $$sys rm -r /ops/daemon/app_dist;
rcp -r app_dist_prod/ $$sys:/ops/daemon/app_dist;
done
@echo All done

I have 6 tasks for the install2prod target with task 5 having 3 nested tasks:

  1. Check if the current (Unix) login id is "ops"; abort if false
  2. print a message "installing prod in /ops/daemon/app_dist to UnixServ1 UnixServ2 UnixServ3 UnixServ4"
  3. Copy the classes dir tree to app_dist_prod/bin/
  4. Copy the app_dist.pl script to app_dist_prod/bin/
  5. Install to ALL_SERVERS:

    • Print a message "Installing on sys "
    • Delete the dir tree /ops/daemon/app_dist on remote sys
    • Copy the dir tree app_dist_prod/ to ops/daemon/app_dist on remote sys

  6. Print a message "All done"


What would be the Ant equivalent?
More specifically:

  • How do you remsh or rpc in Ant?
  • How do you (or can you:() loop over a list of values such as ${ALL_SERVERS}?

Thanks,


Leslie

   <<Less

Re: Make2Ant

Posted By:   Anonymous  
Posted On:   Wednesday, October 1, 2003 06:04 PM

Ant 1.6 has an task, and there has long been a task allowing you to control a remote server.

Looping is a slightly more complex story, oddly. But there is a task in the Sourceforge ant-contrib project that implements this behavior.

Re: Make2Ant

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, October 1, 2003 08:50 AM

Sounds interesting. I haven't worked much with Ant but I get the impression that it is not exactly intended as a complete "Make replacement". Rather, they overlap in some common functionalities, but Ant is not intended as a general purpose scripting language, right? so there will be still things that you want to use Make for (especially for your looping, and for your remsh and rpc), and things you want to use Ant for, and perhaps you might even want to write your Makefile to invoke Ant sometimes, when appropriate?

About | Sitemap | Contact