mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 08:45:44 +02:00
Commit for Leo Treggiari:
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.
This commit is contained in:
parent
757c7b4860
commit
ee27feda67
10 changed files with 701 additions and 60 deletions
|
@ -355,6 +355,7 @@
|
||||||
<option
|
<option
|
||||||
name="Test Forward Option"
|
name="Test Forward Option"
|
||||||
category="test.forward.child.category"
|
category="test.forward.child.category"
|
||||||
|
valueType="boolean"
|
||||||
id="test.forward.option">
|
id="test.forward.option">
|
||||||
</option>
|
</option>
|
||||||
<optionCategory
|
<optionCategory
|
||||||
|
|
|
@ -12,28 +12,31 @@ package org.eclipse.cdt.managedbuild.core.tests;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
import org.eclipse.cdt.managedbuilder.core.IProjectType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
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.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import java.util.ArrayList;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import java.util.Arrays;
|
||||||
import org.eclipse.core.runtime.OperationCanceledException;
|
import java.util.List;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
|
|
||||||
|
|
||||||
public class ManagedBuildCoreTests extends TestCase {
|
public class ManagedBuildCoreTests extends TestCase {
|
||||||
private static final boolean boolVal = true;
|
private static final boolean boolVal = true;
|
||||||
|
private static IProjectType exeType;
|
||||||
|
private static IProjectType libType;
|
||||||
|
private static IProjectType dllType;
|
||||||
|
|
||||||
public ManagedBuildCoreTests(String name) {
|
public ManagedBuildCoreTests(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -41,32 +44,593 @@ public class ManagedBuildCoreTests extends TestCase {
|
||||||
|
|
||||||
public static Test suite() {
|
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("testLoadManifest"));
|
||||||
suite.addTest(new ManagedBuildCoreTests("cleanup"));
|
|
||||||
|
|
||||||
return suite;
|
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.
|
* definitions are loaded correctly.
|
||||||
*/
|
*/
|
||||||
public void testLoadManifest() throws Exception {
|
public void testLoadManifest() throws Exception {
|
||||||
IProjectType exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
|
IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
|
||||||
assertNotNull(exeType);
|
exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
|
||||||
IProjectType libType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.lib");
|
checkExeProjectType(exeType);
|
||||||
assertNotNull(libType);
|
dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.so");
|
||||||
IProjectType dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.so");
|
checkSoProjectType(dllType);
|
||||||
assertNotNull(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() {
|
private void checkExeProjectType(IProjectType ptype) throws BuildException {
|
||||||
//removeProject(projectName);
|
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
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,13 @@
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
<attribute name="parent" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
The configuration that this configuration was cloned from.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
<attribute name="artifactName" type="string">
|
<attribute name="artifactName" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
|
|
|
@ -130,6 +130,21 @@ public interface IManagedProject extends IBuildObject {
|
||||||
*/
|
*/
|
||||||
public void setDirty(boolean isDirty);
|
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).
|
* Persist the managed project to the project file (.cdtbuild).
|
||||||
*
|
*
|
||||||
|
|
|
@ -1135,6 +1135,10 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
// This is a 1.2 manifest and we are compatible for now
|
// This is a 1.2 manifest and we are compatible for now
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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));
|
return(buildInfoVersion.isCompatibleWith(version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1184,8 +1188,12 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
// Make sure that the version is compatible with the manager
|
// Make sure that the version is compatible with the manager
|
||||||
fileVersion = rootElement.getNodeValue();
|
fileVersion = rootElement.getNodeValue();
|
||||||
PluginVersionIdentifier version = new PluginVersionIdentifier(fileVersion);
|
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)) {
|
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)) {
|
if (buildInfoVersion.isGreaterThan(version)) {
|
||||||
// TODO Upgrade the project
|
// TODO Upgrade the project
|
||||||
|
@ -1207,6 +1215,11 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
throw e;
|
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);
|
project.setSessionProperty(buildInfoProperty, buildInfo);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1245,18 +1258,34 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
IExtension extension = extensions[i];
|
IExtension extension = extensions[i];
|
||||||
// Can we read this manifest
|
// Can we read this manifest
|
||||||
if (!isVersionCompatible(extension)) {
|
if (!isVersionCompatible(extension)) {
|
||||||
//The version of the Plug-in is greater than what the manager thinks it understands
|
// The version of the Plug-in is greater than what the manager thinks it understands
|
||||||
throw new BuildException(ManagedMakeMessages.getResourceString(MANIFEST_VERSION_ERROR));
|
// 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));
|
||||||
}
|
}
|
||||||
// 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.
|
// Then call resolve.
|
||||||
//
|
//
|
||||||
|
@ -1834,5 +1863,4 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
public static IManagedConfigElement getConfigElement(IBuildObject buildObj) {
|
public static IManagedConfigElement getConfigElement(IBuildObject buildObj) {
|
||||||
return (IManagedConfigElement)getConfigElementMap().get(buildObj);
|
return (IManagedConfigElement)getConfigElementMap().get(buildObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
* Create a new extension configuration based on one already defined.
|
* Create a new extension configuration based on one already defined.
|
||||||
*
|
*
|
||||||
* @param projectType The <code>ProjectType</code> the configuration will be added to.
|
* @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.
|
* @param id A unique ID for the new configuration.
|
||||||
*/
|
*/
|
||||||
public Configuration(ProjectType projectType, IConfiguration parentConfig, String id) {
|
public Configuration(ProjectType projectType, IConfiguration parentConfig, String id) {
|
||||||
|
@ -144,6 +144,7 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
* Create a new extension configuration and fill in the attributes and childen later.
|
* 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 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 id A unique ID for the new configuration.
|
||||||
* @param name A name for the new configuration.
|
* @param name A name for the new configuration.
|
||||||
*/
|
*/
|
||||||
|
@ -196,8 +197,9 @@ public class Configuration extends BuildObject implements IConfiguration {
|
||||||
* Create a new project, non-extension, configuration based on one already defined.
|
* 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 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 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) {
|
public Configuration(ManagedProject managedProject, Configuration cloneConfig, String id, boolean cloneTools) {
|
||||||
setId(id);
|
setId(id);
|
||||||
|
|
|
@ -123,7 +123,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
// TODO: There should only be 1?
|
// TODO: There should only be 1?
|
||||||
for (int projIndex = projNodes.getLength() - 1; projIndex >= 0; --projIndex) {
|
for (int projIndex = projNodes.getLength() - 1; projIndex >= 0; --projIndex) {
|
||||||
ManagedProject proj = new ManagedProject(this, (Element)projNodes.item(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
|
// Switch the rebuild off since this is an existing project
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
private Map configMap;
|
private Map configMap;
|
||||||
// Miscellaneous
|
// Miscellaneous
|
||||||
private boolean isDirty = false;
|
private boolean isDirty = false;
|
||||||
|
private boolean isValid = true;
|
||||||
private boolean resolved = true;
|
private boolean resolved = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -95,15 +96,17 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
this(buildInfo.getOwner());
|
this(buildInfo.getOwner());
|
||||||
|
|
||||||
// Initialize from the XML attributes
|
// Initialize from the XML attributes
|
||||||
loadFromProject(element);
|
if (loadFromProject(element)) {
|
||||||
|
// Load children
|
||||||
// Load children
|
NodeList configElements = element.getChildNodes();
|
||||||
NodeList configElements = element.getChildNodes();
|
for (int i = 0; i < configElements.getLength(); ++i) {
|
||||||
for (int i = 0; i < configElements.getLength(); ++i) {
|
Node configElement = configElements.item(i);
|
||||||
Node configElement = configElements.item(i);
|
if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
|
||||||
if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
|
Configuration config = new Configuration(this, (Element)configElement);
|
||||||
Configuration config = new Configuration(this, (Element)configElement);
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
setValid(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// hook me up
|
// hook me up
|
||||||
|
@ -120,7 +123,7 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
*
|
*
|
||||||
* @param element An XML element containing the project information
|
* @param element An XML element containing the project information
|
||||||
*/
|
*/
|
||||||
protected void loadFromProject(Element element) {
|
protected boolean loadFromProject(Element element) {
|
||||||
|
|
||||||
// id
|
// id
|
||||||
setId(element.getAttribute(IBuildObject.ID));
|
setId(element.getAttribute(IBuildObject.ID));
|
||||||
|
@ -135,9 +138,10 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
if (projectTypeId != null && projectTypeId.length() > 0) {
|
if (projectTypeId != null && projectTypeId.length() > 0) {
|
||||||
projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
|
projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
|
||||||
if (projectType == null) {
|
if (projectType == null) {
|
||||||
// TODO: Report error
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -348,14 +352,14 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* Resolve the element IDs to interface references
|
* Resolve the element IDs to interface references
|
||||||
*/
|
*/
|
||||||
public void resolveReferences() {
|
public boolean resolveReferences() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
resolved = true;
|
resolved = true;
|
||||||
// Resolve project-type
|
// Resolve project-type
|
||||||
if (projectTypeId != null && projectTypeId.length() > 0) {
|
if (projectTypeId != null && projectTypeId.length() > 0) {
|
||||||
projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
|
projectType = ManagedBuildManager.getExtensionProjectType(projectTypeId);
|
||||||
if (projectType == null) {
|
if (projectType == null) {
|
||||||
// TODO: Report error
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,6 +370,7 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
current.resolveReferences();
|
current.resolveReferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -400,4 +405,20 @@ public class ManagedProject extends BuildObject implements IManagedProject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,12 @@ Option.error.bad_value_type=Bad value for type
|
||||||
ManagedBuildManager.error.owner_not_null=addTarget: owner not null
|
ManagedBuildManager.error.owner_not_null=addTarget: owner not null
|
||||||
ManagedBuildManager.error.null_owner=addTarget: null owner
|
ManagedBuildManager.error.null_owner=addTarget: null owner
|
||||||
ManagedBuildManager.error.owner_not_project=addTarget: owner not project
|
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.manifest_load_failed_title=Managed Build System Version Error
|
||||||
ManagedBuildManager.error.project.version.error=The version of the project is higher than the build system
|
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_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.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
|
# Makefile Generator Messages
|
||||||
MakefileGenerator.message.start.file=Building file:
|
MakefileGenerator.message.start.file=Building file:
|
||||||
|
|
|
@ -54,7 +54,7 @@ BuildPropertyPage.tip.addconf=Add configurations for the platform
|
||||||
BuildPropertyPage.tip.remconf=Remove configurations for the platform
|
BuildPropertyPage.tip.remconf=Remove configurations for the platform
|
||||||
BuildPropertyPage.manage.title=Manage
|
BuildPropertyPage.manage.title=Manage
|
||||||
BuildPropertyPage.error.Unknown_tree_element=Unknown type of element in tree of type {0}
|
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.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.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
|
BuildPropertyPage.changes.save.title=Apply Configuration Changes
|
||||||
|
@ -72,7 +72,7 @@ ToolsSettingsBlock.label.ToolOptions=Options
|
||||||
|
|
||||||
# ----------- Build Settings Block -----------
|
# ----------- Build Settings Block -----------
|
||||||
BuildSettingsBlock.label.Settings=Build Settings
|
BuildSettingsBlock.label.Settings=Build Settings
|
||||||
BuildSettingsBlock.label.makecmdgroup=Make command
|
BuildSettingsBlock.label.makecmdgroup=Build command
|
||||||
BuildSettingsBlock.label.makecmddef=Use default command
|
BuildSettingsBlock.label.makecmddef=Use default command
|
||||||
BuildSettingsBlock.label.output.group=Build output
|
BuildSettingsBlock.label.output.group=Build output
|
||||||
BuildSettingsBlock.label.output.name=Artifact name:
|
BuildSettingsBlock.label.output.name=Artifact name:
|
||||||
|
@ -87,7 +87,7 @@ ResourceBuildPropertyPage.selection.configuration.all=All configurations
|
||||||
ResourceBuildPropertyPage.label.ToolTree=Tools
|
ResourceBuildPropertyPage.label.ToolTree=Tools
|
||||||
ResourceBuildPropertyPage.label.ToolOptions=Options
|
ResourceBuildPropertyPage.label.ToolOptions=Options
|
||||||
ResourceBuildPropertyPage.label.NotMBSFile=The project is closed or the file is not contained within a Managed Make project.
|
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 -----------
|
# ----------- Entry Dialog -----------
|
||||||
BrowseEntryDialog.error.Folder_name_invalid = Folder name invalid
|
BrowseEntryDialog.error.Folder_name_invalid = Folder name invalid
|
||||||
|
|
Loading…
Add table
Reference in a new issue