# HG changeset patch # User dadubrow # Date 1244834536 18000 # Node ID 0f7a3f55e6fee9009fd9a9afa37d5de18193a1aa # Parent 6d7fbf0e482aa0347b3a63d3ea21420a33f327e5 [Bug 9230] Only create source roots for build components, overridable by pref diff -r 6d7fbf0e482a -r 0f7a3f55e6fe builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Fri Jun 12 13:48:02 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Fri Jun 12 14:22:16 2009 -0500 @@ -16,63 +16,30 @@ */ package com.nokia.carbide.cdt.builder; -import java.io.*; -import java.sql.Time; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.core.resources.IProject; -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.Path; - import com.nokia.carbide.cdt.builder.builder.CarbideCPPBuilder; -import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; -import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo; -import com.nokia.carbide.cpp.epoc.engine.BldInfDataRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.BldInfViewRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; -import com.nokia.carbide.cpp.epoc.engine.ImageMakefileDataRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.MMPDataRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.MMPViewRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.PKGViewRunnableAdapter; -import com.nokia.carbide.cpp.epoc.engine.image.IBitmapSource; -import com.nokia.carbide.cpp.epoc.engine.image.IImageSource; -import com.nokia.carbide.cpp.epoc.engine.image.IMultiImageSource; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfData; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IBldInfView; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExport; +import com.nokia.carbide.cdt.builder.project.*; +import com.nokia.carbide.cpp.epoc.engine.*; +import com.nokia.carbide.cpp.epoc.engine.image.*; +import com.nokia.carbide.cpp.epoc.engine.model.bldinf.*; import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IExtension; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMMPReference; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakMakeReference; -import com.nokia.carbide.cpp.epoc.engine.model.bldinf.IMakefileReference; import com.nokia.carbide.cpp.epoc.engine.model.makefile.image.IImageMakefileData; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPLanguage; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.EMMPStatement; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPAIFInfo; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPBitmap; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPView; -import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPViewConfiguration; +import com.nokia.carbide.cpp.epoc.engine.model.mmp.*; import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter; import com.nokia.carbide.cpp.epoc.engine.preprocessor.AllNodesViewFilter; import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.EPKGLanguage; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGEmbeddedSISFile; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGInstallFile; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.IPKGView; -import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.PKGModelHelper; -import com.nokia.cpp.internal.api.utils.core.CommonPathFinder; -import com.nokia.cpp.internal.api.utils.core.FileUtils; -import com.nokia.cpp.internal.api.utils.core.Logging; +import com.nokia.carbide.internal.api.cpp.epoc.engine.model.pkg.*; +import com.nokia.cpp.internal.api.utils.core.*; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.*; + +import java.io.*; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class EpocEngineHelper { @@ -1370,7 +1337,14 @@ }); + boolean indexAll = getIndexAllPreference(); + List buildComponents = null; + if (!indexAll) // if indexAll, leave buildComponents as null because that will cause the same behavior + buildComponents = info.isBuildingFromInf() ? null : info.getInfBuildComponents(); for (IMMPReference mmp : mmps) { + if (buildComponents != null && !containsIgnoreCase(buildComponents, mmp.getPath().lastSegment())) + continue; + EpocEnginePathHelper helper = new EpocEnginePathHelper(info.getProject()); final IPath workspaceRelativeMMPPath = helper.convertToWorkspace(mmp.getPath()); EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, @@ -1469,6 +1443,25 @@ return sourceRoots; } + + private static boolean getIndexAllPreference() { + // Can't access this pref from the project ui plugin because it would cause a circular dependency + Plugin plugin = Platform.getPlugin("com.nokia.carbide.cpp.project.ui"); //$NON-NLS-1$ + if (plugin == null) { + CarbideBuilderPlugin.log(Logging.newStatus(CarbideBuilderPlugin.getDefault(), + IStatus.WARNING, "Could not find project UI plugin!")); + return true; + } + return plugin.getPluginPreferences().getBoolean("indexAll"); //$NON-NLS-1$ + } + + private static boolean containsIgnoreCase(List list, String s) { + for (String string : list) { + if (string.equalsIgnoreCase(s)) + return true; + } + return false; + } /** * Get the list of all mmp file paths for any and all build configurations of a project. diff -r 6d7fbf0e482a -r 0f7a3f55e6fe 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 Fri Jun 12 13:48:02 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Fri Jun 12 14:22:16 2009 -0500 @@ -63,6 +63,7 @@ private List extraSourceEntries; private List cacheFileSource; private long cacheTimestamp; + private boolean forceRebuildCache; private final String CONFIG_DATA_CACHE = "configDataCache"; //$NON-NLS-1$ private final String SOURCES_CACHE = "sourcesCache"; //$NON-NLS-1$ @@ -164,6 +165,10 @@ buildCache(); cacheBuilt = true; } + } else if (forceRebuildCache) { + buildCache(); + forceRebuildCache = false; + cacheBuilt = true; } else { // rebuild if any of the files have changed since we built the cache last for (File file : cacheFileSource) { @@ -343,4 +348,8 @@ return null; } + public void forceRebuildCache() { + forceRebuildCache = true; + } + } diff -r 6d7fbf0e482a -r 0f7a3f55e6fe builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Fri Jun 12 13:48:02 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Fri Jun 12 14:22:16 2009 -0500 @@ -16,27 +16,25 @@ */ package com.nokia.carbide.cdt.internal.builder; -import java.util.ArrayList; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.core.settings.model.ICStorageElement; -import org.eclipse.cdt.core.settings.model.WriteAccessException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; - import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier; import com.nokia.carbide.cdt.internal.api.builder.CarbideConfigurationDataProvider; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.settings.model.*; +import org.eclipse.core.runtime.*; + +import java.util.ArrayList; + public class CarbideProjectModifier extends CarbideProjectInfo implements ICarbideProjectModifier { // need to make all changes to the same description and save it protected ICProjectDescription projDes; + private boolean shouldForceRebuildCache; /* @@ -138,12 +136,14 @@ if (settingName.equals(PROJECT_RELATIVE_INFFILE_PROPS_KEY)) { projectRelativeBldInfPath = new Path(settingValue); } else if (settingName.equals(BLD_FROM_INF_PROPS_KEY)) { + shouldForceRebuildCache = true; if (settingValue.equalsIgnoreCase("false")) { buildFromInf = false; } else { buildFromInf = true; } } else if (settingName.equals(INF_COMPONENTS_PROPS_KEY)) { + shouldForceRebuildCache = true; setInfBuildComponentList(settingValue); } else if (settingName.equals(OVERRIDE_WORKSPACE_SETTINGS_KEY)) { if (settingValue.equalsIgnoreCase("false")) { @@ -232,18 +232,31 @@ public boolean saveChanges() { - checkInteralSettings(); + checkInternalSettings(); // make sure this flag is set before saving the ICProjectDescription projDes.setCdtProjectCreated(); + if (shouldForceRebuildCache) { + for (ICConfigurationDescription configuration : projDes.getConfigurations()) { + BuildConfigurationData data = (BuildConfigurationData) configuration.getConfigurationData(); + data.forceRebuildCache(); + } + } + try { + // replace the old info in the map with the new + CarbideBuilderPlugin.getBuildManager().setProjectInfo(this); + // save the CDT project description CCorePlugin.getDefault().setProjectDescription(projectTracker.getProject(), projDes, true, new NullProgressMonitor()); - // replace the old info in the map with the new - CarbideBuilderPlugin.getBuildManager().setProjectInfo(this); - + if (shouldForceRebuildCache) { + ICProject cproject = CoreModel.getDefault().create(projectTracker.getProject()); + if (cproject != null) + CCorePlugin.getIndexManager().reindex(cproject); + } + return true; } catch (CoreException e) { e.printStackTrace(); @@ -252,7 +265,7 @@ return false; } - public void checkInteralSettings() { + public void checkInternalSettings() { // make sure our internal settings are written to disk try {