|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Wildcards in depends?Hi,
I was wondering if anyone else thought being able to specify wildcards in the depends attribute of the target would be helpful. Where I work, we use a lot of build fragments that get imported, and we would like the ability to allow the developer to add/remove build funtionality easilt without disrupting the basic workflow. essentially something like: build.xml imports base-java.xml and java-checkstyle.xml base-java.xml: <target name="pre-compile" depends="java-pre-plugin*,compile" /> java-checkstyle.xml <target name="java-pre-plugin-checkstyle"> ... run checkstyle ... </target> This way a developer can add/remove something like checkstyle simply by adding/removing the import. This would also allow the developer to use a different syntax checker simply by the import. I think the most reasonable way to do this would be to modify the addDependency method in Target.java. Something like this: public void addDependency(final String dependency) { if (dependencies == null) { dependencies = new ArrayList(2); } if (dependency.endsWith("*")) { String key; final String prefix = dependency.substring(0, (dependency.indexOf("*") - 1)); final Enumeration<String> e = getProject().getTargets().keys(); while (e.hasMoreElements()) { key = e.nextElement(); if (key.startsWith(prefix)) { dependencies.add(dependency); } } } else { dependencies.add(dependency); } } any thoughts? - Jonathan --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Wildcards in depends?--- jonathan doklovic <list-reader@...> wrote: > Hi, > > I was wondering if anyone else thought being able to > specify wildcards > in the depends attribute of the target would be > helpful. This would probably be fairly harmful if simply introduced into existing builds. However, it should be feasible for you to write your own Executor implementation (seehttp://ant.apache.org/manual/running.html#sysprops) to do whatever you like with dependencies. -Matt > Where I work, we use a lot of build fragments that > get imported, and we > would like the ability to allow the developer to > add/remove build > funtionality easilt without disrupting the basic > workflow. > > essentially something like: > > build.xml imports base-java.xml and > java-checkstyle.xml > > base-java.xml: > <target name="pre-compile" > depends="java-pre-plugin*,compile" /> > > java-checkstyle.xml > <target name="java-pre-plugin-checkstyle"> ... run > checkstyle ... </target> > > This way a developer can add/remove something like > checkstyle simply by > adding/removing the import. > This would also allow the developer to use a > different syntax checker > simply by the import. > > I think the most reasonable way to do this would be > to modify the > addDependency method in Target.java. Something like > this: > public void addDependency(final String dependency) { > if (dependencies == null) { > dependencies = new ArrayList(2); > } > > if (dependency.endsWith("*")) { > String key; > final String prefix = dependency.substring(0, > > (dependency.indexOf("*") - 1)); > final Enumeration<String> e = > getProject().getTargets().keys(); > while (e.hasMoreElements()) { > key = e.nextElement(); > if (key.startsWith(prefix)) { > dependencies.add(dependency); > } > } > } else { > dependencies.add(dependency); > } > } > > any thoughts? > > - Jonathan > > > > > To unsubscribe, e-mail: > dev-unsubscribe@... > For additional commands, e-mail: > dev-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Wildcards in depends?On Tue, Jul 1, 2008 at 12:41 PM, jonathan doklovic
<list-reader@...> wrote: > I was wondering if anyone else thought being able to specify wildcards in > the depends attribute of the target would be helpful. > Where I work, we use a lot of build fragments that get imported, and we > would like the ability to allow the developer to add/remove build > funtionality easilt without disrupting the basic workflow. > > essentially something like: > > build.xml imports base-java.xml and java-checkstyle.xml > > base-java.xml: > <target name="pre-compile" depends="java-pre-plugin*,compile" /> > > java-checkstyle.xml > <target name="java-pre-plugin-checkstyle"> ... run checkstyle ... </target> > > This way a developer can add/remove something like checkstyle simply by > adding/removing the import. > This would also allow the developer to use a different syntax checker simply > by the import. Your syntax is not backward compatible in general, but as Matt writes a custom Executor may enable it specifically for you. BTW your use case would be answered by a proposed extension using new 'before/after' attributes on <target> which was discussed at length a few weeks back. Injecting dependencies that way, a la Maven, would make plugging in things together more easily, and mesh well with <import>. You may have a better chance with before/after than depends="foo*". --DD --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
|
|
Re: Wildcards in depends?Thanks,
I didn't see that other thread, but just looked it over and it does seem to be a good way to go about it. In the meantime, I'll also dig into the executor for our own personal 1.7 approach. Thanks again for the comments/suggestions. - Jonathan Dominique Devienne wrote: > On Tue, Jul 1, 2008 at 12:41 PM, jonathan doklovic > <list-reader@...> wrote: > >> I was wondering if anyone else thought being able to specify wildcards in >> the depends attribute of the target would be helpful. >> Where I work, we use a lot of build fragments that get imported, and we >> would like the ability to allow the developer to add/remove build >> funtionality easilt without disrupting the basic workflow. >> >> essentially something like: >> >> build.xml imports base-java.xml and java-checkstyle.xml >> >> base-java.xml: >> <target name="pre-compile" depends="java-pre-plugin*,compile" /> >> >> java-checkstyle.xml >> <target name="java-pre-plugin-checkstyle"> ... run checkstyle ... </target> >> >> This way a developer can add/remove something like checkstyle simply by >> adding/removing the import. >> This would also allow the developer to use a different syntax checker simply >> by the import. >> > > Your syntax is not backward compatible in general, but as Matt writes > a custom Executor may enable it specifically for you. > > BTW your use case would be answered by a proposed extension using new > 'before/after' attributes on <target> which was discussed at length a > few weeks back. Injecting dependencies that way, a la Maven, would > make plugging in things together more easily, and mesh well with > <import>. You may have a better chance with before/after than > depends="foo*". --DD > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@... > For additional commands, e-mail: dev-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free Forum Powered by Nabble | Forum Help |