mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
1.Fix for [Bug 189125] [New project model] Stroage modules don't get copied
2. small bug-fixes
This commit is contained in:
parent
d94ffa1869
commit
d118d88beb
4 changed files with 81 additions and 16 deletions
|
@ -57,6 +57,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
|||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.core.settings.model.util.XmlStorageElement;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
|
||||
|
@ -2619,19 +2620,19 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
public static void setLoaddedBuildInfo(IProject project, IManagedBuildInfo info) throws CoreException{
|
||||
// Associate the build info with the project for the duration of the session
|
||||
//project.setSessionProperty(buildInfoProperty, info);
|
||||
IResourceRuleFactory rcRf = ResourcesPlugin.getWorkspace().getRuleFactory();
|
||||
ISchedulingRule rule = rcRf.modifyRule(project);
|
||||
IJobManager mngr = Job.getJobManager();
|
||||
// IResourceRuleFactory rcRf = ResourcesPlugin.getWorkspace().getRuleFactory();
|
||||
// ISchedulingRule rule = rcRf.modifyRule(project);
|
||||
// IJobManager mngr = Job.getJobManager();
|
||||
|
||||
try {
|
||||
mngr.beginRule(rule, null);
|
||||
// try {
|
||||
// mngr.beginRule(rule, null);
|
||||
doSetLoaddedInfo(project, info);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// TODO: set anyway for now
|
||||
doSetLoaddedInfo(project, info);
|
||||
}finally {
|
||||
mngr.endRule(rule);
|
||||
}
|
||||
// } catch (IllegalArgumentException e) {
|
||||
// // TODO: set anyway for now
|
||||
// doSetLoaddedInfo(project, info);
|
||||
// }finally {
|
||||
// mngr.endRule(rule);
|
||||
// }
|
||||
}
|
||||
|
||||
private synchronized static void doSetLoaddedInfo(IProject project, IManagedBuildInfo info){
|
||||
|
@ -2733,10 +2734,12 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
return null;
|
||||
}
|
||||
|
||||
if(buildInfo == null && forceLoad){
|
||||
if(buildInfo == null /*&& forceLoad*/){
|
||||
int flags = forceLoad ? 0 : ICProjectDescriptionManager.GET_IF_LOADDED;
|
||||
|
||||
if(BuildDbgUtil.DEBUG)
|
||||
BuildDbgUtil.getInstance().traceln(BuildDbgUtil.BUILD_INFO_LOAD, "build info load: build info is NOT loadded and force_load");
|
||||
ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(proj, false);
|
||||
BuildDbgUtil.getInstance().traceln(BuildDbgUtil.BUILD_INFO_LOAD, "build info load: build info is NOT loadded" + (forceLoad ? " forceload" : ""));
|
||||
ICProjectDescription projDes = CoreModel.getDefault().getProjectDescriptionManager().getProjectDescription(proj, flags);
|
||||
if(projDes != null){
|
||||
if(BuildDbgUtil.DEBUG)
|
||||
BuildDbgUtil.getInstance().traceln(BuildDbgUtil.BUILD_INFO_LOAD, "build info load: project description is obtained, qwerying the loaded build info");
|
||||
|
|
|
@ -13,7 +13,9 @@ package org.eclipse.cdt.core.settings.model;
|
|||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.cdt.core.CProjectNature;
|
||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||
|
@ -27,7 +29,7 @@ import org.eclipse.core.runtime.QualifiedName;
|
|||
|
||||
public class CProjectDescriptionBasicTests extends BaseTestCase{
|
||||
private static final String PROJ_NAME_PREFIX = "CProjectDescriptionBasicTests_";
|
||||
IProject p1, p2;
|
||||
IProject p1, p2, p3;
|
||||
|
||||
public static TestSuite suite() {
|
||||
return suite(CProjectDescriptionBasicTests.class, "_");
|
||||
|
@ -59,6 +61,49 @@ public class CProjectDescriptionBasicTests extends BaseTestCase{
|
|||
assertTrue(failed);
|
||||
}
|
||||
|
||||
public void testModulesCopiedOnCreateNewConfig() throws Exception {
|
||||
ICProject p = CProjectHelper.createNewStileCProject(PROJ_NAME_PREFIX + "c", IPDOMManager.ID_NO_INDEXER);
|
||||
p3 = p.getProject();
|
||||
|
||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||
|
||||
ICProjectDescription des = mngr.getProjectDescription(p3);
|
||||
ICConfigurationDescription baseCfg = des.getConfigurations()[0];
|
||||
final String baseCfgId = baseCfg.getId();
|
||||
final String STORAGE_ID = "test.storage_id";
|
||||
final String ATTR = "testAttr";
|
||||
final String ATTR_VALUE = "testAttrValue";
|
||||
final String EL_NAME = "testElName";
|
||||
final String ATTR2 = "testAttr2";
|
||||
final String ATTR2_VALUE = "testAttr2Value";
|
||||
|
||||
ICStorageElement el = baseCfg.getStorage(STORAGE_ID, false);
|
||||
assertNull(el);
|
||||
el = baseCfg.getStorage(STORAGE_ID, true);
|
||||
assertNotNull(el);
|
||||
assertNull(el.getAttribute(ATTR));
|
||||
el.setAttribute(ATTR, ATTR_VALUE);
|
||||
assertEquals(0, el.getChildren().length);
|
||||
ICStorageElement child = el.createChild(EL_NAME);
|
||||
child.setAttribute(ATTR2, ATTR2_VALUE);
|
||||
|
||||
final String newCfgId1 = CDataUtil.genId(null);
|
||||
final String newCfgId2 = CDataUtil.genId(null);
|
||||
|
||||
ICConfigurationDescription cfg1 = des.createConfiguration(newCfgId1, newCfgId1 + ".name", baseCfg);
|
||||
assertEquals(newCfgId1, cfg1.getId());
|
||||
el = cfg1.getStorage(STORAGE_ID, false);
|
||||
assertNotNull(el);
|
||||
assertEquals(ATTR_VALUE, el.getAttribute(ATTR));
|
||||
assertEquals(1, el.getChildren().length);
|
||||
child = el.getChildren()[0];
|
||||
assertEquals(EL_NAME, child.getName());
|
||||
assertEquals(ATTR2_VALUE, child.getAttribute(ATTR2));
|
||||
|
||||
mngr.setProjectDescription(p3, des);
|
||||
|
||||
}
|
||||
|
||||
public void remove_prefix_testSetInvalidCreatingDescription() throws Exception {
|
||||
IWorkspace wsp = ResourcesPlugin.getWorkspace();
|
||||
IWorkspaceRoot root = wsp.getRoot();
|
||||
|
@ -106,6 +151,11 @@ public class CProjectDescriptionBasicTests extends BaseTestCase{
|
|||
p2.getProject().delete(true, null);
|
||||
} catch (CoreException e){
|
||||
}
|
||||
try {
|
||||
if(p3 != null)
|
||||
p3.getProject().delete(true, null);
|
||||
} catch (CoreException e){
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,15 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
|||
super(null, projectDes, null);
|
||||
|
||||
setConfiguration(this);
|
||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, ((CConfigurationDescription)base).getSpecSettings());
|
||||
internalSetId(id);
|
||||
|
||||
CConfigurationSpecSettings baseSettings = ((CConfigurationDescription)base).getSpecSettings();
|
||||
InternalXmlStorageElement baseRootEl = (InternalXmlStorageElement)baseSettings.getRootStorageElement();
|
||||
InternalXmlStorageElement newRootEl = CProjectDescriptionManager.getInstance().copyElement(baseRootEl, false);
|
||||
ICStorageElement parentEl = baseRootEl.getParent();
|
||||
parentEl.importChild(newRootEl);
|
||||
|
||||
fCfgSpecSettings = new CConfigurationSpecSettings(this, baseSettings, newRootEl);
|
||||
fCfgSpecSettings.setId(id);
|
||||
fCfgSpecSettings.setName(name);
|
||||
CConfigurationData baseData = ((IInternalCCfgInfo)base).getConfigurationData(false);
|
||||
|
|
|
@ -106,6 +106,10 @@ public abstract class CDataProxy implements ICSettingObject {
|
|||
fData = data;
|
||||
}
|
||||
|
||||
void internalSetId(String id){
|
||||
fId = id;
|
||||
}
|
||||
|
||||
void doClearData(){
|
||||
fData = null;
|
||||
setRescan(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue