You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Ludwig, Michael" <Mi...@delphi-mb.de> on 2010/07/29 10:18:41 UTC

Bootstrap script, fetch prerequisites

What's the best way to bootstrap an Ant script installation?

Say you're going to introduce an Ant script to automate tasks in
dev environment, and you're going to add new functionality as you
go, possibly modifying the script a lot, and introducing various
dependencies along the road, like JARs, new tasks and whatnot.

Say have a bunch of users of your script who can't be bothered to
download those dependencies manually, and you want to automate the
process whereby they bootstrap their installation, and also update
it when more functionality becomes available, like, say, a new
target "doc-pdf" requiring some library to generate documentation
in PDF.

I'd imagine targets like in a UNIX package manager:

  ant self-check
  ant self-update
  ant self-upgrade

This should download the required JARs and place them in some
suitable directory, possibly ~/.ant/lib.

I know Maven does this sort of dependency management, but our
choice is Ant.

What's the best or most standard or your preferred way of doing
this?

What about Ivy? Does it work for that kind of stuff? Not too
complex?

(One thing I personally dislike is checking JARs into your version
control system, so that's not exactly the solution path I'm most
interested in. I can see why people may choose to go there, I just
don't want to follow that path myself.)

-- 
Michael Ludwig 

Re: Bootstrap script, fetch prerequisites

Posted by Dominique Devienne <dd...@gmail.com>.
On Thu, Jul 29, 2010 at 4:03 PM, Michael Ludwig <mi...@gmx.de> wrote:
> Dominique Devienne schrieb am 29.07.2010 um 08:42 (-0500):
>> I believe that bootstrapping is possible, but I think it would require
>> changes in Ant to possibly restart a new VM using new JARs for
>> example, or at least rerun itself into a completely different class
>> loader (and a way to update JARs already in use on Windows). Didn't do
>> it myself. --DD
>
> If it turns out to be too complicated, I'll include a Perl or VBS
> script, that'll do the job!

There I was more thinking into a pure Ant / Java solution that
wouldn't require external wrapper (non-Java) scripts as front-ends to
Ant itself; something that would likely have to involve class loaders,
but of course using front-end script is much more practical :) --DD

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


Re: Bootstrap script, fetch prerequisites

