--- Tim Dawson <[EMAIL PROTECTED]> wrote: > adding complexity where? > > when I look at my build files, I see a lot of unnecessary complexity > when I look at the depends="init" attributes on each and every target. > and then the mess that occurs when I forget to add it... especially to > a target that normally works because its usually included as a > dependency, e.g. > > <project name="example1" default="jar-example"> > <target name="init"> > do some necessary stuff, e.g. <mkdirs> > </target> > > <target name="compile"> > <!-- depends on init, but I forgot to add it --> > <javac>.... > </target> > > <target name="jar-example" depends="init,compile"> > <jar>... > </target> > </project> > > Now, most of the time, the compile works fine because by default I run > the jar-example task, which executes init before executing compile. > But if I were to manually execute "ant compile", it would fail.
There are a couple of things here. One is that if jar-example depends on compile and compile depends on init, then the dependencies should be done that way -- ie: <target name="jar-example" depends="compile"> ... <target name="compile" depends="init"> It's up to the build-file writer to not forget to specify the dependencies, and if they do, then the build -should- fail, so the oops can be corrected. The other is, if you have some targets that depend on an init target and others that don't, then you couldn't use your (proposed) "init" attribute to <project> anyway, so you're still going to end up having to specify the dependency for those targets that do depend on it. Personally, I don't see a big win for adding an "init" to <project>. (Suppose I might as well also mention that I don't mind the project-level tasks either.) Diane ===== ([EMAIL PROTECTED]) __________________________________________________ Do You Yahoo!? Make a great connection at Yahoo! Personals. http://personals.yahoo.com
