Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Schaefer2016-05-10 16:45:02 +0000
committerGerrit Code Review @ Eclipse.org2016-05-10 20:05:53 +0000
commit2c4921bca0925a343ba88f5fec731d6a463fd55e (patch)
treed81b9a02dcc2c89fd2125e036709af68078691ff /core/org.eclipse.cdt.core/model
parent49e921843f89b9b2ce4ba38004d197428d4dc8cc (diff)
downloadorg.eclipse.cdt-2c4921bca0925a343ba88f5fec731d6a463fd55e.tar.gz
org.eclipse.cdt-2c4921bca0925a343ba88f5fec731d6a463fd55e.tar.xz
org.eclipse.cdt-2c4921bca0925a343ba88f5fec731d6a463fd55e.zip
Add binary parsers to new build system. Clean up some toolchain stuff.
new build configs now support binary parsers which are by default driven from the toolchains. Ran into problem with new versions of toolchains. Added versioning info to toolchains to take that into account. Change-Id: Ie1fb7755e84239b525dca0ae11759027a0b44574
Diffstat (limited to 'core/org.eclipse.cdt.core/model')
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java62
1 files changed, 47 insertions, 15 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
index 400ae89cdbd..b9e110c6499 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java
@@ -26,6 +26,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
@@ -34,6 +35,7 @@ import org.eclipse.cdt.core.IBinaryParser;
import org.eclipse.cdt.core.IBinaryParser.IBinaryArchive;
import org.eclipse.cdt.core.IBinaryParser.IBinaryFile;
import org.eclipse.cdt.core.IBinaryParser.IBinaryObject;
+import org.eclipse.cdt.core.build.ICBuildConfiguration;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsChangeEvent;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsChangeListener;
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
@@ -68,6 +70,7 @@ import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.resources.IBuildConfiguration;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
@@ -604,22 +607,51 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
public BinaryParserConfig[] getBinaryParser(IProject project) {
BinaryParserConfig[] parsers = binaryParsersMap.get(project);
if (parsers == null) {
- ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(project, false);
- if (desc != null) {
- ICConfigurationDescription cfgDesc = desc.getDefaultSettingConfiguration();
- if (cfgDesc != null) {
- ICConfigExtensionReference[] refs = cfgDesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
- if (refs.length > 0) {
- ArrayList<BinaryParserConfig> list = new ArrayList<>(refs.length);
- for (ICConfigExtensionReference ref : refs) {
- BinaryParserConfig config = new BinaryParserConfig(ref);
- list.add(config);
+ try {
+ // Check for new style build configs first
+ Set<String> parserIds = new HashSet<>();
+ for (IBuildConfiguration config : project.getBuildConfigs()) {
+ if (!IBuildConfiguration.DEFAULT_CONFIG_NAME.equals(config.getName())) {
+ ICBuildConfiguration cconfig = config.getAdapter(ICBuildConfiguration.class);
+ if (cconfig != null) {
+ parserIds.add(cconfig.getBinaryParserId());
+ }
+ }
+ }
+ if (!parserIds.isEmpty()) {
+ String[] ids = parserIds.toArray(new String[parserIds.size()]);
+ parsers = new BinaryParserConfig[parserIds.size()];
+ for (int i = 0; i < parsers.length; ++i) {
+ String id = ids[i];
+ IBinaryParser parser = CCorePlugin.getDefault().getBinaryParser(id);
+ if (parser != null) {
+ parsers[i] = new BinaryParserConfig(parser, id);
+ }
+ }
+ }
+ } catch (CoreException e) {
+ CCorePlugin.log(e);
+ parsers = null;
+ }
+
+ if (parsers == null) {
+ ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(project, false);
+ if (desc != null) {
+ ICConfigurationDescription cfgDesc = desc.getDefaultSettingConfiguration();
+ if (cfgDesc != null) {
+ ICConfigExtensionReference[] refs = cfgDesc.get(CCorePlugin.BINARY_PARSER_UNIQ_ID);
+ if (refs.length > 0) {
+ ArrayList<BinaryParserConfig> list = new ArrayList<>(refs.length);
+ for (ICConfigExtensionReference ref : refs) {
+ BinaryParserConfig config = new BinaryParserConfig(ref);
+ list.add(config);
+ }
+ parsers = new BinaryParserConfig[list.size()];
+ list.toArray(parsers);
+ } else {
+ // no parser configured
+ parsers = new BinaryParserConfig[0];
}
- parsers = new BinaryParserConfig[list.size()];
- list.toArray(parsers);
- } else {
- // no parser configured
- parsers = new BinaryParserConfig[0];
}
}
}

Back to the top