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 352131 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/IExternalToolConstants.java (-1 / +16 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 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 136-141 Link Here
136
	public static final String ATTR_LOCATION = UI_PLUGIN_ID + ".ATTR_LOCATION"; //$NON-NLS-1$
136
	public static final String ATTR_LOCATION = UI_PLUGIN_ID + ".ATTR_LOCATION"; //$NON-NLS-1$
137
137
138
	/**
138
	/**
139
	 * String attribute identifying the version of the launch configuration. 
140
	 * This can be used for migration
141
	 * 
142
	 * @since 3.8
143
	 */
144
	public static final String ATTR_VERSION = UI_PLUGIN_ID + ".ATTR_VERSION"; //$NON-NLS-1$
145
	
146
	/**
147
	 * Current version of the launcher configuration
148
	 * 
149
	 * @since 3.8
150
	 */
151
	public static final int VERSION = 1;
152
	
153
	/**
139
	 * Boolean attribute indicating if the user should be prompted for
154
	 * Boolean attribute indicating if the user should be prompted for
140
	 * arguments before running a tool. Default value is <code>false</code>.
155
	 * arguments before running a tool. Default value is <code>false</code>.
141
	 * THIS ATTRIBUTE IS NOT USED.
156
	 * THIS ATTRIBUTE IS NOT USED.
(-)a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java (-2 / +25 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 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 45-50 Link Here
45
	 * @since 3.7
45
	 * @since 3.7
46
	 */
46
	 */
47
	public static final String INC_CLEAN = "incclean"; //$NON-NLS-1$
47
	public static final String INC_CLEAN = "incclean"; //$NON-NLS-1$
48
	
49
	/**
50
	 * Constant added to the build command to determine if the trigger for auto build is really requested
51
	 * 
52
	 * @since 3.8
53
	 */
54
	public static final String NOT_REAL_AUTO  = "notrealauto";//$NON-NLS-1$
48
55
49
	/**
56
	/**
50
	 * Constant used to find a builder using the 3.0-interim format
57
	 * Constant used to find a builder using the 3.0-interim format
Lines 116-121 Link Here
116
				}
123
				}
117
			}
124
			}
118
		}
125
		}
126
		if (configuration != null) {
127
			configuration = ExternalToolMigration.migrateIfRequired(configuration);
128
		}
119
		return configuration;
129
		return configuration;
120
	}
130
	}
121
131
Lines 126-132 Link Here
126
		newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false);
136
		newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false);
127
		String buildKinds = config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null);
137
		String buildKinds = config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null);
128
		int[] triggers = buildTypesToArray(buildKinds);
138
		int[] triggers = buildTypesToArray(buildKinds);
129
		boolean isfull = false, isinc = false;
139
		boolean isfull = false, isinc = false, isauto = false;
130
		for (int i = 0; i < triggers.length; i++) {
140
		for (int i = 0; i < triggers.length; i++) {
131
			switch (triggers[i]) {
141
			switch (triggers[i]) {
132
				case IncrementalProjectBuilder.FULL_BUILD:
142
				case IncrementalProjectBuilder.FULL_BUILD:
Lines 139-149 Link Here
139
					break;
149
					break;
140
				case IncrementalProjectBuilder.AUTO_BUILD:
150
				case IncrementalProjectBuilder.AUTO_BUILD:
141
					newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, true);
151
					newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, true);
152
					isauto = true;
142
					break;
153
					break;
143
				case IncrementalProjectBuilder.CLEAN_BUILD:
154
				case IncrementalProjectBuilder.CLEAN_BUILD:
144
					newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true);
155
					newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true);
145
					break;
156
					break;
146
			}
157
			}
158
		}
159
		if ((isfull || isinc) && !isauto) {
160
			// if build automatically is turned on, AUTO_BUILD targets will be triggered 
161
			// for normal builds too. Hence, get a trigger for AUTO_BUILD too.
162
			Map args = newCommand.getArguments();
163
			if(args == null) {
164
				args = new HashMap();
165
			}
166
			newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, true);
167
			args.put(NOT_REAL_AUTO, Boolean.TRUE.toString());
168
			newCommand.setArguments(args);
147
		}
169
		}
148
		if(!isfull && isinc) {
170
		if(!isfull && isinc) {
149
			Map args = newCommand.getArguments();
171
			Map args = newCommand.getArguments();
Lines 157-162 Link Here
157
		if (!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) {
179
		if (!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) {
158
			ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
180
			ILaunchConfigurationWorkingCopy copy = config.getWorkingCopy();
159
			copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
181
			copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
182
			copy.setAttribute(IExternalToolConstants.ATTR_VERSION, IExternalToolConstants.VERSION);
160
			copy.doSave();
183
			copy.doSave();
161
		}
184
		}
162
	}
185
	}
(-)a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java (-6 / +13 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 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 70-76 Link Here
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
	    if (kind == IncrementalProjectBuilder.AUTO_BUILD && args.get(BuilderCoreUtils.NOT_REAL_AUTO) != null) {
74
	    		return null;
75
	    }
74
		ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]);
76
		ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[1]);
75
        if (config == null) {
77
        if (config == null) {
76
            throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null);
78
            throw ExternalToolsCore.newError(ExternalToolsModelMessages.ExternalToolBuilder_0, null);
Lines 281-295 Link Here
281
    
283
    
282
    protected void clean(IProgressMonitor monitor) throws CoreException {
284
    protected void clean(IProgressMonitor monitor) throws CoreException {
283
	    ICommand command= getCommand();
285
	    ICommand command= getCommand();
284
        ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), new String[1]);
286
	    String[] version = new String[1];
287
        ILaunchConfiguration config= BuilderCoreUtils.configFromBuildCommandArgs(getProject(), command.getArguments(), version);
285
    	if (!configEnabled(config)) {
288
    	if (!configEnabled(config)) {
286
	    	return;
289
	    	return;
287
	    }
290
	    }
288
        
291
        
289
        if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
292
        if ((!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false))) {
290
            //old behavior
293
        	if (version.equals(BuilderCoreUtils.VERSION_3_0_final)) {
291
            super.clean(monitor);
294
        		commandConfiguredForKind(config, IncrementalProjectBuilder.CLEAN_BUILD);
292
            return;
295
        	} else {
296
        		//old behavior
297
	            super.clean(monitor);
298
	            return;
299
        	}
293
        }
300
        }
294
	
301
	
295
		launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, null, monitor);
302
		launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, null, monitor);
(-)a/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/registry/ExternalToolMigration.java (-2 / +51 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 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 17-22 Link Here
17
17
18
import org.eclipse.core.externaltools.internal.ExternalToolsCore;
18
import org.eclipse.core.externaltools.internal.ExternalToolsCore;
19
import org.eclipse.core.externaltools.internal.IExternalToolConstants;
19
import org.eclipse.core.externaltools.internal.IExternalToolConstants;
20
import org.eclipse.core.externaltools.internal.model.BuilderCoreUtils;
21
import org.eclipse.core.resources.IncrementalProjectBuilder;
20
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.debug.core.DebugPlugin;
23
import org.eclipse.debug.core.DebugPlugin;
22
import org.eclipse.debug.core.ILaunchConfiguration;
24
import org.eclipse.debug.core.ILaunchConfiguration;
Lines 406-410 Link Here
406
		}
408
		}
407
		
409
		
408
		return varDef;
410
		return varDef;
409
	}	
411
	}
412
413
	public static ILaunchConfiguration migrateIfRequired(ILaunchConfiguration configuration) {
414
		try {
415
			int version = configuration.getAttribute(IExternalToolConstants.ATTR_VERSION, 0);
416
			if (version < IExternalToolConstants.VERSION) {
417
				// migration may be required
418
				String buildKinds = configuration.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null);
419
				if (buildKinds != null) {
420
					int[] triggers = BuilderCoreUtils.buildTypesToArray(buildKinds);
421
					boolean auto = false;
422
					boolean fullOrIncr = false;
423
					for (int i = 0; i < triggers.length; i++) {
424
						switch (triggers[i]) {
425
						case IncrementalProjectBuilder.FULL_BUILD:
426
						case IncrementalProjectBuilder.INCREMENTAL_BUILD:
427
							fullOrIncr = true;
428
							break;
429
						case IncrementalProjectBuilder.AUTO_BUILD:
430
							auto = true;
431
							break;
432
						}
433
					}
434
					if (!auto && fullOrIncr) {
435
						return updateConfiguration(configuration, /* configure = */true);
