mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
1. fix to [bug 175662] [Build] Include directory from workspace shows up invalid
2. fix to [Bug 175508] [New project model] Invalid warnings about includes in problems view 3. fix to [Bug 175198] Internal Builder does nothing after a clean. 4. fix to [Bug 175087] [New project model] PathEntry not converted
This commit is contained in:
parent
6936ef3514
commit
77a8e0ef9c
19 changed files with 247 additions and 82 deletions
|
@ -636,7 +636,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
|
|
||||||
IConfiguration cfg = builder.getParent().getParent();
|
IConfiguration cfg = builder.getParent().getParent();
|
||||||
boolean isParallel = builder.getParallelizationNum() != 0;
|
boolean isParallel = builder.getParallelizationNum() != 0;
|
||||||
boolean buildIncrementaly = true;
|
// boolean buildIncrementaly = true;
|
||||||
boolean resumeOnErr = !builder.isStopOnError();
|
boolean resumeOnErr = !builder.isStopOnError();
|
||||||
|
|
||||||
// Get the project and make sure there's a monitor to cancel the build
|
// Get the project and make sure there's a monitor to cancel the build
|
||||||
|
@ -654,13 +654,15 @@ public class CommonBuilder extends ACBuilder {
|
||||||
OutputStream epmOutputStream = null;
|
OutputStream epmOutputStream = null;
|
||||||
try {
|
try {
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
IResourceDelta delta = null;
|
IResourceDelta delta = getDelta(currentProject);
|
||||||
|
|
||||||
if(buildIncrementaly){
|
if(delta != null){
|
||||||
flags = BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED | BuildDescriptionManager.DEPS;
|
flags = BuildDescriptionManager.REBUILD | BuildDescriptionManager.REMOVED | BuildDescriptionManager.DEPS;
|
||||||
delta = getDelta(currentProject);
|
// delta = getDelta(currentProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean buildIncrementaly = delta != null;
|
||||||
|
|
||||||
IBuildDescription des = BuildDescriptionManager.createBuildDescription(cfg, delta, flags);
|
IBuildDescription des = BuildDescriptionManager.createBuildDescription(cfg, delta, flags);
|
||||||
|
|
||||||
DescriptionBuilder dBuilder = null;
|
DescriptionBuilder dBuilder = null;
|
||||||
|
|
|
@ -84,7 +84,9 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData applyConfiguration(
|
public CConfigurationData applyConfiguration(
|
||||||
ICConfigurationDescription des, CConfigurationData base)
|
ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData base)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
if(des.isPreferenceConfiguration())
|
if(des.isPreferenceConfiguration())
|
||||||
return applyPreferences(des, base);
|
return applyPreferences(des, base);
|
||||||
|
@ -115,7 +117,9 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
|
|
||||||
|
|
||||||
public CConfigurationData createConfiguration(
|
public CConfigurationData createConfiguration(
|
||||||
ICConfigurationDescription des, CConfigurationData base, boolean clone)
|
ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData base, boolean clone)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
if(des.isPreferenceConfiguration())
|
if(des.isPreferenceConfiguration())
|
||||||
return createPreferences(des, base);
|
return createPreferences(des, base);
|
||||||
|
|
|
@ -189,6 +189,9 @@ public class EntryStorage {
|
||||||
if(size > 0){
|
if(size > 0){
|
||||||
for(int j = 0; j < size; j++){
|
for(int j = 0; j < size; j++){
|
||||||
String value = (String)list.get(j);
|
String value = (String)list.get(j);
|
||||||
|
if(value.indexOf('"') == 0 && value.lastIndexOf('"') == value.length() - 1 && value.length() != 1){
|
||||||
|
value = value.substring(1, value.length() - 1);
|
||||||
|
}
|
||||||
ICLanguageSettingEntry entry = createEntry(discoveredEntryFromString(value), false, false);
|
ICLanguageSettingEntry entry = createEntry(discoveredEntryFromString(value), false, false);
|
||||||
EntryInfo discoveredInfo = fDiscoveredEntries.getEntryInfo(entry);
|
EntryInfo discoveredInfo = fDiscoveredEntries.getEntryInfo(entry);
|
||||||
if(discoveredInfo != null){
|
if(discoveredInfo != null){
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class ExternalExtensionMacroSupplier implements ICdtVariableSupplier{
|
||||||
case IBuildMacroProvider.CONTEXT_PROJECT:
|
case IBuildMacroProvider.CONTEXT_PROJECT:
|
||||||
if (contextData instanceof IManagedProject) {
|
if (contextData instanceof IManagedProject) {
|
||||||
IManagedProject project = (IManagedProject)contextData;
|
IManagedProject project = (IManagedProject)contextData;
|
||||||
IProjectBuildMacroSupplier supplier = project.getProjectType().getBuildMacroSupplier();
|
IProjectBuildMacroSupplier supplier = project.getProjectType() != null ? project.getProjectType().getBuildMacroSupplier() : null;
|
||||||
if(supplier == null)
|
if(supplier == null)
|
||||||
return null;
|
return null;
|
||||||
return supplier.getMacro(macroName,project,new ExtensionMacroProvider(contextType, contextData));
|
return supplier.getMacro(macroName,project,new ExtensionMacroProvider(contextType, contextData));
|
||||||
|
@ -187,7 +187,7 @@ public class ExternalExtensionMacroSupplier implements ICdtVariableSupplier{
|
||||||
case IBuildMacroProvider.CONTEXT_PROJECT:
|
case IBuildMacroProvider.CONTEXT_PROJECT:
|
||||||
if (contextData instanceof IManagedProject) {
|
if (contextData instanceof IManagedProject) {
|
||||||
IManagedProject project = (IManagedProject)contextData;
|
IManagedProject project = (IManagedProject)contextData;
|
||||||
IProjectBuildMacroSupplier supplier = project.getProjectType().getBuildMacroSupplier();
|
IProjectBuildMacroSupplier supplier = project.getProjectType() != null ? project.getProjectType().getBuildMacroSupplier() : null;
|
||||||
if(supplier != null)
|
if(supplier != null)
|
||||||
macros = supplier.getMacros(project,new ExtensionMacroProvider(contextType, contextData));
|
macros = supplier.getMacros(project,new ExtensionMacroProvider(contextType, contextData));
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,7 +452,7 @@ public class CPropertyVarsTab extends AbstractCPropertyTab {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUserVar(ICdtVariable v) {
|
private boolean isUserVar(ICdtVariable v) {
|
||||||
return mgr.isUserVariable(v, cfgd);
|
return cfgd != null ? mgr.isUserVariable(v, cfgd) : vars.contains(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check whether variable is dynamic */
|
/* check whether variable is dynamic */
|
||||||
|
|
|
@ -40,7 +40,9 @@ public abstract class CConfigurationDataProvider {
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public abstract CConfigurationData createConfiguration(ICConfigurationDescription des, CConfigurationData base, boolean clone) throws CoreException;
|
public abstract CConfigurationData createConfiguration(ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData baseData, boolean clone) throws CoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* called to notify the provider that the configuration is removed
|
* called to notify the provider that the configuration is removed
|
||||||
|
@ -60,5 +62,7 @@ public abstract class CConfigurationDataProvider {
|
||||||
* @return
|
* @return
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public abstract CConfigurationData applyConfiguration(ICConfigurationDescription des, CConfigurationData base) throws CoreException;
|
public abstract CConfigurationData applyConfiguration(ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData baseData) throws CoreException;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||||
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||||
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.CoreModelUtil;
|
import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||||
|
@ -54,7 +57,11 @@ import org.eclipse.cdt.core.settings.model.extension.CFileData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
||||||
|
import org.eclipse.cdt.internal.core.CdtVarPathEntryVariableManager;
|
||||||
import org.eclipse.cdt.internal.core.CharOperation;
|
import org.eclipse.cdt.internal.core.CharOperation;
|
||||||
|
import org.eclipse.cdt.internal.core.cdtvariables.CoreVariableSubstitutor;
|
||||||
|
import org.eclipse.cdt.internal.core.cdtvariables.DefaultVariableContextInfo;
|
||||||
|
import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
|
||||||
import org.eclipse.cdt.internal.core.model.APathEntry;
|
import org.eclipse.cdt.internal.core.model.APathEntry;
|
||||||
import org.eclipse.cdt.internal.core.model.CModelStatus;
|
import org.eclipse.cdt.internal.core.model.CModelStatus;
|
||||||
import org.eclipse.cdt.internal.core.model.PathEntry;
|
import org.eclipse.cdt.internal.core.model.PathEntry;
|
||||||
|
@ -62,6 +69,7 @@ import org.eclipse.cdt.internal.core.settings.model.CConfigurationDescriptionCac
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CExternalSetting;
|
import org.eclipse.cdt.internal.core.settings.model.CExternalSetting;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
import org.eclipse.cdt.internal.core.settings.model.IInternalCCfgInfo;
|
||||||
|
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFolder;
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -112,6 +120,24 @@ public class PathEntryTranslator {
|
||||||
private Map fResourceMap = new HashMap();
|
private Map fResourceMap = new HashMap();
|
||||||
private IWorkspaceRoot fRoot = ResourcesPlugin.getWorkspace().getRoot();
|
private IWorkspaceRoot fRoot = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
|
|
||||||
|
private static class VarSubstitutor extends CoreVariableSubstitutor {
|
||||||
|
ICConfigurationDescription fCfg;
|
||||||
|
ICdtVariableManager fMngr = CCorePlugin.getDefault().getCdtVariableManager();
|
||||||
|
|
||||||
|
public VarSubstitutor(ICConfigurationDescription cfg) {
|
||||||
|
super(new DefaultVariableContextInfo(ICoreVariableContextInfo.CONTEXT_CONFIGURATION, cfg), "", " "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
fCfg = cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ResolvedMacro resolveMacro(ICdtVariable macro)
|
||||||
|
throws CdtVariableException {
|
||||||
|
if(!CdtVarPathEntryVariableManager.isPathEntryVariable(macro, fCfg, fMngr))
|
||||||
|
return super.resolveMacro(macro);
|
||||||
|
return new ResolvedMacro(macro.getName(), CdtVariableResolver.createVariableReference(macro.getName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final class ReferenceSettingsInfo{
|
public static final class ReferenceSettingsInfo{
|
||||||
private IPath[] fRefProjPaths;
|
private IPath[] fRefProjPaths;
|
||||||
private ICExternalSetting[] fExtSettings;
|
private ICExternalSetting[] fExtSettings;
|
||||||
|
@ -390,7 +416,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(path != null){
|
if(path != null){
|
||||||
return new CLibraryFileEntry(path, flags);
|
return new CLibraryFileEntry(value.getName(), flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -407,7 +433,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(path != null){
|
if(path != null){
|
||||||
return new CIncludePathEntry(path, flags);
|
return new CIncludePathEntry(value.getName(), flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -431,7 +457,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(path != null){
|
if(path != null){
|
||||||
return new CIncludeFileEntry(path, flags);
|
return new CIncludeFileEntry(value.getName(), flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -444,7 +470,7 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(path != null){
|
if(path != null){
|
||||||
return new CMacroFileEntry(path, flags);
|
return new CMacroFileEntry(value.getName(), flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -563,6 +589,9 @@ public class PathEntryTranslator {
|
||||||
|
|
||||||
basePath = mngr.resolvePath(basePath);
|
basePath = mngr.resolvePath(basePath);
|
||||||
valuePath = mngr.resolvePath(valuePath);
|
valuePath = mngr.resolvePath(valuePath);
|
||||||
|
|
||||||
|
fName = unresolvedBase.append(unresolvedValue).toString();
|
||||||
|
fValue = fName;
|
||||||
|
|
||||||
if (!basePath.isEmpty()) {
|
if (!basePath.isEmpty()) {
|
||||||
IPath loc = basePath;
|
IPath loc = basePath;
|
||||||
|
@ -580,8 +609,6 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fLocation = loc.append(valuePath);
|
fLocation = loc.append(valuePath);
|
||||||
fName = unresolvedBase.append(unresolvedValue).toString();
|
|
||||||
fValue = fName;
|
|
||||||
// fName = fValuePath.toString();
|
// fName = fValuePath.toString();
|
||||||
// fValue = fValuePath.toString();
|
// fValue = fValuePath.toString();
|
||||||
break;
|
break;
|
||||||
|
@ -604,11 +631,12 @@ public class PathEntryTranslator {
|
||||||
fResourceInfo = rcInfo;
|
fResourceInfo = rcInfo;
|
||||||
// fFullPath = fResourceInfo.fRc.getFullPath();
|
// fFullPath = fResourceInfo.fRc.getFullPath();
|
||||||
// fLocation = fResourceInfo.fRc.getLocation();
|
// fLocation = fResourceInfo.fRc.getLocation();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fLocation = valuePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fLocation = valuePath;
|
||||||
}while(false);
|
}while(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -722,27 +750,30 @@ public class PathEntryTranslator {
|
||||||
private Set fFiltersSet;
|
private Set fFiltersSet;
|
||||||
private boolean fIsExported;
|
private boolean fIsExported;
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
|
private ICConfigurationDescription fCfg;
|
||||||
|
|
||||||
PathEntryComposer(String projName, IProject project){
|
PathEntryComposer(String projName, IProject project, ICConfigurationDescription cfg){
|
||||||
this(new Path(projName).makeAbsolute(), project);
|
this(new Path(projName).makeAbsolute(), project, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
PathEntryComposer(IPath path, IProject project){
|
PathEntryComposer(IPath path, IProject project, ICConfigurationDescription cfg){
|
||||||
fPath = toProjectPath(path);
|
fPath = toProjectPath(path);
|
||||||
fProject = project;
|
fProject = project;
|
||||||
|
fCfg = cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IPath toProjectPath(IPath path){
|
private static IPath toProjectPath(IPath path){
|
||||||
if(path.segmentCount() > 1)
|
if(path.segmentCount() > 1)
|
||||||
path = new Path(path.segment(0));
|
path = new Path(path.segment(0));
|
||||||
|
|
||||||
return path.makeAbsolute();
|
return path.makeAbsolute();
|
||||||
}
|
}
|
||||||
|
|
||||||
PathEntryComposer(ICExclusionPatternPathEntry entry, IProject project){
|
PathEntryComposer(ICExclusionPatternPathEntry entry, IProject project, ICConfigurationDescription cfg){
|
||||||
fPath = new Path(entry.getValue());
|
fPath = new Path(entry.getValue());
|
||||||
fLangEntry = entry;
|
fLangEntry = entry;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
|
fCfg = cfg;
|
||||||
IPath[] exclusions = entry.getExclusionPatterns();
|
IPath[] exclusions = entry.getExclusionPatterns();
|
||||||
if(exclusions.length != 0){
|
if(exclusions.length != 0){
|
||||||
fFiltersSet = new HashSet(exclusions.length);
|
fFiltersSet = new HashSet(exclusions.length);
|
||||||
|
@ -750,11 +781,12 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PathEntryComposer(IPath path, ICLanguageSettingEntry entry, boolean exported, IProject project){
|
PathEntryComposer(IPath path, ICLanguageSettingEntry entry, boolean exported, IProject project, ICConfigurationDescription cfg){
|
||||||
fPath = path;
|
fPath = path;
|
||||||
fLangEntry = entry;
|
fLangEntry = entry;
|
||||||
fIsExported = exported;
|
fIsExported = exported;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
|
fCfg = cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addFilter(IPath path){
|
public void addFilter(IPath path){
|
||||||
|
@ -778,32 +810,48 @@ public class PathEntryTranslator {
|
||||||
return new IPath[0];
|
return new IPath[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath[] getEntryPath(ICSettingEntry entry){
|
private IPath[] getEntryPath(ICSettingEntry entry, ICConfigurationDescription cfg){
|
||||||
return valueToEntryPath(entry.getName(), (entry.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0);
|
return valueToEntryPath(entry.getName(), (entry.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPath[] valueToEntryPath(String value, boolean isWsp){
|
private IPath[] valueToEntryPath(String value, boolean isWsp, ICConfigurationDescription cfg){
|
||||||
IPath path = new Path(value);
|
String pathVarValue = resolveKeepingPathEntryFars(value, cfg);
|
||||||
|
String resolvedValue = resolveAll(value, cfg);
|
||||||
|
IPath resolvedPath = new Path(resolvedValue);
|
||||||
|
IPath pathVarPath = new Path(pathVarValue);
|
||||||
IPath result[] = new IPath[2];
|
IPath result[] = new IPath[2];
|
||||||
if(isWsp){
|
if(isWsp){
|
||||||
if(!path.isAbsolute()){
|
if(!resolvedPath.isAbsolute()){
|
||||||
result[0] = fProject.getFullPath().makeRelative();
|
result[0] = fProject.getFullPath().makeRelative();
|
||||||
result[1] = path;
|
result[1] = pathVarPath;
|
||||||
path = fProject.getFullPath().append(path);
|
// path = fProject.getFullPath().append(path);
|
||||||
} else {
|
} else {
|
||||||
if(path.segmentCount() != 0){
|
if(resolvedPath.segmentCount() != 0){
|
||||||
result[0] = new Path(path.segment(0));
|
String projName = resolvedPath.segment(0);
|
||||||
result[1] = path.removeFirstSegments(1).makeRelative();
|
IPath valuePath = resolvedPath.removeFirstSegments(1).makeRelative();
|
||||||
|
if(pathVarPath.segmentCount() != 0){
|
||||||
|
String resolvedProjName = projName;
|
||||||
|
String varProjName = pathVarPath.segment(0);
|
||||||
|
IPath resolvedProjPath = CCorePlugin.getDefault().getPathEntryVariableManager().resolvePath(new Path(varProjName));
|
||||||
|
if(resolvedProjPath.segmentCount() == 1 && resolvedProjName.equals(resolvedProjPath.segment(0))){
|
||||||
|
projName = varProjName;
|
||||||
|
valuePath = pathVarPath.removeFirstSegments(1).makeRelative();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
result[0] = new Path(projName);
|
||||||
|
result[1] = valuePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// path = path.makeRelative();
|
// path = path.makeRelative();
|
||||||
} else {
|
} else {
|
||||||
if(!path.isAbsolute()){
|
if(!resolvedPath.isAbsolute()){
|
||||||
IPath location = fProject.getLocation();
|
IPath location = fProject.getLocation();
|
||||||
if(location != null)
|
if(location != null)
|
||||||
path = location.append(path);
|
pathVarPath = location.append(pathVarPath);
|
||||||
}
|
}
|
||||||
result[1] = path;
|
result[1] = pathVarPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -813,24 +861,24 @@ public class PathEntryTranslator {
|
||||||
if(fLangEntry != null){
|
if(fLangEntry != null){
|
||||||
switch(fLangEntry.getKind()){
|
switch(fLangEntry.getKind()){
|
||||||
case ICLanguageSettingEntry.INCLUDE_FILE:{
|
case ICLanguageSettingEntry.INCLUDE_FILE:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry);
|
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||||
return CoreModel.newIncludeFileEntry(fPath, null, paths[0], paths[1], getExclusionPatterns(), fIsExported);
|
return CoreModel.newIncludeFileEntry(fPath, null, paths[0], paths[1], getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.INCLUDE_PATH:{
|
case ICLanguageSettingEntry.INCLUDE_PATH:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry);
|
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||||
ICIncludePathEntry ipe = (ICIncludePathEntry)fLangEntry;
|
ICIncludePathEntry ipe = (ICIncludePathEntry)fLangEntry;
|
||||||
return CoreModel.newIncludeEntry(fPath, paths[0], paths[1], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
return CoreModel.newIncludeEntry(fPath, paths[0], paths[1], !ipe.isLocal(), getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.MACRO:
|
case ICLanguageSettingEntry.MACRO:
|
||||||
return CoreModel.newMacroEntry(fPath, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
return CoreModel.newMacroEntry(fPath, fLangEntry.getName(), fLangEntry.getValue(), getExclusionPatterns(), fIsExported);
|
||||||
case ICLanguageSettingEntry.MACRO_FILE:{
|
case ICLanguageSettingEntry.MACRO_FILE:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry);
|
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||||
return CoreModel.newMacroFileEntry(fPath, paths[0], null, paths[1], getExclusionPatterns(), fIsExported);
|
return CoreModel.newMacroFileEntry(fPath, paths[0], null, paths[1], getExclusionPatterns(), fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.LIBRARY_PATH:
|
case ICLanguageSettingEntry.LIBRARY_PATH:
|
||||||
return null;
|
return null;
|
||||||
case ICLanguageSettingEntry.LIBRARY_FILE:{
|
case ICLanguageSettingEntry.LIBRARY_FILE:{
|
||||||
IPath paths[] = getEntryPath(fLangEntry);
|
IPath paths[] = getEntryPath(fLangEntry, fCfg);
|
||||||
return CoreModel.newLibraryEntry(fPath, paths[0], paths[1], null, null, null, fIsExported);
|
return CoreModel.newLibraryEntry(fPath, paths[0], paths[1], null, null, null, fIsExported);
|
||||||
}
|
}
|
||||||
case ICLanguageSettingEntry.OUTPUT_PATH:
|
case ICLanguageSettingEntry.OUTPUT_PATH:
|
||||||
|
@ -847,29 +895,52 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String resolveAll(String value, ICConfigurationDescription cfg){
|
||||||
|
try {
|
||||||
|
return CCorePlugin.getDefault().getCdtVariableManager().resolveValue(value, "", " ", cfg);
|
||||||
|
} catch (CdtVariableException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String resolveKeepingPathEntryFars(String value, ICConfigurationDescription cfg){
|
||||||
|
try {
|
||||||
|
VarSubstitutor substitutor = new VarSubstitutor(cfg);
|
||||||
|
|
||||||
|
return CdtVariableResolver.resolveToString(value, substitutor);
|
||||||
|
} catch (CdtVariableException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
public static class PathEntryCollector {
|
public static class PathEntryCollector {
|
||||||
private PathSettingsContainer fStorage;
|
private PathSettingsContainer fStorage;
|
||||||
private KindBasedStore fStore;
|
private KindBasedStore fStore;
|
||||||
private LinkedHashMap fRefProjMap;
|
private LinkedHashMap fRefProjMap;
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
|
private ICConfigurationDescription fCfg;
|
||||||
|
|
||||||
private PathEntryCollector(IProject project){
|
private PathEntryCollector(IProject project, ICConfigurationDescription cfg){
|
||||||
fStorage = PathSettingsContainer.createRootContainer();
|
fStorage = PathSettingsContainer.createRootContainer();
|
||||||
fStorage.setValue(this);
|
fStorage.setValue(this);
|
||||||
fStore = new KindBasedStore(false);
|
fStore = new KindBasedStore(false);
|
||||||
|
fCfg = cfg;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project){
|
private PathEntryCollector(PathSettingsContainer container, KindBasedStore store, IProject project, ICConfigurationDescription cfg){
|
||||||
fStorage = container;
|
fStorage = container;
|
||||||
fStore = store;
|
fStore = store;
|
||||||
|
fCfg = cfg;
|
||||||
fProject = project;
|
fProject = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){
|
public void setSourceOutputEntries(int kind, ICExclusionPatternPathEntry entries[]){
|
||||||
Map map = getEntriesMap(kind, true);
|
Map map = getEntriesMap(kind, true);
|
||||||
for(int i = 0; i < entries.length; i++){
|
for(int i = 0; i < entries.length; i++){
|
||||||
map.put(entries[i], new PathEntryComposer(entries[i], fProject));
|
map.put(entries[i], new PathEntryComposer(entries[i], fProject, fCfg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,7 +950,7 @@ public class PathEntryTranslator {
|
||||||
else {
|
else {
|
||||||
fRefProjMap = new LinkedHashMap();
|
fRefProjMap = new LinkedHashMap();
|
||||||
for(int i = 0; i < paths.length; i++){
|
for(int i = 0; i < paths.length; i++){
|
||||||
PathEntryComposer cs = new PathEntryComposer(paths[i], fProject);
|
PathEntryComposer cs = new PathEntryComposer(paths[i], fProject, fCfg);
|
||||||
IPath path = cs.getPath();
|
IPath path = cs.getPath();
|
||||||
fRefProjMap.put(path, cs);
|
fRefProjMap.put(path, cs);
|
||||||
}
|
}
|
||||||
|
@ -906,7 +977,7 @@ public class PathEntryTranslator {
|
||||||
info[i].setInfo((LinkedHashMap)map.clone());
|
info[i].setInfo((LinkedHashMap)map.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PathEntryCollector newCr = new PathEntryCollector(newContainer, cloneStore, fProject);
|
PathEntryCollector newCr = new PathEntryCollector(newContainer, cloneStore, fProject, fCfg);
|
||||||
newContainer.setValue(newCr);
|
newContainer.setValue(newCr);
|
||||||
return newCr;
|
return newCr;
|
||||||
}
|
}
|
||||||
|
@ -944,7 +1015,7 @@ public class PathEntryTranslator {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ICLanguageSettingEntry entry = entries[i];
|
ICLanguageSettingEntry entry = entries[i];
|
||||||
map.put(entry, new PathEntryComposer(fullPath, entry, exportedEntries.contains(entry), fProject));
|
map.put(entry, new PathEntryComposer(fullPath, entry, exportedEntries.contains(entry), fProject, fCfg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2157,13 +2228,13 @@ public class PathEntryTranslator {
|
||||||
CConfigurationData data = des instanceof CConfigurationDescriptionCache ?
|
CConfigurationData data = des instanceof CConfigurationDescriptionCache ?
|
||||||
(CConfigurationData)des : ((IInternalCCfgInfo)des).getConfigurationData(false);
|
(CConfigurationData)des : ((IInternalCCfgInfo)des).getConfigurationData(false);
|
||||||
|
|
||||||
ReferenceSettingsInfo info = new ReferenceSettingsInfo(des);
|
ReferenceSettingsInfo refInfo = new ReferenceSettingsInfo(des);
|
||||||
|
|
||||||
return collectEntries(project, data, info);
|
// return collectEntries(project, data, info);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public static PathEntryCollector collectEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo){
|
// public static PathEntryCollector collectEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo){
|
||||||
final PathEntryCollector cr = new PathEntryCollector(project);
|
final PathEntryCollector cr = new PathEntryCollector(project, des);
|
||||||
PathSettingsContainer rcDatas = createRcDataHolder(data);
|
PathSettingsContainer rcDatas = createRcDataHolder(data);
|
||||||
IPath srcPaths[] = data.getSourcePaths();
|
IPath srcPaths[] = data.getSourcePaths();
|
||||||
ICSourceEntry sEntries[] = calculateSourceEntriesFromPaths(project, rcDatas, srcPaths);
|
ICSourceEntry sEntries[] = calculateSourceEntriesFromPaths(project, rcDatas, srcPaths);
|
||||||
|
@ -2250,8 +2321,9 @@ public class PathEntryTranslator {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IPathEntry[] getPathEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo, int flags){
|
// public static IPathEntry[] getPathEntries(IProject project, CConfigurationData data, ReferenceSettingsInfo refInfo, int flags){
|
||||||
PathEntryCollector cr = collectEntries(project, data, refInfo);
|
public static IPathEntry[] getPathEntries(IProject project, ICConfigurationDescription cfg, int flags){
|
||||||
|
PathEntryCollector cr = collectEntries(project, cfg);
|
||||||
return cr.getEntries(flags);
|
return cr.getEntries(flags);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -41,7 +41,6 @@ import org.eclipse.cdt.core.settings.model.extension.CFolderData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
|
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.impl.CDefaultConfigurationData;
|
|
||||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -99,7 +98,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
if(baseData instanceof CConfigurationDescriptionCache){
|
if(baseData instanceof CConfigurationDescriptionCache){
|
||||||
baseData = ((CConfigurationDescriptionCache)baseData).getConfigurationData();
|
baseData = ((CConfigurationDescriptionCache)baseData).getConfigurationData();
|
||||||
}
|
}
|
||||||
setData(CProjectDescriptionManager.getInstance().createData(this, baseData, false));
|
setData(CProjectDescriptionManager.getInstance().createData(this, base, baseData, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -138,8 +137,9 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
|
||||||
void doWritable() throws CoreException{
|
void doWritable() throws CoreException{
|
||||||
CConfigurationData data = getConfigurationData(false);
|
CConfigurationData data = getConfigurationData(false);
|
||||||
if(data instanceof CConfigurationDescriptionCache){
|
if(data instanceof CConfigurationDescriptionCache){
|
||||||
data = ((CConfigurationDescriptionCache)data).getConfigurationData();
|
CConfigurationDescriptionCache cache = (CConfigurationDescriptionCache)data;
|
||||||
setData(CProjectDescriptionManager.getInstance().createData(this, data, true));
|
data = cache.getConfigurationData();
|
||||||
|
setData(CProjectDescriptionManager.getInstance().createData(this, cache, data, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
fInitializing = false;
|
fInitializing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationDescriptionCache(CConfigurationData base, CConfigurationSpecSettings settingsBase, CProjectDescription parent, ICStorageElement rootEl, boolean saving) throws CoreException {
|
CConfigurationDescriptionCache(ICConfigurationDescription baseDescription, CConfigurationData base, CConfigurationSpecSettings settingsBase, CProjectDescription parent, ICStorageElement rootEl, boolean saving) throws CoreException {
|
||||||
super(base.getId(), base.getName(), null);
|
super(base.getId(), base.getName(), null);
|
||||||
fInitializing = true;
|
fInitializing = true;
|
||||||
fParent = parent;
|
fParent = parent;
|
||||||
|
@ -97,9 +97,10 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
|
||||||
|
|
||||||
if(base instanceof CConfigurationDescriptionCache){
|
if(base instanceof CConfigurationDescriptionCache){
|
||||||
fData = ((CConfigurationDescriptionCache)base).getConfigurationData();
|
fData = ((CConfigurationDescriptionCache)base).getConfigurationData();
|
||||||
fData = CProjectDescriptionManager.getInstance().applyData(this, fData);
|
fData = CProjectDescriptionManager.getInstance().applyData(this, baseDescription, fData);
|
||||||
} else {
|
} else {
|
||||||
base = CProjectDescriptionManager.getInstance().applyData(this, base);
|
fData = base;
|
||||||
|
base = CProjectDescriptionManager.getInstance().applyData(this, baseDescription, base);
|
||||||
fData = base;
|
fData = base;
|
||||||
}
|
}
|
||||||
fDataLoadded = true;
|
fDataLoadded = true;
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
if(baseData instanceof CConfigurationDescriptionCache){
|
if(baseData instanceof CConfigurationDescriptionCache){
|
||||||
baseData = ((CConfigurationDescriptionCache)baseData).getConfigurationData();
|
baseData = ((CConfigurationDescriptionCache)baseData).getConfigurationData();
|
||||||
}
|
}
|
||||||
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(baseData, cfgDes.getSpecSettings(), this, null, saving);
|
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache((ICConfigurationDescription)cfgDes, baseData, cfgDes.getSpecSettings(), this, null, saving);
|
||||||
configurationCreated(cache);
|
configurationCreated(cache);
|
||||||
} else {
|
} else {
|
||||||
CConfigurationData baseData = cfgDes.getConfigurationData(false);
|
CConfigurationData baseData = cfgDes.getConfigurationData(false);
|
||||||
|
|
|
@ -149,6 +149,7 @@ public class CProjectDescriptionManager {
|
||||||
private static final String DEFAULT_CFG_NAME = "Configuration"; //$NON-NLS-1$
|
private static final String DEFAULT_CFG_NAME = "Configuration"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final QualifiedName SCANNER_INFO_PROVIDER_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, "scannerInfoProvider"); //$NON-NLS-1$
|
private static final QualifiedName SCANNER_INFO_PROVIDER_PROPERTY = new QualifiedName(CCorePlugin.PLUGIN_ID, "scannerInfoProvider"); //$NON-NLS-1$
|
||||||
|
private static final QualifiedName LOAD_FLAG = new QualifiedName(CCorePlugin.PLUGIN_ID, "descriptionLoadded"); //$NON-NLS-1$
|
||||||
|
|
||||||
private class CompositeSafeRunnable implements ISafeRunnable {
|
private class CompositeSafeRunnable implements ISafeRunnable {
|
||||||
private List fRunnables = new ArrayList();
|
private List fRunnables = new ArrayList();
|
||||||
|
@ -376,7 +377,7 @@ public class CProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(des != null){
|
if(des != null){
|
||||||
if(setLoaddedDescription(project, des, false)){
|
if(setLoaddedDescriptionOnLoad(project, des)){
|
||||||
|
|
||||||
if(eDes != null)
|
if(eDes != null)
|
||||||
saveConversion(project, eDes, (CProjectDescription)des, new NullProgressMonitor());
|
saveConversion(project, eDes, (CProjectDescription)des, new NullProgressMonitor());
|
||||||
|
@ -414,6 +415,18 @@ public class CProjectDescriptionManager {
|
||||||
return des;
|
return des;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized boolean setLoaddedDescriptionOnLoad(IProject project, ICProjectDescription des){
|
||||||
|
des.setSessionProperty(LOAD_FLAG, Boolean.TRUE);
|
||||||
|
ICProjectDescription oldDes = getLoaddedDescription(project);
|
||||||
|
|
||||||
|
setLoaddedDescription(project, des, true);
|
||||||
|
|
||||||
|
if(oldDes == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return oldDes.getSessionProperty(LOAD_FLAG) == null;
|
||||||
|
}
|
||||||
|
|
||||||
private CProjectDescriptionEvent createLoaddedEvent(ICProjectDescription des){
|
private CProjectDescriptionEvent createLoaddedEvent(ICProjectDescription des){
|
||||||
return new CProjectDescriptionEvent(CProjectDescriptionEvent.LOADDED,
|
return new CProjectDescriptionEvent(CProjectDescriptionEvent.LOADDED,
|
||||||
null,
|
null,
|
||||||
|
@ -1304,9 +1317,9 @@ public class CProjectDescriptionManager {
|
||||||
return provider.loadConfiguration(des);
|
return provider.loadConfiguration(des);
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationData applyData(ICConfigurationDescription des, CConfigurationData base) throws CoreException {
|
CConfigurationData applyData(ICConfigurationDescription des, ICConfigurationDescription baseDescription, CConfigurationData base) throws CoreException {
|
||||||
CConfigurationDataProvider provider = getProvider(des);
|
CConfigurationDataProvider provider = getProvider(des);
|
||||||
return provider.applyConfiguration(des, base);
|
return provider.applyConfiguration(des, baseDescription, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeData(ICConfigurationDescription des, CConfigurationData data) throws CoreException{
|
void removeData(ICConfigurationDescription des, CConfigurationData data) throws CoreException{
|
||||||
|
@ -1314,9 +1327,9 @@ public class CProjectDescriptionManager {
|
||||||
provider.removeConfiguration(des, data);
|
provider.removeConfiguration(des, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
CConfigurationData createData(ICConfigurationDescription des, CConfigurationData base, boolean clone) throws CoreException{
|
CConfigurationData createData(ICConfigurationDescription des, ICConfigurationDescription baseDescription, CConfigurationData base, boolean clone) throws CoreException{
|
||||||
CConfigurationDataProvider provider = getProvider(des);
|
CConfigurationDataProvider provider = getProvider(des);
|
||||||
return provider.createConfiguration(des, base, clone);
|
return provider.createConfiguration(des, baseDescription, base, clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CConfigurationDataProvider getProvider(ICConfigurationDescription des) throws CoreException{
|
private CConfigurationDataProvider getProvider(ICConfigurationDescription des) throws CoreException{
|
||||||
|
@ -2583,7 +2596,7 @@ public class CProjectDescriptionManager {
|
||||||
rootParent.removeChild(rootEl);
|
rootParent.removeChild(rootEl);
|
||||||
ICStorageElement baseRootEl = settings.getRootStorageElement();
|
ICStorageElement baseRootEl = settings.getRootStorageElement();
|
||||||
rootEl = rootParent.importChild(baseRootEl);
|
rootEl = rootParent.importChild(baseRootEl);
|
||||||
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(baseData, cfgDes.getSpecSettings(), null, rootEl, true);
|
CConfigurationDescriptionCache cache = new CConfigurationDescriptionCache(des, baseData, cfgDes.getSpecSettings(), null, rootEl, true);
|
||||||
|
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,18 @@ public class DefaultConfigurationDataProvider extends
|
||||||
CConfigurationDataProvider {
|
CConfigurationDataProvider {
|
||||||
|
|
||||||
public CConfigurationData applyConfiguration(
|
public CConfigurationData applyConfiguration(
|
||||||
ICConfigurationDescription des, CConfigurationData base)
|
ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData base)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
//TODO: implement load/store
|
//TODO: implement load/store
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData createConfiguration(
|
public CConfigurationData createConfiguration(
|
||||||
ICConfigurationDescription des, CConfigurationData base,
|
ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData base,
|
||||||
boolean clone) throws CoreException {
|
boolean clone) throws CoreException {
|
||||||
//TODO: implement load/store
|
//TODO: implement load/store
|
||||||
CDefaultConfigurationData data = new CDefaultConfigurationData(des.getId(), des.getName(), base, null, clone);
|
CDefaultConfigurationData data = new CDefaultConfigurationData(des.getId(), des.getName(), base, null, clone);
|
||||||
|
|
|
@ -12,9 +12,7 @@ package org.eclipse.cdt.internal.core.settings.model;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
|
@ -220,7 +218,9 @@ public class PathEntryConfigurationDataProvider extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData applyConfiguration(
|
public CConfigurationData applyConfiguration(
|
||||||
ICConfigurationDescription des, CConfigurationData base)
|
ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData base)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
//TODO: check external/reference info here as well.
|
//TODO: check external/reference info here as well.
|
||||||
if(!fFactory.isModified(base))
|
if(!fFactory.isModified(base))
|
||||||
|
@ -229,8 +229,8 @@ public class PathEntryConfigurationDataProvider extends
|
||||||
|
|
||||||
|
|
||||||
IProject project = des.getProjectDescription().getProject();
|
IProject project = des.getProjectDescription().getProject();
|
||||||
ReferenceSettingsInfo refInfo = new ReferenceSettingsInfo(des);
|
// ReferenceSettingsInfo refInfo = new ReferenceSettingsInfo(des);
|
||||||
IPathEntry entries[] = PathEntryTranslator.getPathEntries(project, base, refInfo, PathEntryTranslator.INCLUDE_USER);
|
IPathEntry entries[] = PathEntryTranslator.getPathEntries(project, baseDescription, PathEntryTranslator.INCLUDE_USER);
|
||||||
CModelManager manager = CModelManager.getDefault();
|
CModelManager manager = CModelManager.getDefault();
|
||||||
ICProject cproject = manager.create(project);
|
ICProject cproject = manager.create(project);
|
||||||
IPathEntry[] curRawEntries = PathEntryManager.getDefault().getRawPathEntries(cproject);
|
IPathEntry[] curRawEntries = PathEntryManager.getDefault().getRawPathEntries(cproject);
|
||||||
|
@ -249,7 +249,9 @@ public class PathEntryConfigurationDataProvider extends
|
||||||
}
|
}
|
||||||
|
|
||||||
public CConfigurationData createConfiguration(
|
public CConfigurationData createConfiguration(
|
||||||
ICConfigurationDescription des, CConfigurationData base,
|
ICConfigurationDescription des,
|
||||||
|
ICConfigurationDescription baseDescription,
|
||||||
|
CConfigurationData base,
|
||||||
boolean clone) throws CoreException {
|
boolean clone) throws CoreException {
|
||||||
CfgData copy = new CfgData(des.getId(), des.getName(), base, clone);
|
CfgData copy = new CfgData(des.getId(), des.getName(), base, clone);
|
||||||
copy.setModified(false);
|
copy.setModified(false);
|
||||||
|
|
|
@ -19,9 +19,11 @@ import java.util.Set;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||||
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
|
||||||
import org.eclipse.cdt.core.resources.IPathEntryVariableChangeListener;
|
import org.eclipse.cdt.core.resources.IPathEntryVariableChangeListener;
|
||||||
import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
|
import org.eclipse.cdt.core.resources.IPathEntryVariableManager;
|
||||||
import org.eclipse.cdt.core.resources.PathEntryVariableChangeEvent;
|
import org.eclipse.cdt.core.resources.PathEntryVariableChangeEvent;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.internal.core.cdtvariables.ICdtVariableChangeListener;
|
import org.eclipse.cdt.internal.core.cdtvariables.ICdtVariableChangeListener;
|
||||||
import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
|
import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
|
||||||
import org.eclipse.cdt.internal.core.cdtvariables.UserDefinedVariableSupplier;
|
import org.eclipse.cdt.internal.core.cdtvariables.UserDefinedVariableSupplier;
|
||||||
|
@ -129,6 +131,23 @@ public class CdtVarPathEntryVariableManager implements
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isPathEntryVariable(ICdtVariable var, ICConfigurationDescription cfg){
|
||||||
|
return isPathEntryVariable(var, cfg, CCorePlugin.getDefault().getCdtVariableManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isPathEntryVariable(ICdtVariable var, ICConfigurationDescription cfg, ICdtVariableManager mngr){
|
||||||
|
if(mngr.isUserVariable(var, cfg))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(!mngr.isUserVariable(var, null))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(getVariablePath(var) == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getVariableNames() {
|
public String[] getVariableNames() {
|
||||||
ICdtVariable[] vars = fUserVarSupplier.getMacros(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
|
ICdtVariable[] vars = fUserVarSupplier.getMacros(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null);
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
|
|
|
@ -17,7 +17,16 @@ import org.eclipse.cdt.utils.cdtvariables.IVariableContextInfo;
|
||||||
import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableManager;
|
import org.eclipse.cdt.utils.cdtvariables.SupplierBasedCdtVariableManager;
|
||||||
|
|
||||||
public class BuildSystemVariableSupplier extends CoreMacroSupplierBase {
|
public class BuildSystemVariableSupplier extends CoreMacroSupplierBase {
|
||||||
|
private static BuildSystemVariableSupplier fInstance;
|
||||||
|
private BuildSystemVariableSupplier(){
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BuildSystemVariableSupplier getInstance(){
|
||||||
|
if(fInstance == null){
|
||||||
|
fInstance = new BuildSystemVariableSupplier();
|
||||||
|
}
|
||||||
|
return fInstance;
|
||||||
|
}
|
||||||
private class ExtensionMacroProvider extends CdtVariableManager{
|
private class ExtensionMacroProvider extends CdtVariableManager{
|
||||||
private IVariableContextInfo fStartInfo;
|
private IVariableContextInfo fStartInfo;
|
||||||
private int fContextType;
|
private int fContextType;
|
||||||
|
|
|
@ -31,6 +31,7 @@ public class CdtVariableManager implements ICdtVariableManager {
|
||||||
static private CdtVariableManager fDefault;
|
static private CdtVariableManager fDefault;
|
||||||
|
|
||||||
public static UserDefinedVariableSupplier fUserDefinedMacroSupplier = UserDefinedVariableSupplier.getInstance();
|
public static UserDefinedVariableSupplier fUserDefinedMacroSupplier = UserDefinedVariableSupplier.getInstance();
|
||||||
|
public static BuildSystemVariableSupplier fBuildSystemVariableSupplier = BuildSystemVariableSupplier.getInstance();
|
||||||
public static EnvironmentVariableSupplier fEnvironmentMacroSupplier = EnvironmentVariableSupplier.getInstance();
|
public static EnvironmentVariableSupplier fEnvironmentMacroSupplier = EnvironmentVariableSupplier.getInstance();
|
||||||
public static CdtMacroSupplier fCdtMacroSupplier = CdtMacroSupplier.getInstance();
|
public static CdtMacroSupplier fCdtMacroSupplier = CdtMacroSupplier.getInstance();
|
||||||
public static EclipseVariablesVariableSupplier fEclipseVariablesMacroSupplier = EclipseVariablesVariableSupplier.getInstance();
|
public static EclipseVariablesVariableSupplier fEclipseVariablesMacroSupplier = EclipseVariablesVariableSupplier.getInstance();
|
||||||
|
@ -199,6 +200,12 @@ public class CdtVariableManager implements ICdtVariableManager {
|
||||||
|
|
||||||
public boolean isUserVariable(ICdtVariable variable,
|
public boolean isUserVariable(ICdtVariable variable,
|
||||||
ICConfigurationDescription cfg) {
|
ICConfigurationDescription cfg) {
|
||||||
return variable instanceof StorableCdtVariable;
|
if(!(variable instanceof StorableCdtVariable))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(cfg != null)
|
||||||
|
return UserDefinedVariableSupplier.getInstance().containsVariable(ICoreVariableContextInfo.CONTEXT_CONFIGURATION, cfg, variable);
|
||||||
|
|
||||||
|
return UserDefinedVariableSupplier.getInstance().containsVariable(ICoreVariableContextInfo.CONTEXT_WORKSPACE, null, variable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class DefaultVariableContextInfo implements ICoreVariableContextInfo {
|
||||||
if(data instanceof ICConfigurationDescription){
|
if(data instanceof ICConfigurationDescription){
|
||||||
return new ICdtVariableSupplier[]{
|
return new ICdtVariableSupplier[]{
|
||||||
CdtVariableManager.fUserDefinedMacroSupplier,
|
CdtVariableManager.fUserDefinedMacroSupplier,
|
||||||
|
CdtVariableManager.fBuildSystemVariableSupplier,
|
||||||
CdtVariableManager.fEnvironmentMacroSupplier,
|
CdtVariableManager.fEnvironmentMacroSupplier,
|
||||||
CdtVariableManager.fCdtMacroSupplier
|
CdtVariableManager.fCdtMacroSupplier
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariable;
|
||||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
|
import org.eclipse.cdt.internal.core.cdtvariables.UserDefinedVariableSupplier.VarKey;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
|
import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
|
||||||
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver;
|
||||||
|
|
||||||
|
@ -375,4 +376,16 @@ public class StorableCdtVariables {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean contains(ICdtVariable var){
|
||||||
|
ICdtVariable curVar = getMacro(var.getName());
|
||||||
|
if(curVar == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(new VarKey(curVar, false).equals(new VarKey(var, false)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class VarKey {
|
static class VarKey {
|
||||||
private ICdtVariable fVar;
|
private ICdtVariable fVar;
|
||||||
private boolean fNameOnly;
|
private boolean fNameOnly;
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
StorableCdtVariables macros = loadNewStileWorkspaceMacros();
|
StorableCdtVariables macros = loadNewStileWorkspaceMacros();
|
||||||
|
|
||||||
//now load PathEntry Variables from preferences
|
//now load PathEntry Variables from preferences
|
||||||
|
loadPathEntryVariables(macros);
|
||||||
|
|
||||||
return macros;
|
return macros;
|
||||||
}
|
}
|
||||||
|
@ -672,4 +672,15 @@ public class UserDefinedVariableSupplier extends CoreMacroSupplierBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean containsVariable(int context, Object data, ICdtVariable var){
|
||||||
|
ICdtVariable varContained = getMacro(var.getName(), context, data);
|
||||||
|
if(varContained == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if(new VarKey(varContained, false).equals(new VarKey(var, false)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue