Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 294502 | Differences between
and this patch

Collapse All | Expand All

(-)src_ant/org/eclipse/ant/internal/core/ant/InternalAntRunner.java (-14 / +40 lines)
Lines 24-36 Link Here
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;
28
import java.util.Iterator;
27
import java.util.Iterator;
29
import java.util.List;
28
import java.util.List;
30
import java.util.ListIterator;
29
import java.util.ListIterator;
31
import java.util.Map;
30
import java.util.Map;
32
import java.util.Properties;
31
import java.util.Properties;
33
import java.util.Set;
34
import java.util.Vector;
32
import java.util.Vector;
35
33
36
import org.apache.tools.ant.AntTypeDefinition;
34
import org.apache.tools.ant.AntTypeDefinition;
Lines 426-431 Link Here
426
			processAntHome(true);
424
			processAntHome(true);
427
		}
425
		}
428
	}
426
	}
427
	
428
	/**
429
	 * Returns a list of target names in the build script.
430
	 * 
431
	 * @return a list of target names
432
	 */
433
	private List getTargetNames() {
434
		try {
435
		    setJavaClassPath();
436
			Project antProject;
437
		
438
			antProject = getProject();
439
			processAntHome(false);
440
			antProject.init();
441
			setTypes(antProject);
442
			processProperties(AntCoreUtil.getArrayList(extraArguments));
443
			
444
			setProperties(antProject, false);
445
			if (isVersionCompatible("1.5")) { //$NON-NLS-1$
446
				new InputHandlerSetter().setInputHandler(antProject, "org.eclipse.ant.internal.core.ant.NullInputHandler"); //$NON-NLS-1$
447
			}
448
			parseBuildFile(antProject);
449
			Enumeration projectTargets = antProject.getTargets().elements();
450
			List names = new ArrayList();
451
			Target target;
452
			while (projectTargets.hasMoreElements()) {
453
				target = (Target) projectTargets.nextElement();
454
				String name= target.getName();
455
				if (name.length() == 0) {
456
					//"no name" implicit target of Ant 1.6
457
					continue;
458
				}
459
				names.add(name);
460
			}
461
			return names;
462
		} finally {
463
			processAntHome(true);
464
		}
465
	}	
429
466
430
	private Project getProject() {
467
	private Project getProject() {
431
		Project antProject;
468
		Project antProject;
Lines 1089-1106 Link Here
1089
	 * @since 3.6
1126
	 * @since 3.6
1090
	 */
1127
	 */
1091
	private void processUnrecognizedTargets(List commands) {
1128
	private void processUnrecognizedTargets(List commands) {
1092
		List list = getTargets();
1129
		List names = getTargetNames();
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();
1130
		ListIterator iterator = commands.listIterator();
1105
		
1131
		
1106
		while (iterator.hasNext()) {
1132
		while (iterator.hasNext()) {
(-)tests/org/eclipse/ant/tests/core/tests/FrameworkTests.java (-1 / +12 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 126-131 Link Here
126
        run("NoDefault.xml");
126
        run("NoDefault.xml");
127
        assertSuccessful();
127
        assertSuccessful();
128
    }
128
    }
129
    
130
    /**
131
     * Regression test for running a specific target from a script that has no default target.
132
     * Associated with bug 294502.
133
     * 
134
     * @throws CoreException
135
     */
136
    public void testSpecificTargetWithNoDefaultTarget() throws CoreException {
137
    	run("NoDefault.xml", new String[]{"test"});
138
    	assertSuccessful();
139
    }
129
	
140
	
130
	/**
141
	/**
131
	 * Ensures that tasks like javac work when includeAntRuntime is specified
142
	 * Ensures that tasks like javac work when includeAntRuntime is specified

Return to bug 294502