1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Patch for Sean

This commit is contained in:
Hoda Amer 2004-04-05 17:43:15 +00:00
parent bde7613ebe
commit bc0892c5e7
2 changed files with 58 additions and 17 deletions

View file

@ -53,6 +53,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceDescription;
import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
@ -440,6 +441,12 @@ public class ManagedBuildTests extends TestCase {
project = createProject(projectName); project = createProject(projectName);
// Now associate the builder with the project // Now associate the builder with the project
addManagedBuildNature(project); addManagedBuildNature(project);
IProjectDescription description = project.getDescription();
// Make sure it has a managed nature
if (description != null) {
assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
}
} catch (CoreException e) { } catch (CoreException e) {
fail("Test failed on project creation: " + e.getLocalizedMessage()); fail("Test failed on project creation: " + e.getLocalizedMessage());
} }
@ -637,18 +644,24 @@ public class ManagedBuildTests extends TestCase {
// Add the managed build nature // Add the managed build nature
try { try {
ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor()); ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
} catch (CoreException e) { } catch (CoreException e) {
fail("Test failed on adding managed build nature: " + e.getLocalizedMessage()); fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
} }
// Associate the project with the managed builder so the clients can get proper information // Associate the project with the managed builder so the clients can get proper information
ICDescriptor desc = null;
try { try {
ICDescriptor desc = CCorePlugin.getDefault().getCProjectDescription(project); desc = CCorePlugin.getDefault().getCProjectDescription(project);
desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID); desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY); desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
} catch (CoreException e) { } catch (CoreException e) {
fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage()); fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
} }
try {
desc.saveProjectData();
} catch (CoreException e) {
fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); }
} }
/** /**
@ -936,13 +949,17 @@ public class ManagedBuildTests extends TestCase {
topCategory = tools[0].getTopOptionCategory(); topCategory = tools[0].getTopOptionCategory();
options = topCategory.getOptions(configs[2]); options = topCategory.getOptions(configs[2]);
assertEquals(2, options.length); assertEquals(2, options.length);
// Check that there's an empty string list and a true boolean (commands should not have changed) // Check that there's an string list with totally new values
assertTrue(options[0] instanceof OptionReference); assertTrue(options[0] instanceof OptionReference);
assertEquals("List Option in Top", options[0].getName()); assertEquals("List Option in Top", options[0].getName());
assertEquals(IOption.STRING_LIST, options[0].getValueType()); assertEquals(IOption.STRING_LIST, options[0].getValueType());
valueList = options[0].getStringListValue(); valueList = options[0].getStringListValue();
assertTrue(valueList.length == 0); assertTrue(valueList.length == 3);
assertEquals("d", valueList[0]);
assertEquals("e", valueList[1]);
assertEquals("f", valueList[2]);
assertEquals("-L", options[0].getCommand()); assertEquals("-L", options[0].getCommand());
// and a true boolean (commands should not have changed)
assertEquals("Boolean Option in Top", options[1].getName()); assertEquals("Boolean Option in Top", options[1].getName());
assertTrue(options[1] instanceof OptionReference); assertTrue(options[1] instanceof OptionReference);
assertEquals("Boolean Option in Top", options[1].getName()); assertEquals("Boolean Option in Top", options[1].getName());
@ -970,7 +987,7 @@ public class ManagedBuildTests extends TestCase {
assertEquals(IOption.BOOLEAN, options[3].getValueType()); assertEquals(IOption.BOOLEAN, options[3].getValueType());
assertEquals(true, options[3].getBooleanValue()); assertEquals(true, options[3].getBooleanValue());
tool = tools[0]; tool = tools[0];
assertEquals("-b overridden -stralsooverridden", tool.getToolFlags()); assertEquals("-Ld -Le -Lf -b overridden -stralsooverridden", tool.getToolFlags());
} }
/* /*
@ -1111,6 +1128,8 @@ public class ManagedBuildTests extends TestCase {
assertEquals(1, builtInPaths.length); assertEquals(1, builtInPaths.length);
assertEquals("/usr/gnu/include", builtInPaths[0]); assertEquals("/usr/gnu/include", builtInPaths[0]);
assertEquals("-I", subOpts[0].getCommand()); assertEquals("-I", subOpts[0].getCommand());
assertEquals(IOption.BROWSE_DIR, subOpts[0].getBrowseType());
// There are no user-defined preprocessor symbols // There are no user-defined preprocessor symbols
assertEquals("Defined Symbols", subOpts[1].getName()); assertEquals("Defined Symbols", subOpts[1].getName());
assertEquals(IOption.PREPROCESSOR_SYMBOLS, subOpts[1].getValueType()); assertEquals(IOption.PREPROCESSOR_SYMBOLS, subOpts[1].getValueType());
@ -1121,12 +1140,17 @@ public class ManagedBuildTests extends TestCase {
String[] builtInSymbols = subOpts[1].getBuiltIns(); String[] builtInSymbols = subOpts[1].getBuiltIns();
assertEquals(1, builtInSymbols.length); assertEquals(1, builtInSymbols.length);
assertEquals("BUILTIN", builtInSymbols[0]); assertEquals("BUILTIN", builtInSymbols[0]);
// Broswe type should be none
assertEquals(IOption.BROWSE_NONE, subOpts[1].getBrowseType());
assertEquals("More Includes", subOpts[2].getName()); assertEquals("More Includes", subOpts[2].getName());
assertEquals(IOption.INCLUDE_PATH, subOpts[2].getValueType()); assertEquals(IOption.INCLUDE_PATH, subOpts[2].getValueType());
String[] moreIncPath = subOpts[2].getIncludePaths(); String[] moreIncPath = subOpts[2].getIncludePaths();
assertEquals(2, moreIncPath.length); assertEquals(2, moreIncPath.length);
assertEquals("C:\\home\\tester/include", moreIncPath[0]); assertEquals("C:\\home\\tester/include", moreIncPath[0]);
assertEquals("-I", subOpts[2].getCommand()); assertEquals("-I", subOpts[2].getCommand());
assertEquals(IOption.BROWSE_DIR, subOpts[2].getBrowseType());
// Check the user object option // Check the user object option
assertEquals("User Objects", subOpts[3].getName()); assertEquals("User Objects", subOpts[3].getName());
assertEquals(IOption.OBJECTS, subOpts[3].getValueType()); assertEquals(IOption.OBJECTS, subOpts[3].getValueType());
@ -1134,6 +1158,7 @@ public class ManagedBuildTests extends TestCase {
assertEquals(2, objs.length); assertEquals(2, objs.length);
assertEquals("obj1.o", objs[0]); assertEquals("obj1.o", objs[0]);
assertEquals("obj2.o", objs[1]); assertEquals("obj2.o", objs[1]);
assertEquals(IOption.BROWSE_FILE, subOpts[3].getBrowseType());
// Get the configs for this target; it should inherit all the configs defined for the parent // Get the configs for this target; it should inherit all the configs defined for the parent
IConfiguration[] configs = target.getConfigurations(); IConfiguration[] configs = target.getConfigurations();
@ -1214,7 +1239,7 @@ public class ManagedBuildTests extends TestCase {
removeProject(projectName); removeProject(projectName);
} }
/** /* (non-Javadoc)
* Create a new project named <code>name</code> or return the project in * Create a new project named <code>name</code> or return the project in
* the workspace of the same name if it exists. * the workspace of the same name if it exists.
* *
@ -1229,6 +1254,9 @@ public class ManagedBuildTests extends TestCase {
if (!newProjectHandle.exists()) { if (!newProjectHandle.exists()) {
IWorkspace workspace = ResourcesPlugin.getWorkspace(); IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceDescription workspaceDesc = workspace.getDescription();
workspaceDesc.setAutoBuilding(false);
workspace.setDescription(workspaceDesc);
IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName()); IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
//description.setLocation(root.getLocation()); //description.setLocation(root.getLocation());
project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), MakeCorePlugin.MAKE_PROJECT_ID); project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), MakeCorePlugin.MAKE_PROJECT_ID);
@ -1237,8 +1265,9 @@ public class ManagedBuildTests extends TestCase {
project = newProjectHandle; project = newProjectHandle;
} }
// Open the project if we have to
if (!project.isOpen()) { if (!project.isOpen()) {
project.open(null); project.open(new NullProgressMonitor());
} }
return project; return project;
@ -1255,7 +1284,7 @@ public class ManagedBuildTests extends TestCase {
IProject project = root.getProject(name); IProject project = root.getProject(name);
if (project.exists()) { if (project.exists()) {
try { try {
project.delete(true, false, null); project.delete(true, true, null);
} catch (CoreException e) { } catch (CoreException e) {
assertTrue(false); assertTrue(false);
} }

View file

@ -32,12 +32,12 @@
point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo"> point="org.eclipse.cdt.managedbuilder.core.ManagedBuildInfo">
<tool <tool
natureFilter="both" natureFilter="both"
sources="rc"
name="Target Independent Tool" name="Target Independent Tool"
sources="rc"
headerExtensions="h" headerExtensions="h"
outputFlag="/fo" outputFlag="/fo"
outputs="free"
command="RC.EXE" command="RC.EXE"
outputs="free"
id="target.independent.tool"> id="target.independent.tool">
<optionCategory <optionCategory
owner="target.independent.tool" owner="target.independent.tool"
@ -125,8 +125,8 @@
name="Another String Option in Category" name="Another String Option in Category"
category="category" category="category"
command="-str" command="-str"
valueType="string" id="another.string.option"
id="another.string.option"> valueType="string">
</option> </option>
<option <option
name="Enumerated Option in Category" name="Enumerated Option in Category"
@ -149,8 +149,8 @@
commandFalse="-nob" commandFalse="-nob"
name="Boolean Option in Category" name="Boolean Option in Category"
category="category" category="category"
valueType="boolean" id="boolean.false.option"
id="boolean.false.option"> valueType="boolean">
</option> </option>
</tool> </tool>
<configuration <configuration
@ -199,6 +199,15 @@
</optionReference> </optionReference>
<optionReference <optionReference
id="list.option"> id="list.option">
<listOptionValue
value="d">
</listOptionValue>
<listOptionValue
value="e">
</listOptionValue>
<listOptionValue
value="f">
</listOptionValue>
</optionReference> </optionReference>
</toolReference> </toolReference>
</configuration> </configuration>
@ -229,6 +238,7 @@
<option <option
name="Include Paths" name="Include Paths"
command="-I" command="-I"
browseType="directory"
valueType="includePath" valueType="includePath"
id="sub.tool.opt.inc.paths"> id="sub.tool.opt.inc.paths">
<listOptionValue <listOptionValue
@ -255,6 +265,7 @@
<option <option
name="More Includes" name="More Includes"
command="-I" command="-I"
browseType="directory"
valueType="includePath" valueType="includePath"
id="sub.tool.opts.inc.paths.more"> id="sub.tool.opts.inc.paths.more">
<listOptionValue <listOptionValue
@ -268,6 +279,7 @@
</option> </option>
<option <option
name="User Objects" name="User Objects"
browseType="file"
valueType="userObjs" valueType="userObjs"
id="sub.tool.opt.objs"> id="sub.tool.opt.objs">
<listOptionValue <listOptionValue
@ -311,8 +323,8 @@
isTest="true" isTest="true"
osList="win32,solaris,linux" osList="win32,solaris,linux"
name="Forward Child" name="Forward Child"
parent="test.forward.parent.target"
binaryParser="org.eclipse.cdt.core.tests.target2" binaryParser="org.eclipse.cdt.core.tests.target2"
parent="test.forward.parent.target"
id="test.forward.child.target"> id="test.forward.child.target">
<toolReference <toolReference
id="test.forward.tool"> id="test.forward.tool">