[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Build Model Changes
|
Details are in the change logs, but
this patch includes three things:
1. Fix for bug 38665 - Need to select
platform before configurations become visible
2. Icon files that were not delivered
in my last patch
3. A new interface for clients of the
build model to extract include paths and defined symbols for managed projects.
Unmanaged projects to follow soon.
Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada
Attachment:
new_build_icons.zip
Description: Zip archive
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/ChangeLog,v
retrieving revision 1.68
diff -u -r1.68 ChangeLog
--- ChangeLog 18 Jun 2003 19:36:15 -0000 1.68
+++ ChangeLog 20 Jun 2003 13:58:04 -0000
@@ -1,3 +1,6 @@
+2003-06-20 Sean Evoy
+ Moved the ManagedBuildInfo extension point to the plugin file in org.eclipse.cdt.core.tests
+
2003-06-17 Brent Nicolle
Added Interface tests of IStructure.java.
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/plugin.xml,v
retrieving revision 1.14
diff -u -r1.14 plugin.xml
--- plugin.xml 17 Jun 2003 20:58:41 -0000 1.14
+++ plugin.xml 20 Jun 2003 13:58:04 -0000
@@ -22,107 +22,4 @@
</requires>
- <extension
- id="buildTest"
- name="Tools for Build Test"
- point="org.eclipse.cdt.core.ManagedBuildInfo">
- <target
- isTest="true"
- name="Test Root"
- defaultExtension="toor"
- isAbstract="false"
- id="test.root">
- <tool
- sources="foo,bar"
- name="Root Tool"
- outputs="toor"
- command="doIt"
- id="root.tool">
- <optionCategory
- owner="root.tool"
- name="Category"
- id="category">
- </optionCategory>
- <option
- name="List Option in Top"
- command="-L"
- valueType="stringList"
- id="list.option">
- <optionValue
- value="a">
- </optionValue>
- <optionValue
- value="b">
- </optionValue>
- </option>
- <option
- defaultValue="false"
- name="Boolean Option in Top"
- command="-b"
- valueType="boolean"
- id="boolean.option">
- </option>
- <option
- defaultValue="x"
- name="String Option in Category"
- category="category"
- valueType="string"
- id="string.option">
- </option>
- <option
- name="Enumerated Option in Category"
- category="category"
- valueType="enumerated"
- id="enumerated.option">
- <optionEnum
- name="Default Enum"
- isDefault="true"
- command="-e1"
- id="default.enum.option">
- </optionEnum>
- <optionEnum
- name="Another Enum"
- command="-e2"
- id="another.enum.option">
- </optionEnum>
- </option>
- </tool>
- <configuration
- name="Root Config"
- id="root.config">
- </configuration>
- <configuration
- name="Root Override Config"
- id="root.override.config">
- <toolRef
- id="root.tool">
- <optionRef
- defaultValue="y"
- id="string.option">
- </optionRef>
- <optionRef
- defaultValue="true"
- id="boolean.option">
- </optionRef>
- </toolRef>
- </configuration>
- </target>
- <target
- isTest="true"
- name="Test Sub"
- parent="test.root"
- defaultExtension="bus"
- isAbstract="false"
- id="test.sub">
- <configuration
- name="Sub Config"
- id="sub.config">
- </configuration>
- <tool
- name="Sub Tool"
- id="tool.sub">
- </tool>
- </target>
- </extension>
-
</plugin>
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.106
diff -u -r1.106 ChangeLog
--- ChangeLog 18 Jun 2003 15:39:24 -0000 1.106
+++ ChangeLog 20 Jun 2003 13:57:48 -0000
@@ -1,3 +1,19 @@
+2003-06-20 Sean Evoy
+ Added (again) the icons required for the new managed project wizard and property pages
+ * icons/full/build16/config-command.gif
+ * icons/full/build16/config-librarian.gif
+ * icons/full/build16/config-tool.gif
+ * icons/full/wizban/newmngc_app.gif
+ * icons/full/wizban/newmngcc_app.gif
+
+ Fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=38665
+ * build/org/eclipse/cdt/ui/build/wizards/CProjectPlatformPage.java
+
+ Adjusted the Option settings store and pages to properly handle new option types needed
+ to implement parser interface for include paths and defined symbols.
+ * build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java
+ * build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java
+
2003-06-18 David Inglis
fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=39053
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.28
diff -u -r1.28 plugin.xml
--- plugin.xml 16 Jun 2003 17:35:44 -0000 1.28
+++ plugin.xml 20 Jun 2003 13:57:49 -0000
@@ -230,7 +230,7 @@
<!-- Managed Make Builder Projects -->
<wizard
name="%MngCCWizard.name"
- icon="icons/full/ctool16/newmngcc_app.gif"
+ icon="icons/full/wizban/newmngcc_app.gif"
category="org.eclipse.cdt.ui.newCCWizards"
class="org.eclipse.cdt.ui.build.wizards.ManagedCCWizard"
project="true"
@@ -242,7 +242,7 @@
</wizard>
<wizard
name="%MngCWizard.name"
- icon="icons/full/ctool16/newmngcc_app.gif"
+ icon="icons/full/wizban/newmngcc_app.gif"
category="org.eclipse.cdt.ui.newCWizards"
class="org.eclipse.cdt.ui.build.wizards.ManagedCWizard"
project="true"
@@ -586,7 +586,7 @@
name="Defined Symbols"
category="cygwin.compiler.category.preprocessor"
command="-D"
- valueType="stringList"
+ valueType="definedSymbols"
id="cygwin.preprocessor.def.symbols">
</option>
<option
@@ -667,7 +667,7 @@
name="Include Paths"
category="cygwin.compiler.category.general"
command="-I"
- valueType="stringList"
+ valueType="includePath"
id="cygwin.compiler.general.include.paths">
</option>
<option
Index: build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java,v
retrieving revision 1.1
diff -u -r1.1 BuildToolSettingsPage.java
--- build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java 9 Jun 2003 19:22:19 -0000 1.1
+++ build/org/eclipse/cdt/ui/build/properties/BuildToolSettingsPage.java 20 Jun 2003 13:57:49 -0000
@@ -1,5 +1,6 @@
package org.eclipse.cdt.ui.build.properties;
+import org.eclipse.cdt.core.build.managed.BuildException;
import org.eclipse.cdt.core.build.managed.IConfiguration;
import org.eclipse.cdt.core.build.managed.IOption;
import org.eclipse.cdt.core.build.managed.IOptionCategory;
@@ -58,27 +59,36 @@
// Figure out which type the option is and add a proper field editor for it
switch (opt.getValueType()) {
case IOption.STRING :
- StringFieldEditor stringField = new StringFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
- addField(stringField);
- break;
+ StringFieldEditor stringField = new StringFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
+ addField(stringField);
+ break;
case IOption.BOOLEAN :
- BooleanFieldEditor booleanField = new BooleanFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
- addField(booleanField);
- break;
+ BooleanFieldEditor booleanField = new BooleanFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
+ addField(booleanField);
+ break;
case IOption.ENUMERATED :
- BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(opt.getId(), opt.getName(), opt.getApplicableValues(), opt.getSelectedEnum(), getFieldEditorParent());
- addField(comboField);
- break;
+ String sel;
+ try {
+ sel = opt.getSelectedEnum();
+ } catch (BuildException e) {
+ // If we get this exception, then the option type is wrong
+ break;
+ }
+ BuildOptionComboFieldEditor comboField = new BuildOptionComboFieldEditor(opt.getId(), opt.getName(), opt.getApplicableValues(), sel, getFieldEditorParent());
+ addField(comboField);
+ break;
case IOption.STRING_LIST :
- BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
- addField(listField);
- break;
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
+ BuildOptionListFieldEditor listField = new BuildOptionListFieldEditor(opt.getId(), opt.getName(), getFieldEditorParent());
+ addField(listField);
+ break;
// case IOption.SUMMARY :
// SummaryFieldEditor summaryField = new SummaryFieldEditor(opt.getId(), opt.getName(), category.getTool(), getFieldEditorParent());
// addField(summaryField);
// break;
default :
- break;
+ break;
}
}
}
@@ -117,6 +127,8 @@
ManagedBuildManager.setOption(configuration, option, strVal);
break;
case IOption.STRING_LIST :
+ case IOption.INCLUDE_PATH :
+ case IOption.PREPROCESSOR_SYMBOLS :
String listStr = getPreferenceStore().getString(option.getId());
String[] listVal = BuildToolsSettingsStore.parseString(listStr);
ManagedBuildManager.setOption(configuration, option, listVal);
Index: build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java,v
retrieving revision 1.1
diff -u -r1.1 BuildToolsSettingsStore.java
--- build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java 9 Jun 2003 19:22:19 -0000 1.1
+++ build/org/eclipse/cdt/ui/build/properties/BuildToolsSettingsStore.java 20 Jun 2003 13:57:49 -0000
@@ -194,6 +194,7 @@
try {
value = new Boolean(opt.getBooleanValue());
} catch (BuildException e) {
+ // Exception occurs if there's an option value type mismatch
break;
}
optionMap.put(name, value);
@@ -207,7 +208,7 @@
case IOption.STRING :
try {
value = opt.getStringValue();
- } catch (BuildException e1) {
+ } catch (BuildException e) {
break;
}
optionMap.put(name, value);
@@ -216,7 +217,23 @@
case IOption.STRING_LIST :
try {
value = createList(opt.getStringListValue());
- } catch (BuildException e2) {
+ } catch (BuildException e) {
+ break;
+ }
+ optionMap.put(name, value);
+ break;
+ case IOption.INCLUDE_PATH :
+ try {
+ value = createList(opt.getIncludePaths());
+ } catch (BuildException e) {
+ break;
+ }
+ optionMap.put(name, value);
+ break;
+ case IOption.PREPROCESSOR_SYMBOLS :
+ try {
+ value = createList(opt.getDefinedSymbols());
+ } catch (BuildException e) {
break;
}
optionMap.put(name, value);
@@ -239,36 +256,6 @@
return (String)s;
}
return getDefaultString(name);
-
-// Object s = optionMap.get(name);
-// if (s instanceof IOption) {
-// IOption option = (IOption) s;
-// String [] values = null;
-// String list = null;
-// try {
-// switch (option.getValueType()) {
-// // Return the enumerated options in a semicolon-separated list
-// case IOption.ENUMERATED :
-// values = option.getApplicableValues();
-// list = createList(values);
-// break;
-// // Just return the string
-// case IOption.STRING :
-// list = option.getStringValue();
-// break;
-// // Return the list values in a semicolon-spearated string
-// case IOption.STRING_LIST :
-// values = option.getStringListValue();
-// list = createList(values);
-// default:
-// break;
-// }
-// } catch (BuildException e) {
-// return getDefaultString(name);
-// }
-// return list == null ? getDefaultString(name) : list;
-// }
-// return getDefaultString(name);
}
/**
Index: build/org/eclipse/cdt/ui/build/wizards/CProjectPlatformPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/build/org/eclipse/cdt/ui/build/wizards/CProjectPlatformPage.java,v
retrieving revision 1.1
diff -u -r1.1 CProjectPlatformPage.java
--- build/org/eclipse/cdt/ui/build/wizards/CProjectPlatformPage.java 9 Jun 2003 19:22:19 -0000 1.1
+++ build/org/eclipse/cdt/ui/build/wizards/CProjectPlatformPage.java 20 Jun 2003 13:57:49 -0000
@@ -127,6 +127,9 @@
}
});
+ // Select the first target in the list
+ handleTargetSelection();
+
// Do the nasty
setErrorMessage(null);
setMessage(null);
Index: icons/full/build16/config-librarian.gif
===================================================================
RCS file: icons/full/build16/config-librarian.gif
diff -N icons/full/build16/config-librarian.gif
Binary files /dev/null and config-librarian.gif differ
Index: icons/full/build16/config-tool.gif
===================================================================
RCS file: icons/full/build16/config-tool.gif
diff -N icons/full/build16/config-tool.gif
Binary files /dev/null and config-tool.gif differ
Index: icons/full/wizban/newmngc_app.gif
===================================================================
RCS file: icons/full/wizban/newmngc_app.gif
diff -N icons/full/wizban/newmngc_app.gif
Binary files /dev/null and newmngc_app.gif differ
Index: icons/full/wizban/newmngcc_app.gif
===================================================================
RCS file: icons/full/wizban/newmngcc_app.gif
diff -N icons/full/wizban/newmngcc_app.gif
Binary files /dev/null and newmngcc_app.gif differ
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- ChangeLog 18 Jun 2003 21:29:47 -0000 1.1
+++ ChangeLog 20 Jun 2003 13:57:30 -0000
@@ -1,3 +1,9 @@
+2003-06-17 Sean Evoy
+ Moved the ManagedBuildInfo extension point from the plugin file in org.eclipse.cdt.ui.tests
+ Added new options to sub target for include paths and preprocessor symbols
+ Added test for IManagedBuildPathInfo
+ * build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
+
2003-06-17 Brent Nicolle
Added Interface tests of IStructure.java.
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/plugin.xml,v
retrieving revision 1.1
diff -u -r1.1 plugin.xml
--- plugin.xml 18 Jun 2003 21:29:47 -0000 1.1
+++ plugin.xml 20 Jun 2003 13:57:30 -0000
@@ -121,6 +121,33 @@
<tool
name="Sub Tool"
id="tool.sub">
+ <option
+ name="Include Paths"
+ command="-I"
+ valueType="includePath"
+ id="sub.tool.opt.inc.paths">
+ <optionValue
+ value="/usr/include">
+ </optionValue>
+ <optionValue
+ value="/opt/gnome/include">
+ </optionValue>
+ </option>
+ <option
+ name="Defined Symbols"
+ command="-D"
+ valueType="definedSymbols"
+ id="sub.tool.opt.def.symbols">
+ </option>
+ <option
+ name="More Includes"
+ command="-I"
+ valueType="includePath"
+ id="sub.tool.opts.inc.paths.more">
+ <optionValue
+ value="/home/tester/include">
+ </optionValue>
+ </option>
</tool>
</target>
</extension>
Index: build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java,v
retrieving revision 1.1
diff -u -r1.1 AllBuildTests.java
--- build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java 18 Jun 2003 21:29:47 -0000 1.1
+++ build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java 20 Jun 2003 13:57:30 -0000
@@ -19,6 +19,7 @@
import org.eclipse.cdt.core.build.managed.BuildException;
import org.eclipse.cdt.core.build.managed.IConfiguration;
+import org.eclipse.cdt.core.build.managed.IManagedBuildPathInfo;
import org.eclipse.cdt.core.build.managed.IOption;
import org.eclipse.cdt.core.build.managed.IOptionCategory;
import org.eclipse.cdt.core.build.managed.IResourceBuildInfo;
@@ -56,6 +57,7 @@
suite.addTest(new AllBuildTests("testProject"));
suite.addTest(new AllBuildTests("testConfigurations"));
suite.addTest(new AllBuildTests("testTargetArtifacts"));
+ suite.addTest(new AllBuildTests("testBuildPathInfoInterface"));
suite.addTest(new AllBuildTests("cleanup"));
return suite;
@@ -90,6 +92,88 @@
}
/**
+ * The purpose of this test is to exercise the build path info interface.
+ * To get to that point, a new target/config has to be created in the test
+ * project and the default configuration changed.
+ *
+ * @throws CoreException
+ */
+ public void testBuildPathInfoInterface(){
+ // Open the test project
+ IProject project = null;
+ try {
+ project = createProject(projectName);
+ } catch (CoreException e) {
+ fail("Failed to open project: " + e.getLocalizedMessage());
+ }
+
+ // Create a new target in the project based on the sub target
+ ITarget baseTarget = ManagedBuildManager.getTarget(project, "test.sub");
+ assertNotNull(baseTarget);
+ ITarget newTarget = null;
+ try {
+ newTarget = ManagedBuildManager.createTarget(project, baseTarget);
+ } catch (BuildException e) {
+ fail("Failed adding new target to project: " + e.getLocalizedMessage());
+ }
+ assertNotNull(newTarget);
+ // Copy over the configs
+ IConfiguration[] baseConfigs = baseTarget.getConfigurations();
+ for (int i = 0; i < baseConfigs.length; ++i) {
+ newTarget.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
+ }
+
+ // Change the default configuration to the sub config
+ IConfiguration[] configs = newTarget.getConfigurations();
+ assertEquals(3, configs.length);
+ IResourceBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
+ buildInfo.setDefaultConfiguration(newTarget.getConfiguration("sub.config.2"));
+ // Get the path information for the project
+ IManagedBuildPathInfo info = ManagedBuildManager.getBuildPathInfo(project);
+ assertNotNull(info);
+
+ // Test the interface for include paths. It is important that the build model
+ // return the contents of all options flagged as containing include paths
+ String[] expectedPaths = {"/usr/include", "/opt/gnome/include", "/home/tester/include"};
+ String[] actualPaths = info.getIncludePaths();
+ assertTrue(Arrays.equals(expectedPaths, actualPaths));
+
+ // Test the interface for defined symbols (there are none but it should not return null)
+ String[] definedSymbols = info.getDefinedSymbols();
+ assertNotNull(definedSymbols);
+ assertEquals(0, definedSymbols.length);
+
+ // Add some defined symbols programmatically
+ String[] expectedSymbols = {"DEBUG", "GNOME"};
+ IConfiguration defaultConfig = buildInfo.getDefaultConfiguration(newTarget);
+ ITool[] tools = defaultConfig.getTools();
+ ITool subTool = null;
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ if("tool.sub".equalsIgnoreCase(tool.getId())) {
+ subTool = tool;
+ break;
+ }
+ }
+ assertNotNull(subTool);
+ IOption symbolOpt = null;
+ IOption[] opts = subTool.getOptions();
+ for (int i = 0; i < opts.length; i++) {
+ IOption option = opts[i];
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ symbolOpt = option;
+ break;
+ }
+ }
+ assertNotNull(symbolOpt);
+ ManagedBuildManager.setOption(defaultConfig, symbolOpt, expectedSymbols);
+
+ // Retest
+ definedSymbols = info.getDefinedSymbols();
+ assertTrue(Arrays.equals(expectedSymbols, definedSymbols));
+ }
+
+ /**
* Create a new configuration based on one defined in the plugin file.
* Overrides all of the configuration settings. Saves, closes, and reopens
* the project. Then calls a method to check the overridden options.
@@ -145,9 +229,18 @@
checkOptionReferences(project);
}
- public void testProject() throws CoreException, BuildException {
+ /**
+ * @throws CoreException
+ * @throws BuildException
+ */
+ public void testProject() throws BuildException {
// Create new project
- IProject project = createProject(projectName);
+ IProject project = null;
+ try {
+ project = createProject(projectName);
+ } catch (CoreException e) {
+ fail("Test failed on project creation: " + e.getLocalizedMessage());
+ }
// There should not be any targets defined for this project yet
assertEquals(0, ManagedBuildManager.getTargets(project).length);
@@ -196,9 +289,17 @@
// Save, close, reopen and test again
ManagedBuildManager.saveBuildInfo(project);
- project.close(null);
+ try {
+ project.close(null);
+ } catch (CoreException e) {
+ fail("Failed on project close: " + e.getLocalizedMessage());
+ }
ManagedBuildManager.removeBuildInfo(project);
- project.open(null);
+ try {
+ project.open(null);
+ } catch (CoreException e) {
+ fail("Failed on project open: " + e.getLocalizedMessage());
+ }
// Test that the default config was remembered
IResourceBuildInfo info = ManagedBuildManager.getBuildInfo(project);
@@ -213,7 +314,8 @@
checkRootTarget(targets[0], "z");
// Now test the information the makefile builder needs
- checkBuildSettings(project);
+ checkBuildTestSettings(info);
+ ManagedBuildManager.removeBuildInfo(project);
}
/**
@@ -222,15 +324,13 @@
*
* @param project
*/
- private void checkBuildSettings(IProject project) {
+ private void checkBuildTestSettings(IResourceBuildInfo info) {
String ext1 = "foo";
String ext2 = "bar";
String badExt = "cpp";
String expectedOutput = "toor";
String expectedCmd = "doIt";
- // Get that interface, Rover. Go get it. That's a good doggie! Good boy.
- IResourceBuildInfo info = ManagedBuildManager.getBuildInfo(project);
assertNotNull(info);
assertEquals(info.getBuildArtifactName(), "BuildTest.toor");
@@ -330,7 +430,9 @@
assertEquals("-e2", rootOptions[3].getEnumCommand(selEnum));
}
-
+ /*
+ * Do a full sanity check on the root target.
+ */
private void checkRootTarget(ITarget target, String oicValue) throws BuildException {
// Target stuff
assertTrue(target.isTestTarget());
@@ -439,28 +541,58 @@
assertEquals("-e2", options[1].getEnumCommand(valueList[1]));
}
- private void checkSubTarget(ITarget target) {
+ /*
+ * Do a sanity check on the values in the sub-target. Most of the
+ * sanity on the how build model entries are read is performed in
+ * the root target check, so these tests just verify that the the sub
+ * target properly inherits from its parent. For the new options
+ * in the sub target, the test does a sanity check just to be complete.
+ */
+ private void checkSubTarget(ITarget target) throws BuildException {
// Make sure this is a test target
assertTrue(target.isTestTarget());
// Make sure the build artifact extension is there
assertEquals(target.getDefaultExtension(), subExt);
- // Tools
+ // Get the tools for this target
ITool[] tools = target.getTools();
- // Root Tool
+ // Do we inherit properly from parent
ITool rootTool = tools[0];
assertEquals("Root Tool", rootTool.getName());
- // Sub Tool
+ // Now get the tool defined for this target
ITool subTool = tools[1];
assertEquals("Sub Tool", subTool.getName());
+ // Confirm that it has three options
+ IOption[] subOpts = subTool.getOptions();
+ assertEquals(3, subOpts.length);
+
+ // Do a sanity check on the options
+ assertEquals("Include Paths", subOpts[0].getName());
+ assertEquals(IOption.INCLUDE_PATH, subOpts[0].getValueType());
+ String[] incPath = subOpts[0].getIncludePaths();
+ assertEquals(2, incPath.length);
+ assertEquals("/usr/include", incPath[0]);
+ assertEquals("/opt/gnome/include", incPath[1]);
+ assertEquals("-I", subOpts[0].getCommand());
+ assertEquals("Defined Symbols", subOpts[1].getName());
+ assertEquals(IOption.PREPROCESSOR_SYMBOLS, subOpts[1].getValueType());
+ String[] defdSymbols = subOpts[1].getDefinedSymbols();
+ assertEquals(0, defdSymbols.length);
+ assertEquals("-D", subOpts[1].getCommand());
+ assertEquals("More Includes", subOpts[2].getName());
+ assertEquals(IOption.INCLUDE_PATH, subOpts[2].getValueType());
+ String[] moreIncPath = subOpts[2].getIncludePaths();
+ assertEquals(1, moreIncPath.length);
+ assertEquals("/home/tester/include", moreIncPath[0]);
+ assertEquals("-I", subOpts[2].getCommand());
- // Configs
+ // Get the configs for this target
IConfiguration[] configs = target.getConfigurations();
- // Root Config
+ // Check inheritance
IConfiguration rootConfig = configs[0];
assertEquals("Root Config", rootConfig.getName());
assertEquals("Root Override Config", configs[1].getName());
- // Sub Config
+ // Check the defined config for target
IConfiguration subConfig = configs[2];
assertEquals("Sub Config", subConfig.getName());
}
@@ -550,4 +682,5 @@
public void testThatAlwaysFails() {
assertTrue(false);
}
+
}
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.102
diff -u -r1.102 ChangeLog
--- ChangeLog 19 Jun 2003 17:51:42 -0000 1.102
+++ ChangeLog 20 Jun 2003 13:57:03 -0000
@@ -1,3 +1,22 @@
+2003-06-20 Sean Evoy
+ Added two new value types to the ManagedBuildTools schema for include paths
+ and defined symbols.
+
+ Added interface so clients can query build model for include paths and
+ defined symbols
+ * build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
+ * build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java
+ * build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
+
+ Changed code in build model to support these new value types
+ * build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
+ * build/org/eclipse/cdt/internal/core/build/managed/Option.java
+ * build/org/eclipse/cdt/core/build/managed/IOption.java
+ * build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
+ * build/org/eclipse/cdt/internal/core/build/managed/Tool.java
+ * build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
+
+
2003-06-19 Alain Magloire
* model/org/eclipse/cdt/internal/core/model/CModelManager.java:
Index: build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java
===================================================================
RCS file: build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java
diff -N build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ build/org/eclipse/cdt/core/build/managed/IManagedBuildPathInfo.java 20 Jun 2003 13:57:03 -0000
@@ -0,0 +1,32 @@
+package org.eclipse.cdt.core.build.managed;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+
+public interface IManagedBuildPathInfo {
+ /**
+ * Answers a <code>String</code> array containing all the defined
+ * preprocessor symbols. If there are no defined symbols, the receiver
+ * will return an empty array, never <code>null</code>
+ *
+ * @return
+ */
+ public String[] getDefinedSymbols();
+
+ /**
+ * Answers a <code>String</code> array containing all the known include
+ * search paths. If there are no paths defined, the receiver will
+ * return an empty array, never <code>null</code>
+ *
+ * @return
+ */
+ public String[] getIncludePaths();
+}
Index: build/org/eclipse/cdt/core/build/managed/IOption.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/IOption.java,v
retrieving revision 1.7
diff -u -r1.7 IOption.java
--- build/org/eclipse/cdt/core/build/managed/IOption.java 29 May 2003 14:00:58 -0000 1.7
+++ build/org/eclipse/cdt/core/build/managed/IOption.java 20 Jun 2003 13:57:03 -0000
@@ -14,24 +14,28 @@
*
*/
public interface IOption extends IBuildObject {
-
// Type for the value of the option
public static final int BOOLEAN = 0;
public static final int ENUMERATED = 1;
public static final int STRING = 2;
public static final int STRING_LIST = 3;
+ public static final int INCLUDE_PATH = 4;
+ public static final int PREPROCESSOR_SYMBOLS = 5;
/**
* If this option is defined as an enumeration, this function returns
* the list of possible values for that enum.
*
- * If this option is not defined as an enumeration, it returns null.
+ * If this option is not defined as an enumeration, it returns <code>null</code>.
* @return
*/
public String [] getApplicableValues();
/**
- * @return the value for a boolean option.
+ * Answers the value for a boolean option.
+ *
+ * @return
+ * @throws BuildException
*/
public boolean getBooleanValue() throws BuildException;
@@ -43,45 +47,64 @@
public IOptionCategory getCategory();
/**
- * @return a String containing the actual command line option
- * associated with the <code>IOption</code>
+ * Answers a <code>String</code> containing the actual command line
+ * option associated with the option
+ *
+ * @return
*/
public String getCommand();
/**
- * @return <code>String</code> containing the command associated with the
- * enumeration name.
+ * @return
+ * @throws BuildException
*/
- public String getEnumCommand (String name);
-
+ public String[] getDefinedSymbols() throws BuildException;
+
/**
- * Returns the name of this option.
- *
- * @return
+ * Answers the command associated with the enumeration name. For
+ * example, if the enumeration name was 'Default' for the debug
+ * level option of the Gnu compiler, and the plugin manifest defined
+ * that as -g, then the return value would be a String containing "-g"
+ *
+ * @return
*/
- public String getName();
-
+ public String getEnumCommand (String name);
+
/**
- * Returns the current value for this option if it is a List of Strings.
+ * Answers an array of <code>String</code> containing the includes paths
+ * defined in the build model.
*
* @return
+ * @throws BuildException
*/
- public String [] getStringListValue() throws BuildException;
+ public String[] getIncludePaths() throws BuildException;
+
/**
- * @return a <code>String</code> containing the selected enumeration in an
+ * Answers a <code>String</code> containing the selected enumeration in an
* enumerated option. For an option that has not been changed by the user,
* the receiver will answer with the default defined in the plugin manifest.
* If the user has modified the selection, the receiver will answer with the
* overridden selection.
+ *
+ * @return
+ * @throws BuildException
*/
- public String getSelectedEnum ();
+ public String getSelectedEnum () throws BuildException;
+ /**
+ * Returns the current value for this option if it is a List of Strings.
+ *
+ * @return
+ * @throws BuildException
+ */
+ public String [] getStringListValue() throws BuildException;
/**
* Returns the current value for this option if it is a String
*
* @return
+ * @throws BuildException
*/
public String getStringValue() throws BuildException;
Index: build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java,v
retrieving revision 1.8
diff -u -r1.8 ManagedBuildManager.java
--- build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java 9 Jun 2003 19:22:15 -0000 1.8
+++ build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java 20 Jun 2003 13:57:03 -0000
@@ -118,19 +118,28 @@
}
}
-
+
+ /**
+ * Answers the result of a best-effort search to find a target with the
+ * specified ID, or <code>null</code> if one is not found.
+ *
+ * @param resource
+ * @param id
+ * @return
+ */
public static ITarget getTarget(IResource resource, String id) {
+ ITarget target = null;
+ // Check if the target is spec'd in the build info for the resource
if (resource != null) {
IResourceBuildInfo buildInfo = getBuildInfo(resource);
if (buildInfo != null)
- return buildInfo.getTarget(id);
+ target = buildInfo.getTarget(id);
}
-
- ITarget target = (ITarget)getExtensionTargetMap().get(id);
- if (target != null)
- return target;
-
- return null;
+ // OK, check the extension map
+ if (target == null) {
+ target = (ITarget)getExtensionTargetMap().get(id);
+ }
+ return target;
}
/**
@@ -329,7 +338,7 @@
return buildInfo;
}
- public static IResourceBuildInfo getBuildInfo(IResource resource, boolean create) {
+ private static ResourceBuildInfo findBuildInfo(IResource resource, boolean create) {
// Make sure the extension information is loaded first
loadExtensions();
ResourceBuildInfo buildInfo = null;
@@ -354,9 +363,23 @@
return buildInfo;
}
+ public static IResourceBuildInfo getBuildInfo(IResource resource, boolean create) {
+ return (IResourceBuildInfo) findBuildInfo(resource, create);
+ }
+
public static IResourceBuildInfo getBuildInfo(IResource resource) {
- return getBuildInfo(resource, false);
+ return (IResourceBuildInfo) findBuildInfo(resource, false);
}
+ /**
+ * Answers with an interface to the parse information that has been
+ * associated with the resource specified in the argument.
+ *
+ * @param resource
+ * @return
+ */
+ public static IManagedBuildPathInfo getBuildPathInfo(IResource resource) {
+ return (IManagedBuildPathInfo) getBuildInfo(resource, false);
+ }
}
Index: build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java,v
retrieving revision 1.10
diff -u -r1.10 Configuration.java
--- build/org/eclipse/cdt/internal/core/build/managed/Configuration.java 9 Jun 2003 19:22:15 -0000 1.10
+++ build/org/eclipse/cdt/internal/core/build/managed/Configuration.java 20 Jun 2003 13:57:03 -0000
@@ -272,7 +272,21 @@
*/
public void setOption(IOption option, String[] value) throws BuildException {
// Is there a delta
- String[] oldValue = option.getStringListValue();
+ String[] oldValue;
+ switch (option.getValueType()) {
+ case IOption.STRING_LIST :
+ oldValue = option.getStringListValue();
+ break;
+ case IOption.INCLUDE_PATH :
+ oldValue = option.getIncludePaths();
+ break;
+ case IOption.PREPROCESSOR_SYMBOLS :
+ oldValue = option.getDefinedSymbols();
+ break;
+ default :
+ oldValue = new String[0];
+ break;
+ }
if(!Arrays.equals(value, oldValue))
createOptionReference(option).setValue(value);
}
Index: build/org/eclipse/cdt/internal/core/build/managed/Option.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Option.java,v
retrieving revision 1.6
diff -u -r1.6 Option.java
--- build/org/eclipse/cdt/internal/core/build/managed/Option.java 29 May 2003 14:00:58 -0000 1.6
+++ build/org/eclipse/cdt/internal/core/build/managed/Option.java 20 Jun 2003 13:57:03 -0000
@@ -36,7 +36,7 @@
private String defaultEnumName;
private String command;
- private static final String[] emptyStrings = new String[0];
+ private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final String EMPTY_STRING = new String();
public Option(ITool tool) {
@@ -46,24 +46,24 @@
public Option(Tool tool, IConfigurationElement element) {
this(tool);
- // id
+ // Get the unique id of the option
setId(element.getAttribute("id"));
- // hook me up
+ // Hook me up to a tool
tool.addOption(this);
- // name
+ // Get the option Name (this is what the user will see in the UI)
setName(element.getAttribute("name"));
- // category
+ // Options can be grouped into categories
String categoryId = element.getAttribute("category");
if (categoryId != null)
setCategory(tool.getOptionCategory(categoryId));
- // command
+ // Get the command defined for the option
command = element.getAttribute("command");
- // valueType
+ // Options hold different types of values
String valueTypeStr = element.getAttribute("valueType");
if (valueTypeStr == null)
valueType = -1;
@@ -73,10 +73,14 @@
valueType = IOption.STRING_LIST;
else if (valueTypeStr.equals("boolean"))
valueType = IOption.BOOLEAN;
- else
+ else if (valueTypeStr.equals("enumerated"))
valueType = IOption.ENUMERATED;
+ else if (valueTypeStr.equals("includePath"))
+ valueType = IOption.INCLUDE_PATH;
+ else
+ valueType = IOption.PREPROCESSOR_SYMBOLS;
- // value
+ // Now get the actual value
enumCommands = new HashMap();
switch (valueType) {
case IOption.BOOLEAN:
@@ -103,6 +107,8 @@
value = enumList;
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
List valueList = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren("optionValue");
for (int i = 0; i < valueElements.length; ++i) {
@@ -122,7 +128,7 @@
List enumValues = (List)value;
return enumValues != null
? (String[])enumValues.toArray(new String[enumValues.size()])
- : emptyStrings;
+ : EMPTY_STRING_ARRAY;
}
public boolean getBooleanValue() {
@@ -145,36 +151,70 @@
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
+ */
+ public String[] getDefinedSymbols() throws BuildException {
+ if (valueType != IOption.PREPROCESSOR_SYMBOLS) {
+ throw new BuildException("bad value type");
+ }
+ List v = (List)value;
+ return v != null
+ ? (String[])v.toArray(new String[v.size()])
+ : EMPTY_STRING_ARRAY;
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
*/
public String getEnumCommand(String name) {
String cmd = (String) enumCommands.get(name);
- return (cmd == null ? new String() : cmd);
+ return cmd == null ? EMPTY_STRING : cmd;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
+ */
+ public String[] getIncludePaths() throws BuildException {
+ if (valueType != IOption.INCLUDE_PATH) {
+ throw new BuildException("bad value type");
+ }
+ List v = (List)value;
+ return v != null
+ ? (String[])v.toArray(new String[v.size()])
+ : EMPTY_STRING_ARRAY;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
- public String getSelectedEnum() {
- return defaultEnumName;
+ public String getSelectedEnum() throws BuildException {
+ if (valueType != IOption.ENUMERATED) {
+ throw new BuildException("bad value type");
+ }
+ return defaultEnumName == null ? EMPTY_STRING : defaultEnumName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getStringListValue()
*/
- public String[] getStringListValue() {
+ public String[] getStringListValue() throws BuildException {
+ if (valueType != IOption.STRING_LIST) {
+ throw new BuildException("bad value type");
+ }
List v = (List)value;
return v != null
? (String[])v.toArray(new String[v.size()])
- : emptyStrings;
+ : EMPTY_STRING_ARRAY;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getStringValue()
*/
- public String getStringValue() {
- String v = (String) value;
- return value == null ? EMPTY_STRING : v;
+ public String getStringValue() throws BuildException {
+ if (valueType != IOption.STRING) {
+ throw new BuildException("bad value type");
+ }
+ return value == null ? EMPTY_STRING : (String)value;
}
/* (non-Javadoc)
@@ -204,16 +244,15 @@
public IOption setValue(IConfiguration config, String value)
throws BuildException
{
- if (valueType != IOption.STRING)
+ if (valueType != IOption.STRING
+ || valueType != IOption.ENUMERATED)
throw new BuildException("Bad value for type");
if (config == null) {
this.value = value;
return this;
} else {
-
// Magic time
-
return null;
}
}
@@ -224,7 +263,9 @@
public IOption setValue(IConfiguration config, String[] value)
throws BuildException
{
- if (valueType != IOption.STRING_LIST)
+ if (valueType != IOption.STRING_LIST
+ || valueType != IOption.INCLUDE_PATH
+ || valueType != IOption.PREPROCESSOR_SYMBOLS)
throw new BuildException("Bad value for type");
if (config == null) {
Index: build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java,v
retrieving revision 1.8
diff -u -r1.8 OptionReference.java
--- build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java 9 Jun 2003 19:22:15 -0000 1.8
+++ build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java 20 Jun 2003 13:57:04 -0000
@@ -53,7 +53,7 @@
}
/**
- * Created from extension.
+ * Created from extension point.
*
* @param owner
* @param element
@@ -73,9 +73,15 @@
value = element.getAttribute("defaultValue");
break;
case IOption.ENUMERATED:
- value = option.getSelectedEnum();
+ try {
+ value = option.getSelectedEnum();
+ } catch (BuildException e) {
+ value = new String();
+ }
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
List valueList = new ArrayList();
IConfigurationElement[] valueElements = element.getChildren("optionValue");
for (int i = 0; i < valueElements.length; ++i) {
@@ -108,6 +114,8 @@
value = (String) element.getAttribute("defaultValue");
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
List valueList = new ArrayList();
NodeList nodes = element.getElementsByTagName("optionValue");
for (int i = 0; i < nodes.getLength(); ++i) {
@@ -141,6 +149,8 @@
element.setAttribute("defaultValue", (String)value);
break;
case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
ArrayList stringList = (ArrayList)value;
ListIterator iter = stringList.listIterator();
while (iter.hasNext()) {
@@ -174,6 +184,20 @@
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getDefinedSymbols()
+ */
+ public String[] getDefinedSymbols() throws BuildException {
+ if (value == null)
+ return option.getDefinedSymbols();
+ else if (getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ ArrayList list = (ArrayList)value;
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+ else
+ throw new BuildException("bad value type");
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getEnumCommand(java.lang.String)
*/
public String getEnumCommand(String name) {
@@ -184,13 +208,29 @@
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
*/
public String getId() {
+ // A reference has the same id as the option it references
return option.getId();
}
/* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IOption#getIncludePaths()
+ */
+ public String[] getIncludePaths() throws BuildException {
+ if (value == null)
+ return option.getIncludePaths();
+ else if (getValueType() == IOption.INCLUDE_PATH) {
+ ArrayList list = (ArrayList)value;
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+ else
+ throw new BuildException("bad value type");
+ }
+
+ /* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuildObject#getName()
*/
public String getName() {
+ // A reference has the same name as the option it references
return option.getName();
}
@@ -212,13 +252,15 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
*/
- public String getSelectedEnum() {
+ public String getSelectedEnum() throws BuildException {
if (value == null) {
// Return the default defined for the enumeration in the manifest.
return option.getSelectedEnum();
- } else {
+ } else if (getValueType() == IOption.ENUMERATED) {
// Value will contain the human-readable name of the enum
return (String) value;
+ } else {
+ throw new BuildException("bad value type");
}
}
@@ -302,11 +344,14 @@
* @throws BuildException
*/
public void setValue(String [] value) throws BuildException {
- if (getValueType() == IOption.STRING_LIST) {
+ if (getValueType() == IOption.STRING_LIST
+ || getValueType() == IOption.INCLUDE_PATH
+ || getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
// Just replace what the option reference is holding onto
this.value = new ArrayList(Arrays.asList(value));
}
else
throw new BuildException("bad value type");
}
+
}
Index: build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java,v
retrieving revision 1.3
diff -u -r1.3 ResourceBuildInfo.java
--- build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java 9 Jun 2003 19:22:15 -0000 1.3
+++ build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java 20 Jun 2003 13:57:04 -0000
@@ -12,13 +12,16 @@
* **********************************************************************/
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.eclipse.cdt.core.build.managed.BuildException;
+import org.eclipse.cdt.core.build.managed.IManagedBuildPathInfo;
import org.eclipse.cdt.core.build.managed.IConfiguration;
+import org.eclipse.cdt.core.build.managed.IOption;
import org.eclipse.cdt.core.build.managed.IResourceBuildInfo;
import org.eclipse.cdt.core.build.managed.ITarget;
import org.eclipse.cdt.core.build.managed.ITool;
@@ -27,7 +30,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-public class ResourceBuildInfo implements IResourceBuildInfo {
+public class ResourceBuildInfo implements IResourceBuildInfo, IManagedBuildPathInfo {
private IResource owner;
private Map targetMap;
@@ -271,6 +274,60 @@
return;
}
defaultTarget = target;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildParseInfo#getDefinedSymbols()
+ */
+ public String[] getDefinedSymbols() {
+ // Return the include paths for the default configuration
+ ArrayList paths = new ArrayList();
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ IOption[] opts = tool.getOptions();
+ for (int j = 0; j < opts.length; j++) {
+ IOption option = opts[j];
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ try {
+ paths.addAll(Arrays.asList(option.getDefinedSymbols()));
+ } catch (BuildException e) {
+ // we should never get here
+ continue;
+ }
+ }
+ }
+ }
+ paths.trimToSize();
+ return (String[])paths.toArray(new String[paths.size()]);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuildParseInfo#getIncludePaths()
+ */
+ public String[] getIncludePaths() {
+ // Return the include paths for the default configuration
+ ArrayList paths = new ArrayList();
+ IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+ ITool[] tools = config.getTools();
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ IOption[] opts = tool.getOptions();
+ for (int j = 0; j < opts.length; j++) {
+ IOption option = opts[j];
+ if (option.getValueType() == IOption.INCLUDE_PATH) {
+ try {
+ paths.addAll(Arrays.asList(option.getIncludePaths()));
+ } catch (BuildException e) {
+ // we should never get here
+ continue;
+ }
+ }
+ }
+ }
+ paths.trimToSize();
+ return (String[])paths.toArray(new String[paths.size()]);
}
}
Index: build/org/eclipse/cdt/internal/core/build/managed/Tool.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java,v
retrieving revision 1.6
diff -u -r1.6 Tool.java
--- build/org/eclipse/cdt/internal/core/build/managed/Tool.java 9 Jun 2003 19:22:15 -0000 1.6
+++ build/org/eclipse/cdt/internal/core/build/managed/Tool.java 20 Jun 2003 13:57:04 -0000
@@ -233,14 +233,32 @@
break;
case IOption.STRING_LIST :
- String cmd = option.getCommand();
+ String listCmd = option.getCommand();
String[] list = option.getStringListValue();
for (int j = 0; j < list.length; j++) {
String temp = list[j];
- buf.append(cmd + temp + WHITE_SPACE);
+ buf.append(listCmd + temp + WHITE_SPACE);
}
break;
+ case IOption.INCLUDE_PATH :
+ String incCmd = option.getCommand();
+ String[] paths = option.getIncludePaths();
+ for (int j = 0; j < paths.length; j++) {
+ String temp = paths[j];
+ buf.append(incCmd + temp + WHITE_SPACE);
+ }
+ break;
+
+ case IOption.PREPROCESSOR_SYMBOLS :
+ String defCmd = option.getCommand();
+ String[] symbols = option.getDefinedSymbols();
+ for (int j = 0; j < symbols.length; j++) {
+ String temp = symbols[j];
+ buf.append(defCmd + temp + WHITE_SPACE);
+ }
+ break;
+
default :
break;
}
Index: build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java,v
retrieving revision 1.6
diff -u -r1.6 ToolReference.java
--- build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java 9 Jun 2003 19:22:15 -0000 1.6
+++ build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java 20 Jun 2003 13:57:04 -0000
@@ -168,6 +168,24 @@
}
break;
+ case IOption.INCLUDE_PATH :
+ String incCmd = option.getCommand();
+ String[] paths = option.getIncludePaths();
+ for (int j = 0; j < paths.length; j++) {
+ String temp = paths[j];
+ buf.append(incCmd + temp + WHITE_SPACE);
+ }
+ break;
+
+ case IOption.PREPROCESSOR_SYMBOLS :
+ String defCmd = option.getCommand();
+ String[] symbols = option.getDefinedSymbols();
+ for (int j = 0; j < symbols.length; j++) {
+ String temp = symbols[j];
+ buf.append(defCmd + temp + WHITE_SPACE);
+ }
+ break;
+
default :
break;
}
Index: schema/ManagedBuildTools.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd,v
retrieving revision 1.6
diff -u -r1.6 ManagedBuildTools.exsd
--- schema/ManagedBuildTools.exsd 9 Jun 2003 19:22:15 -0000 1.6
+++ schema/ManagedBuildTools.exsd 20 Jun 2003 13:57:04 -0000
@@ -118,7 +118,9 @@
<attribute name="valueType" use="default" value="string">
<annotation>
<documentation>
- An option can be one of the following types; 'string' for catch-all entries for options that cannot be easily defined any other way, 'string list' for entries that consist of a list of values such as defined symbols or paths, 'boolean' for options that have two values, and 'enumerated' for options that are one-of a list of values.
+ General options can be one of the following types; 'string' for catch-all entries for options that cannot be easily defined any other way, 'string list' for entries that consist of a list of values such as defined symbols or paths, 'boolean' for options that have two values, and 'enumerated' for options that are one-of a list of values.
+
+Two additional types exist to flag options of special relevance to the build model; 'include', and 'definedSymbols'. You can pre-populate with optionValues, and they will display in the UI the same way the 'StringList' options do. The build model will look specifically for these value types when clients query for include paths and preprocessor defines.
</documentation>
</annotation>
<simpleType>
@@ -130,6 +132,10 @@
<enumeration value="boolean">
</enumeration>
<enumeration value="enumerated">
+ </enumeration>
+ <enumeration value="includePath">
+ </enumeration>
+ <enumeration value="definedSymbols">
</enumeration>
</restriction>
</simpleType>