Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 188608 Details for
Bug 114563
[launching] [builders] Ant Builder doesn't build with Target set to <default>
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch + regression tests
ant_builders.patch (text/plain), 55.83 KB, created by
Michael Rennie
on 2011-02-09 13:03:49 EST
(
hide
)
Description:
patch + regression tests
Filename:
MIME Type:
Creator:
Michael Rennie
Created:
2011-02-09 13:03:49 EST
Size:
55.83 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ant.tests.ui >Index: External Tools/org/eclipse/ant/tests/ui/externaltools/AbstractExternalToolTest.java >=================================================================== >RCS file: External Tools/org/eclipse/ant/tests/ui/externaltools/AbstractExternalToolTest.java >diff -N External Tools/org/eclipse/ant/tests/ui/externaltools/AbstractExternalToolTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ External Tools/org/eclipse/ant/tests/ui/externaltools/AbstractExternalToolTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,204 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ant.tests.ui.externaltools; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import junit.framework.Test; >+ >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.model.BuilderCoreUtils; >+import org.eclipse.core.externaltools.internal.registry.ExternalToolMigration; >+import org.eclipse.core.resources.ICommand; >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+import org.eclipse.ui.externaltools.internal.model.BuilderUtils; >+ >+/** >+ * Abstract {@link Test} class for external tools >+ * >+ * @since 3.5.100 org.eclipse.ant.tests.ui >+ */ >+public abstract class AbstractExternalToolTest extends AbstractAntUITest { >+ >+ static final String EXT_BUILD_FILE_NAME = "ext-builders.xml"; >+ >+ /** >+ * Constructor >+ * @param name >+ */ >+ public AbstractExternalToolTest(String name) { >+ super(name); >+ } >+ >+ /** >+ * Creates a new external tool builder for the given project from the given {@link ILaunchConfiguration} >+ * >+ * @param project the parent project >+ * @param name the name of the config >+ * @param args the argument map to set in the new configuration >+ * @return a new Ant build {@link ILaunchConfiguration} or <code>null</code> >+ * @throws Exception >+ */ >+ protected ILaunchConfiguration createExternalToolBuilder(IProject project, String name, Map args) throws Exception { >+ IFolder dir = getProject().getFolder(BuilderCoreUtils.BUILDER_FOLDER_NAME); >+ if(!dir.exists()) { >+ dir.create(true, true, null); >+ } >+ ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager().getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE); >+ if(type != null) { >+ ILaunchConfigurationWorkingCopy config = type.newInstance(dir, name); >+ config.setAttributes(args); >+ return config.doSave(); >+ } >+ return null; >+ } >+ >+ /** >+ * Creates a new external tool Ant build configuration that has never been saved >+ * @param project >+ * @param name >+ * @param args >+ * @return >+ * @throws Exception >+ */ >+ protected ILaunchConfigurationWorkingCopy createExternalToolBuilderWorkingCopy(IProject project, String name, Map args) throws Exception { >+ IFolder dir = getProject().getFolder(BuilderCoreUtils.BUILDER_FOLDER_NAME); >+ if(!dir.exists()) { >+ dir.create(true, true, null); >+ } >+ ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager().getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE); >+ if(type != null) { >+ ILaunchConfigurationWorkingCopy config = type.newInstance(dir, name); >+ config.setAttributes(args); >+ return config; >+ } >+ return null; >+ } >+ >+ /** >+ * Creates a new empty {@link ICommand} >+ * @return the new build {@link ICommand} >+ * @throws Exception >+ */ >+ protected ICommand createEmptyBuildCommand() throws Exception { >+ return getProject().getDescription().newCommand(); >+ } >+ >+ /** >+ * Creates a new builder {@link ICommand} >+ * @param config >+ * @return the new builder {@link ICommand} >+ * @throws Exception >+ */ >+ protected ICommand createBuildCommand(ILaunchConfiguration config) throws Exception { >+ return BuilderUtils.commandFromLaunchConfig(getProject(), config); >+ } >+ >+ /** >+ * Returns a map of arguments for an Ant buildfile using >+ * Eclipse 2.0 arguments. >+ * >+ * @return a map of 2.0 arguments for an Ant buildfile. >+ */ >+ protected Map get20AntArgumentMap() { >+ HashMap arguments= new HashMap(); >+ arguments.put(ExternalToolMigration.TAG_VERSION, "2.0"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_TYPE, "org.eclipse.ui.externaltools.type.ant"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_NAME, "ant tool"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_LOCATION, "location"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_REFRESH, "refresh scope"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_ARGUMENTS, "arg ${ant_target:target1} ${ant_target:target2}"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_SHOW_LOG, "true"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_BLOCK, "false"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_BUILD_TYPES, "build kinds"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_DIRECTORY, "working dir"); >+ return arguments; >+ } >+ >+ /** >+ * Returns a map of arguments for executing a program >+ * using Eclipse 2.0 arguments. >+ * >+ * @return a map of 2.0 arguments for a program >+ */ >+ protected Map get20ProgramArgumentMap() { >+ HashMap arguments= new HashMap(); >+ arguments.put(ExternalToolMigration.TAG_VERSION, "2.0"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_TYPE, "org.eclipse.ui.externaltools.type.program"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_NAME, "program tool"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_LOCATION, "location"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_REFRESH, "refresh scope"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_ARGUMENTS, "arg ${ant_target:target1} ${ant_target:target2}"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_SHOW_LOG, "true"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_BLOCK, "false"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_BUILD_TYPES, "build kinds"); >+ arguments.put(ExternalToolMigration.TAG_TOOL_DIRECTORY, "working dir"); >+ return arguments; >+ } >+ >+ /** >+ * Returns a map of arguments for executing an Ant >+ * buildfile using Eclipse 2.1 arguments. >+ * >+ * @return a map of 2.1 arguments for an Ant buildfile >+ */ >+ protected Map get21AntArgumentMap() { >+ HashMap arguments= new HashMap(); >+ arguments.put(ExternalToolMigration.TAG_VERSION, "2.1"); >+ arguments.put(ExternalToolMigration.TAG_NAME, "ant config"); >+ arguments.put(ExternalToolMigration.TAG_TYPE, ExternalToolMigration.TOOL_TYPE_ANT_BUILD); >+ arguments.put(ExternalToolMigration.TAG_LOCATION, "location"); >+ arguments.put(ExternalToolMigration.TAG_WORK_DIR, "working directory"); >+ arguments.put(ExternalToolMigration.TAG_CAPTURE_OUTPUT, "true"); >+ arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >+ arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >+ arguments.put(ExternalToolMigration.TAG_RUN_BKGRND, "true"); >+ arguments.put(ExternalToolMigration.TAG_PROMPT_ARGS, "true"); >+ arguments.put(ExternalToolMigration.TAG_REFRESH_SCOPE, "refresh scope"); >+ arguments.put(ExternalToolMigration.TAG_REFRESH_RECURSIVE, "true"); >+ arguments.put(ExternalToolMigration.TAG_RUN_BUILD_KINDS, "build kinds"); >+ arguments.put(ExternalToolMigration.TAG_ARGS, "arg1 arg2"); >+ arguments.put(ExternalToolMigration.TAG_EXTRA_ATTR, ExternalToolMigration.RUN_TARGETS_ATTRIBUTE + "=target1,target2"); >+ return arguments; >+ } >+ >+ /** >+ * Returns a map of arguments for executing a program >+ * buildfile using Eclipse 2.1 arguments. >+ * >+ * @return a map of 2.1 arguments for a program >+ */ >+ protected Map get21ProgramArgumentMap() { >+ HashMap arguments= new HashMap(); >+ arguments.put(ExternalToolMigration.TAG_VERSION, "2.1"); >+ arguments.put(ExternalToolMigration.TAG_NAME, "program config"); >+ arguments.put(ExternalToolMigration.TAG_TYPE, IExternalToolConstants.TOOL_TYPE_PROGRAM); >+ arguments.put(ExternalToolMigration.TAG_LOCATION, "location"); >+ arguments.put(ExternalToolMigration.TAG_WORK_DIR, "working directory"); >+ arguments.put(ExternalToolMigration.TAG_CAPTURE_OUTPUT, "true"); >+ arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >+ arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >+ arguments.put(ExternalToolMigration.TAG_RUN_BKGRND, "true"); >+ arguments.put(ExternalToolMigration.TAG_PROMPT_ARGS, "true"); >+ arguments.put(ExternalToolMigration.TAG_REFRESH_SCOPE, "refresh scope"); >+ arguments.put(ExternalToolMigration.TAG_REFRESH_RECURSIVE, "true"); >+ arguments.put(ExternalToolMigration.TAG_RUN_BUILD_KINDS, "build kinds"); >+ arguments.put(ExternalToolMigration.TAG_ARGS, "arg1 arg2"); >+ return arguments; >+ } >+} >Index: External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java >=================================================================== >RCS file: External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java >diff -N External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ External Tools/org/eclipse/ant/tests/ui/externaltools/BuilderCoreUtilsTests.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,486 @@ >+/******************************************************************************* >+ * Copyright (c) 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ant.tests.ui.externaltools; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.ant.internal.launching.AntLaunchingUtil; >+import org.eclipse.ant.launching.IAntLaunchConstants; >+import org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest; >+import org.eclipse.core.externaltools.internal.IExternalToolConstants; >+import org.eclipse.core.externaltools.internal.model.BuilderCoreUtils; >+import org.eclipse.core.resources.ICommand; >+import org.eclipse.core.resources.IncrementalProjectBuilder; >+import org.eclipse.debug.core.ILaunchConfiguration; >+import org.eclipse.debug.core.ILaunchConfigurationType; >+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; >+ >+/** >+ * Tests for {@link BuilderCoreUtils} >+ * >+ * @since 3.5.100 org.eclipse.ant.tests.ui >+ */ >+public class BuilderCoreUtilsTests extends AbstractExternalToolTest { >+ >+ /** >+ * Constructor >+ */ >+ public BuilderCoreUtilsTests() { >+ super("BuilderCoreUtils Tests"); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ant.tests.ui.testplugin.AbstractAntUITest#setUp() >+ */ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ //create the external tool builder dir >+ BuilderCoreUtils.getBuilderFolder(getProject(), true); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map, String[])} >+ * method. >+ * <br><br> >+ * Tests the argument map missing the {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute and all other config arguments >+ * @throws Exception >+ */ >+ public void testConfigFromBuildCommandArgs1() throws Exception { >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), new HashMap(), new String[] {BuilderCoreUtils.VERSION_1_0}); >+ assertNull("There should be no configuration returned without the config handle and arguments", config); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map, String[])} >+ * method. >+ * <br><br> >+ * Tests the argument map missing the {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute only >+ * @throws Exception >+ */ >+ public void testConfigFromBuildCommandArgs2() throws Exception { >+ Map args = get20AntArgumentMap(); >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1}); >+ assertNotNull("There should be a migrated configuration returned", config); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map, String[])} >+ * method. >+ * <br><br> >+ * Tests the argument map with an invalid {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute >+ * @throws Exception >+ */ >+ public void testConfigFromBuildCommandArgs3() throws Exception { >+ Map args = new HashMap(); >+ args.put(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE, "foo"); >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1}); >+ assertNull("There should be no configuration returned", config); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map, String[])} >+ * method. >+ * <br><br> >+ * Tests the argument map with a valid {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute with no project prefix, but does >+ * include the .externalToolBuilders dir name - causes a lookup in the launch manager which fails because of the extra path prefix >+ * @throws Exception >+ */ >+ public void testConfigFromBuildCommandArgs4() throws Exception { >+ createExternalToolBuilder(getProject(), "testConfigFromBuildCommandArgs4", null); >+ Map args = new HashMap(); >+ args.put(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE, "/.externalToolBuilders/testConfigFromBuildCommandArgs4.launch"); >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1}); >+ assertNull("There should be no configuration returned", config); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map, String[])} >+ * method. >+ * <br><br> >+ * Tests the argument map with a valid {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute with no project prefix - >+ * causes a lookup in the launch manager returns the config >+ * @throws Exception >+ */ >+ public void testConfigFromBuildCommandArgs5() throws Exception { >+ createExternalToolBuilder(getProject(), "testConfigFromBuildCommandArgs5", null); >+ Map args = new HashMap(); >+ args.put(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE, "testConfigFromBuildCommandArgs5.launch"); >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1}); >+ assertNotNull("There should be a configuration returned", config); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map, String[])} >+ * method. >+ * <br><br> >+ * Tests the argument map with a valid {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute with the project prefix but >+ * not including the .externalToolBuilder path segment >+ * @throws Exception >+ */ >+ public void testConfigFromBuildCommandArgs6() throws Exception { >+ createExternalToolBuilder(getProject(), "testConfigFromBuildCommandArgs6", null); >+ Map args = new HashMap(); >+ args.put(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE, "<project>/testConfigFromBuildCommandArgs6.launch"); >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1}); >+ assertNull("There should be no configuration returned", config); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configFromBuildCommandArgs(org.eclipse.core.resources.IProject, java.util.Map, String[])} >+ * method. >+ * <br><br> >+ * Tests the argument map with a valid {@link BuilderCoreUtils#LAUNCH_CONFIG_HANDLE} attribute with the project prefix and >+ * a valid config path >+ * @throws Exception >+ */ >+ public void testConfigFromBuildCommandArgs7() throws Exception { >+ createExternalToolBuilder(getProject(), "testConfigFromBuildCommandArgs7", null); >+ Map args = new HashMap(); >+ args.put(BuilderCoreUtils.LAUNCH_CONFIG_HANDLE, "<project>/.externalToolBuilders/testConfigFromBuildCommandArgs7.launch"); >+ ILaunchConfiguration config = BuilderCoreUtils.configFromBuildCommandArgs(getProject(), args, new String[] {BuilderCoreUtils.VERSION_2_1}); >+ assertNotNull("There should be a configuration returned", config); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for a full build of the default target after a clean >+ * @throws Exception >+ */ >+ public void testConfigureTriggers1() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, null); >+ args.put(IExternalToolConstants.ATTR_LOCATION, getBuildFile(EXT_BUILD_FILE_NAME).getAbsolutePath()); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_FULL); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers1", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building FULL builds", command.isBuilding(IncrementalProjectBuilder.FULL_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - null given for target names", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for a full build of a specific targets 'def' and 'clean' >+ * @throws Exception >+ */ >+ public void testConfigureTriggers2() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, "def,clean"); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_FULL); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers2", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building FULL builds", command.isBuilding(IncrementalProjectBuilder.FULL_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - only available during a build", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for an incremental AND full build with default targets >+ * <br><br> >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=114563 >+ * @throws Exception >+ */ >+ public void testConfigureTriggers3() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS, null); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_INCREMENTAL); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers3", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building INCREMENTAL builds", command.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD)); >+ assertTrue("the command must be building FULL builds", command.isBuilding(IncrementalProjectBuilder.FULL_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - null given for target names", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for an incremental AND full build with the targets 'def' and 'inc' >+ * <br><br> >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=114563 >+ * @throws Exception >+ */ >+ public void testConfigureTriggers4() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS, "def,inc"); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_INCREMENTAL); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers4", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building INCREMENTAL builds", command.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD)); >+ assertTrue("the command must be building FULL builds", command.isBuilding(IncrementalProjectBuilder.FULL_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - only available during a build", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for an auto build >+ * @throws Exception >+ */ >+ public void testConfigureTriggers5() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS, null); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_AUTO); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers5", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building AUTO builds", command.isBuilding(IncrementalProjectBuilder.AUTO_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - null given for target names", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for an auto build with the targets 'def' and 'auto' >+ * @throws Exception >+ */ >+ public void testConfigureTriggers6() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS, "def,auto"); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_AUTO); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers6", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building AUTO builds", command.isBuilding(IncrementalProjectBuilder.AUTO_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - only available during a build", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for a clean build >+ * @throws Exception >+ */ >+ public void testConfigureTriggers7() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS, null); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_CLEAN); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers7", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - null given for target names", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for a clean build with the targets 'def' and 'clean' >+ * @throws Exception >+ */ >+ public void testConfigureTriggers8() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS, "def,clean"); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_CLEAN); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers6", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - only available during a build", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for a full + incremental build with the targets 'def' and 'inc' specified >+ * for after clean targets and manual targets respectively >+ * @throws Exception >+ */ >+ public void testConfigureTriggers9() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, "def"); >+ args.put(IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS, "inc"); >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, IExternalToolConstants.BUILD_TYPE_CLEAN+","+IExternalToolConstants.BUILD_TYPE_INCREMENTAL); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers9", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.FULL_BUILD)); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - only available during a build", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#configureTriggers(org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests that the triggers are configured for a full + incremental build with the targets 'def' and 'inc' specified >+ * for after clean targets and manual targets respectively >+ * @throws Exception >+ */ >+ public void testConfigureTriggers10() throws Exception { >+ Map args = new HashMap(); >+ args.put(IAntLaunchConstants.ATTR_ANT_AFTER_CLEAN_TARGETS, "def"); >+ args.put(IAntLaunchConstants.ATTR_ANT_MANUAL_TARGETS, "inc"); >+ args.put(IAntLaunchConstants.ATTR_ANT_AUTO_TARGETS, "auto"); >+ args.put(IAntLaunchConstants.ATTR_ANT_CLEAN_TARGETS, "clean"); >+ String kinds = IExternalToolConstants.BUILD_TYPE_CLEAN+","+ >+ IExternalToolConstants.BUILD_TYPE_INCREMENTAL+","+ >+ IExternalToolConstants.BUILD_TYPE_AUTO+","+ >+ IExternalToolConstants.BUILD_TYPE_FULL; >+ args.put(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, kinds); >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testConfigureTriggers10", args); >+ assertNotNull("the test builder must not be null", config); >+ ICommand command = createBuildCommand(config); >+ assertNotNull("the test build command must not be null", command); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.FULL_BUILD)); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD)); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.CLEAN_BUILD)); >+ assertTrue("the command must be building CLEAN builds", command.isBuilding(IncrementalProjectBuilder.AUTO_BUILD)); >+ String[] names = AntLaunchingUtil.getTargetNames(config); >+ assertNull("should be no target names resolved from the config - only available during a build", names); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#isUnmigratedConfig(org.eclipse.debug.core.ILaunchConfiguration)} method >+ * @throws Exception >+ */ >+ public void testIsUnmigratedConfig1() throws Exception { >+ ILaunchConfigurationType type = AbstractAntUITest.getLaunchManager().getLaunchConfigurationType(IAntLaunchConstants.ID_ANT_BUILDER_LAUNCH_CONFIGURATION_TYPE); >+ if(type != null) { >+ ILaunchConfigurationWorkingCopy config = type.newInstance(BuilderCoreUtils.getBuilderFolder(getProject(), true), "testIsUnmigratedConfig1"); >+ assertTrue("should be considered 'unmigrated'", BuilderCoreUtils.isUnmigratedConfig(config)); >+ } >+ else { >+ fail("could not find the Ant builder launch configuration type"); >+ } >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#isUnmigratedConfig(org.eclipse.debug.core.ILaunchConfiguration)} method >+ * @throws Exception >+ */ >+ public void testIsUnmigratedConfig2() throws Exception { >+ ILaunchConfiguration config = createExternalToolBuilder(getProject(), "testIsUnmigratedConfig2", null); >+ assertFalse("Shoudl not be considered 'unmigrated'", BuilderCoreUtils.isUnmigratedConfig(config)); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#toBuildCommand(org.eclipse.core.resources.IProject, org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests the case of a new un-saved {@link ILaunchConfiguration} >+ * @throws Exception >+ */ >+ public void testToBuildCommand1() throws Exception { >+ ILaunchConfigurationWorkingCopy copy = createExternalToolBuilderWorkingCopy(getProject(), "testToBuildCommand1", null); >+ ICommand command = BuilderCoreUtils.toBuildCommand(getProject(), copy, getProject().getDescription().newCommand()); >+ assertNotNull("There should have been a new build command created", command); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#toBuildCommand(org.eclipse.core.resources.IProject, org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests the case of an existing configuration >+ * @throws Exception >+ */ >+ public void testToBuildCommand2() throws Exception { >+ Map args = new HashMap(); >+ ILaunchConfiguration copy = createExternalToolBuilder(getProject(), "testToBuildCommand2", args); >+ ICommand command = BuilderCoreUtils.toBuildCommand(getProject(), copy, getProject().getDescription().newCommand()); >+ assertNotNull("There should have been a new build command created", command); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#toBuildCommand(org.eclipse.core.resources.IProject, org.eclipse.debug.core.ILaunchConfiguration, org.eclipse.core.resources.ICommand)} >+ * method >+ * <br><br> >+ * Tests the case of the working copy of an existing configuration >+ * @throws Exception >+ */ >+ public void testToBuildCommand3() throws Exception { >+ Map args = new HashMap(); >+ ILaunchConfiguration copy = createExternalToolBuilder(getProject(), "testToBuildCommand3", args); >+ ICommand command = BuilderCoreUtils.toBuildCommand(getProject(), copy.getWorkingCopy(), getProject().getDescription().newCommand()); >+ assertNotNull("There should have been a new build command created", command); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#migrateBuilderConfiguration(org.eclipse.core.resources.IProject, org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)} >+ * method >+ * @throws Exception >+ */ >+ public void testMigrateBuilderConfiguration1() throws Exception { >+ ILaunchConfigurationWorkingCopy copy = createExternalToolBuilderWorkingCopy(getProject(), "testMigrateBuilderConfiguration1", null); >+ ILaunchConfiguration config = BuilderCoreUtils.migrateBuilderConfiguration(getProject(), copy); >+ assertNotNull("The un-saved working copy should have been migrated", config); >+ assertTrue("The name of the migrated configuration should be testMigrateBuilderConfiguration1", config.getName().equals("testMigrateBuilderConfiguration1")); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#migrateBuilderConfiguration(org.eclipse.core.resources.IProject, org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)} >+ * method >+ * @throws Exception >+ */ >+ public void testMigrateBuilderConfiguration2() throws Exception { >+ ILaunchConfigurationWorkingCopy copy = createExternalToolBuilderWorkingCopy(getProject(), "testMigra/teBuilderConfi/guration2", null); >+ ILaunchConfiguration config = BuilderCoreUtils.migrateBuilderConfiguration(getProject(), copy); >+ assertNotNull("The un-saved working copy should have been migrated", config); >+ assertTrue("The name of the migrated configuration should be testMigra.teBuilderConfi.guration2", config.getName().equals("testMigra.teBuilderConfi.guration2")); >+ } >+ >+ /** >+ * Tests the {@link BuilderCoreUtils#buildTypesToArray(String)} method >+ * @throws Exception >+ */ >+ public void testBuildTypesToArray1() throws Exception { >+ String kinds = IExternalToolConstants.BUILD_TYPE_CLEAN+","+ >+ IExternalToolConstants.BUILD_TYPE_INCREMENTAL+","+ >+ IExternalToolConstants.BUILD_TYPE_AUTO+","+ >+ IExternalToolConstants.BUILD_TYPE_FULL; >+ int[] array = BuilderCoreUtils.buildTypesToArray(kinds); >+ assertNotNull("The build kinds array cannot be null", array); >+ boolean contains = true; >+ for (int i = 0; i < array.length; i++) { >+ contains &= (array[i] == IncrementalProjectBuilder.AUTO_BUILD) | >+ (array[i] == IncrementalProjectBuilder.CLEAN_BUILD) | >+ (array[i] == IncrementalProjectBuilder.FULL_BUILD) | >+ (array[i] == IncrementalProjectBuilder.INCREMENTAL_BUILD); >+ if(!contains) { >+ break; >+ } >+ } >+ assertTrue("All of the build kinds should have been found", contains); >+ } >+} >Index: External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java,v >retrieving revision 1.9 >diff -u -r1.9 MigrationTests.java >--- External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java 8 Oct 2009 18:44:12 -0000 1.9 >+++ External Tools/org/eclipse/ant/tests/ui/externaltools/MigrationTests.java 9 Feb 2011 18:02:29 -0000 >@@ -10,11 +10,8 @@ > *******************************************************************************/ > package org.eclipse.ant.tests.ui.externaltools; > >-import java.util.HashMap; > import java.util.Map; > >-import junit.framework.TestCase; >- > import org.eclipse.ant.internal.launching.AntLaunchingUtil; > import org.eclipse.ant.launching.IAntLaunchConstants; > import org.eclipse.core.externaltools.internal.IExternalToolConstants; >@@ -29,9 +26,16 @@ > * Tests migration of Ant and External Tool configurations from old > * formats to the current format. > */ >-public class MigrationTests extends TestCase { >+public class MigrationTests extends AbstractExternalToolTest { > > /** >+ * Constructor >+ */ >+ public MigrationTests() { >+ super("Migration Tests"); >+ } >+ >+ /** > * Tests migration of arguments from an Eclipse 2.0 Ant buildfile > * configuration to a current launch configuration. > * >@@ -59,27 +63,6 @@ > } > > /** >- * Returns a map of arguments for an Ant buildfile using >- * Eclipse 2.0 arguments. >- * >- * @return a map of 2.0 arguments for an Ant buildfile. >- */ >- private Map get20AntArgumentMap() { >- HashMap arguments= new HashMap(); >- arguments.put(ExternalToolMigration.TAG_VERSION, "2.0"); >- arguments.put(ExternalToolMigration.TAG_TOOL_TYPE, "org.eclipse.ui.externaltools.type.ant"); >- arguments.put(ExternalToolMigration.TAG_TOOL_NAME, "ant tool"); >- arguments.put(ExternalToolMigration.TAG_TOOL_LOCATION, "location"); >- arguments.put(ExternalToolMigration.TAG_TOOL_REFRESH, "refresh scope"); >- arguments.put(ExternalToolMigration.TAG_TOOL_ARGUMENTS, "arg ${ant_target:target1} ${ant_target:target2}"); >- arguments.put(ExternalToolMigration.TAG_TOOL_SHOW_LOG, "true"); >- arguments.put(ExternalToolMigration.TAG_TOOL_BLOCK, "false"); >- arguments.put(ExternalToolMigration.TAG_TOOL_BUILD_TYPES, "build kinds"); >- arguments.put(ExternalToolMigration.TAG_TOOL_DIRECTORY, "working dir"); >- return arguments; >- } >- >- /** > * Tests migration of arguments from an Eclipse 2.0 Ant buildfile > * configuration to a current launch configuration. > * >@@ -100,27 +83,6 @@ > } > > /** >- * Returns a map of arguments for executing a program >- * using Eclipse 2.0 arguments. >- * >- * @return a map of 2.0 arguments for a program >- */ >- private Map get20ProgramArgumentMap() { >- HashMap arguments= new HashMap(); >- arguments.put(ExternalToolMigration.TAG_VERSION, "2.0"); >- arguments.put(ExternalToolMigration.TAG_TOOL_TYPE, "org.eclipse.ui.externaltools.type.program"); >- arguments.put(ExternalToolMigration.TAG_TOOL_NAME, "program tool"); >- arguments.put(ExternalToolMigration.TAG_TOOL_LOCATION, "location"); >- arguments.put(ExternalToolMigration.TAG_TOOL_REFRESH, "refresh scope"); >- arguments.put(ExternalToolMigration.TAG_TOOL_ARGUMENTS, "arg ${ant_target:target1} ${ant_target:target2}"); >- arguments.put(ExternalToolMigration.TAG_TOOL_SHOW_LOG, "true"); >- arguments.put(ExternalToolMigration.TAG_TOOL_BLOCK, "false"); >- arguments.put(ExternalToolMigration.TAG_TOOL_BUILD_TYPES, "build kinds"); >- arguments.put(ExternalToolMigration.TAG_TOOL_DIRECTORY, "working dir"); >- return arguments; >- } >- >- /** > * Tests migration of arguments from an Eclipse 2.1 Ant buildfile > * configuration to a current launch configuration. > * >@@ -150,32 +112,6 @@ > } > > /** >- * Returns a map of arguments for executing an Ant >- * buildfile using Eclipse 2.1 arguments. >- * >- * @return a map of 2.1 arguments for an Ant buildfile >- */ >- private Map get21AntArgumentMap() { >- HashMap arguments= new HashMap(); >- arguments.put(ExternalToolMigration.TAG_VERSION, "2.1"); >- arguments.put(ExternalToolMigration.TAG_NAME, "ant config"); >- arguments.put(ExternalToolMigration.TAG_TYPE, ExternalToolMigration.TOOL_TYPE_ANT_BUILD); >- arguments.put(ExternalToolMigration.TAG_LOCATION, "location"); >- arguments.put(ExternalToolMigration.TAG_WORK_DIR, "working directory"); >- arguments.put(ExternalToolMigration.TAG_CAPTURE_OUTPUT, "true"); >- arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >- arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >- arguments.put(ExternalToolMigration.TAG_RUN_BKGRND, "true"); >- arguments.put(ExternalToolMigration.TAG_PROMPT_ARGS, "true"); >- arguments.put(ExternalToolMigration.TAG_REFRESH_SCOPE, "refresh scope"); >- arguments.put(ExternalToolMigration.TAG_REFRESH_RECURSIVE, "true"); >- arguments.put(ExternalToolMigration.TAG_RUN_BUILD_KINDS, "build kinds"); >- arguments.put(ExternalToolMigration.TAG_ARGS, "arg1 arg2"); >- arguments.put(ExternalToolMigration.TAG_EXTRA_ATTR, ExternalToolMigration.RUN_TARGETS_ATTRIBUTE + "=target1,target2"); >- return arguments; >- } >- >- /** > * Tests migration of arguments from an Eclipse 2.1 program > * configuration to a current launch configuration. > * >@@ -199,30 +135,4 @@ > assertEquals("build kinds", config.getAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, "")); > assertEquals("arg1 arg2", config.getAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, "")); > } >- >- /** >- * Returns a map of arguments for executing a program >- * buildfile using Eclipse 2.1 arguments. >- * >- * @return a map of 2.1 arguments for a program >- */ >- private Map get21ProgramArgumentMap() { >- HashMap arguments= new HashMap(); >- arguments.put(ExternalToolMigration.TAG_VERSION, "2.1"); >- arguments.put(ExternalToolMigration.TAG_NAME, "program config"); >- arguments.put(ExternalToolMigration.TAG_TYPE, IExternalToolConstants.TOOL_TYPE_PROGRAM); >- arguments.put(ExternalToolMigration.TAG_LOCATION, "location"); >- arguments.put(ExternalToolMigration.TAG_WORK_DIR, "working directory"); >- arguments.put(ExternalToolMigration.TAG_CAPTURE_OUTPUT, "true"); >- arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >- arguments.put(ExternalToolMigration.TAG_SHOW_CONSOLE, "true"); >- arguments.put(ExternalToolMigration.TAG_RUN_BKGRND, "true"); >- arguments.put(ExternalToolMigration.TAG_PROMPT_ARGS, "true"); >- arguments.put(ExternalToolMigration.TAG_REFRESH_SCOPE, "refresh scope"); >- arguments.put(ExternalToolMigration.TAG_REFRESH_RECURSIVE, "true"); >- arguments.put(ExternalToolMigration.TAG_RUN_BUILD_KINDS, "build kinds"); >- arguments.put(ExternalToolMigration.TAG_ARGS, "arg1 arg2"); >- return arguments; >- } >- > } >Index: test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ant.tests.ui/test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java,v >retrieving revision 1.30 >diff -u -r1.30 AntUITests.java >--- test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java 3 Nov 2008 14:16:23 -0000 1.30 >+++ test plugin/org/eclipse/ant/tests/ui/testplugin/AntUITests.java 9 Feb 2011 18:02:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2008 GEBIT Gesellschaft fuer EDV-Beratung >+ * Copyright (c) 2002, 2011 GEBIT Gesellschaft fuer EDV-Beratung > * und Informatik-Technologien mbH, > * Berlin, Duesseldorf, Frankfurt (Germany) and others. > * All rights reserved. This program and the accompanying materials >@@ -33,6 +33,7 @@ > import org.eclipse.ant.tests.ui.editor.formatter.XmlDocumentFormatterTest; > import org.eclipse.ant.tests.ui.editor.formatter.XmlFormatterTest; > import org.eclipse.ant.tests.ui.editor.formatter.XmlTagFormatterTest; >+import org.eclipse.ant.tests.ui.externaltools.BuilderCoreUtilsTests; > import org.eclipse.ant.tests.ui.externaltools.MigrationTests; > import org.eclipse.ant.tests.ui.separateVM.SeparateVMTests; > >@@ -52,6 +53,7 @@ > suite.addTest(new TestSuite(TaskDescriptionProviderTest.class)); > suite.addTest(new TestSuite(AntEditorContentOutlineTests.class)); > suite.addTest(new TestSuite(MigrationTests.class)); >+ suite.addTest(new TestSuite(BuilderCoreUtilsTests.class)); > suite.addTest(new TestSuite(FormattingPreferencesTest.class)); > suite.addTest(new TestSuite(XmlDocumentFormatterTest.class)); > suite.addTest(new TestSuite(XmlTagFormatterTest.class)); >Index: testbuildfiles/ext-builders.xml >=================================================================== >RCS file: testbuildfiles/ext-builders.xml >diff -N testbuildfiles/ext-builders.xml >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ testbuildfiles/ext-builders.xml 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<project name="project-builder" default="def"> >+ <description> >+ Builder >+ </description> >+ >+ <target name="def" description="description"> >+ <echo>DEFAULT</echo> >+ </target> >+ >+ <target name="full"> >+ <echo>FULL</echo> >+ </target> >+ >+ <target name="inc"> >+ <echo>INCREMENTAL</echo> >+ </target> >+ >+ <target name="auto"> >+ <echo>AUTO</echo> >+ </target> >+ >+ <target name="clean"> >+ <echo>CLEAN</echo> >+ </target> >+ >+</project> >\ No newline at end of file >#P org.eclipse.core.externaltools >Index: src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java,v >retrieving revision 1.2 >diff -u -r1.2 BuilderCoreUtils.java >--- src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java 14 Oct 2009 14:04:59 -0000 1.2 >+++ src/org/eclipse/core/externaltools/internal/model/BuilderCoreUtils.java 9 Feb 2011 18:02:32 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 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 >@@ -39,6 +39,12 @@ > public class BuilderCoreUtils { > > public static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$ >+ /** >+ * Constant added to the build command to determine if we are doing an incremental build after a clean >+ * >+ * @since 3.7 >+ */ >+ public static final String INC_CLEAN = "incclean"; //$NON-NLS-1$ > > /** > * Constant used to find a builder using the 3.0-interim format >@@ -113,41 +119,41 @@ > return configuration; > } > >- public static void configureTriggers(ILaunchConfiguration config, >- ICommand newCommand) throws CoreException { >+ public static void configureTriggers(ILaunchConfiguration config, ICommand newCommand) throws CoreException { > newCommand.setBuilding(IncrementalProjectBuilder.FULL_BUILD, false); >- newCommand.setBuilding(IncrementalProjectBuilder.INCREMENTAL_BUILD, >- false); >+ 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 = BuilderCoreUtils.buildTypesToArray(buildKinds); >+ Map args = newCommand.getArguments(); >+ 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); >- break; >- case IncrementalProjectBuilder.INCREMENTAL_BUILD: >- newCommand.setBuilding( >- IncrementalProjectBuilder.INCREMENTAL_BUILD, true); >- break; >- case IncrementalProjectBuilder.AUTO_BUILD: >- newCommand.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, >- true); >- break; >- case IncrementalProjectBuilder.CLEAN_BUILD: >- newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, >- true); >- break; >+ 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); >+ break; >+ case IncrementalProjectBuilder.CLEAN_BUILD: >+ newCommand.setBuilding(IncrementalProjectBuilder.CLEAN_BUILD, true); >+ break; > } > } >- if (!config.getAttribute( >- IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, false)) { >+ if(!isfull && isinc) { >+ 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); >+ copy.setAttribute(IExternalToolConstants.ATTR_TRIGGERS_CONFIGURED, true); > copy.doSave(); > } > } >Index: src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.externaltools/src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java,v >retrieving revision 1.1 >diff -u -r1.1 ExternalToolBuilder.java >--- src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java 8 Oct 2009 18:18:51 -0000 1.1 >+++ src/org/eclipse/core/externaltools/internal/model/ExternalToolBuilder.java 9 Feb 2011 18:02:32 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 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 >@@ -85,7 +85,7 @@ > } > boolean kindCompatible= commandConfiguredForKind(config, kind); > if (kindCompatible && configEnabled(config)) { >- doBuildBasedOnScope(resources, kind, config, monitor); >+ doBuildBasedOnScope(resources, kind, config, args, monitor); > } > > return projectsWithinScope; >@@ -157,7 +157,7 @@ > 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) { >@@ -166,19 +166,19 @@ > } > > 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(); > } > >@@ -215,15 +215,22 @@ > /** > * Stores the currently active build kind and build project when a build begins > * @param buildKind >+ * @param args the arguments passed into the builder > */ >- 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(BuilderCoreUtils.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; >@@ -285,6 +292,6 @@ > return; > } > >- launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, monitor); >+ launchBuild(IncrementalProjectBuilder.CLEAN_BUILD, config, null, monitor); > } > } >\ No newline at end of file >#P org.eclipse.ui.externaltools >Index: External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.externaltools/External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java,v >retrieving revision 1.50 >diff -u -r1.50 ExternalToolsBuilderTab.java >--- External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java 7 Feb 2011 21:44:39 -0000 1.50 >+++ External Tools Base/org/eclipse/ui/externaltools/internal/launchConfigurations/ExternalToolsBuilderTab.java 9 Feb 2011 18:02:33 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >+ * Copyright (c) 2000, 2009 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 >@@ -12,9 +12,6 @@ > package org.eclipse.ui.externaltools.internal.launchConfigurations; > > >-import java.util.HashSet; >-import java.util.Iterator; >- > import org.eclipse.core.externaltools.internal.IExternalToolConstants; > import org.eclipse.core.externaltools.internal.launchConfigurations.ExternalToolsCoreUtil; > import org.eclipse.core.resources.IResource; >@@ -390,33 +387,25 @@ > fVariables.setEnabled(haveOutputFile); > fAppend.setEnabled(haveOutputFile); > } >- >+ > /* (non-Javadoc) > * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) > */ > public void performApply(ILaunchConfigurationWorkingCopy configuration) { > if (fCreateBuildScheduleComponent) { >- HashSet kinds = new HashSet(4); >+ StringBuffer buffer= new StringBuffer(); > if (afterClean.getSelection()) { >- kinds.add(IExternalToolConstants.BUILD_TYPE_FULL); >+ buffer.append(IExternalToolConstants.BUILD_TYPE_FULL).append(','); > } >- if(manualBuild.getSelection()){ >- kinds.add(IExternalToolConstants.BUILD_TYPE_FULL); >- kinds.add(IExternalToolConstants.BUILD_TYPE_INCREMENTAL); >+ if (manualBuild.getSelection()){ >+ buffer.append(IExternalToolConstants.BUILD_TYPE_INCREMENTAL).append(','); > } > if (autoBuildButton.getSelection()) { >- kinds.add(IExternalToolConstants.BUILD_TYPE_AUTO); >+ buffer.append(IExternalToolConstants.BUILD_TYPE_AUTO).append(','); > } > > if (fDuringClean.getSelection()) { >- kinds.add(IExternalToolConstants.BUILD_TYPE_CLEAN); >- } >- StringBuffer buffer= new StringBuffer(); >- for(Iterator i = kinds.iterator(); i.hasNext();) { >- buffer.append(i.next()); >- if(i.hasNext()) { >- buffer.append(','); >- } >+ buffer.append(IExternalToolConstants.BUILD_TYPE_CLEAN); > } > configuration.setAttribute(IExternalToolConstants.ATTR_RUN_BUILD_KINDS, buffer.toString()); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 114563
:
165391
|
184083
|
188199
| 188608