|
Lines 19-33
Link Here
|
| 19 |
import java.io.InputStream; |
19 |
import java.io.InputStream; |
| 20 |
import java.io.PrintStream; |
20 |
import java.io.PrintStream; |
| 21 |
import java.net.URL; |
21 |
import java.net.URL; |
| 22 |
import java.text.MessageFormat; // don't use ICU in ant builder |
22 |
import java.text.MessageFormat; |
| 23 |
import java.util.ArrayList; |
23 |
import java.util.ArrayList; |
| 24 |
import java.util.Arrays; |
24 |
import java.util.Arrays; |
| 25 |
import java.util.Enumeration; |
25 |
import java.util.Enumeration; |
| 26 |
import java.util.HashMap; |
26 |
import java.util.HashMap; |
|
|
27 |
import java.util.HashSet; |
| 27 |
import java.util.Iterator; |
28 |
import java.util.Iterator; |
| 28 |
import java.util.List; |
29 |
import java.util.List; |
|
|
30 |
import java.util.ListIterator; |
| 29 |
import java.util.Map; |
31 |
import java.util.Map; |
| 30 |
import java.util.Properties; |
32 |
import java.util.Properties; |
|
|
33 |
import java.util.Set; |
| 31 |
import java.util.Vector; |
34 |
import java.util.Vector; |
| 32 |
|
35 |
|
| 33 |
import org.apache.tools.ant.AntTypeDefinition; |
36 |
import org.apache.tools.ant.AntTypeDefinition; |
|
Lines 1068-1073
Link Here
|
| 1068 |
processUnrecognizedCommands(commands); |
1071 |
processUnrecognizedCommands(commands); |
| 1069 |
} |
1072 |
} |
| 1070 |
|
1073 |
|
|
|
1074 |
if(!commands.isEmpty()) { |
| 1075 |
processUnrecognizedTargets(commands); |
| 1076 |
} |
| 1077 |
|
| 1071 |
if (!commands.isEmpty()) { |
1078 |
if (!commands.isEmpty()) { |
| 1072 |
processTargets(commands); |
1079 |
processTargets(commands); |
| 1073 |
} |
1080 |
} |
|
Lines 1075-1083
Link Here
|
| 1075 |
return true; |
1082 |
return true; |
| 1076 |
} |
1083 |
} |
| 1077 |
|
1084 |
|
|
|
1085 |
/** |
| 1086 |
* Checks for unrecognized targets on the command line and |
| 1087 |
* removes them. |
| 1088 |
* |
| 1089 |
* @since 3.6 |
| 1090 |
*/ |
| 1091 |
private void processUnrecognizedTargets(List commands) { |
| 1092 |
List list = getTargets(); |
| 1093 |
Set names = new HashSet(); |
| 1094 |
Iterator it = list.iterator(); |
| 1095 |
while (it.hasNext()) { |
| 1096 |
Object element = it.next(); |
| 1097 |
if (element instanceof List) { |
| 1098 |
List target = (List)element; |
| 1099 |
if (!target.isEmpty()) { |
| 1100 |
names.add(target.get(0)); |
| 1101 |
} |
| 1102 |
} |
| 1103 |
} |
| 1104 |
ListIterator iterator = commands.listIterator(); |
| 1105 |
|
| 1106 |
while (iterator.hasNext()) { |
| 1107 |
String target = (String) iterator.next(); |
| 1108 |
if (!names.contains(target)) { |
| 1109 |
iterator.remove(); |
| 1110 |
String message = MessageFormat.format(InternalAntMessages.InternalAntRunner_unknown_target, new Object[]{target}); |
| 1111 |
logMessage(currentProject, message, Project.MSG_WARN); |
| 1112 |
} |
| 1113 |
} |
| 1114 |
} |
| 1115 |
|
| 1116 |
|
| 1078 |
/* |
1117 |
/* |
| 1079 |
* Checks for unrecognized arguments on the command line. |
1118 |
* Checks for unrecognized arguments on the command line. |
| 1080 |
* Since there is no syntactic way to distingush between |
1119 |
* Since there is no syntactic way to distinguish between |
| 1081 |
* ant -foo target1 target2 |
1120 |
* ant -foo target1 target2 |
| 1082 |
* ant -foo fooarg target |
1121 |
* ant -foo fooarg target |
| 1083 |
* we remove everything up to the last argument that |
1122 |
* we remove everything up to the last argument that |
|
Lines 1090-1096
Link Here
|
| 1090 |
|
1129 |
|
| 1091 |
// find the last arg that begins with '-' |
1130 |
// find the last arg that begins with '-' |
| 1092 |
for (int i = commands.size() - 1; i >= 0; i--) { |
1131 |
for (int i = commands.size() - 1; i >= 0; i--) { |
| 1093 |
if (((String) commands.get(0)).startsWith("-")) { //$NON-NLS-1$ |
1132 |
if (((String) commands.get(i)).startsWith("-")) { //$NON-NLS-1$ |
| 1094 |
p = i; |
1133 |
p = i; |
| 1095 |
break; |
1134 |
break; |
| 1096 |
} |
1135 |
} |