Posted by Michael Ludwig <mi...@gmx.de>.
Dominique Devienne schrieb am 29.07.2010 um 08:42 (-0500):
> On Thu, Jul 29, 2010 at 3:18 AM, Ludwig, Michael
> <Mi...@delphi-mb.de> wrote:
> > What's the best way to bootstrap an Ant script installation? [...]
> > (One thing I personally dislike is checking JARs into your version
> > control system, [...]
> 
> Well, Ant has no built-in bootstrap mechanism.
> 
> Build scripts are typically under version control, but they might use
> support files (typically imported) from other modules of the VCS, and
> they might use JARs downloaded from somewhere or under VCS themselves.

Exactly. My Ant script will be under version control along with the
project it helps build. I'm just a little recuctant to put external
JARs under version control as well.

> If you run checks to verify for new versions of files/JARs implicitly
> on every build, you run the risk of slowing down all builds, and
> surprising your users for changes they didn't want, so I find it nicer
> to have an explicit target(s) to do the checking and updating
> explicitly.

Same thinking here. The idea is:

          \,,,/
          (o o)
------oOOo-(_)-oOOo------
ant new-fangled-target
# horrible callstack shows up
# notice at the end to PLEASE RUN *ant self-update*
ant self-update
# fetches dependencies not under VCS, does whatever is needed
# give it another try
ant new-fangled-target
# now working

> But even that can fail, especially on Windows, since you can't update
> JARs ANT is currently using, and you can't easily force ANT to use a
> new version of a JAR that was just updated.

Well, it wouldn't have to be in one and the same run. First update, then
use new JARs the next time around.

> I believe that bootstrapping is possible, but I think it would require
> changes in Ant to possibly restart a new VM using new JARs for
> example, or at least rerun itself into a completely different class
> loader (and a way to update JARs already in use on Windows). Didn't do
> it myself. --DD

If it turns out to be too complicated, I'll include a Perl or VBS
script, that'll do the job!

Thanks for your thoughts!
-- 
Michael Ludwig

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


RE: Bootstrap script, fetch prerequisites

Posted by Shawn Castrianni <Sh...@halliburton.com>.
Yes, from svnkit, is a jar that you can run with "java -jar" that is equivalent to an svn command line client.


IVY, yes I would highly recommend it!  I have it supporting 5 different platforms with both java and native code, 400 developers, 120 modules, 20 releases, etc.  I worked with the author Xavier Hanin to add more features for my use cases and so far it can do everything that I need.  Development is looking into OSGI which may conflict with IVY, not sure yet.

---
Shawn Castrianni


-----Original Message-----
From: Michael Ludwig [mailto:milu71@gmx.de] 
Sent: Thursday, July 29, 2010 4:18 PM
To: Ant Users List
Subject: Re: Bootstrap script, fetch prerequisites

Shawn Castrianni schrieb am 29.07.2010 um 09:37 (-0500):
> I use ant, svn, and ivy to handle this issue as well as for a
> generalized dependency mechanism.  Originally, my ant launcher script
> didn't do much more than configure a few env variables and launch ant.
> But just like you, I needed a way to provide my users with updates.
> I chose to use svn.

My choice, too. SVN to update the Ant script. But not external
properties. I tend to think that what is maintained externally should
not be cut off from its source; so better keep in touch with upstream
versions and bugfixes instead of hardcoding your dependency to some
version that will sooner or later be a legacy version.

> I use the java svn command line client (so that it works on all
> platforms) that is also checked into the ant build system sandbox.

SVNKit?

> ivy is then used for all other kind of dependencies for the actual
> building of source code.

Would you recommend it?

Thanks for your input!
-- 
Michael Ludwig

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

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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


Re: Bootstrap script, fetch prerequisites

Posted by Michael Ludwig <mi...@gmx.de>.
Shawn Castrianni schrieb am 29.07.2010 um 09:37 (-0500):
> I use ant, svn, and ivy to handle this issue as well as for a
> generalized dependency mechanism.  Originally, my ant launcher script
> didn't do much more than configure a few env variables and launch ant.
> But just like you, I needed a way to provide my users with updates.
> I chose to use svn.

My choice, too. SVN to update the Ant script. But not external
properties. I tend to think that what is maintained externally should
not be cut off from its source; so better keep in touch with upstream
versions and bugfixes instead of hardcoding your dependency to some
version that will sooner or later be a legacy version.

> I use the java svn command line client (so that it works on all
> platforms) that is also checked into the ant build system sandbox.

SVNKit?

> ivy is then used for all other kind of dependencies for the actual
> building of source code.

Would you recommend it?

Thanks for your input!
-- 
Michael Ludwig

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


RE: Bootstrap script, fetch prerequisites

Posted by Shawn Castrianni <Sh...@halliburton.com>.
I use ant, svn, and ivy to handle this issue as well as for a generalized dependency mechanism.  Originally, my ant launcher script didn't do much more than configure a few env variables and launch ant.  But just like you, I needed a way to provide my users with updates.  I chose to use svn.  My entire ant installation with all of my custom build scripts are stored in svn.  A new user of the build system would first need to checkout a sandbox of that ant build system.  Then from then on, they can choose to update the sandbox whenever they want to receive my updates.  Or, their other option is to let the my enhanced ant launcher scripts perform the auto-update for them on every invocation.  The enhanced launcher scripts will perform an svn update of their build system sandbox (while still within the batch scripts) BEFORE ant starts so you don't have to worry about locked files on windows.  I use the java svn command line client (so that it works on all platforms) that is also checked into the ant build system sandbox.  To allow the user a choice of when to allow build system updates, he can set a special environment variable SYSTEM_UPDATE which determines whether the ant launcher scripts perform the auto-update on every invocation or not.  It not, it is up to the user to update it by manually running an svn update.

ivy is then used for all other kind of dependencies for the actual building of source code.

---
Shawn Castrianni

-----Original Message-----
From: Dominique Devienne [mailto:ddevienne@gmail.com] 
Sent: Thursday, July 29, 2010 8:42 AM
To: Ant Users List
Subject: Re: Bootstrap script, fetch prerequisites

On Thu, Jul 29, 2010 at 3:18 AM, Ludwig, Michael
<Mi...@delphi-mb.de> wrote:
> What's the best way to bootstrap an Ant script installation? [...]
> (One thing I personally dislike is checking JARs into your version control system, [...]

Well, Ant has no built-in bootstrap mechanism.

Build scripts are typically under version control, but they might use
support files
(typically imported) from other modules of the VCS, and they might use
JARs downloaded
from somewhere or under VCS themselves. If you run checks to verify
for new versions of
files/JARs implicitly on every build, you run the risk of slowing down
all builds, and surprising
your users for changes they didn't want, so I find it nicer to have an
explicit target(s) to do the
checking and updating explicitly. But even that can fail, especially
on Windows, since you can't
update JARs ANT is currently using, and you can't easily force ANT to
use a new version of a
JAR that was just updated.

I believe that bootstrapping is possible, but I think it would require
changes in Ant to possibly
restart a new VM using new JARs for example, or at least rerun itself
into a completely different
class loader (and a way to update JARs already in use on Windows).
Didn't do it myself. --DD

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

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

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


Re: Bootstrap script, fetch prerequisites

Posted by Dominique Devienne <dd...@gmail.com>.
On Thu, Jul 29, 2010 at 3:18 AM, Ludwig, Michael
<Mi...@delphi-mb.de> wrote:
> What's the best way to bootstrap an Ant script installation? [...]
> (One thing I personally dislike is checking JARs into your version control system, [...]

Well, Ant has no built-in bootstrap mechanism.

Build scripts are typically under version control, but they might use
support files
(typically imported) from other modules of the VCS, and they might use
JARs downloaded
from somewhere or under VCS themselves. If you run checks to verify
for new versions of
files/JARs implicitly on every build, you run the risk of slowing down
all builds, and surprising
your users for changes they didn't want, so I find it nicer to have an
explicit target(s) to do the
checking and updating explicitly. But even that can fail, especially
on Windows, since you can't
update JARs ANT is currently using, and you can't easily force ANT to
use a new version of a
JAR that was just updated.

I believe that bootstrapping is possible, but I think it would require
changes in Ant to possibly
restart a new VM using new JARs for example, or at least rerun itself
into a completely different
class loader (and a way to update JARs already in use on Windows).
Didn't do it myself. --DD

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