# HG changeset patch # User Steve Sobek # Date 1245767761 18000 # Node ID f512e4fde380d65eb242f06815f8caa33f763248 # Parent ca271fb95b0343d92217628fd595fa0c622d9d79 Bug 9328 - Import parses MMP files that are not selected, for each configuration selected diff -r ca271fb95b03 -r f512e4fde380 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 Mon Jun 22 15:42:52 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Tue Jun 23 09:36:01 2009 -0500 @@ -1227,10 +1227,18 @@ if (mmps == null) return; + // get the list of all mmp files selected for the build configuration + // a null buildComponents list means all MMPs are included - so leave it null when indexing all files + List buildComponents = null; + if (buildConfiguration != null && !EpocEngineHelper.getIndexAllPreference()) + buildComponents = buildConfiguration.getCarbideProject().isBuildingFromInf() ? null : buildConfiguration.getCarbideProject().getInfBuildComponents(); + for (IMMPReference mmp : mmps) { if (buildConfiguration != null) { - getMMPIncludePaths(projectInfo.getProject(), - mmp.getPath(), buildConfiguration, userPaths, systemPaths); + if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmp.getPath().lastSegment())) { + getMMPIncludePaths(projectInfo.getProject(), + mmp.getPath(), buildConfiguration, userPaths, systemPaths); + } } else { for (ICarbideBuildConfiguration buildConfig : projectInfo.getBuildConfigurations()) { getMMPIncludePaths(projectInfo.getProject(), @@ -1447,11 +1455,14 @@ }); + // get the list of all mmp files selected for the build configuration + // a null buildComponents list means all MMPs are included - so leave it null when indexing all files List buildComponents = null; - if (!getIndexAllPreference()) // if indexAll, leave buildComponents as null because that will cause the same behavior + if (!getIndexAllPreference()) buildComponents = info.isBuildingFromInf() ? null : info.getInfBuildComponents(); + for (IMMPReference mmp : mmps) { - if (buildComponents != null && !containsIgnoreCase(buildComponents, mmp.getPath().lastSegment())) + if (buildComponents != null && !EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmp.getPath().lastSegment())) continue; EpocEnginePathHelper helper = new EpocEnginePathHelper(info.getProject()); @@ -1565,7 +1576,7 @@ return sourceRoots; } - private static boolean getIndexAllPreference() { + public 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) { @@ -1576,7 +1587,7 @@ return plugin.getPluginPreferences().getBoolean("indexAll"); //$NON-NLS-1$ } - private static boolean containsIgnoreCase(List list, String s) { + public static boolean containsStringIgnoreCase(List list, String s) { for (String string : list) { if (string.equalsIgnoreCase(s)) return true; @@ -1994,7 +2005,15 @@ public static List getTargetTypesForBuildConfiguration(final ICarbideBuildConfiguration buildConfig) { final List targetTypes = new ArrayList(); + // get the list of all mmp files selected for the build configuration + // a null buildComponents list means all MMPs are included - so leave it null when indexing all files + List buildComponents = null; + if (!EpocEngineHelper.getIndexAllPreference()) + buildComponents = buildConfig.getCarbideProject().isBuildingFromInf() ? null : buildConfig.getCarbideProject().getInfBuildComponents(); + for (IPath mmpPath : getMMPFilesForBuildConfiguration(buildConfig)) { + if (buildComponents != null && !containsStringIgnoreCase(buildComponents, mmpPath.lastSegment())) + continue; EpocEnginePlugin.runWithMMPData(mmpPath, new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig, new AcceptedNodesViewFilter()), diff -r ca271fb95b03 -r f512e4fde380 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Mon Jun 22 15:42:52 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Tue Jun 23 09:36:01 2009 -0500 @@ -53,7 +53,7 @@ public static final int ACTION_COMPILE_AND_LINK = 2; /** - * Load all the configurations associated with this project. If this is a new project + * Load all the configurations associated with this project. If this is a new project, * then a dummy .settings file will be created which can be used to generate new build * configurations. * @return A list of ICarbideBuildConfiguration objects, which may be empty @@ -61,7 +61,7 @@ public List getBuildConfigurations(); /** - * Get an ICarbideBuildConfiguration object from a display name + * Get an ICarbideBuildConfiguration object from a display name. * @param configName - The display name for the build configuration * @return - An ICarbideBuildConfiguration. Returns null if the configuration does not exist. */ @@ -75,7 +75,7 @@ public ICarbideBuildConfiguration getDefaultConfiguration(); /** - * Get the configuration/display name for the currently selected build configuration + * Get the configuration/display name for the currently selected build configuration. * @return A String of the display name. */ public String getDefaultBuildConfigName(); @@ -88,7 +88,7 @@ public boolean isBuildingFromInf(); /** - * Return the full path to the bld.inf file for the project + * Return the full path to the bld.inf file for the project. * @return IPath with the bld.inf file */ public IPath getAbsoluteBldInfPath(); @@ -100,7 +100,7 @@ public IPath getProjectRelativeBldInfPath(); /** - * Get a path to the bld.inf file that is relative to the workspace root + * Get a path to the bld.inf file that is relative to the workspace root. * @return IPath */ public IPath getWorkspaceRelativeBldInfPath(); @@ -114,7 +114,7 @@ public String getMMPTargetFile(); /** - * Get the IProject for the Carbide.c++ project + * Get the IProject for the Carbide.c++ project. * @return IProject object */ public IProject getProject(); @@ -122,7 +122,7 @@ /** * Get a list of the names of the bld.inf components as they come from the settings. * Test components (PRJ_TESTMMPFILES) contain a suffix (" [test component]") to identify a particular - * component as being a test components. + * component as being a test component. * @return A list of strings with the components names as they are from the .cproject file * @see getInfBuildComponents() for the names with test suffix cleansed. */ @@ -130,14 +130,14 @@ /** * Get a list of all the names of the bld.inf components to be built. - * @return A List of compnent names with extension. + * @return A List of component names with extension. * @see isBuildingFromInf() */ public List getInfBuildComponents(); /** * Get the list of PRJ_MMPFILES that are currently being built for the project. This list will only be populated when - * ICarbideProjectInfo.isBuildingFromInf() returns true, oherwise it will be an empty list. + * ICarbideProjectInfo.isBuildingFromInf() returns true, otherwise it will be an empty list. * @return A list of Strings with the component names as they appear in the bld.inf file * @see com.nokia.carbide.cdt.builder.EpocEngineHelper.getMakMakeFiles(IPath, List, List, List, IProgressMonitor ) @@ -146,7 +146,7 @@ /** * Get the list of PRJ_TESTMMPFILES that are currently being built for the project. This list will only be populated when - * ICarbideProjectInfo#isBuildingFromInf() returns true, oherwise it will be an empty list. + * ICarbideProjectInfo#isBuildingFromInf() returns true, otherwise it will be an empty list. * @return A list of Strings with the component names as they appear in the bld.inf file * @see com.nokia.carbide.cdt.builder.EpocEngineHelper.getMakMakeFiles(IPath, List, List, List, IProgressMonitor ) @@ -155,7 +155,7 @@ /** * Get the working directory of the bld.inf file for the default configuration. This may change for a project if - * a bld.inf file is on a different drive than the EPOCROOT of the SDK but only if + * a bld.inf file is on a different drive than the EPOCROOT of the SDK, but only if * they only differ in the drive spec. For example, a bld.inf of "m:\myproj\group\bld.inf" * and an EPOCROOT of "x:\", the IPath will be returned as "x:\myproj\group\". Otherwise, * the original path is returned, "m:\myproj\group\". @@ -197,7 +197,7 @@ /** * Get the project setting that determines whether or not Carbide takes advantage of the make "-j" option - * which will runs make jobs in parallel. + * which will run make jobs in parallel. * @return true when enabled * * Note that the workspace setting is returned unless it is overridden by the project setting @@ -207,7 +207,7 @@ public boolean isConcurrentBuildingEnabled(); /** - * Get the project setting for the maximum number or parallel make jobs + * Get the project setting for the maximum number or parallel make jobs. * @return the number of jobs * * Note that the workspace setting is returned unless it is overridden by the project setting @@ -228,7 +228,7 @@ public boolean promptForMMPChangedAction(); /** - * Returns int value for the mmp action type for the project + * Returns int value for the mmp action type for the project. * @return {@value #ACTION_NONE}, {@value #ACTION_LINK_ONLY}, or {@value #ACTION_COMPILE_AND_LINK} * * Note that the workspace setting is returned unless it is overridden by the project setting diff -r ca271fb95b03 -r f512e4fde380 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 Mon Jun 22 15:42:52 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/BuildConfigurationData.java Tue Jun 23 09:36:01 2009 -0500 @@ -244,8 +244,15 @@ Set pathList = new HashSet(); EpocEngineHelper.addIncludedFilesFromBldInf(cpi, carbideBuildConfig, cpi.getAbsoluteBldInfPath(), pathList); + // get the list of all mmp files selected for the build configuration + // a null buildComponents list means all MMPs are included - so leave it null when indexing all files + List buildComponents = null; + if (!EpocEngineHelper.getIndexAllPreference()) + buildComponents = carbideBuildConfig.getCarbideProject().isBuildingFromInf() ? null : carbideBuildConfig.getCarbideProject().getInfBuildComponents(); + for (IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig)) { - EpocEngineHelper.addIncludedFilesFromMMP(cpi, carbideBuildConfig, mmpPath, pathList); + if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmpPath.lastSegment())) + EpocEngineHelper.addIncludedFilesFromMMP(cpi, carbideBuildConfig, mmpPath, pathList); } cacheFileSource = new ArrayList(); diff -r ca271fb95b03 -r f512e4fde380 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 Mon Jun 22 15:42:52 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildManager.java Tue Jun 23 09:36:01 2009 -0500 @@ -20,13 +20,19 @@ import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CoreModel; +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.extension.CConfigurationData; +import org.eclipse.cdt.core.settings.model.extension.CFolderData; +import org.eclipse.cdt.core.settings.model.extension.CLanguageData; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.jobs.Job; import com.nokia.carbide.cdt.builder.*; import com.nokia.carbide.cdt.builder.project.*; +import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener; import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.cpp.internal.api.utils.core.FileUtils; @@ -304,10 +310,41 @@ // expand macros, locate includes, etc. we're using a set to avoid duplicates. Set pathList = new HashSet(); for (ICarbideBuildConfiguration config : cpi.getBuildConfigurations()) { + + // force a rebuild of the CarbideLanguageData cache + CLanguageData languageData = null; + ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(config.getCarbideProject().getProject()); + if (projDes != null) { + ICConfigurationDescription configDes = projDes.getConfigurationById(config.getDisplayString()); + if (configDes != null) { + CConfigurationData configData = configDes.getConfigurationData(); + if (configData != null && configData instanceof BuildConfigurationData) { + CFolderData rootFolderData = ((BuildConfigurationData)configData).getRootFolderData(); + if (rootFolderData != null) { + CLanguageData[] languageDatas = rootFolderData.getLanguageDatas(); + if (languageDatas != null && languageDatas.length > 0) { + // there's only one for Carbide anyway + languageData = languageDatas[0]; + if (languageData instanceof CarbideLanguageData) + ((CarbideLanguageData)languageData).forceRebuildCache(); + } + } + } + } + } + EpocEngineHelper.addIncludedFilesFromBldInf(cpi, config, cpi.getAbsoluteBldInfPath(), pathList); + + // get the list of all mmp files selected for the build configuration + // a null buildComponents list means all MMPs are included - so leave it null when indexing all files + List buildComponents = null; + if (!EpocEngineHelper.getIndexAllPreference()) + buildComponents = config.getCarbideProject().isBuildingFromInf() ? null : config.getCarbideProject().getInfBuildComponents(); + for (IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(config)) { - EpocEngineHelper.addIncludedFilesFromMMP(cpi, config, mmpPath, pathList); + if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmpPath.lastSegment())) + EpocEngineHelper.addIncludedFilesFromMMP(cpi, config, mmpPath, pathList); } } diff -r ca271fb95b03 -r f512e4fde380 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 Mon Jun 22 15:42:52 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Tue Jun 23 09:36:01 2009 -0500 @@ -52,6 +52,7 @@ private List macroEntries; private List cacheFileSource; private boolean lastUseMMPMacrosValue; + private boolean forceRebuildCache = false; private long cacheTimestamp; private final String CONFIG_DATA_CACHE = "configDataCache"; //$NON-NLS-1$ @@ -80,8 +81,12 @@ synchronized (this) { if (kind == ICLanguageSettingEntry.INCLUDE_PATH || kind == ICLanguageSettingEntry.MACRO) { + if (forceRebuildCache) { + buildCache(); + forceRebuildCache = false; + cacheBuilt = true; // see if we have the data cached or not. if so, make sure the cache isn't stale - if (includeEntries == null || macroEntries == null || cacheFileSource == null) { + } else if (includeEntries == null || macroEntries == null || cacheFileSource == null) { // try to load persisted cache loadCache(); @@ -255,11 +260,19 @@ } } - // get the list of all mmp files applicable to our build configuration. if the pref option - // is enabled then check the mmp's for MACRO's. + // get the list of all mmp files selected for the build configuration + // a null buildComponents list means all MMPs are included - so leave it null when indexing all files + List buildComponents = null; + if (!EpocEngineHelper.getIndexAllPreference()) + buildComponents = carbideBuildConfig.getCarbideProject().isBuildingFromInf() ? null : carbideBuildConfig.getCarbideProject().getInfBuildComponents(); + + // if the pref option is enabled, then check the mmp's for MACRO's. if (cpi.shouldUseMMPMacros()) { List mmps = EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig); for (IPath mmp : mmps) { + if (buildComponents != null && !EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmp.lastSegment())) + continue; + List mmpMacros = EpocEngineHelper.getMMPMacrosForBuildConfiguration(mmp, carbideBuildConfig); for (String mmpMacro : mmpMacros) { // Symbian docs say they are converted to upper case always @@ -278,7 +291,8 @@ EpocEngineHelper.addIncludedFilesFromBldInf(cpi, carbideBuildConfig, cpi.getAbsoluteBldInfPath(), pathList); for (IPath mmpPath : EpocEngineHelper.getMMPFilesForBuildConfiguration(carbideBuildConfig)) { - EpocEngineHelper.addIncludedFilesFromMMP(cpi, carbideBuildConfig, mmpPath, pathList); + if (buildComponents == null || EpocEngineHelper.containsStringIgnoreCase(buildComponents, mmpPath.lastSegment())) + EpocEngineHelper.addIncludedFilesFromMMP(cpi, carbideBuildConfig, mmpPath, pathList); } cacheFileSource = new ArrayList(); @@ -443,6 +457,10 @@ } return fContentTypes; } + + public void forceRebuildCache() { + forceRebuildCache = true; + } @Override public int getSupportedEntryKinds() {