[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] FW: Managed Build System patches for CDT 2.1
|
This time with the files….
From: Treggiari, Leo
Sent: Monday, November 15, 2004
1:31 PM
To: 'cdt-patch@xxxxxxxxxxx'
Subject: Managed Build System
patches for CDT 2.1
Here are additional patches for “core”,
“core.tests” and “ui”.
The patches include:
- Code to handle the case where a
manifest file or project file contains a higher version number than the
Managed Build System.
- New JUnit tests for the new
model.
- Updates to some external
strings.
Regards,
Leo
|
Index: src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties,v
retrieving revision 1.22
diff -u -r1.22 PluginResources.properties
--- src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties 8 Nov 2004 20:12:41 -0000 1.22
+++ src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties 15 Nov 2004 18:01:54 -0000
@@ -54,7 +54,7 @@
BuildPropertyPage.tip.remconf=Remove configurations for the platform
BuildPropertyPage.manage.title=Manage
BuildPropertyPage.error.Unknown_tree_element=Unknown type of element in tree of type {0}
-BuildPropertyPage.error.version_low=The project settings are stored in an earlier format.\nYou must upgrade the project before the settings can be displayed.
+BuildPropertyPage.error.version_low=The Managed Make project settings for this project are not available.
BuildPropertyPage.defaults.title=Reset Configuration Tools
BuildPropertyPage.defaults.message=This action will reset all of the tools in the selected configuration to their default settings.\n\nDo you want to proceed?
BuildPropertyPage.changes.save.title=Apply Configuration Changes
@@ -72,7 +72,7 @@
# ----------- Build Settings Block -----------
BuildSettingsBlock.label.Settings=Build Settings
-BuildSettingsBlock.label.makecmdgroup=Make command
+BuildSettingsBlock.label.makecmdgroup=Build command
BuildSettingsBlock.label.makecmddef=Use default command
BuildSettingsBlock.label.output.group=Build output
BuildSettingsBlock.label.output.name=Artifact name:
@@ -87,7 +87,7 @@
ResourceBuildPropertyPage.label.ToolTree=Tools
ResourceBuildPropertyPage.label.ToolOptions=Options
ResourceBuildPropertyPage.label.NotMBSFile=The project is closed or the file is not contained within a Managed Make project.
-ResourceBuildPropertyPage.error.version_low=The project settings are stored in an earlier format.\nYou must upgrade the project before the settings can be displayed.
+ResourceBuildPropertyPage.error.version_low=The Managed Make project settings for this project are not available.
# ----------- Entry Dialog -----------
BrowseEntryDialog.error.Folder_name_invalid = Folder name invalid
Index: schema/buildDefinitions.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd,v
retrieving revision 1.2
diff -u -r1.2 buildDefinitions.exsd
--- schema/buildDefinitions.exsd 4 Nov 2004 16:56:27 -0000 1.2
+++ schema/buildDefinitions.exsd 15 Nov 2004 18:00:25 -0000
@@ -153,6 +153,13 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="parent" type="string">
+ <annotation>
+ <documentation>
+ The configuration that this configuration was cloned from.
+ </documentation>
+ </annotation>
+ </attribute>
<attribute name="artifactName" type="string">
<annotation>
<documentation>
Index: src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java,v
retrieving revision 1.1
diff -u -r1.1 IManagedProject.java
--- src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java 28 Oct 2004 17:16:53 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/core/IManagedProject.java 15 Nov 2004 18:00:25 -0000
@@ -131,6 +131,21 @@
public void setDirty(boolean isDirty);
/**
+ * Returns <code>true</code> if this project is valid
+ * else <code>false</code>.
+ *
+ * @return boolean
+ */
+ public boolean isValid();
+
+ /**
+ * Sets the element's "Valid" flag.
+ *
+ * @param isValid
+ */
+ public void setValid(boolean isValid);
+
+ /**
* Persist the managed project to the project file (.cdtbuild).
*
* @param doc
Index: src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java,v
retrieving revision 1.31
diff -u -r1.31 ManagedBuildManager.java
--- src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java 8 Nov 2004 20:12:37 -0000 1.31
+++ src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java 15 Nov 2004 18:00:26 -0000
@@ -1135,6 +1135,10 @@
// This is a 1.2 manifest and we are compatible for now
return true;
} else {
+ // isCompatibleWith will return FALSE, if:
+ // o The major versions are not equal
+ // o The major versions are equal, but the remainder of the manifest version # is
+ // greater than the MBS version #
return(buildInfoVersion.isCompatibleWith(version));
}
}
@@ -1184,8 +1188,12 @@
// Make sure that the version is compatible with the manager
fileVersion = rootElement.getNodeValue();
PluginVersionIdentifier version = new PluginVersionIdentifier(fileVersion);
+ // isCompatibleWith will return FALSE, if:
+ // o The major versions are not equal
+ // o The major versions are equal, but the remainder of the .cdtbuild version # is
+ // greater than the MBS version #
if (!buildInfoVersion.isCompatibleWith(version)) {
- throw new BuildException(ManagedMakeMessages.getResourceString(PROJECT_VERSION_ERROR));
+ throw new BuildException(ManagedMakeMessages.getFormattedString(PROJECT_VERSION_ERROR, project.getName()));
}
if (buildInfoVersion.isGreaterThan(version)) {
// TODO Upgrade the project
@@ -1207,6 +1215,11 @@
throw e;
}
}
+ if (buildInfo.getManagedProject() == null ||
+ (!buildInfo.getManagedProject().isValid())) {
+ // The load failed
+ throw new Exception(ManagedMakeMessages.getFormattedString("ManagedBuildManager.error.id.nomatch", project.getName()));
+ }
project.setSessionProperty(buildInfoProperty, buildInfo);
}
} catch (Exception e) {
@@ -1245,18 +1258,34 @@
IExtension extension = extensions[i];
// Can we read this manifest
if (!isVersionCompatible(extension)) {
- //The version of the Plug-in is greater than what the manager thinks it understands
- throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR));
- }
- // Get the "configuraton elements" defined in the plugin.xml file.
- // Note that these "configuration elements" are not related to the
- // managed build system "configurations".
- // From the PDE Guide:
- // A configuration element, with its attributes and children, directly
- // reflects the content and structure of the extension section within the
- // declaring plug-in's manifest (plugin.xml) file.
- IConfigurationElement[] elements = extension.getConfigurationElements();
- loadConfigElements(DefaultManagedConfigElement.convertArray(elements));
+ // The version of the Plug-in is greater than what the manager thinks it understands
+ // Display error message
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if(window == null){
+ IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
+ window = windows[0];
+ }
+
+ final Shell shell = window.getShell();
+ final String errMsg = ManagedMakeMessages.getFormattedString(MANIFEST_VERSION_ERROR, extension.getUniqueIdentifier());
+ shell.getDisplay().syncExec( new Runnable() {
+ public void run() {
+ MessageDialog.openError(shell,
+ ManagedMakeMessages.getResourceString("ManagedBuildManager.error.manifest_load_failed_title"), //$NON-NLS-1$
+ errMsg);
+ }
+ } );
+ } else {
+ // Get the "configuraton elements" defined in the plugin.xml file.
+ // Note that these "configuration elements" are not related to the
+ // managed build system "configurations".
+ // From the PDE Guide:
+ // A configuration element, with its attributes and children, directly
+ // reflects the content and structure of the extension section within the
+ // declaring plug-in's manifest (plugin.xml) file.
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ loadConfigElements(DefaultManagedConfigElement.convertArray(elements));
+ }
}
// Then call resolve.
//
@@ -1834,5 +1863,4 @@
public static IManagedConfigElement getConfigElement(IBuildObject buildObj) {
return (IManagedConfigElement)getConfigElementMap().get(buildObj);
}
-
}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java,v
retrieving revision 1.20
diff -u -r1.20 Configuration.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java 28 Oct 2004 17:16:53 -0000 1.20
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java 15 Nov 2004 18:00:27 -0000
@@ -111,7 +111,7 @@
* Create a new extension configuration based on one already defined.
*
* @param projectType The <code>ProjectType</code> the configuration will be added to.
- * @param parentConfig The <code>IConfiguration</code> to copy the settings from.
+ * @param parentConfig The <code>IConfiguration</code> that is the parent configuration of this configuration
* @param id A unique ID for the new configuration.
*/
public Configuration(ProjectType projectType, IConfiguration parentConfig, String id) {
@@ -144,6 +144,7 @@
* Create a new extension configuration and fill in the attributes and childen later.
*
* @param projectType The <code>ProjectType</code> the configuration will be added to.
+ * @param parentConfig The <code>IConfiguration</code> that is the parent configuration of this configuration
* @param id A unique ID for the new configuration.
* @param name A name for the new configuration.
*/
@@ -196,8 +197,9 @@
* Create a new project, non-extension, configuration based on one already defined.
*
* @param managedProject The <code>ManagedProject</code> the configuration will be added to.
- * @param parentConfig The <code>IConfiguration</code> to copy the settings from.
+ * @param cloneConfig The <code>IConfiguration</code> to copy the settings from.
* @param id A unique ID for the new configuration.
+ * @param cloneTools If <code>true</code>, the configuration's tools are cloned
*/
public Configuration(ManagedProject managedProject, Configuration cloneConfig, String id, boolean cloneTools) {
setId(id);
Index: src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java,v
retrieving revision 1.28
diff -u -r1.28 ManagedBuildInfo.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java 8 Nov 2004 21:10:26 -0000 1.28
+++ src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java 15 Nov 2004 18:00:27 -0000
@@ -123,7 +123,8 @@
// TODO: There should only be 1?
for (int projIndex = projNodes.getLength() - 1; projIndex >= 0; --projIndex) {
ManagedProject proj = new ManagedProject(this, (Element)projNodes.item(projIndex));
- proj.resolveReferences();
+ if (!proj.resolveReferences())
+ proj.setValid(false);
}
// Switch the rebuild off since this is an existing project
Index: src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java,v
retrieving revision 1.2
diff -u -r1.2 ManagedProject.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java 8 Nov 2004 20:12:37 -0000 1.2
+++ src/org/eclipse/cdt/managedbuilder/internal/core/ManagedProject.java 15 Nov 2004 18:00:27 -0000
@@ -47,6 +47,7 @@
private Map configMap;
// Miscellaneous
private boolean isDirty = false;
+ private boolean isValid = true;
private boolean resolved = true;
/*
@@ -95,15 +96,17 @@
this(buildInfo.getOwner());
// Initialize from the XML attributes
- loadFromProject(element);
-
- // Load children
- NodeList configElements = element.getChildNodes();
- for (int i = 0; i < configElements.getLength(); ++i) {
- Node configElement = configElements.item(i);
- if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
- Configuration config = new Configuration(this, (Element)configElement);
+ if (loadFromProject(element)) {
+ // Load children
+ NodeList configElements = element.getChildNodes();
+ for (int i = 0; i < configElements.getLength(); ++i) {
+ Node configElement = configElements.item(i);
+ if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
+ Configuration config = new Configuration(this, (Element)configElement);
+ }
}
+ } else {
+ setValid(false);
}
// hook me up
@@ -120,7 +123,7 @@
*
* @param element An XML element containing the project information
*/
- protected void loadFromProject(Element element) {
+ protected boolean loadFromProject(Element element) {
// id
setId(element.getAttribute(IBuildObject.ID));
@@ -135,9 +138,10 @@
if (projectTypeId != null && projectTypeId.length() > 0) {
projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
if (projectType == null) {
- // TODO: Report error
+ return false;
}
}
+ return true;
}
/* (non-Javadoc)
@@ -348,14 +352,14 @@
/* (non-Javadoc)
* Resolve the element IDs to interface references
*/
- public void resolveReferences() {
+ public boolean resolveReferences() {
if (!resolved) {
resolved = true;
// Resolve project-type
if (projectTypeId != null && projectTypeId.length() > 0) {
projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
if (projectType == null) {
- // TODO: Report error
+ return false;
}
}
@@ -366,6 +370,7 @@
current.resolveReferences();
}
}
+ return true;
}
/* (non-Javadoc)
@@ -398,6 +403,22 @@
current.setDirty(false);
}
}
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#isValid()
+ */
+ public boolean isValid() {
+ // TODO: In the future, children could also have a "valid" state that should be checked
+ return isValid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#setValid(boolean)
+ */
+ public void setValid(boolean isValid) {
+ // TODO: In the future, children could also have a "valid" state...
+ this.isValid = isValid;
}
}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties,v
retrieving revision 1.19
diff -u -r1.19 PluginResources.properties
--- src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties 8 Nov 2004 20:12:37 -0000 1.19
+++ src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties 15 Nov 2004 18:00:27 -0000
@@ -37,10 +37,12 @@
ManagedBuildManager.error.owner_not_null=addTarget: owner not null
ManagedBuildManager.error.null_owner=addTarget: null owner
ManagedBuildManager.error.owner_not_project=addTarget: owner not project
-ManagedBuildManager.error.manifest.version.error=The version of plugin file is higher than version of the build system
-ManagedBuildManager.error.project.version.error=The version of the project is higher than the build system
+ManagedBuildManager.error.manifest_load_failed_title=Managed Build System Version Error
+ManagedBuildManager.error.manifest.version.error=The version number defined in the plugin manifest file\n{0}\nis greater than the version of the Managed Build System.\nThe definitions in the manifest file will not be loaded.
ManagedBuildManager.error.open_failed_title=Managed Make Project File Error
ManagedBuildManager.error.open_failed=The Managed Make project file could not be read because of the following error.\n\n{0}\n\nManaged Make functionality will not be available for this project.
+ManagedBuildManager.error.project.version.error=The version number of the project {0} is greater than the Managed Build System version number.
+ManagedBuildManager.error.id.nomatch=Error loading Managed Make project information for project {0}. The tool definitions used to create the project are not available.
# Makefile Generator Messages
MakefileGenerator.message.start.file=Building file:
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml,v
retrieving revision 1.10
diff -u -r1.10 plugin.xml
--- plugin.xml 4 Nov 2004 16:55:58 -0000 1.10
+++ plugin.xml 15 Nov 2004 18:01:21 -0000
@@ -355,6 +355,7 @@
<option
name="Test Forward Option"
category="test.forward.child.category"
+ valueType="boolean"
id="test.forward.option">
</option>
<optionCategory
Index: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java,v
retrieving revision 1.14
diff -u -r1.14 ManagedBuildCoreTests.java
--- tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java 4 Nov 2004 16:55:57 -0000 1.14
+++ tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java 15 Nov 2004 18:01:21 -0000
@@ -12,61 +12,625 @@
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
+import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+
public class ManagedBuildCoreTests extends TestCase {
private static final boolean boolVal = true;
-
+ private static IProjectType exeType;
+ private static IProjectType libType;
+ private static IProjectType dllType;
+
public ManagedBuildCoreTests(String name) {
super(name);
}
public static Test suite() {
- TestSuite suite = new TestSuite(ManagedBuildCoreTests.class.getName());
-
+ TestSuite suite = new TestSuite(ManagedBuildCoreTests.class.getName());
suite.addTest(new ManagedBuildCoreTests("testLoadManifest"));
- suite.addTest(new ManagedBuildCoreTests("cleanup"));
-
return suite;
}
/**
- * Navigates through the CDT 2.1 manifest file and verifies that the
+ * Navigates through a CDT 2.1 manifest file and verifies that the
* definitions are loaded correctly.
*/
public void testLoadManifest() throws Exception {
- IProjectType exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
- assertNotNull(exeType);
- IProjectType libType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.lib");
- assertNotNull(libType);
- IProjectType dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.so");
- assertNotNull(dllType);
+ IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
+ exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
+ checkExeProjectType(exeType);
+ dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.so");
+ checkSoProjectType(dllType);
+ libType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.lib");
+ checkLibProjectType(libType);
}
+
- /**
- * Remove all the project information associated with the project used during test.
+ /*
+ * Do a sanity check on the testgnu exe project type.
*/
- public void cleanup() {
- //removeProject(projectName);
- }
+ private void checkExeProjectType(IProjectType ptype) throws BuildException {
+ int i;
+ int expecectedNumConfigs = 2;
+ String[] expectedConfigName = {"Dbg", "Rel"};
+ String expectedCleanCmd = "rm -rf";
+ String expectedParserId = "org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser";
+ String expectedOSList = "solaris,linux,hpux,aix,qnx";
+ int expectedSizeOSList = 5;
+ String[] expectedArchList = {"all"};
+ String expectedBinaryParser = "org.eclipse.cdt.core.ELF";
+ String[] expectedPlatformName = {"Dbg Platform",
+ "Rel Platform"};
+ String expectedCommand = "make";
+ String expectedArguments = "-k";
+ String[] expectedBuilderName = {"Dbg Builder",
+ "Rel Builder"};
+ String expectedBuilderInfo = "org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator";
+ String[] expectedToolId1 = {"cdt.managedbuild.tool.testgnu.c.compiler.exe.debug",
+ "cdt.managedbuild.tool.testgnu.c.compiler.exe.release"};
+ String expectedSuperToolId1 = "cdt.managedbuild.tool.testgnu.c.compiler";
+ String expectedSuperOutputFlag1 = "-o";
+ String expectedSuperGetToolCommand1 = "gcc";
+ String expectedSuperInputExt1 = "c";
+ String expectedSuperToolInterfaceExt1 = "h";
+ String[] expectedSuperToolOutputExt1 = {"o"};
+ String expectedOptionCategory1 = "testgnu.c.compiler.category.preprocessor";
+ String[] OptionId1 = {"testgnu.c.compiler.exe.debug.option.optimization.level",
+ "testgnu.c.compiler.exe.release.option.optimization.level"};
+ String[] expectedOptionIdValue1 = {"testgnu.c.optimization.level.none",
+ "testgnu.c.optimization.level.most"};
+ String expectedEnumList1 = "Posix.Optimize.None, Posix.Optimize.Optimize, Posix.Optimize.More, Posix.Optimize.Most";
+ int expectedSizeEnumList1 = 4;
+ String[] expectedOptionEnumCmd1arr = {"-O0", "-O3"};
+ String OptionId2 = "testgnu.c.compiler.option.debugging.other";
+ String expectedOptionIdName2 = "Posix.Debug.Other";
+ String OptionId3 = "testgnu.c.compiler.option.debugging.gprof";
+ String expectedOptionIdName3 = "Posix.Debug.gprof";
+ String expectedOptionIdCmd3 = "-pg";
+ boolean expectedOptionIdValue3 = false;
+ int expecectedNumTools = 5;
+ int numOrderCCompilerTool = 0;
+ int expecectedCNature = ITool.FILTER_C;
+ int expecectedCCNature = ITool.FILTER_CC;
+
+ // Check project attributes
+ //
+ assertNotNull(ptype);
+ assertTrue(ptype.isTestProjectType());
+ assertFalse(ptype.isAbstract());
+
+ // Check project configurations
+ //
+ IConfiguration[] configs = ptype.getConfigurations();
+ assertNotNull(configs);
+ assertEquals(expecectedNumConfigs, configs.length);
+
+ // Loop over configurations
+ //
+ for (int iconfig=0; iconfig < configs.length; iconfig++) {
+
+ // Verify configuration attributes
+ //
+ assertEquals(configs[iconfig].getName(), (expectedConfigName[iconfig]));
+ assertEquals(expectedCleanCmd, configs[iconfig].getCleanCommand());
+ assertEquals(expectedParserId, configs[iconfig].getErrorParserIds());
+
+ // Fetch toolchain
+ //
+ IToolChain toolChain = configs[iconfig].getToolChain();
+
+ // Fetch and check platform
+ //
+ ITargetPlatform platform = toolChain.getTargetPlatform();
+
+ List expectedOSListarr = new ArrayList();
+ String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedOSListTokens.length; ++i) {
+ expectedOSListarr.add(expectedOSListTokens[i].trim());
+ }
+ assertTrue(Arrays.equals(platform.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
+ assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
+ assertEquals(platform.getBinaryParserId(), expectedBinaryParser);
+ assertEquals(platform.getName(), expectedPlatformName[iconfig]);
+
+ // Fetch and check builder
+ //
+ IBuilder builder = toolChain.getBuilder();
+ assertEquals(builder.getCommand(), expectedCommand);
+ assertEquals(builder.getArguments(), expectedArguments);
+ assertEquals(builder.getName(), expectedBuilderName[iconfig]);
+ IConfigurationElement element = builder.getBuildFileGeneratorElement();
+ if (element != null) {
+ assertEquals(element.getAttribute(IBuilder.BUILDFILEGEN_ID), expectedBuilderInfo);
+ }
+
+ // Fetch and check tools list
+ //
+ ITool[] tools = toolChain.getTools();
+ assertEquals(tools.length, expecectedNumTools);
+
+ // Fetch and check the gnu C compiler tool
+ //
+ ITool tool;
+ ITool superTool;
+
+ tool = tools[numOrderCCompilerTool];
+ superTool = tool.getSuperClass();
+ assertEquals(tool.getId(), expectedToolId1[iconfig]);
+ assertEquals(superTool.getId(), expectedSuperToolId1);
+ assertEquals(tool.getNatureFilter(), expecectedCNature);
+ List expectedSuperInputExt1List = new ArrayList();
+ String[] expectedSuperInputExt1Tokens = expectedSuperInputExt1.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedSuperInputExt1Tokens.length; ++i) {
+ expectedSuperInputExt1List.add(expectedSuperInputExt1Tokens[i].trim());
+ }
+ assertEquals(superTool.getInputExtensions(), expectedSuperInputExt1List);
+ assertEquals(superTool.getOutputFlag(), expectedSuperOutputFlag1);
+ assertEquals(superTool.getToolCommand(), expectedSuperGetToolCommand1);
+ assertTrue(Arrays.equals(superTool.getOutputExtensions(), expectedSuperToolOutputExt1));
+ List expectedSuperInterfaceExt1List = new ArrayList();
+ String[] expectedSuperInterfaceExt1Tokens = expectedSuperToolInterfaceExt1.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedSuperInterfaceExt1Tokens.length; ++i) {
+ expectedSuperInterfaceExt1List.add(expectedSuperInterfaceExt1Tokens[i].trim());
+ }
+ assertEquals(superTool.getInterfaceExtensions(), expectedSuperInterfaceExt1List);
+
+ assertTrue(superTool.isAbstract());
+
+ // Fetch and check an option category
+ //
+ IOptionCategory[] optionCats = superTool.getChildCategories();
+ assertEquals(optionCats[0].getId(), (expectedOptionCategory1));
+
+ // Fetch and check options customized for this tool
+ //
+ IOption option;
+
+ // Fetch the optimization level option and verify that it has the proper
+ // default value, which should overwrite the value set in the abstract
+ // project that its containing project is derived from
+ //
+ option = tool.getOptionById(OptionId1[iconfig]);
+ assertTrue(option.isExtensionElement());
+ String optionDefaultValue = (String)option.getDefaultValue();
+ assertEquals(option.getValueType(), (IOption.ENUMERATED));
+ assertEquals(optionDefaultValue, (expectedOptionIdValue1[iconfig]));
+ String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue);
+ assertEquals(optionEnumCmd1, (expectedOptionEnumCmd1arr[iconfig]));
+ List expectedEnumList1arr = new ArrayList();
+ String enumValues[] = option.getApplicableValues();
+ String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedEnumList1Tokens.length; ++i) {
+ expectedEnumList1arr.add(expectedEnumList1Tokens[i].trim());
+ }
+ assertTrue(Arrays.equals(option.getApplicableValues(), (String[]) expectedEnumList1arr.toArray(new String[expectedSizeEnumList1])));
+
+ // Fetch the debug other option and verify
+ //
+ option = tool.getOptionById(OptionId2);
+ assertTrue(option.isExtensionElement());
+ assertEquals(option.getValueType(), (IOption.STRING));
+ assertEquals(option.getName(), (expectedOptionIdName2));
+
+ // Fetch the debug gprof option and verify
+ //
+ option = tool.getOptionById(OptionId3);
+ assertTrue(option.isExtensionElement());
+ assertEquals(option.getValueType(), (IOption.BOOLEAN));
+ boolean optionDefaultValueb = option.getBooleanValue();
+ assertEquals(optionDefaultValueb, (expectedOptionIdValue3));
+ assertEquals(option.getName(), (expectedOptionIdName3));
+ assertEquals(option.getCommand(), (expectedOptionIdCmd3));
+
+ } // end for
+ } // end routine
+
+ /*
+ * Do a sanity check on the testgnu so project type.
+ */
+ private void checkSoProjectType(IProjectType ptype) throws BuildException {
+ int i;
+ int expecectedNumConfigs = 2;
+ String[] expectedConfigName = {"Debug", "Release"};
+ String expectedCleanCmd = "rm -rf";
+ String expectedParserId = "org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser";
+ String expectedArtifactExtension = "so";
+ String expectedOSList = "solaris,linux,hpux,aix,qnx";
+ int expectedSizeOSList = 5;
+ String[] expectedArchList = {"all"};
+ String expectedBinaryParser = "org.eclipse.cdt.core.ELF";
+ String[] expectedPlatformName = {"so Debug Platform",
+ "so Release Platform"};
+ String expectedCommand = "make";
+ String expectedArguments = "-k";
+ String[] expectedBuilderName = {"so Debug Builder",
+ "so Release Builder"};
+ String expectedScannerInfo = "org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector";
+ String[] expectedToolChainName = {"so Debug ToolChain",
+ "so Release ToolChain"};
+ String[] expectedToolId1 = {"cdt.managedbuild.tool.testgnu.c.linker.so.debug",
+ "cdt.managedbuild.tool.testgnu.c.linker.so.release"};
+ String expectedSuperToolId1 = "cdt.managedbuild.tool.testgnu.c.linker";
+ String expectedToolOutputPrefix = "lib";
+ String[] expectedToolOutput = {""};
+ String expectedSuperOutputFlag1 = "-o";
+ String expectedSuperGetToolCommand1 = "gcc";
+ String expectedSuperInputExt1 = "o";
+ String[] expectedSuperToolOutputExt1 = {""};
+ String expectedOptionCategory1 = "testgnu.c.link.category.general";
+ String OptionId1A = "testgnu.c.link.option.libs";
+ String OptionId1B = "testgnu.c.link.option.paths";
+ String OptionId1C = "testgnu.c.link.option.userobjs";
+ String expectedOptionCmd1Aarr = "-l";
+ String expectedOptionCmd1Barr = "-L";
+ String OptionId2 = "testgnu.c.link.option.defname";
+ String expectedOptionIdName2 = "Posix.Linker.Defname";
+ String expectedOptionIdCmd2 = "-Wl,--output-def=";
+ String OptionId3 = "testgnu.c.link.option.nostart";
+ String expectedOptionIdName3 = "Posix.Linker.NoStartFiles";
+ String expectedOptionIdCmd3 = "-nostartfiles";
+ boolean expectedOptionIdValue3 = false;
+ String OptionId4 = "testgnu.c.link.option.shared";
+ String expectedOptionIdName4 = "Posix.Linker.Shared";
+ String expectedOptionIdCmd4 = "-shared";
+ boolean expectedOptionIdValue4 = false;
+ int expecectedNumTools = 5;
+ int numOrderCLinkerTool = 2;
+ int expecectedCNature = ITool.FILTER_C;
+ int expecectedCCNature = ITool.FILTER_CC;
+
+ // Check project attributes
+ //
+ assertNotNull(ptype);
+ assertTrue(ptype.isTestProjectType());
+ assertFalse(ptype.isAbstract());
+
+ // Check project configurations
+ //
+ IConfiguration[] configs = ptype.getConfigurations();
+ assertNotNull(configs);
+ assertEquals(expecectedNumConfigs, configs.length);
+
+ // Loop over configurations
+ //
+ for (int iconfig=0; iconfig < configs.length; iconfig++) {
+
+ // Verify configuration attributes
+ //
+ assertEquals(configs[iconfig].getName(), (expectedConfigName[iconfig]));
+ assertEquals(expectedCleanCmd, configs[iconfig].getCleanCommand());
+ assertEquals(expectedParserId, configs[iconfig].getErrorParserIds());
+ assertEquals(configs[iconfig].getArtifactExtension(), (expectedArtifactExtension));
+
+ // Fetch toolchain and verify
+ //
+ IToolChain toolChain = configs[iconfig].getToolChain();
+ assertEquals(toolChain.getName(), (expectedToolChainName[iconfig]));
+
+ List expectedOSListarr = new ArrayList();
+ String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedOSListTokens.length; ++i) {
+ expectedOSListarr.add(expectedOSListTokens[i].trim());
+ }
+ assertEquals(expectedParserId, configs[iconfig].getErrorParserIds());
+ assertTrue(Arrays.equals(toolChain.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
+ assertTrue(Arrays.equals(toolChain.getArchList(), expectedArchList));
+ IConfigurationElement element = toolChain.getScannerInfoCollectorElement();
+ if (element != null) {
+ assertEquals(element.getAttribute(IToolChain.SCANNER_INFO_ID), expectedScannerInfo);
+ }
+
+ // Fetch and check platform
+ //
+ ITargetPlatform platform = toolChain.getTargetPlatform();
+ assertTrue(Arrays.equals(platform.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
+ assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
+ assertEquals(platform.getBinaryParserId(), expectedBinaryParser);
+ assertEquals(platform.getName(), expectedPlatformName[iconfig]);
+
+ // Fetch and check builder
+ //
+ IBuilder builder = toolChain.getBuilder();
+ assertEquals(builder.getCommand(), expectedCommand);
+ assertEquals(builder.getArguments(), expectedArguments);
+ assertEquals(builder.getName(), expectedBuilderName[iconfig]);
+
+ // Fetch and check tools list
+ //
+ ITool[] tools = toolChain.getTools();
+ assertEquals(tools.length, expecectedNumTools);
+
+ // Fetch and check the gnu C linker tool
+ //
+ ITool tool;
+ ITool superTool;
+
+ tool = tools[numOrderCLinkerTool];
+ superTool = tool.getSuperClass();
+ assertEquals(tool.getId(), expectedToolId1[iconfig]);
+ assertEquals(superTool.getId(), expectedSuperToolId1);
+ assertEquals(tool.getNatureFilter(), expecectedCNature);
+ assertEquals(tool.getOutputPrefix(), expectedToolOutputPrefix);
+ assertTrue(Arrays.equals(superTool.getOutputExtensions(), expectedToolOutput));
+ List expectedSuperInputExt1List = new ArrayList();
+ String[] expectedSuperInputExt1Tokens = expectedSuperInputExt1.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedSuperInputExt1Tokens.length; ++i) {
+ expectedSuperInputExt1List.add(expectedSuperInputExt1Tokens[i].trim());
+ }
+ assertEquals(superTool.getInputExtensions(), expectedSuperInputExt1List);
+ assertEquals(superTool.getOutputFlag(), expectedSuperOutputFlag1);
+ assertEquals(superTool.getToolCommand(), expectedSuperGetToolCommand1);
+ assertTrue(Arrays.equals(superTool.getOutputExtensions(), expectedSuperToolOutputExt1));
+
+ // Fetch and check an option category
+ //
+ IOptionCategory[] optionCats = superTool.getChildCategories();
+ assertEquals(optionCats[0].getId(), (expectedOptionCategory1));
+
+ // Fetch and check options customized for this tool
+ //
+ IOption option;
+
+ // Fetch the libs option and verify
+ //
+ option = tool.getOptionById(OptionId1A);
+ assertTrue(option.isExtensionElement());
+ String optionDefaultValue = (String)option.getDefaultValue();
+ assertEquals(option.getValueType(), (IOption.LIBRARIES));
+ assertEquals(option.getCommand(), (expectedOptionCmd1Aarr));
+ assertEquals(option.getBrowseType(), (IOption.BROWSE_FILE));
+
+ // Fetch the libsearch option and verify
+ //
+ option = tool.getOptionById(OptionId1B);
+ assertTrue(option.isExtensionElement());
+ optionDefaultValue = (String)option.getDefaultValue();
+ assertEquals(option.getValueType(), (IOption.STRING_LIST));
+ assertEquals(option.getCommand(), (expectedOptionCmd1Barr));
+ assertEquals(option.getBrowseType(), (IOption.BROWSE_DIR));
+
+ // Fetch the user objs option and verify
+ //
+ option = tool.getOptionById(OptionId1C);
+ assertTrue(option.isExtensionElement());
+ optionDefaultValue = (String)option.getDefaultValue();
+ assertEquals(option.getValueType(), (IOption.OBJECTS));
+ assertEquals(option.getBrowseType(), (IOption.BROWSE_FILE));
+
+ // Fetch the defname option and verify
+ //
+ option = tool.getOptionById(OptionId2);
+ assertTrue(option.isExtensionElement());
+ assertEquals(option.getValueType(), (IOption.STRING));
+ assertEquals(option.getName(), (expectedOptionIdName2));
+ assertEquals(option.getCommand(), (expectedOptionIdCmd2));
+
+ // Fetch the nostartfiles option and verify
+ //
+ option = tool.getOptionById(OptionId3);
+ assertTrue(option.isExtensionElement());
+ assertEquals(option.getValueType(), (IOption.BOOLEAN));
+ boolean optionDefaultValueb1 = option.getBooleanValue();
+ assertEquals(optionDefaultValueb1, (expectedOptionIdValue3));
+ assertEquals(option.getName(), (expectedOptionIdName3));
+ assertEquals(option.getCommand(), (expectedOptionIdCmd3));
+
+ // Fetch the shared option and verify that it has the proper
+ // default value, which should overwrite the value set in the abstract
+ // project that its containing project is derived from
+ //
+ option = tool.getOptionById(OptionId4);
+ assertTrue(option.isExtensionElement());
+ assertEquals(option.getValueType(), (IOption.BOOLEAN));
+ boolean optionDefaultValueb2 = option.getBooleanValue();
+ assertEquals(optionDefaultValueb2, (expectedOptionIdValue4));
+ assertEquals(option.getName(), (expectedOptionIdName4));
+ assertEquals(option.getCommand(), (expectedOptionIdCmd4));
-}
+ } // end for
+ } //end routine
+
+ /*
+ * Do a sanity check on the testgnu lib project type.
+ */
+ private void checkLibProjectType(IProjectType ptype) throws BuildException {
+ int i;
+ int expecectedNumConfigs = 2;
+ String[] expectedConfigName = {"Dbg", "Rel"};
+ String expectedCleanCmd = "rm -rf";
+ String expectedParserId = "org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser";
+ String expectedArtifactExtension = "a";
+ String expectedOSList = "solaris,linux,hpux,aix,qnx";
+ int expectedSizeOSList = 5;
+ String[] expectedArchList = {"all"};
+ String expectedBinaryParser = "org.eclipse.cdt.core.ELF";
+ String[] expectedPlatformName = {"Dbg P",
+ "Rel P"};
+ String expectedCommand = "make";
+ String expectedArguments = "-k";
+ String[] expectedBuilderName = {"Dbg B",
+ "Rel B"};
+ String expectedScannerInfo = "org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector";
+ String[] expectedToolId1 = {"cdt.managedbuild.tool.testgnu.cpp.compiler.lib.debug",
+ "cdt.managedbuild.tool.testgnu.cpp.compiler.lib.release"};
+ String expectedSuperToolId1 = "cdt.managedbuild.tool.testgnu.cpp.compiler";
+ String expectedSuperOutputFlag1 = "-o";
+ String expectedSuperGetToolCommand1 = "g++";
+ String expectedSuperInputExt1 = "c,C,cc,cxx,cpp";
+ String expectedSuperToolInterfaceExt1 = "h,H,hpp";
+ String[] expectedSuperToolOutputExt1 = {"o"};
+ String expectedOptionCategory1 = "testgnu.cpp.compiler.category.preprocessor";
+ String[] OptionId1 = {"testgnu.cpp.compiler.lib.debug.option.optimization.level",
+ "testgnu.cpp.compiler.lib.release.option.optimization.level"};
+ String[] expectedOptionIdValue1 = {"testgnu.cpp.compiler.optimization.level.none",
+ "testgnu.cpp.compiler.optimization.level.most"};
+ String expectedEnumList1 = "Posix.Optimize.None, Posix.Optimize.Optimize, Posix.Optimize.More, Posix.Optimize.Most";
+ int expectedSizeEnumList1 = 4;
+ String[] expectedOptionEnumCmd1arr = {"-O0", "-O3"};
+
+ String OptionId2 = "testgnu.cpp.compiler.option.other.other";
+ String expectedOptionIdName2 = "OtherFlags";
+
+ String OptionId3 = "testgnu.cpp.compiler.option.other.verbose";
+ String expectedOptionIdName3 = "Posix.Verbose";
+ String expectedOptionIdCmd3 = "-v";
+ boolean expectedOptionIdValue3 = false;
+ int expecectedNumTools = 4;
+ int numOrderCppCompilerTool = 1;
+ int expecectedCNature = ITool.FILTER_C;
+ int expecectedCCNature = ITool.FILTER_CC;
+
+ // Check project attributes
+ //
+ assertNotNull(ptype);
+ assertTrue(ptype.isTestProjectType());
+ assertFalse(ptype.isAbstract());
+
+ // Check project configurations
+ //
+ IConfiguration[] configs = ptype.getConfigurations();
+ assertNotNull(configs);
+ assertEquals(expecectedNumConfigs, configs.length);
+
+ // Loop over configurations
+ //
+ for (int iconfig=0; iconfig < configs.length; iconfig++) {
+
+ // Verify configuration attributes
+ //
+ assertEquals(configs[iconfig].getName(), (expectedConfigName[iconfig]));
+ assertEquals(expectedCleanCmd, configs[iconfig].getCleanCommand());
+ assertEquals(expectedParserId, configs[iconfig].getErrorParserIds());
+ assertEquals(configs[iconfig].getArtifactExtension(), (expectedArtifactExtension));
+
+ // Fetch toolchain and verify
+ //
+ IToolChain toolChain = configs[iconfig].getToolChain();
+
+ List expectedOSListarr = new ArrayList();
+ String[] expectedOSListTokens = expectedOSList.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedOSListTokens.length; ++i) {
+ expectedOSListarr.add(expectedOSListTokens[i].trim());
+ }
+ assertEquals(expectedParserId, configs[iconfig].getErrorParserIds());
+ assertTrue(Arrays.equals(toolChain.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
+ assertTrue(Arrays.equals(toolChain.getArchList(), expectedArchList));
+ IConfigurationElement element = toolChain.getScannerInfoCollectorElement();
+ if (element != null) {
+ assertEquals(element.getAttribute(IToolChain.SCANNER_INFO_ID), expectedScannerInfo);
+ }
+
+ // Fetch and check platform
+ //
+ ITargetPlatform platform = toolChain.getTargetPlatform();
+ assertTrue(Arrays.equals(platform.getOSList(), (String[]) expectedOSListarr.toArray(new String[expectedSizeOSList])));
+ assertTrue(Arrays.equals(platform.getArchList(), expectedArchList));
+ assertEquals(platform.getBinaryParserId(), expectedBinaryParser);
+ assertEquals(platform.getName(), expectedPlatformName[iconfig]);
+
+ // Fetch and check builder
+ //
+ IBuilder builder = toolChain.getBuilder();
+ assertEquals(builder.getCommand(), expectedCommand);
+ assertEquals(builder.getArguments(), expectedArguments);
+ assertEquals(builder.getName(), expectedBuilderName[iconfig]);
+
+ // Fetch and check tools list
+ //
+ ITool[] tools = toolChain.getTools();
+ assertEquals(tools.length, expecectedNumTools);
+
+ // Fetch and check the gnu Cpp compiler tool
+ //
+ ITool tool;
+ ITool superTool;
+
+ tool = tools[numOrderCppCompilerTool];
+ superTool = tool.getSuperClass();
+ assertEquals(tool.getId(), expectedToolId1[iconfig]);
+ assertEquals(superTool.getId(), expectedSuperToolId1);
+ assertEquals(tool.getNatureFilter(), expecectedCCNature);
+
+ List expectedSuperInputExt1List = new ArrayList();
+ String[] expectedSuperInputExt1Tokens = expectedSuperInputExt1.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedSuperInputExt1Tokens.length; ++i) {
+ expectedSuperInputExt1List.add(expectedSuperInputExt1Tokens[i].trim());
+ }
+ assertEquals(superTool.getInputExtensions(), expectedSuperInputExt1List);
+ assertEquals(superTool.getOutputFlag(), expectedSuperOutputFlag1);
+ assertEquals(superTool.getToolCommand(), expectedSuperGetToolCommand1);
+ List expectedSuperInterfaceExt1List = new ArrayList();
+ String[] expectedSuperInterfaceExt1Tokens = expectedSuperToolInterfaceExt1.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedSuperInterfaceExt1Tokens.length; ++i) {
+ expectedSuperInterfaceExt1List.add(expectedSuperInterfaceExt1Tokens[i].trim());
+ }
+ assertEquals(superTool.getInterfaceExtensions(), expectedSuperInterfaceExt1List);
+ assertTrue(Arrays.equals(superTool.getOutputExtensions(), expectedSuperToolOutputExt1));
+
+ // Fetch and check an option category
+ //
+ IOptionCategory[] optionCats = superTool.getChildCategories();
+ assertEquals(optionCats[0].getId(), (expectedOptionCategory1));
+
+ // Fetch and check options customized for this tool
+ //
+ IOption option;
+
+ // Fetch the optimization level option and verify that it has the proper
+ // default value, which should overwrite the value set in the abstract
+ // project that its containing project is derived from
+ //
+ option = tool.getOptionById(OptionId1[iconfig]);
+ assertTrue(option.isExtensionElement());
+ String optionDefaultValue = (String)option.getDefaultValue();
+ assertEquals(option.getValueType(), (IOption.ENUMERATED));
+ assertEquals(optionDefaultValue, (expectedOptionIdValue1[iconfig]));
+ String optionEnumCmd1 = option.getEnumCommand(optionDefaultValue);
+ assertEquals(optionEnumCmd1, (expectedOptionEnumCmd1arr[iconfig]));
+
+ List expectedEnumList1arr = new ArrayList();
+ String enumValues[] = option.getApplicableValues();
+ String[] expectedEnumList1Tokens = expectedEnumList1.split(","); //$NON-NLS-1$
+ for (i = 0; i < expectedEnumList1Tokens.length; ++i) {
+ expectedEnumList1arr.add(expectedEnumList1Tokens[i].trim());
+ }
+ assertTrue(Arrays.equals(option.getApplicableValues(), (String[]) expectedEnumList1arr.toArray(new String[expectedSizeEnumList1])));
+
+ // Fetch the other flags option and verify
+ //
+ option = tool.getOptionById(OptionId2);
+ assertTrue(option.isExtensionElement());
+ assertEquals(option.getValueType(), (IOption.STRING));
+ assertEquals(option.getName(), (expectedOptionIdName2));
+
+ // Fetch the verbose option and verify
+ //
+ option = tool.getOptionById(OptionId3);
+ assertTrue(option.isExtensionElement());
+ assertEquals(option.getValueType(), (IOption.BOOLEAN));
+ boolean optionDefaultValueb = option.getBooleanValue();
+ assertEquals(optionDefaultValueb, (expectedOptionIdValue3));
+ assertEquals(option.getName(), (expectedOptionIdName3));
+ assertEquals(option.getCommand(), (expectedOptionIdCmd3));
+
+ } // end for
+ } // end routine
+} // end class