# HG changeset patch # User Ed Swartz # Date 1284587810 18000 # Node ID d6760e7efd55e8622cd2ce24af11a3e5515942e6 # Parent b3e017e143356fe4a88ebccf365c4c844eac302c# Parent 1f9d642f8f252246c2cd3aaabff2df62f0b42857 Merge commit diff -r 1f9d642f8f25 -r d6760e7efd55 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Wed Sep 15 15:23:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Wed Sep 15 16:56:50 2010 -0500 @@ -316,7 +316,7 @@ try { ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(((CarbideBuildConfiguration)carbideBuildConfig).getBuildContext().getConfigurationID()); + ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getBuildContext().getConfigurationID()); if (configDes != null) { ICStorageElement storage = configDes.getStorage(CONFIG_DATA_CACHE, false); if (storage != null) { diff -r 1f9d642f8f25 -r d6760e7efd55 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Wed Sep 15 15:23:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Wed Sep 15 16:56:50 2010 -0500 @@ -338,12 +338,14 @@ Set pathList = new HashSet(); for (ICarbideBuildConfiguration config : cpi.getBuildConfigurations()) { + // Bug 12078: I see no reason for this in C3 -- it always happens on startup and obviates the cache + /* // force a rebuild of the CarbideLanguageData cache // TODO PERFORMANCE EJS: why??? We end up forcing a cache rebuild even when you just switch configurations... CLanguageData languageData = null; ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(config.getCarbideProject().getProject()); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(config.getDisplayString()); + ICConfigurationDescription configDes = projDes.getConfigurationById(config.getBuildContext().getConfigurationID()); if (configDes != null) { CConfigurationData configData = configDes.getConfigurationData(); if (configData != null && configData instanceof BuildConfigurationData) { @@ -360,7 +362,8 @@ } } } - + */ + EpocEngineHelper.addIncludedFilesFromBldInf(cpi, config, cpi.getAbsoluteBldInfPath(), pathList); diff -r 1f9d642f8f25 -r d6760e7efd55 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Wed Sep 15 15:23:31 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Wed Sep 15 16:56:50 2010 -0500 @@ -36,17 +36,25 @@ import org.eclipse.cdt.core.settings.model.extension.CLanguageData; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ProjectScope; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.resources.WorkspaceJob; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.content.IContentType; import org.eclipse.core.runtime.content.IContentTypeManager; import org.eclipse.core.runtime.content.IContentTypeSettings; +import org.eclipse.core.runtime.jobs.Job; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext; @@ -140,7 +148,30 @@ } if (cacheBuilt) { - persistCache(); + + // Bug 12078: persisting the cache requires setting the project + // description, or else it gets thrown away (!). + // But we must save the cache in a workspace job because this code + // is usually called when the project description is being read for + // the first time (thus saving just throws an exception). + Job job = new Job("Saving Carbide indexer cache for " + carbideBuildConfig.getDisplayString()) { + + @Override + protected IStatus run(IProgressMonitor monitor) { + persistCache(monitor); + + return Status.OK_STATUS; + } + + }; + job.setRule(ResourcesPlugin.getWorkspace().getRoot()); + job.setSystem(true); + job.setPriority(Job.LONG); + job.schedule(5000); + // This scheduling delay is a gross HACK: WorkspaceModelProvider#saveStorage() + // has had and still has problems with deadlocks on saving + // model content. This job exacerbates it unless we wait a + // while before locking the workspace. } switch(kind) { @@ -333,13 +364,20 @@ cacheTimestamp = System.currentTimeMillis(); } - private void persistCache() { + private void persistCache(IProgressMonitor monitor) { // persist the cache between IDE launches. + if (!isValid()) + return; try { - final IProject project = carbideBuildConfig.getCarbideProject().getProject(); + ICarbideProjectInfo carbideProject = carbideBuildConfig.getCarbideProject(); + if (carbideProject == null) + return; + final IProject project = carbideProject.getProject(); + if (project == null) + return; ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getDisplayString()); + ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getBuildContext().getConfigurationID()); if (configDes != null) { String includesCacheValue = ""; for (ICLanguageSettingEntry inc : includeEntries) { @@ -370,6 +408,8 @@ filesCacheValue += file.getAbsolutePath() + ENTRY_DELIMTER; } storage.setAttribute(FILES_CACHE, filesCacheValue); + + CoreModel.getDefault().setProjectDescription(project, projDes, true, monitor); } } } catch (CoreException e) { @@ -386,7 +426,7 @@ try { ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project); if (projDes != null) { - ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getDisplayString()); + ICConfigurationDescription configDes = projDes.getConfigurationById(carbideBuildConfig.getBuildContext().getConfigurationID()); if (configDes != null) { ICStorageElement storage = configDes.getStorage(CONFIG_DATA_CACHE, false); if (storage != null) { diff -r 1f9d642f8f25 -r d6760e7efd55 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/ModelProviderThreadTests.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/ModelProviderThreadTests.java Wed Sep 15 15:23:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/ModelProviderThreadTests.java Wed Sep 15 16:56:50 2010 -0500 @@ -263,7 +263,7 @@ // can't actually validate -- we have no idea whether writers' // commits have come in order or not, since one writer may have // been out-of-sync and had to retry its commit late. - validate(builder.toString()); + //validate(builder.toString()); } finally { view.dispose(); } diff -r 1f9d642f8f25 -r d6760e7efd55 project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDataCache.java --- a/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDataCache.java Wed Sep 15 15:23:31 2010 -0500 +++ b/project/com.nokia.carbide.cpp.epoc.engine.tests/src/com/nokia/carbide/cpp/epoc/engine/tests/model/TestViewDataCache.java Wed Sep 15 16:56:50 2010 -0500 @@ -459,7 +459,10 @@ b.start(); while (System.currentTimeMillis() < timeout) { - Thread.sleep(100); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + } } a.interrupt(); @@ -526,7 +529,10 @@ b.start(); while (System.currentTimeMillis() < timeout) { - Thread.sleep(100); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + } } a.interrupt(); @@ -606,7 +612,11 @@ b.start(); while (System.currentTimeMillis() < timeout) { - Thread.sleep(100); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + + } } a.interrupt();