|
Lines 1-290
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2009 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2011 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 |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
| 10 |
* Matthew Conway - Bug 175186 |
10 |
* Matthew Conway - Bug 175186 |
| 11 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
| 12 |
package org.eclipse.core.externaltools.internal.model; |
12 |
package org.eclipse.core.externaltools.internal.model; |
| 13 |
|
13 |
|
| 14 |
|
14 |
|
| 15 |
import java.util.Map; |
15 |
import java.util.Map; |
| 16 |
|
16 |
|
| 17 |
import org.eclipse.core.externaltools.internal.ExternalToolsCore; |
17 |
import org.eclipse.core.externaltools.internal.ExternalToolsCore; |
| 18 |
import org.eclipse.core.externaltools.internal.IExternalToolConstants; |
18 |
import org.eclipse.core.externaltools.internal.IExternalToolConstants; |
| 19 |
import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; |
19 |
import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; |
| 20 |
import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration; |
20 |
import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration; |
| 21 |
import org.eclipse.core.resources.ICommand; |
21 |
import org.eclipse.core.resources.ICommand; |
| 22 |
import org.eclipse.core.resources.IFile; |
22 |
import org.eclipse.core.resources.IFile; |
| 23 |
import org.eclipse.core.resources.IProject; |
23 |
import org.eclipse.core.resources.IProject; |
| 24 |
import org.eclipse.core.resources.IProjectDescription; |
24 |
import org.eclipse.core.resources.IProjectDescription; |
| 25 |
import org.eclipse.core.resources.IResource; |
25 |
import org.eclipse.core.resources.IResource; |
| 26 |
import org.eclipse.core.resources.IResourceDelta; |
26 |
import org.eclipse.core.resources.IResourceDelta; |
| 27 |
import org.eclipse.core.resources.IResourceDeltaVisitor; |
27 |
import org.eclipse.core.resources.IResourceDeltaVisitor; |
| 28 |
import org.eclipse.core.resources.IncrementalProjectBuilder; |
28 |
import org.eclipse.core.resources.IncrementalProjectBuilder; |
| 29 |
import org.eclipse.core.runtime.CoreException; |
29 |
import org.eclipse.core.runtime.CoreException; |
| 30 |
import org.eclipse.core.runtime.IPath; |
30 |
import org.eclipse.core.runtime.IPath; |
| 31 |
import org.eclipse.core.runtime.IProgressMonitor; |
31 |
import org.eclipse.core.runtime.IProgressMonitor; |
| 32 |
import org.eclipse.debug.core.ILaunchConfiguration; |
32 |
import org.eclipse.debug.core.ILaunchConfiguration; |
| 33 |
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
33 |
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; |
| 34 |
import org.eclipse.debug.core.ILaunchManager; |
34 |
import org.eclipse.debug.core.ILaunchManager; |
| 35 |
import org.eclipse.osgi.util.NLS; |
35 |
import org.eclipse.osgi.util.NLS; |
| 36 |
import org.osgi.framework.Bundle; |
36 |
import org.osgi.framework.Bundle; |
| 37 |
|
37 |
|
| 38 |
/** |
38 |
/** |
| 39 |
* This project builder implementation will run an external tool during the |
39 |
* This project builder implementation will run an external tool during the |
| 40 |
* build process. |
40 |
* build process. |
| 41 |
*/ |
41 |
*/ |
| 42 |
public final class ExternalToolBuilder extends IncrementalProjectBuilder { |
42 |
public final class ExternalToolBuilder extends IncrementalProjectBuilder { |
| 43 |
private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor { |
43 |
private final class IgnoreTeamPrivateChanges implements IResourceDeltaVisitor { |
| 44 |
private boolean[] fTrueChange; |
44 |
private boolean[] fTrueChange; |
| 45 |
private IgnoreTeamPrivateChanges(boolean[] trueChange) { |
45 |
private IgnoreTeamPrivateChanges(boolean[] trueChange) { |
| 46 |
super(); |
46 |
super(); |
| 47 |
fTrueChange= trueChange; |
47 |
fTrueChange= trueChange; |
| 48 |
} |
48 |
} |
| 49 |
public boolean visit(IResourceDelta visitDelta) throws CoreException { |
49 |
public boolean visit(IResourceDelta visitDelta) throws CoreException { |
| 50 |
IResource resource= visitDelta.getResource(); |
50 |
IResource resource= visitDelta.getResource(); |
| 51 |
if (resource instanceof IFile) { |
51 |
if (resource instanceof IFile) { |
| 52 |
fTrueChange[0]= true; |
52 |
fTrueChange[0]= true; |
| 53 |
return false; |
53 |
return false; |
| 54 |
} |
54 |
} |
| 55 |
return true; |
55 |
return true; |
| 56 |
} |
56 |
} |
| 57 |
} |
57 |
} |
| 58 |
|
58 |
|
| 59 |
public static final String ID = "org.eclipse.ui.externaltools.ExternalToolBuilder"; //$NON-NLS-1$; |
59 |
public static final String ID = "org.eclipse.ui.externaltools.ExternalToolBuilder"; //$NON-NLS-1$; |
| 60 |
|
60 |
|
| 61 |
private static String buildType = IExternalToolConstants.BUILD_TYPE_NONE; |
61 |
private static String buildType = IExternalToolConstants.BUILD_TYPE_NONE; |
| 62 |
|
62 |
|
| 63 |
private static IProject buildProject= null; |
63 |
private static IProject buildProject= null; |
| 64 |
private static IResourceDelta buildDelta= null; |
64 |
private static IResourceDelta buildDelta= null; |
| 65 |
|
65 |
|
| 66 |
/* (non-Javadoc) |
66 |
/* (non-Javadoc) |
| 67 |
* @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) |
67 |
* @see org.eclipse.core.internal.events.InternalBuilder#build(int, java.util.Map, org.eclipse.core.runtime.IProgressMonitor) |
| 68 |
*/ |
68 |
*/ |
| 69 |
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { |
69 |
protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { |
| 70 |
if (ExternalToolsCore.getDefault().getBundle().getState() != Bundle.ACTIVE) { |
70 |
if (ExternalToolsCore.getDefault().getBundle().getState() != Bundle.ACTIVE) { |
| 71 |
return null; |
71 |
return null; |
| 72 |
} |
72 |
} |
| 73 |
|
73 |
|
| 74 |
ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]); |
74 |
ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]); |
| 75 |
if (config == null) { |
75 |
if (config == null) { |
| 76 |
throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null); |
76 |
throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null); |
| 77 |
} |
77 |
} |
| 78 |
IProject[] projectsWithinScope= null; |
78 |
IProject[] projectsWithinScope= null; |
| 79 |
IResource[] resources = ExternalToolsCoreUtil.getResourcesForBuildScope(config); |
79 |
IResource[] resources = ExternalToolsCoreUtil.getResourcesForBuildScope(config); |
| 80 |
if (resources != null) { |
80 |
if (resources != null) { |
| 81 |
projectsWithinScope= new IProject[resources.length]; |
81 |
projectsWithinScope= new IProject[resources.length]; |
| 82 |
for (int i = 0; i < resources.length; i++) { |
82 |
for (int i = 0; i < resources.length; i++) { |
| 83 |
projectsWithinScope[i]= resources[i].getProject(); |
83 |
projectsWithinScope[i]= resources[i].getProject(); |
| 84 |
} |
84 |
} |
| 85 |
} |
85 |
} |
| 86 |
boolean kindCompatible= commandConfiguredForKind(config, kind); |
86 |
boolean kindCompatible= commandConfiguredForKind(config, kind); |
| 87 |
if (kindCompatible && configEnabled(config)) { |
87 |
if (kindCompatible && configEnabled(config)) { |
| 88 |
doBuildBasedOnScope(resources, kind, config, monitor); |
88 |
doBuildBasedOnScope(resources, kind, config, args, monitor); |
| 89 |
} |
89 |
} |
| 90 |
|
90 |
|
| 91 |
return projectsWithinScope; |
91 |
return projectsWithinScope; |
| 92 |
} |
92 |
} |
| 93 |
|
93 |
|
| 94 |
private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) { |
94 |
private boolean commandConfiguredForKind(ILaunchConfiguration config, int kind) { |
| 95 |
try { |
95 |
try { |
| 96 |
if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { |
96 |
if (!(config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { |
| 97 |
ICommand command= getCommand(); |
97 |
ICommand command= getCommand(); |
| 98 |
//adapt the builder command to make use of the 3.1 support for setting command build kinds |
98 |
//adapt the builder command to make use of the 3.1 support for setting command build kinds |
| 99 |
//this will only happen once for builder/command defined before the support existed |
99 |
//this will only happen once for builder/command defined before the support existed |
| 100 |
BuilderCoreUtils.configureTriggers(config, command); |
100 |
BuilderCoreUtils.configureTriggers(config, command); |
| 101 |
IProjectDescription desc= getProject().getDescription(); |
101 |
IProjectDescription desc= getProject().getDescription(); |
| 102 |
ICommand[] commands= desc.getBuildSpec(); |
102 |
ICommand[] commands= desc.getBuildSpec(); |
| 103 |
int index= getBuilderCommandIndex(commands, command); |
103 |
int index= getBuilderCommandIndex(commands, command); |
| 104 |
if (index != -1) { |
104 |
if (index != -1) { |
| 105 |
commands[index]= command; |
105 |
commands[index]= command; |
| 106 |
desc.setBuildSpec(commands); |
106 |
desc.setBuildSpec(commands); |
| 107 |
getProject().setDescription(desc, null); |
107 |
getProject().setDescription(desc, null); |
| 108 |
ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); |
108 |
ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); |
| 109 |
copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); |
109 |
copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); |
| 110 |
copy.doSave(); |
110 |
copy.doSave(); |
| 111 |
} |
111 |
} |
| 112 |
return command.isBuilding(kind); |
112 |
return command.isBuilding(kind); |
| 113 |
} |
113 |
} |
| 114 |
} catch (CoreException e) { |
114 |
} catch (CoreException e) { |
| 115 |
ExternalToolsCore.log(e); |
115 |
ExternalToolsCore.log(e); |
| 116 |
return true; |
116 |
return true; |
| 117 |
} |
117 |
} |
| 118 |
return true; |
118 |
return true; |
| 119 |
} |
119 |
} |
| 120 |
|
120 |
|
| 121 |
private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) { |
121 |
private int getBuilderCommandIndex(ICommand[] buildSpec, ICommand command) { |
| 122 |
Map commandArgs= command.getArguments(); |
122 |
Map commandArgs= command.getArguments(); |
| 123 |
if (commandArgs == null) { |
123 |
if (commandArgs == null) { |
| 124 |
return -1; |
124 |
return -1; |
| 125 |
} |
125 |
} |
| 126 |
String handle= (String) commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); |
126 |
String handle= (String) commandArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); |
| 127 |
if (handle == null) { |
127 |
if (handle == null) { |
| 128 |
return -1; |
128 |
return -1; |
| 129 |
} |
129 |
} |
| 130 |
for (int i = 0; i < buildSpec.length; ++i) { |
130 |
for (int i = 0; i < buildSpec.length; ++i) { |
| 131 |
ICommand buildSpecCommand= buildSpec[i]; |
131 |
ICommand buildSpecCommand= buildSpec[i]; |
| 132 |
if (ID.equals(buildSpecCommand.getBuilderName())) { |
132 |
if (ID.equals(buildSpecCommand.getBuilderName())) { |
| 133 |
Map buildSpecArgs= buildSpecCommand.getArguments(); |
133 |
Map buildSpecArgs= buildSpecCommand.getArguments(); |
| 134 |
if (buildSpecArgs != null) { |
134 |
if (buildSpecArgs != null) { |
| 135 |
String buildSpecHandle= (String) buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); |
135 |
String buildSpecHandle= (String) buildSpecArgs.get(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE); |
| 136 |
if (handle.equals(buildSpecHandle)) { |
136 |
if (handle.equals(buildSpecHandle)) { |
| 137 |
return i; |
137 |
return i; |
| 138 |
} |
138 |
} |
| 139 |
} |
139 |
} |
| 140 |
} |
140 |
} |
| 141 |
} |
141 |
} |
| 142 |
return -1; |
142 |
return -1; |
| 143 |
} |
143 |
} |
| 144 |
|
144 |
|
| 145 |
/** |
145 |
/** |
| 146 |
* Returns whether the given builder config is enabled or not. |
146 |
* Returns whether the given builder config is enabled or not. |
| 147 |
* |
147 |
* |
| 148 |
* @param config the config to examine |
148 |
* @param config the config to examine |
| 149 |
* @return whether the config is enabled |
149 |
* @return whether the config is enabled |
| 150 |
*/ |
150 |
*/ |
| 151 |
private boolean configEnabled(ILaunchConfiguration config) { |
151 |
private boolean configEnabled(ILaunchConfiguration config) { |
| 152 |
try { |
152 |
try { |
| 153 |
return ExternalToolsCoreUtil.isBuilderEnabled(config); |
153 |
return ExternalToolsCoreUtil.isBuilderEnabled(config); |
| 154 |
} catch (CoreException e) { |
154 |
} catch (CoreException e) { |
| 155 |
ExternalToolsCore.log(e); |
155 |
ExternalToolsCore.log(e); |
| 156 |
} |
156 |
} |
| 157 |
return true; |
157 |
return true; |
| 158 |
} |
158 |
} |
| 159 |
|
159 |
|
| 160 |
private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { |
160 |
private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, Map args, IProgressMonitor monitor) throws CoreException { |
| 161 |
boolean buildForChange = true; |
161 |
boolean buildForChange = true; |
| 162 |
if (kind != FULL_BUILD) { //scope not applied for full builds |
162 |
if (kind != FULL_BUILD) { //scope not applied for full builds |
| 163 |
if (resources != null && resources.length > 0) { |
163 |
if (resources != null && resources.length > 0) { |
| 164 |
buildForChange = buildScopeIndicatesBuild(resources); |
164 |
buildForChange = buildScopeIndicatesBuild(resources); |
| 165 |
} |
165 |
} |
| 166 |
} |
166 |
} |
| 167 |
|
167 |
|
| 168 |
if (buildForChange) { |
168 |
if (buildForChange) { |
| 169 |
launchBuild(kind, config, monitor); |
169 |
launchBuild(kind, config, args, monitor); |
| 170 |
} |
170 |
} |
| 171 |
} |
171 |
} |
| 172 |
|
172 |
|
| 173 |
private void launchBuild(int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { |
173 |
private void launchBuild(int kind, ILaunchConfiguration config, Map args, IProgressMonitor monitor) throws CoreException { |
| 174 |
monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()})); |
174 |
monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()})); |
| 175 |
buildStarted(kind); |
175 |
buildStarted(kind, args); |
| 176 |
// The default value for "launch in background" is true in debug core. If |
176 |
// The default value for "launch in background" is true in debug core. If |
| 177 |
// the user doesn't go through the UI, the new attribute won't be set. This means |
177 |
// the user doesn't go through the UI, the new attribute won't be set. This means |
| 178 |
// that existing Ant builders will try to run in the background (and likely conflict with |
178 |
// that existing Ant builders will try to run in the background (and likely conflict with |
| 179 |
// each other) without migration. |
179 |
// each other) without migration. |
| 180 |
config= ExternalToolMigration.migrateRunInBackground(config); |
180 |
ILaunchConfiguration newconfig= ExternalToolMigration.migrateRunInBackground(config); |
| 181 |
config.launch(ILaunchManager.RUN_MODE, monitor); |
181 |
newconfig.launch(ILaunchManager.RUN_MODE, monitor); |
| 182 |
buildEnded(); |
182 |
buildEnded(); |
| 183 |
} |
183 |
} |
| 184 |
|
184 |
|
| 185 |
/** |
185 |
/** |
| 186 |
* Returns the build type being performed if the |
186 |
* Returns the build type being performed if the |
| 187 |
* external tool is being run as a project builder. |
187 |
* external tool is being run as a project builder. |
| 188 |
* |
188 |
* |
| 189 |
* @return one of the <code>IExternalToolConstants.BUILD_TYPE_*</code> constants. |
189 |
* @return one of the <code>IExternalToolConstants.BUILD_TYPE_*</code> constants. |
| 190 |
*/ |
190 |
*/ |
| 191 |
public static String getBuildType() { |
191 |
public static String getBuildType() { |
| 192 |
return buildType; |
192 |
return buildType; |
| 193 |
} |
193 |
} |
| 194 |
|
194 |
|
| 195 |
/** |
195 |
/** |
| 196 |
* Returns the project that is being built and has triggered the current external |
196 |
* Returns the project that is being built and has triggered the current external |
| 197 |
* tool builder. <code>null</code> is returned if no build is currently occurring. |
197 |
* tool builder. <code>null</code> is returned if no build is currently occurring. |
| 198 |
* |
198 |
* |
| 199 |
* @return project being built or <code>null</code>. |
199 |
* @return project being built or <code>null</code>. |
| 200 |
*/ |
200 |
*/ |
| 201 |
public static IProject getBuildProject() { |
201 |
public static IProject getBuildProject() { |
| 202 |
return buildProject; |
202 |
return buildProject; |
| 203 |
} |
203 |
} |
| 204 |
|
204 |
|
| 205 |
/** |
205 |
/** |
| 206 |
* Returns the <code>IResourceDelta</code> that is being built and has triggered the current external |
206 |
* Returns the <code>IResourceDelta</code> that is being built and has triggered the current external |
| 207 |
* tool builder. <code>null</code> is returned if no build is currently occurring. |
207 |
* tool builder. <code>null</code> is returned if no build is currently occurring. |
| 208 |
* |
208 |
* |
| 209 |
* @return resource delta for the build or <code>null</code> |
209 |
* @return resource delta for the build or <code>null</code> |
| 210 |
*/ |
210 |
*/ |
| 211 |
public static IResourceDelta getBuildDelta() { |
211 |
public static IResourceDelta getBuildDelta() { |
| 212 |
return buildDelta; |
212 |
return buildDelta; |
| 213 |
} |
213 |
} |
| 214 |
|
214 |
|
| 215 |
/** |
215 |
/** |
| 216 |
* Stores the currently active build kind and build project when a build begins |
216 |
* Stores the currently active build kind and build project when a build begins |
| 217 |
* @param buildKind |
217 |
* @param buildKind |
| 218 |
*/ |
218 |
* @param args the arguments passed into the builder |
| 219 |
private void buildStarted(int buildKind) { |
219 |
*/ |
| 220 |
switch (buildKind) { |
220 |
private void buildStarted(int buildKind, Map args) { |
| 221 |
case IncrementalProjectBuilder.INCREMENTAL_BUILD : |
221 |
switch (buildKind) { |
| 222 |
buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; |
222 |
case IncrementalProjectBuilder.INCREMENTAL_BUILD : |
| 223 |
buildDelta = getDelta(getProject()); |
223 |
buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; |
| 224 |
break; |
224 |
buildDelta = getDelta(getProject()); |
| 225 |
case IncrementalProjectBuilder.FULL_BUILD : |
225 |
break; |
| 226 |
buildType = IExternalToolConstants.BUILD_TYPE_FULL; |
226 |
case IncrementalProjectBuilder.FULL_BUILD : |
| 227 |
break; |
227 |
if(args != null && args.containsKey(BuilderCoreUtils.INC_CLEAN)) { |
| 228 |
case IncrementalProjectBuilder.AUTO_BUILD : |
228 |
buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; |
| 229 |
buildType = IExternalToolConstants.BUILD_TYPE_AUTO; |
229 |
buildDelta = getDelta(getProject()); |
| 230 |
buildDelta = getDelta(getProject()); |
230 |
} |
| 231 |
break; |
231 |
else { |
| 232 |
case IncrementalProjectBuilder.CLEAN_BUILD : |
232 |
buildType = IExternalToolConstants.BUILD_TYPE_FULL; |
| 233 |
buildType = IExternalToolConstants.BUILD_TYPE_CLEAN; |
233 |
} |
| 234 |
break; |
234 |
break; |
| 235 |
default : |
235 |
case IncrementalProjectBuilder.AUTO_BUILD : |
| 236 |
buildType = IExternalToolConstants.BUILD_TYPE_NONE; |
236 |
buildType = IExternalToolConstants.BUILD_TYPE_AUTO; |
| 237 |
break; |
237 |
buildDelta = getDelta(getProject()); |
| 238 |
} |
238 |
break; |
| 239 |
buildProject= getProject(); |
239 |
case IncrementalProjectBuilder.CLEAN_BUILD : |
| 240 |
} |
240 |
buildType = IExternalToolConstants.BUILD_TYPE_CLEAN; |
| 241 |
|
241 |
break; |
| 242 |
/** |
242 |
default : |
| 243 |
* Clears the current build kind, build project and build delta when a build finishes. |
243 |
buildType = IExternalToolConstants.BUILD_TYPE_NONE; |
| 244 |
*/ |
244 |
break; |
| 245 |
private void buildEnded() { |
245 |
} |
| 246 |
buildType= IExternalToolConstants.BUILD_TYPE_NONE; |
246 |
buildProject= getProject(); |
| 247 |
buildProject= null; |
247 |
} |
| 248 |
buildDelta= null; |
248 |
|
| 249 |
} |
249 |
/** |
| 250 |
|
250 |
* Clears the current build kind, build project and build delta when a build finishes. |
| 251 |
private boolean buildScopeIndicatesBuild(IResource[] resources) { |
251 |
*/ |
| 252 |
for (int i = 0; i < resources.length; i++) { |
252 |
private void buildEnded() { |
| 253 |
IResourceDelta delta = getDelta(resources[i].getProject()); |
253 |
buildType= IExternalToolConstants.BUILD_TYPE_NONE; |
| 254 |
if (delta == null) { |
254 |
buildProject= null; |
| 255 |
//project just added to the workspace..no previous build tree |
255 |
buildDelta= null; |
| 256 |
return true; |
256 |
} |
| 257 |
} |
257 |
|
| 258 |
IPath path= resources[i].getProjectRelativePath(); |
258 |
private boolean buildScopeIndicatesBuild(IResource[] resources) { |
| 259 |
IResourceDelta change= delta.findMember(path); |
259 |
for (int i = 0; i < resources.length; i++) { |
| 260 |
if (change != null) { |
260 |
IResourceDelta delta = getDelta(resources[i].getProject()); |
| 261 |
final boolean[] trueChange= new boolean[1]; |
261 |
if (delta == null) { |
| 262 |
trueChange[0]= false; |
262 |
//project just added to the workspace..no previous build tree |
| 263 |
try { |
263 |
return true; |
| 264 |
change.accept(new IgnoreTeamPrivateChanges(trueChange)); |
264 |
} |
| 265 |
} catch (CoreException e) { |
265 |
IPath path= resources[i].getProjectRelativePath(); |
| 266 |
ExternalToolsCore.log("Internal error resolving changed resources during build", e); //$NON-NLS-1$ |
266 |
IResourceDelta change= delta.findMember(path); |
| 267 |
} |
267 |
if (change != null) { |
| 268 |
|
268 |
final boolean[] trueChange= new boolean[1]; |
| 269 |
return trueChange[0]; //filtered out team private changes |
269 |
trueChange[0]= false; |
| 270 |
} |
270 |
try { |
| 271 |
} |
271 |
change.accept(new IgnoreTeamPrivateChanges(trueChange)); |
| 272 |
return false; |
272 |
} catch (CoreException e) { |
| 273 |
} |
273 |
ExternalToolsCore.log("Internal error resolving changed resources during build", e); //$NON-NLS-1$ |
| 274 |
|
274 |
} |
| 275 |
protected void clean(IProgressMonitor monitor) throws CoreException { |
275 |
|
| 276 |
ICommand command= getCommand(); |
276 |
return trueChange[0]; //filtered out team private changes |
| 277 |
ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]); |
277 |
} |
| 278 |
if (!configEnabled(config)) { |
278 |
} |
| 279 |
return; |
279 |
return false; |
| 280 |
} |
280 |
} |
| 281 |
|
281 |
|
| 282 |
if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { |
282 |
protected void clean(IProgressMonitor monitor) throws CoreException { |
| 283 |
//old behavior |
283 |
ICommand command= getCommand(); |
| 284 |
super.clean(monitor); |
284 |
ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]); |
| 285 |
return; |
285 |
if (!configEnabled(config)) { |
| 286 |
} |
286 |
return; |
| 287 |
|
287 |
} |
| 288 |
launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, monitor); |
288 |
|
| 289 |
} |
289 |
if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) { |
|
|
290 |
//old behavior |
| 291 |
super.clean(monitor); |
| 292 |
return; |
| 293 |
} |
| 294 |
|
| 295 |
launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, null, monitor); |
| 296 |
} |
| 290 |
} |
297 |
} |