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 39713
Collapse All | Expand All

(-)ExternalToolBuilder.java (-31 / +37 lines)
Lines 15-20 Link Here
15
import java.util.Map;
15
import java.util.Map;
16
import java.util.StringTokenizer;
16
import java.util.StringTokenizer;
17
17
18
import org.eclipse.core.resources.*;
18
import org.eclipse.core.resources.IProject;
19
import org.eclipse.core.resources.IProject;
19
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.resources.IResourceDelta;
21
import org.eclipse.core.resources.IResourceDelta;
Lines 48-87 Link Here
48
	 * Method declared on IncrementalProjectBuilder.
49
	 * Method declared on IncrementalProjectBuilder.
49
	 */
50
	 */
50
	protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
51
	protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
51
		ILaunchConfiguration config= ExternalToolsUtil.configFromBuildCommandArgs(args);
52
		//need to build all external tools from one builder (see bug 39713)
52
		if (config == null) {
53
		ICommand[] commands = getProject().getDescription().getBuildSpec();
53
			return null;
54
		for (int i = 0; i < commands.length; i++) 
54
		}
55
			if (ExternalToolBuilder.ID.equals(commands[i].getBuilderName()))
55
		boolean runTool = false;
56
				doBuild(kind, commands[i].getArguments(), monitor);
56
		int[] buildKinds = buildTypesToArray((String)config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, "")); //$NON-NLS-1$
57
		return null;
57
		for (int i = 0; i < buildKinds.length; i++) {
58
	}
58
			if (kind == buildKinds[i]) {
59
		protected void doBuild(int kind, Map args, IProgressMonitor monitor) throws CoreException {
59
				runTool = true;
60
			ILaunchConfiguration config = ExternalToolsUtil.configFromBuildCommandArgs(args);
60
				break;
61
			if (config == null) {
62
				return;
61
			}
63
			}
62
		}
64
			boolean runTool = false;
63
		if (!runTool) {
65
			int[] buildKinds = buildTypesToArray((String) config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, "")); //$NON-NLS-1$
64
			return null;
66
			for (int i = 0; i < buildKinds.length; i++) {
65
		}
67
				if (kind == buildKinds[i]) {
66
		
68
					runTool = true;
67
		boolean buildForChange= true;
69
					break;
68
		if (kind != FULL_BUILD) {
70
				}
69
			IResource[] resources= ExternalToolsUtil.getResourcesForBuildScope(config, monitor);
71
			}
70
			if (resources != null && resources.length > 0) {
72
			if (!runTool) {
71
				buildForChange= buildScopeIndicatesBuild(resources);
73
				return;
74
			}
75
76
			boolean buildForChange = true;
77
			if (kind != FULL_BUILD) {
78
				IResource[] resources = ExternalToolsUtil.getResourcesForBuildScope(config, monitor);
79
				if (resources != null && resources.length > 0) {
80
					buildForChange = buildScopeIndicatesBuild(resources);
81
				}
82
			}
83
84
			if (buildForChange) {
85
				monitor.subTask(MessageFormat.format(ExternalToolsModelMessages.getString("ExternalToolBuilder.Running_{0}..._1"), new String[] { config.getName()})); //$NON-NLS-1$
86
				buildStarted(kind);
87
				config.launch(ILaunchManager.RUN_MODE, monitor);
88
				buildEnded();
72
			}
89
			}
73
		}
90
		}
74
		
75
		if (buildForChange) {
76
			monitor.subTask(MessageFormat.format(ExternalToolsModelMessages.getString("ExternalToolBuilder.Running_{0}..._1"), new String[]{config.getName()})); //$NON-NLS-1$
77
			buildStarted(kind);
78
			config.launch(ILaunchManager.RUN_MODE, monitor);
79
			buildEnded();
80
			forgetLastBuiltState();
81
		}
82
				
83
		return null;
84
	}
85
	
91
	
86
	/**
92
	/**
87
	 * Returns the build type being performed if the
93
	 * Returns the build type being performed if the

Return to bug 39713