mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
1. Presering configuration order on load
2. dep calculator fix 3. some test updates
This commit is contained in:
parent
15c5a260f1
commit
5a723279bc
11 changed files with 174 additions and 21 deletions
Binary file not shown.
|
@ -38,8 +38,11 @@ public class CTestPlugin extends Plugin {
|
|||
public static File getFileInPlugin(IPath path) {
|
||||
try {
|
||||
URL url = getDefault().find(path,null);
|
||||
url= Platform.asLocalURL(url);
|
||||
return new File(url.getFile());
|
||||
if(url != null){
|
||||
url= Platform.asLocalURL(url);
|
||||
return new File(url.getFile());
|
||||
}
|
||||
return null;
|
||||
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
|
|
|
@ -216,6 +216,10 @@ public class ManagedBuildTestHelper {
|
|||
public static IProject loadProject(String name, String path){
|
||||
IPath zipPath = new Path("resources").append(path).append(name).append(name).addFileExtension("zip");
|
||||
File zipFile = CTestPlugin.getFileInPlugin(zipPath);
|
||||
if(zipFile == null){
|
||||
zipPath = new Path("resources").append(path).append(name).addFileExtension("zip");
|
||||
zipFile = CTestPlugin.getFileInPlugin(zipPath);
|
||||
}
|
||||
if(zipFile == null) {
|
||||
Assert.fail("zip file " + zipPath.toString() + " is missing.");
|
||||
return null;
|
||||
|
|
|
@ -32,6 +32,9 @@ import org.eclipse.cdt.managedbuilder.core.tests.MultiVersionSupportTests;
|
|||
import org.eclipse.cdt.managedbuilder.core.tests.OptionEnablementTests;
|
||||
import org.eclipse.cdt.managedbuilder.core.tests.PathConverterTest;
|
||||
import org.eclipse.cdt.managedbuilder.core.tests.ResourceBuildCoreTests;
|
||||
import org.eclipse.cdt.projectmodel.tests.BackwardCompatiblityTests;
|
||||
import org.eclipse.cdt.projectmodel.tests.OptionStringListValueTests;
|
||||
import org.eclipse.cdt.projectmodel.tests.ProjectModelTests;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -50,23 +53,26 @@ public class AllManagedBuildTests {
|
|||
"Test for org.eclipse.cdt.managedbuild.core.tests");
|
||||
//$JUnit-BEGIN$
|
||||
// TODO uncoment this
|
||||
suite.addTest(ManagedBuildCoreTests20.suite());
|
||||
suite.addTest(ManagedBuildCoreTests.suite());
|
||||
suite.addTest(ManagedProjectUpdateTests.suite());
|
||||
suite.addTest(ManagedCommandLineGeneratorTest.suite());
|
||||
suite.addTest(ResourceBuildCoreTests.suite());
|
||||
suite.addTest(ManagedProject21MakefileTests.suite());
|
||||
suite.addTest(ManagedProject30MakefileTests.suite());
|
||||
// suite.addTest(ManagedBuildCoreTests20.suite());
|
||||
// suite.addTest(ManagedBuildCoreTests.suite());
|
||||
// suite.addTest(ManagedProjectUpdateTests.suite());
|
||||
// suite.addTest(ManagedCommandLineGeneratorTest.suite());
|
||||
// suite.addTest(ResourceBuildCoreTests.suite());
|
||||
// suite.addTest(ManagedProject21MakefileTests.suite());
|
||||
// suite.addTest(ManagedProject30MakefileTests.suite());
|
||||
suite.addTest(ManagedBuildCoreTests_SharedToolOptions.suite());
|
||||
suite.addTest(ManagedBuildEnvironmentTests.suite());
|
||||
suite.addTest(ManagedBuildMacrosTests.suite());
|
||||
suite.addTest(ManagedBuildTCSupportedTest.suite());
|
||||
suite.addTest(MultiVersionSupportTests.suite());
|
||||
// suite.addTest(ManagedBuildEnvironmentTests.suite());
|
||||
// suite.addTest(ManagedBuildMacrosTests.suite());
|
||||
// suite.addTest(ManagedBuildTCSupportedTest.suite());
|
||||
// suite.addTest(MultiVersionSupportTests.suite());
|
||||
suite.addTest(OptionEnablementTests.suite());
|
||||
suite.addTest(ManagedBuildDependencyCalculatorTests.suite());
|
||||
|
||||
suite.addTest(BuildDescriptionModelTests.suite());
|
||||
suite.addTest(PathConverterTest.suite());
|
||||
suite.addTest(ProjectModelTests.suite());
|
||||
suite.addTest(OptionStringListValueTests.suite());
|
||||
suite.addTest(BackwardCompatiblityTests.suite());
|
||||
//$JUnit-END$
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public class TestMacro implements
|
|||
ms = provider.getMacros(IBuildMacroProvider.CONTEXT_CONFIGURATION, configuration, false);
|
||||
IBuildMacro[] newms = null;
|
||||
if (ms != null && ms.length > 0) {
|
||||
newms = new BuildMacro[ms.length + 1];
|
||||
newms = new IBuildMacro[ms.length + 1];
|
||||
System.arraycopy(ms, 0, newms, 0, ms.length);
|
||||
} else {
|
||||
newms = new BuildMacro[1];
|
||||
|
@ -122,7 +122,7 @@ public class TestMacro implements
|
|||
ms = provider.getMacros(IBuildMacroProvider.CONTEXT_PROJECT, mproj, false);
|
||||
IBuildMacro[] newms = null;
|
||||
if (ms != null && ms.length > 0) {
|
||||
newms = new BuildMacro[ms.length + 1];
|
||||
newms = new IBuildMacro[ms.length + 1];
|
||||
System.arraycopy(ms, 0, newms, 0, ms.length);
|
||||
} else {
|
||||
newms = new BuildMacro[1];
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.projectmodel.tests;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
||||
public class BackwardCompatiblityTests extends TestCase {
|
||||
private static final String TEST_3X_STD_MAKE_PROJECTS = "test3xStdMakeProjects";
|
||||
|
||||
private List projList = new LinkedList();
|
||||
|
||||
public static Test suite() {
|
||||
return new TestSuite(BackwardCompatiblityTests.class);
|
||||
}
|
||||
|
||||
public void test3xStdMakeProject(){
|
||||
String PROJ_NAME = "std_cpp_1";
|
||||
|
||||
String[] BIN_PARSERS = new String[]{
|
||||
"org.eclipse.cdt.core.ELF",
|
||||
"org.eclipse.cdt.core.PE",
|
||||
"org.eclipse.cdt.core.GNU_ELF",
|
||||
"org.eclipse.cdt.core.MachO"
|
||||
};
|
||||
|
||||
String[] ERR_PARSERS = new String[]{
|
||||
"org.eclipse.cdt.core.MakeErrorParser",
|
||||
"org.eclipse.cdt.core.GASErrorParser",
|
||||
"org.eclipse.cdt.core.VCErrorParser"
|
||||
};
|
||||
|
||||
IProject project = loadStdProject(PROJ_NAME);
|
||||
projList.add(project);
|
||||
|
||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||
assertFalse(mngr.isNewStyleProject(project));
|
||||
ICProjectDescription des = mngr.getProjectDescription(project, false);
|
||||
checkDescription(des);
|
||||
|
||||
des = mngr.getProjectDescription(project, true);
|
||||
checkDescription(des);
|
||||
|
||||
}
|
||||
|
||||
private void checkDescription(ICProjectDescription des){
|
||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||
|
||||
assertFalse(mngr.isNewStyleProject(des));
|
||||
assertFalse(des.isCdtProjectCreating());
|
||||
assertEquals(1, des.getConfigurations().length);
|
||||
|
||||
}
|
||||
|
||||
private IProject loadStdProject(String name){
|
||||
return ManagedBuildTestHelper.loadProject(name, TEST_3X_STD_MAKE_PROJECTS);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
for(Iterator iter = projList.iterator(); iter.hasNext();){
|
||||
IProject proj = (IProject)iter.next();
|
||||
try {
|
||||
proj.delete(true, null);
|
||||
} catch (Exception e){
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2007 Intel Corporation and others.
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
|
|
@ -146,12 +146,55 @@ public class BuildMacroProvider implements IBuildMacroProvider, IMacroContextInf
|
|||
return CdtVariableResolver.convertStringListToString(value,listDelimiter);
|
||||
}
|
||||
|
||||
private static class VariableWrapper implements IBuildMacro {
|
||||
private ICdtVariable fVariable;
|
||||
|
||||
public VariableWrapper(ICdtVariable var){
|
||||
if(var == null)
|
||||
throw new NullPointerException();
|
||||
|
||||
fVariable = var;
|
||||
}
|
||||
|
||||
public ICdtVariable getVariable(){
|
||||
return fVariable;
|
||||
}
|
||||
|
||||
public int getMacroValueType() {
|
||||
return fVariable.getValueType();
|
||||
}
|
||||
|
||||
public String[] getStringListValue() throws BuildMacroException {
|
||||
try {
|
||||
return fVariable.getStringListValue();
|
||||
} catch (CdtVariableException e) {
|
||||
throw new BuildMacroException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getStringValue() throws BuildMacroException {
|
||||
try {
|
||||
return fVariable.getStringValue();
|
||||
} catch (CdtVariableException e) {
|
||||
throw new BuildMacroException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return fVariable.getName();
|
||||
}
|
||||
|
||||
public int getValueType() {
|
||||
return fVariable.getValueType();
|
||||
}
|
||||
}
|
||||
|
||||
public static IBuildMacro wrap(ICdtVariable var){
|
||||
if(var == null)
|
||||
return null;
|
||||
if(var instanceof IBuildMacro)
|
||||
return (IBuildMacro)var;
|
||||
return new BuildMacro(var);
|
||||
return new VariableWrapper(var);
|
||||
}
|
||||
|
||||
public static IBuildMacro[] wrap(ICdtVariable vars[]){
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.Vector;
|
|||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
|
||||
|
@ -154,7 +155,7 @@ public class DefaultGCCDependencyCalculatorPreBuildCommands implements IManagedD
|
|||
public boolean areCommandsGeneric() {
|
||||
if (genericCommands != null) return genericCommands.booleanValue();
|
||||
// If the context is a Configuration, yes
|
||||
if (buildContext instanceof IConfiguration) {
|
||||
if (buildContext instanceof IConfiguration || buildContext instanceof IFolderInfo) {
|
||||
genericCommands = new Boolean(true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -110,14 +110,14 @@ public interface ICProjectDescriptionManager {
|
|||
void updateProjectDescriptions(IProject projects[], IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
/**
|
||||
* aswers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||
* answers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||
* @param project
|
||||
* @return
|
||||
*/
|
||||
boolean isNewStyleProject(IProject project);
|
||||
|
||||
/**
|
||||
* aswers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||
* answers whether the given project is a new-style project, i.e. CConfigurationDataProvider-driven
|
||||
* @param des
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -1415,7 +1416,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
}
|
||||
|
||||
Map createCfgStorages(ICProjectDescription des) throws CoreException{
|
||||
Map map = new HashMap();
|
||||
LinkedHashMap map = new LinkedHashMap();
|
||||
ICStorageElement rootElement = des.getStorage(MODULE_ID, false);
|
||||
if(rootElement != null){
|
||||
ICStorageElement children[] = rootElement.getChildren();
|
||||
|
|
Loading…
Add table
Reference in a new issue