mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
NEW - bug 205257: CDTProject creation scalability issue
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205257
This commit is contained in:
parent
7a8b371d46
commit
abe9cb4822
4 changed files with 88 additions and 88 deletions
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.managedbuilder.core;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||
|
@ -498,45 +497,12 @@ public interface ITool extends IBuildObject, IHoldsOptions {
|
|||
*/
|
||||
public void setCommandLinePattern(String pattern);
|
||||
|
||||
/**
|
||||
* Returns the plugin.xml element of the commandLineGenerator extension or <code>null</code> if none.
|
||||
*
|
||||
* @return IConfigurationElement
|
||||
*
|
||||
* @deprecated - use getCommandLineGenerator
|
||||
*/
|
||||
public IConfigurationElement getCommandLineGeneratorElement();
|
||||
|
||||
/**
|
||||
* Sets the CommandLineGenerator plugin.xml element
|
||||
*
|
||||
* @param element
|
||||
* @deprecated
|
||||
*/
|
||||
public void setCommandLineGeneratorElement(IConfigurationElement element);
|
||||
|
||||
/**
|
||||
* Returns the command line generator specified for this tool
|
||||
* @return IManagedCommandLineGenerator
|
||||
*/
|
||||
public IManagedCommandLineGenerator getCommandLineGenerator();
|
||||
|
||||
/**
|
||||
* Returns the plugin.xml element of the dependencyGenerator extension or <code>null</code> if none.
|
||||
*
|
||||
* @return IConfigurationElement
|
||||
* @deprecated - use getDependencyGeneratorForExtension or IInputType#getDependencyGenerator method
|
||||
*/
|
||||
public IConfigurationElement getDependencyGeneratorElement();
|
||||
|
||||
/**
|
||||
* Sets the DependencyGenerator plugin.xml element
|
||||
*
|
||||
* @param element
|
||||
* @deprecated
|
||||
*/
|
||||
public void setDependencyGeneratorElement(IConfigurationElement element);
|
||||
|
||||
/**
|
||||
* Returns a class instance that implements an interface to generate
|
||||
* source-level dependencies for the tool specified in the argument.
|
||||
|
@ -747,22 +713,12 @@ public interface ITool extends IBuildObject, IHoldsOptions {
|
|||
|
||||
IResourceInfo getParentResourceInfo();
|
||||
|
||||
/* IInputType setSourceContentTypeIds(IInputType type, String[] ids);
|
||||
|
||||
IInputType setHeaderContentTypeIds(IInputType type, String[] ids);
|
||||
|
||||
IInputType setSourceExtensionsAttribute(IInputType type, String[] extensions);
|
||||
|
||||
IInputType setHeaderExtensionsAttribute(IInputType type, String[] extensions);
|
||||
*/
|
||||
IInputType getEditableInputType(IInputType base);
|
||||
|
||||
IOutputType getEditableOutputType(IOutputType base);
|
||||
|
||||
boolean isEnabled();
|
||||
|
||||
// boolean isReal();
|
||||
|
||||
boolean supportsBuild(boolean managed);
|
||||
|
||||
boolean matches(ITool tool);
|
||||
|
|
|
@ -223,6 +223,8 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
private static Map extensionOutputTypeMap;
|
||||
// Targets defined in the manifest files (CDT V2.0 object model)
|
||||
private static Map extensionTargetMap;
|
||||
|
||||
|
||||
// "Selected configuraton" elements defined in the manifest files.
|
||||
// These are configuration elements that map to objects in the internal
|
||||
// representation of the manifest files. For example, ListOptionValues
|
||||
|
@ -233,6 +235,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
// A configuration element, with its attributes and children, directly
|
||||
// reflects the content and structure of the extension section within the
|
||||
// declaring plug-in's manifest (plugin.xml) file.
|
||||
// This map has a lifecycle corresponding to the build definitions extension loading.
|
||||
private static Map configElementMap;
|
||||
|
||||
// private static List sortedToolChains;
|
||||
|
@ -2250,6 +2253,12 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
return;
|
||||
projectTypesLoading = true;
|
||||
|
||||
|
||||
// scalability issue: configElementMap does not need to live past when loading is done, so we will
|
||||
// deallocate it upon exit with a try...finally
|
||||
|
||||
try {
|
||||
|
||||
//The list of the IManagedBuildDefinitionsStartup callbacks
|
||||
List buildDefStartupList = null;
|
||||
// Get the extensions that use the current CDT managed build model
|
||||
|
@ -2555,6 +2564,12 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
projectTypesLoaded = true;
|
||||
|
||||
ToolChainModificationManager.getInstance().start();
|
||||
|
||||
} // try
|
||||
|
||||
finally {
|
||||
configElementMap = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void performAdjustments(){
|
||||
|
@ -3207,6 +3222,9 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
}
|
||||
|
||||
private static Map getConfigElementMap() {
|
||||
if(!projectTypesLoading)
|
||||
throw new IllegalStateException();
|
||||
|
||||
if (configElementMap == null) {
|
||||
configElementMap = new HashMap();
|
||||
}
|
||||
|
@ -3214,8 +3232,9 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method public for implementation reasons. Not intended for use
|
||||
* @noreference This method public for implementation reasons. Not intended for use
|
||||
* by clients.
|
||||
*
|
||||
*/
|
||||
public static void putConfigElement(IBuildObject buildObj, IManagedConfigElement configElement) {
|
||||
getConfigElementMap().put(buildObj, configElement);
|
||||
|
@ -3229,7 +3248,7 @@ public class ManagedBuildManager extends AbstractCExtension {
|
|||
}
|
||||
|
||||
/**
|
||||
* This method public for implementation reasons. Not intended for use
|
||||
* @noreference This method public for implementation reasons. Not intended for use
|
||||
* by clients.
|
||||
*/
|
||||
public static IManagedConfigElement getConfigElement(IBuildObject buildObj) {
|
||||
|
|
|
@ -12,6 +12,8 @@ package org.eclipse.cdt.managedbuilder.internal.core;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -64,7 +66,6 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
private Vector<String> categoryIds;
|
||||
private Map<String, IOptionCategory> categoryMap;
|
||||
private List<IOptionCategory> childOptionCategories;
|
||||
private Vector<Option> optionList;
|
||||
private Map<String, Option> optionMap;
|
||||
// Miscellaneous
|
||||
private boolean isDirty = false;
|
||||
|
@ -97,8 +98,8 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
// found on an non-extension tools
|
||||
|
||||
boolean copyIds = id.equals(source.id);
|
||||
if (source.optionList != null) {
|
||||
Iterator<Option> iter = source.getOptionList().listIterator();
|
||||
if (source.optionMap != null) {
|
||||
Iterator<Option> iter = source.getOptionCollection().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Option option = iter.next();
|
||||
int nnn = ManagedBuildManager.getRandomNumber();
|
||||
|
@ -123,7 +124,7 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
}
|
||||
|
||||
void copyNonoverriddenSettings(HoldsOptions ho){
|
||||
if (ho.optionList == null || ho.optionList.size() == 0)
|
||||
if (ho.optionMap == null || ho.optionMap.size() == 0)
|
||||
return;
|
||||
|
||||
IOption options[] = getOptions();
|
||||
|
@ -209,8 +210,8 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
}
|
||||
}
|
||||
|
||||
List<Option> optionElements = getOptionList();
|
||||
Iterator<Option> iter2 = optionElements.listIterator();
|
||||
Collection<Option> optionElements = getOptionCollection();
|
||||
Iterator<Option> iter2 = optionElements.iterator();
|
||||
while (iter2.hasNext()) {
|
||||
Option option = iter2.next();
|
||||
ICStorageElement optionElement = element.createChild(OPTION);
|
||||
|
@ -239,7 +240,7 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
* @see org.eclipse.cdt.managedbuilder.core.IHoldsOptions#createOptions(IHoldsOptions)
|
||||
*/
|
||||
public void createOptions(IHoldsOptions superClass) {
|
||||
Iterator<Option> iter = ((HoldsOptions)superClass).getOptionList().listIterator();
|
||||
Iterator<Option> iter = ((HoldsOptions)superClass).getOptionCollection().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Option optionChild = (Option) iter.next();
|
||||
int nnn = ManagedBuildManager.getRandomNumber();
|
||||
|
@ -256,7 +257,6 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
return;
|
||||
// throw new IllegalArgumentException();
|
||||
|
||||
getOptionList().remove(option);
|
||||
getOptionMap().remove(option.getId());
|
||||
setDirty(true);
|
||||
setRebuildState(true);
|
||||
|
@ -276,11 +276,12 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
options = superClass.getOptions();
|
||||
}
|
||||
// Our options take precedence.
|
||||
Vector<Option> ourOpts = getOptionList();
|
||||
Collection<Option> ourOpts = getOptionCollection();
|
||||
Iterator<Option> iter = ourOpts.iterator();
|
||||
if (options != null) {
|
||||
for (int i = 0; i < ourOpts.size(); i++) {
|
||||
while(iter.hasNext()) {
|
||||
int j = options.length;
|
||||
IOption ourOpt = (IOption)ourOpts.get(i);
|
||||
IOption ourOpt = iter.next();
|
||||
if (ourOpt.getSuperClass() != null) {
|
||||
String matchId = ourOpt.getSuperClass().getId();
|
||||
search:
|
||||
|
@ -434,7 +435,6 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
* @param option
|
||||
*/
|
||||
public void addOption(Option option) {
|
||||
getOptionList().add(option);
|
||||
getOptionMap().put(option.getId(), option);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
|
@ -450,11 +450,11 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
/* (non-Javadoc)
|
||||
* Memory-safe way to access the list of options
|
||||
*/
|
||||
private Vector<Option> getOptionList() {
|
||||
if (optionList == null) {
|
||||
optionList = new Vector<Option>();
|
||||
}
|
||||
return optionList;
|
||||
private Collection<Option> getOptionCollection() {
|
||||
// no need to store all the options twice, get them out of the map
|
||||
if(optionMap != null)
|
||||
return optionMap.values();
|
||||
else return Collections.emptyList();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -502,7 +502,7 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
if (isDirty)
|
||||
return true;
|
||||
|
||||
for (Option option : getOptionList())
|
||||
for (Option option : getOptionCollection())
|
||||
if (option.isDirty())
|
||||
return true;
|
||||
|
||||
|
@ -517,7 +517,7 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
this.isDirty = isDirty;
|
||||
// Propagate "false" to the children
|
||||
if (!isDirty) {
|
||||
for (Option option : getOptionList())
|
||||
for (Option option : getOptionCollection())
|
||||
if(!option.isExtensionElement())
|
||||
option.setDirty(false);
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
if (!resolved) {
|
||||
resolved = true;
|
||||
// Call resolveReferences on our children
|
||||
for (Option current : getOptionList()) {
|
||||
for (Option current : getOptionCollection()) {
|
||||
current.resolveReferences();
|
||||
}
|
||||
// Somewhat wasteful, but use the vector to retrieve the categories in proper order
|
||||
|
@ -638,7 +638,7 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
return true;
|
||||
|
||||
// Otherwise see if any options need saving
|
||||
for (Option option : getOptionList())
|
||||
for (Option option : getOptionCollection())
|
||||
if (option.needsRebuild())
|
||||
return true;
|
||||
|
||||
|
@ -653,7 +653,7 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
|
||||
// Propagate "false" to the children
|
||||
if (!rebuildState)
|
||||
for (Option option : getOptionList())
|
||||
for (Option option : getOptionCollection())
|
||||
if(!option.isExtensionElement())
|
||||
option.setRebuildState(false);
|
||||
}
|
||||
|
@ -754,8 +754,8 @@ public abstract class HoldsOptions extends BuildObject implements IHoldsOptions,
|
|||
if(superClass == null)
|
||||
return true;
|
||||
|
||||
if(optionList != null && optionList.size() != 0){
|
||||
for(Option option : optionList)
|
||||
if(optionMap != null && optionMap.size() != 0){
|
||||
for(Option option : getOptionCollection())
|
||||
if(option.hasCustomSettings())
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -434,10 +434,18 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
supportsManagedBuild = tool.supportsManagedBuild;
|
||||
|
||||
|
||||
commandLineGeneratorElement = tool.commandLineGeneratorElement;
|
||||
commandLineGenerator = tool.commandLineGenerator;
|
||||
dependencyGeneratorElement = tool.dependencyGeneratorElement;
|
||||
if(commandLineGenerator == null) {
|
||||
// only need XML if the generator hasn't been created yet
|
||||
commandLineGeneratorElement = tool.commandLineGeneratorElement;
|
||||
}
|
||||
|
||||
dependencyGenerator = tool.dependencyGenerator;
|
||||
if(dependencyGenerator == null) {
|
||||
// only need XML if the generator hasn't been created yet
|
||||
dependencyGeneratorElement = tool.dependencyGeneratorElement;
|
||||
}
|
||||
|
||||
pathconverterElement = tool.pathconverterElement ;
|
||||
optionPathConverter = tool.optionPathConverter ;
|
||||
|
||||
|
@ -562,20 +570,32 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
if(supportsManagedBuild == null)
|
||||
supportsManagedBuild = tool.supportsManagedBuild;
|
||||
|
||||
|
||||
if(commandLineGeneratorElement == null)
|
||||
commandLineGeneratorElement = tool.commandLineGeneratorElement;
|
||||
if(commandLineGenerator == null)
|
||||
if(commandLineGenerator == null) {
|
||||
commandLineGenerator = tool.commandLineGenerator;
|
||||
if(dependencyGeneratorElement == null)
|
||||
dependencyGeneratorElement = tool.dependencyGeneratorElement;
|
||||
if(dependencyGenerator == null)
|
||||
// only copy the generator element if we don't already have a generator
|
||||
if(commandLineGenerator == null && commandLineGeneratorElement == null)
|
||||
commandLineGeneratorElement = tool.commandLineGeneratorElement;
|
||||
}
|
||||
|
||||
if(dependencyGenerator == null) {
|
||||
dependencyGenerator = tool.dependencyGenerator;
|
||||
if(pathconverterElement == null)
|
||||
pathconverterElement = tool.pathconverterElement ;
|
||||
if(optionPathConverter == null)
|
||||
|
||||
// only copy the generator element if we don't already have a generator
|
||||
if(dependencyGenerator == null) {
|
||||
if(dependencyGeneratorElement == null)
|
||||
dependencyGeneratorElement = tool.dependencyGeneratorElement;
|
||||
}
|
||||
}
|
||||
|
||||
if(optionPathConverter == null) {
|
||||
optionPathConverter = tool.optionPathConverter ;
|
||||
|
||||
if(optionPathConverter == null) {
|
||||
if(pathconverterElement == null)
|
||||
pathconverterElement = tool.pathconverterElement ;
|
||||
}
|
||||
}
|
||||
|
||||
if(envVarBuildPathList == null && tool.envVarBuildPathList != null)
|
||||
envVarBuildPathList = new ArrayList<IEnvVarBuildPath>(tool.envVarBuildPathList);
|
||||
|
||||
|
@ -2089,6 +2109,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
try {
|
||||
if (element.getAttribute(COMMAND_LINE_GENERATOR) != null) {
|
||||
commandLineGenerator = (IManagedCommandLineGenerator) element.createExecutableExtension(COMMAND_LINE_GENERATOR);
|
||||
commandLineGeneratorElement = null; // no longer needed now that we've created one
|
||||
return commandLineGenerator;
|
||||
}
|
||||
} catch (CoreException e) {}
|
||||
|
@ -2143,7 +2164,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
* @see org.eclipse.cdt.managedbuilder.core.ITool#setDependencyGeneratorElement(String)
|
||||
* @deprecated
|
||||
*/
|
||||
public void setDependencyGeneratorElement(IConfigurationElement element) {
|
||||
private void setDependencyGeneratorElement(IConfigurationElement element) {
|
||||
dependencyGeneratorElement = element;
|
||||
setDirty(true);
|
||||
}
|
||||
|
@ -2165,8 +2186,10 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
if (element.getAttribute(DEP_CALC_ID) != null) {
|
||||
dependencyGenerator = (IManagedDependencyGeneratorType) element.createExecutableExtension(DEP_CALC_ID);
|
||||
if (dependencyGenerator != null) {
|
||||
if (dependencyGenerator instanceof IManagedDependencyGenerator)
|
||||
if (dependencyGenerator instanceof IManagedDependencyGenerator) {
|
||||
dependencyGeneratorElement = null; // no longer needed now that we've created one
|
||||
return (IManagedDependencyGenerator)dependencyGenerator;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
@ -2790,6 +2813,8 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
optionPathConverter = toolchain.getOptionPathConverter();
|
||||
}
|
||||
}
|
||||
|
||||
pathconverterElement = null; // discard now that we've created one
|
||||
return optionPathConverter ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue