|
|
@@ -795,7 +795,8 @@ public class Main implements AntMain { |
|
|
|
|
|
|
|
if (projectHelp) { |
|
|
|
printDescription(project); |
|
|
|
printTargets(project, msgOutputLevel > Project.MSG_INFO); |
|
|
|
printTargets(project, msgOutputLevel > Project.MSG_INFO, |
|
|
|
msgOutputLevel > Project.MSG_VERBOSE); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@@ -1080,7 +1081,8 @@ public class Main implements AntMain { |
|
|
|
* @param printSubTargets Whether or not subtarget names should also be |
|
|
|
* printed. |
|
|
|
*/ |
|
|
|
private static void printTargets(Project project, boolean printSubTargets) { |
|
|
|
private static void printTargets(Project project, boolean printSubTargets, |
|
|
|
boolean printDependencies) { |
|
|
|
// find the target with the longest name |
|
|
|
int maxLength = 0; |
|
|
|
Map ptargets = removeDuplicateTargets(project.getTargets()); |
|
|
@@ -1091,7 +1093,9 @@ public class Main implements AntMain { |
|
|
|
// on the presence of a description |
|
|
|
Vector topNames = new Vector(); |
|
|
|
Vector topDescriptions = new Vector(); |
|
|
|
Vector/*<Enumeration<String>>*/ topDependencies = new Vector(); |
|
|
|
Vector subNames = new Vector(); |
|
|
|
Vector/*<Enumeration<String>>*/ subDependencies = new Vector(); |
|
|
|
|
|
|
|
for (Iterator i = ptargets.values().iterator(); i.hasNext();) { |
|
|
|
currentTarget = (Target) i.next(); |
|
|
@@ -1104,6 +1108,9 @@ public class Main implements AntMain { |
|
|
|
if (targetDescription == null) { |
|
|
|
int pos = findTargetPosition(subNames, targetName); |
|
|
|
subNames.insertElementAt(targetName, pos); |
|
|
|
if (printDependencies) { |
|
|
|
subDependencies.insertElementAt(currentTarget.getDependencies(), pos); |
|
|
|
} |
|
|
|
} else { |
|
|
|
int pos = findTargetPosition(topNames, targetName); |
|
|
|
topNames.insertElementAt(targetName, pos); |
|
|
@@ -1111,18 +1118,21 @@ public class Main implements AntMain { |
|
|
|
if (targetName.length() > maxLength) { |
|
|
|
maxLength = targetName.length(); |
|
|
|
} |
|
|
|
if (printDependencies) { |
|
|
|
topDependencies.insertElementAt(currentTarget.getDependencies(), pos); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
printTargets(project, topNames, topDescriptions, "Main targets:", |
|
|
|
maxLength); |
|
|
|
printTargets(project, topNames, topDescriptions, topDependencies, |
|
|
|
"Main targets:", maxLength); |
|
|
|
//if there were no main targets, we list all subtargets |
|
|
|
//as it means nothing has a description |
|
|
|
if (topNames.size() == 0) { |
|
|
|
printSubTargets = true; |
|
|
|
} |
|
|
|
if (printSubTargets) { |
|
|
|
printTargets(project, subNames, null, "Other targets:", 0); |
|
|
|
printTargets(project, subNames, null, subDependencies, "Other targets:", 0); |
|
|
|
} |
|
|
|
|
|
|
|
String defaultTarget = project.getDefaultTarget(); |
|
|
@@ -1165,6 +1175,9 @@ public class Main implements AntMain { |
|
|
|
* no descriptions are displayed. |
|
|
|
* If non-<code>null</code>, this should have |
|
|
|
* as many elements as <code>names</code>. |
|
|
|
* @param topDependencies The list of dependencies for each target. |
|
|
|
* The dependencies are listed as a non null |
|
|
|
* enumeration of String. |
|
|
|
* @param heading The heading to display. |
|
|
|
* Should not be <code>null</code>. |
|
|
|
* @param maxlen The maximum length of the names of the targets. |
|
|
@@ -1173,7 +1186,8 @@ public class Main implements AntMain { |
|
|
|
* <i>are</i> shorter than this). |
|
|
|
*/ |
|
|
|
private static void printTargets(Project project, Vector names, |
|
|
|
Vector descriptions, String heading, |
|
|
|
Vector descriptions, Vector dependencies, |
|
|
|
String heading, |
|
|
|
int maxlen) { |
|
|
|
// now, start printing the targets and their descriptions |
|
|
|
String lSep = System.getProperty("line.separator"); |
|
|
@@ -1193,6 +1207,19 @@ public class Main implements AntMain { |
|
|
|
msg.append(descriptions.elementAt(i)); |
|
|
|
} |
|
|
|
msg.append(lSep); |
|
|
|
if (!dependencies.isEmpty()) { |
|
|
|
Enumeration deps = (Enumeration) dependencies.elementAt(i); |
|
|
|
if (deps.hasMoreElements()) { |
|
|
|
msg.append(" depends of: "); |
|
|
|
while (deps.hasMoreElements()) { |
|
|
|
msg.append(deps.nextElement()); |
|
|
|
if (deps.hasMoreElements()) { |
|
|
|
msg.append(", "); |
|
|
|
} |
|
|
|
} |
|
|
|
msg.append(lSep); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
project.log(msg.toString(), Project.MSG_WARN); |
|
|
|
} |
|
|
|