diff options
author | Michael Rennie | 2011-02-22 21:49:30 +0000 |
---|---|---|
committer | Michael Rennie | 2011-02-22 21:49:30 +0000 |
commit | 4edba81e6fb8fbfcf729f9da6104dd86b72901ff (patch) | |
tree | 006cd54fca848397acc715e079102658a4c4eec9 | |
parent | 3af5d412a98439a2f12a1a0e732bce60eebf7d46 (diff) | |
download | eclipse.platform.debug-4edba81e6fb8fbfcf729f9da6104dd86b72901ff.tar.gz eclipse.platform.debug-4edba81e6fb8fbfcf729f9da6104dd86b72901ff.tar.xz eclipse.platform.debug-4edba81e6fb8fbfcf729f9da6104dd86b72901ff.zip |
Bug 335967 - [launching] [builders] Ant Builder doesn't build with Target set to <default>
3 files changed, 42 insertions, 15 deletions
diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java index 6e8a3a2c5..8d8c5df9a 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/BuilderUtils.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -43,6 +43,13 @@ import org.eclipse.ui.externaltools.internal.registry.ExternalToolMigration; */ public class BuilderUtils { + /** + * Constant added to the build command to determine if we are doing an incremental build after a clean + * + * @since 3.5.2 https://bugs.eclipse.org/bugs/show_bug.cgi?id=335967 + */ + public static final String INC_CLEAN = "incclean"; //$NON-NLS-1$ + public static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$ /** @@ -148,15 +155,18 @@ public class BuilderUtils { newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, false); newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false); newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, false); - String buildKinds= config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String)null); - int[] triggers= BuilderUtils.buildTypesToArray(buildKinds); + String buildKinds = config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, (String) null); + int[] triggers = buildTypesToArray(buildKinds); + boolean isfull = false, isinc = false; for (int i = 0; i < triggers.length; i++) { switch (triggers[i]) { case IncrementalProjectBuilder.FULL_BUILD: newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true); + isfull = true; break; case IncrementalProjectBuilder.INCREMENTAL_BUILD: newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, true); + isinc = true; break; case IncrementalProjectBuilder.AUTO_BUILD: newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, true); @@ -166,6 +176,15 @@ public class BuilderUtils { break; } } + if(!isfull && isinc) { + Map args = newCommand.getArguments(); + if(args == null) { + args = new HashMap(2); + } + newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, true); + args.put(INC_CLEAN, Boolean.TRUE.toString()); + newCommand.setArguments(args); + } if (!config.getAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) { ILaunchConfigurationWorkingCopy copy= config.getWorkingCopy(); copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); diff --git a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java index ba3a220eb..812c14be9 100644 --- a/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java +++ b/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/model/ExternalToolBuilder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -83,7 +83,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { } boolean kindCompatible= commandConfiguredForKind(config, kind); if (kindCompatible && configEnabled(config)) { - doBuildBasedOnScope(resources, kind, config, monitor); + doBuildBasedOnScope(resources, kind, config, args, monitor); } return projectsWithinScope; @@ -155,7 +155,7 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { return true; } - private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { + private void doBuildBasedOnScope(IResource[] resources, int kind, ILaunchConfiguration config, Map args, IProgressMonitor monitor) throws CoreException { boolean buildForChange = true; if (kind != FULL_BUILD) { //scope not applied for full builds if (resources != null && resources.length > 0) { @@ -164,19 +164,19 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { } if (buildForChange) { - launchBuild(kind, config, monitor); + launchBuild(kind, config, args, monitor); } } - private void launchBuild(int kind, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException { + private void launchBuild(int kind, ILaunchConfiguration config, Map args, IProgressMonitor monitor) throws CoreException { monitor.subTask(NLS.bind(ExternalToolsModelMessages.ExternalToolBuilder_Running__0_____1, new String[] { config.getName()})); - buildStarted(kind); + buildStarted(kind, args); // The default value for "launch in background" is true in debug core. If // the user doesn't go through the UI, the new attribute won't be set. This means // that existing Ant builders will try to run in the background (and likely conflict with // each other) without migration. - config= ExternalToolMigration.migrateRunInBackground(config); - config.launch(ILaunchManager.RUN_MODE, monitor); + ILaunchConfiguration newconfig= ExternalToolMigration.migrateRunInBackground(config); + newconfig.launch(ILaunchManager.RUN_MODE, monitor); buildEnded(); } @@ -213,15 +213,23 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { /** * Stores the currently active build kind and build project when a build begins * @param buildKind + * @param args */ - private void buildStarted(int buildKind) { + private void buildStarted(int buildKind, Map args) { switch (buildKind) { case IncrementalProjectBuilder.INCREMENTAL_BUILD : + buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; buildDelta = getDelta(getProject()); break; case IncrementalProjectBuilder.FULL_BUILD : - buildType = IExternalToolConstants.BUILD_TYPE_FULL; + if(args != null && args.containsKey(BuilderUtils.INC_CLEAN)) { + buildType = IExternalToolConstants.BUILD_TYPE_INCREMENTAL; + buildDelta = getDelta(getProject()); + } + else { + buildType = IExternalToolConstants.BUILD_TYPE_FULL; + } break; case IncrementalProjectBuilder.AUTO_BUILD : buildType = IExternalToolConstants.BUILD_TYPE_AUTO; @@ -283,6 +291,6 @@ public final class ExternalToolBuilder extends IncrementalProjectBuilder { return; } - launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, monitor); + launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, null, monitor); } }
\ No newline at end of file diff --git a/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF b/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF index 5dce95ff1..89e0223ee 100644 --- a/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF +++ b/org.eclipse.ui.externaltools/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Plugin.name Bundle-SymbolicName: org.eclipse.ui.externaltools; singleton:=true -Bundle-Version: 3.2.0.qualifier +Bundle-Version: 3.2.1.qualifier Bundle-Activator: org.eclipse.ui.externaltools.internal.model.ExternalToolsPlugin Bundle-Vendor: %Plugin.providerName Bundle-Localization: plugin |