I'm hacked such behavior for ant1.2 but I can't make diffs.
my editor had changed tabs to spaces. So it is not easy to give back my stuff
to the ant group.
Yust have a try with code snippets:
At first Target (Target.java) needs a boolean attribute named internal and a
setter for this attribute.
Main.java:
nearly line 427 - give ant a chance to block internal targets
// make sure that we have a target to execute
if (targets.size() == 0) {
targets.addElement(project.getDefaultTarget());
}
if (projectHelp) {
printTargets(project);
} else {
String internalTargetName =
allPublicTargets(project, targets);
if (internalTargetName != null) {
throw new BuildException("Target " + internalTargetName
+ "
is not executable from outside");
}
// actually do some work
project.executeTargets(targets);
}
-------------------------------------------------
new method
/**
* Checks if all targets to be executed from outside not being internal
*/
private static String allPublicTargets(Project project, Vector tNames) {
Target currentTarget;
Enumeration targetNames = tNames.elements();
Hashtable targets = project.getTargets();
while (targetNames.hasMoreElements()) {
currentTarget =
(Target)targets.get((String)targetNames.nextElement());
if (currentTarget != null) {
if (currentTarget.isInternal()) return
currentTarget.getName();
}
}
return null;
}
hope this helps
--
__Claas Thiele____________________________________________________
VIRBUS AG
Software Development
phone +49 341 979 7430
fax +49 341 979 7409
mail [EMAIL PROTECTED]
....................................................................
http://www.virbus.de