436
					}
437
				}
438
				return updateConfiguration(configuration, /* configure = */false);
439
			}
440
		} catch (CoreException e) {
441
			return configuration;
442
		}
443
		return configuration;
444
	}
445
	
446
	private static ILaunchConfiguration updateConfiguration(ILaunchConfiguration configuration, boolean configure) {
447
		try {
448
			ILaunchConfigurationWorkingCopy workingCopy = configuration.getWorkingCopy();
449
			workingCopy.setAttribute(IExternalToolConstants.ATTR_VERSION, IExternalToolConstants.VERSION);
450
			if (configure) {
451
				workingCopy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false);
452
			}
453
			return workingCopy.doSave();
454
		} catch (CoreException e) {
455
			ExternalToolsCore.log(ExternalToolsMigrationMessages.ExternalToolMigration_38, e);
456
		}
457
		return configuration;
458
	}
410
}
459
}
(-)a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 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 308-313 Link Here
308
		configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString());
308
		configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString());
309
		configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
309
		configuration.setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, false);
310
		configuration.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
310
		configuration.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true);
311
		configuration.setAttribute(IExternalToolConstants.ATTR_VERSION, IExternalToolConstants.VERSION);
311
	}
312
	}
312
313
313
	/* (non-Javadoc)
314
	/* (non-Javadoc)

Return to bug 352131