1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-17 05:05:43 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-01-28 16:51:42 -05:00
commit 6680b5a020
9 changed files with 112 additions and 36 deletions

View file

@ -28,9 +28,6 @@ import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache; import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ErrorParserManager; import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.CSourceEntry; import org.eclipse.cdt.core.settings.model.CSourceEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICExternalSetting; import org.eclipse.cdt.core.settings.model.ICExternalSetting;
@ -1546,8 +1543,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if (canExportedArtifactInfo()) { if (canExportedArtifactInfo()) {
// Remove existing exported library, if it exists // Remove existing exported library, if it exists
ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(this); ICConfigurationDescription des = ManagedBuildManager.getDescriptionForConfiguration(this);
ICSettingEntry[] libs = CDataUtil.resolveEntries(new ICSettingEntry[] { ICSettingEntry[] unresolved = new ICSettingEntry[] {CDataUtil.createCLibraryFileEntry(getArtifactName(), 0)};
new CLibraryFileEntry(getArtifactName(), 0)}, des); ICSettingEntry[] libs = CDataUtil.resolveEntries(unresolved, des);
if (libs.length > 0) { if (libs.length > 0) {
for (ICExternalSetting setting : des.getExternalSettings()) { for (ICExternalSetting setting : des.getExternalSettings()) {
Set<ICSettingEntry> entries = new LinkedHashSet<ICSettingEntry>(Arrays.asList(setting.getEntries())); Set<ICSettingEntry> entries = new LinkedHashSet<ICSettingEntry>(Arrays.asList(setting.getEntries()));
@ -2866,14 +2863,14 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
IPath p = new Path(value); IPath p = new Path(value);
if(!p.isAbsolute()) if(!p.isAbsolute())
value = getOwner().getFullPath().append(value).toString(); value = getOwner().getFullPath().append(value).toString();
ICLibraryPathEntry lib = new CLibraryPathEntry(value, out.getFlags() & (~ICSettingEntry.RESOLVED)); ICLibraryPathEntry lib = CDataUtil.createCLibraryPathEntry(value, out.getFlags() & (~ICSettingEntry.RESOLVED));
list.add(lib); list.add(lib);
} }
// Add 'libs' artifact names themselves // Add 'libs' artifact names themselves
ICSettingEntry[] libFile = new ICSettingEntry[] {new CLibraryFileEntry(getArtifactName(), 0)}; ICSettingEntry[] unresolved = new ICSettingEntry[] {CDataUtil.createCLibraryFileEntry(getArtifactName(), 0)};
libFile = CDataUtil.resolveEntries(libFile, des); ICSettingEntry[] libFiles = CDataUtil.resolveEntries(unresolved, des);
list.add(libFile[0]); list.add(libFiles[0]);
// Contribute the settings back as 'exported' // Contribute the settings back as 'exported'
des.createExternalSetting(null, null, null, list.toArray(new ICSettingEntry[list.size()])); des.createExternalSetting(null, null, null, list.toArray(new ICSettingEntry[list.size()]));

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2009 Intel Corporation and others. * Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -15,20 +15,51 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
public final class CLibraryFileEntry extends ACPathEntry implements /**
ICLibraryFileEntry { * Representation in the project model of library file settings entries.
* As an example, those are supplied by a gcc compiler with option "-l".
*/
public final class CLibraryFileEntry extends ACPathEntry implements ICLibraryFileEntry {
private IPath fSourceAttachmentPath; private IPath fSourceAttachmentPath;
private IPath fSourceAttachmentRootPath; private IPath fSourceAttachmentRootPath;
private IPath fSourceAttachmentPrefixMapping; private IPath fSourceAttachmentPrefixMapping;
public CLibraryFileEntry(String value, int flags) { /**
this(value, flags, null, null, null); * This constructor is discouraged to be referenced by clients.
*
* Instead, use pooled entries with CDataUtil.createCLibraryFileEntry(name, flags).
*
* @param name - library file path. The path can be an absolute location on the local file-system
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CLibraryFileEntry(String name, int flags) {
this(name, flags, null, null, null);
} }
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries with CDataUtil.createCLibraryFileEntry(location.toString(), flags)
* or wrap it with CDataUtil.getPooledEntry(new CLibraryFileEntry(location, flags)).
*
* @param location - library file path. The path can be an absolute location on the local
* file-system or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CLibraryFileEntry(IPath location, int flags) { public CLibraryFileEntry(IPath location, int flags) {
this(location, flags, null, null, null); this(location, flags, null, null, null);
} }
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries wrapping with CDataUtil.getPooledEntry(new CLibraryFileEntry(rc, flags)).
*
* @param rc - library file as a resource in the workspace.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
*/
public CLibraryFileEntry(IFile rc, int flags) { public CLibraryFileEntry(IFile rc, int flags) {
this(rc, flags, null, null, null); this(rc, flags, null, null, null);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2008 Intel Corporation and others. * Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -13,17 +13,47 @@ package org.eclipse.cdt.core.settings.model;
import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
public final class CLibraryPathEntry extends ACPathEntry implements /**
ICLibraryPathEntry { * Representation in the project model of library path settings entries.
* As an example, those are supplied by a gcc compiler with option "-L".
public CLibraryPathEntry(String value, int flags) { */
super(value, flags); public final class CLibraryPathEntry extends ACPathEntry implements ICLibraryPathEntry {
/**
* This constructor is discouraged to be referenced by clients.
*
* Instead, use pooled entries with CDataUtil.createCLibraryPathEntry(name, flags).
*
* @param name - library path. The path can be an absolute location on the local file-system
* or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CLibraryPathEntry(String name, int flags) {
super(name, flags);
} }
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries with CDataUtil.createCLibraryPathEntry(location.toString(), flags)
* or wrap it with CDataUtil.getPooledEntry(new CLibraryPathEntry(location, flags)).
*
* @param location - library path. The path can be an absolute location on the local
* file-system or with flag {@link #VALUE_WORKSPACE_PATH} it is treated as workspace full path.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
*/
public CLibraryPathEntry(IPath location, int flags) { public CLibraryPathEntry(IPath location, int flags) {
super(location, flags); super(location, flags);
} }
/**
* This constructor is discouraged to be used directly.
*
* Instead, use pooled entries wrapping with CDataUtil.getPooledEntry(new CLibraryPathEntry(rc, flags)).
*
* @param rc - include path as a resource in the workspace.
* @param flags - bitwise combination of {@link ICSettingEntry} flags.
* If {@link #VALUE_WORKSPACE_PATH} is missing it will be supplied.
*/
public CLibraryPathEntry(IFolder rc, int flags) { public CLibraryPathEntry(IFolder rc, int flags) {
super(rc, flags); super(rc, flags);
} }

View file

@ -419,6 +419,26 @@ public class CDataUtil {
return (CMacroFileEntry) getPooledEntry(new CMacroFileEntry(name, flags)); return (CMacroFileEntry) getPooledEntry(new CMacroFileEntry(name, flags));
} }
/**
* Utility method to create {@link CLibraryPathEntry}.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @since 5.4
*/
public static CLibraryPathEntry createCLibraryPathEntry(String name, int flags) {
return (CLibraryPathEntry) getPooledEntry(new CLibraryPathEntry(name, flags));
}
/**
* Utility method to create {@link CLibraryFileEntry}.
* Note that this method keeps the entries in the pool to avoid proliferation of duplicates.
*
* @since 5.4
*/
public static CLibraryFileEntry createCLibraryFileEntry(String name, int flags) {
return (CLibraryFileEntry) getPooledEntry(new CLibraryFileEntry(name, flags));
}
public static String[] getSourceExtensions(IProject project, CLanguageData data) { public static String[] getSourceExtensions(IProject project, CLanguageData data) {
String[] exts = null; String[] exts = null;
String[] typeIds = data.getSourceContentTypeIds(); String[] typeIds = data.getSourceContentTypeIds();

View file

@ -28,8 +28,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
@ -555,10 +553,10 @@ public class LanguageSettingEntryDialog extends AbstractPropertyDialog {
entry = CDataUtil.createCMacroFileEntry(name, flags); entry = CDataUtil.createCMacroFileEntry(name, flags);
break; break;
case COMBO_INDEX_LIBRARY_PATH: case COMBO_INDEX_LIBRARY_PATH:
entry = new CLibraryPathEntry(name, flags); entry = CDataUtil.createCLibraryPathEntry(name, flags);
break; break;
case COMBO_INDEX_LIBRARY_FILE: case COMBO_INDEX_LIBRARY_FILE:
entry = new CLibraryFileEntry(name, flags); entry = CDataUtil.createCLibraryFileEntry(name, flags);
break; break;
default: default:
result = false; result = false;

View file

@ -12,9 +12,9 @@ package org.eclipse.cdt.ui.newui;
import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
@ -29,7 +29,7 @@ public class ExpLibraryPathTab extends AbstractExportTab implements IPathEntrySt
@Override @Override
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) { public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0; int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
return new CLibraryPathEntry(s2, flags); return CDataUtil.createCLibraryPathEntry(s2, flags);
} }
@Override @Override

View file

@ -12,9 +12,9 @@ package org.eclipse.cdt.ui.newui;
import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
/** /**
* @noextend This class is not intended to be subclassed by clients. * @noextend This class is not intended to be subclassed by clients.
@ -29,7 +29,7 @@ public class ExpLibraryTab extends AbstractExportTab implements IPathEntryStoreL
@Override @Override
public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) { public ICLanguageSettingEntry doAdd(String s1, String s2, boolean isWsp) {
int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0; int flags = isWsp ? ICSettingEntry.VALUE_WORKSPACE_PATH : 0;
return new CLibraryFileEntry(s2, flags); return CDataUtil.createCLibraryFileEntry(s2, flags);
} }
@Override @Override

View file

@ -17,9 +17,9 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.ui.newui.Messages; import org.eclipse.cdt.internal.ui.newui.Messages;
@ -57,7 +57,7 @@ public class LibraryPathTab extends AbstractLangsListTab implements IPathEntrySt
toAllLang = dlg.check3; toAllLang = dlg.check3;
int flags = 0; int flags = 0;
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH; if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
return new CLibraryPathEntry(dlg.text1, flags); return CDataUtil.createCLibraryPathEntry(dlg.text1, flags);
} }
return null; return null;
} }
@ -72,7 +72,7 @@ public class LibraryPathTab extends AbstractLangsListTab implements IPathEntrySt
if (dlg.open() && dlg.text1.trim().length() > 0 ) { if (dlg.open() && dlg.text1.trim().length() > 0 ) {
int flags = 0; int flags = 0;
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH; if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
return new CLibraryPathEntry(dlg.text1, flags); return CDataUtil.createCLibraryPathEntry(dlg.text1, flags);
} }
return null; return null;
} }

View file

@ -16,9 +16,9 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.cdt.core.resources.IPathEntryStoreListener; import org.eclipse.cdt.core.resources.IPathEntryStoreListener;
import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent; import org.eclipse.cdt.core.resources.PathEntryStoreChangedEvent;
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.internal.ui.newui.Messages; import org.eclipse.cdt.internal.ui.newui.Messages;
@ -59,7 +59,7 @@ public class LibraryTab extends AbstractLangsListTab implements IPathEntryStoreL
toAllLang = dlg.check3; toAllLang = dlg.check3;
int flags = 0; int flags = 0;
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH; if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
return new CLibraryFileEntry(dlg.text1, flags); return CDataUtil.createCLibraryFileEntry(dlg.text1, flags);
} }
return null; return null;
} }
@ -76,7 +76,7 @@ public class LibraryTab extends AbstractLangsListTab implements IPathEntryStoreL
if (dlg.open() && dlg.text1.trim().length() > 0 ) { if (dlg.open() && dlg.text1.trim().length() > 0 ) {
int flags = 0; int flags = 0;
if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH; if (dlg.check2) flags = ICSettingEntry.VALUE_WORKSPACE_PATH;
return new CLibraryFileEntry(dlg.text1, flags); return CDataUtil.createCLibraryFileEntry(dlg.text1, flags);
} }
return null; return null;
} }