mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
1. Initial fix for [Bug 174936] [Scanner Discovery] Per file scanner discovery is broken with the New Project Model functionality
2. Fix for [Bug 176301] Imported executables no longer recognized as binaries 3. Other bug-fixes
This commit is contained in:
parent
65b8b57333
commit
9734e3bb45
32 changed files with 1678 additions and 166 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 QNX Software Systems and others.
|
||||
* Copyright (c) 2004, 2007 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -16,6 +16,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.w3c.dom.Element;
|
||||
|
@ -74,6 +75,17 @@ public interface IDiscoveredPathManager {
|
|||
boolean isEmpty(IPath path);
|
||||
}
|
||||
|
||||
interface IPerFileDiscoveredPathInfo2 extends IPerFileDiscoveredPathInfo {
|
||||
/**
|
||||
* returns the map containing {@link IResource} - to - {@link PathInfo} pairs representing
|
||||
* complete set of discovered information for the whole project
|
||||
*
|
||||
* @return Map
|
||||
*/
|
||||
Map getPathInfoMap();
|
||||
}
|
||||
|
||||
|
||||
interface IDiscoveredScannerInfoSerializable {
|
||||
/**
|
||||
* Serialize discovered scanner info to an XML element
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -63,6 +63,8 @@ public interface IScannerConfigBuilderInfo2 {
|
|||
String getProviderOpenFilePath(String providerId);
|
||||
void setProviderOpenFilePath(String providerId, String filePath);
|
||||
|
||||
InfoContext getContext();
|
||||
|
||||
/**
|
||||
* Persist the buildInfo.
|
||||
* @throws CoreException
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.make.core.scannerconfig;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public final class PathInfo {
|
||||
private static final Path[] EMPTY_PATH_ARRAY = new Path[0];
|
||||
private static int EMPTY_CODE = 53;
|
||||
|
||||
private IPath[] fIncludePaths;
|
||||
private IPath[] fQuoteIncludePaths;
|
||||
private HashMap fSymbols;
|
||||
private IPath[] fIncludeFiles;
|
||||
private IPath[] fMacroFiles;
|
||||
private int fHash;
|
||||
|
||||
public PathInfo(IPath[] includePaths,
|
||||
IPath[] quoteIncludePaths,
|
||||
Map symbols,
|
||||
IPath[] includeFiles,
|
||||
IPath[] macroFiles){
|
||||
fIncludePaths = includePaths != null && includePaths.length != 0 ? (IPath[])includePaths.clone() : EMPTY_PATH_ARRAY;
|
||||
fQuoteIncludePaths = quoteIncludePaths != null && quoteIncludePaths.length != 0 ? (IPath[])quoteIncludePaths.clone() : EMPTY_PATH_ARRAY;
|
||||
fSymbols = symbols != null && symbols.size() != 0 ? new HashMap(symbols) : new HashMap(0);
|
||||
fIncludeFiles = includeFiles != null && includeFiles.length != 0 ? (IPath[])includeFiles.clone() : EMPTY_PATH_ARRAY;
|
||||
fMacroFiles = macroFiles != null && macroFiles.length != 0 ? (IPath[])macroFiles.clone() : EMPTY_PATH_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get include paths
|
||||
*/
|
||||
public IPath[] getIncludePaths(){
|
||||
return fIncludePaths.length != 0 ? (IPath[])fIncludePaths.clone() : EMPTY_PATH_ARRAY;
|
||||
}
|
||||
/**
|
||||
* Get quote include paths (for #include "...")
|
||||
*/
|
||||
public IPath[] getQuoteIncludePaths(){
|
||||
return fQuoteIncludePaths.length != 0 ? (IPath[])fQuoteIncludePaths.clone() : EMPTY_PATH_ARRAY;
|
||||
}
|
||||
/**
|
||||
* Get defined symbols
|
||||
*/
|
||||
public Map getSymbols(){
|
||||
return (Map)fSymbols.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get include files (gcc option -include)
|
||||
*/
|
||||
public IPath[] getIncludeFiles(){
|
||||
return fIncludeFiles.length != 0 ? (IPath[])fIncludeFiles.clone() : EMPTY_PATH_ARRAY;
|
||||
}
|
||||
/**
|
||||
* Get macro files (gcc option -imacros)
|
||||
*/
|
||||
public IPath[] getMacroFiles(){
|
||||
return fMacroFiles.length != 0 ? (IPath[])fMacroFiles.clone() : EMPTY_PATH_ARRAY;
|
||||
}
|
||||
/**
|
||||
* Returns if there is any discovered scanner info
|
||||
*/
|
||||
public boolean isEmpty(){
|
||||
return fIncludePaths.length == 0
|
||||
&& fQuoteIncludePaths.length == 0
|
||||
&& fSymbols.size() == 0
|
||||
&& fIncludeFiles.length == 0
|
||||
&& fMacroFiles.length == 0;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if(this == obj)
|
||||
return true;
|
||||
|
||||
if(!(obj instanceof PathInfo))
|
||||
return false;
|
||||
|
||||
PathInfo other = (PathInfo)obj;
|
||||
|
||||
if(!Arrays.equals(fIncludePaths, other.fIncludePaths))
|
||||
return false;
|
||||
if(!Arrays.equals(fQuoteIncludePaths, other.fQuoteIncludePaths))
|
||||
return false;
|
||||
if(!fSymbols.equals(other.fSymbols))
|
||||
return false;
|
||||
if(!Arrays.equals(fIncludeFiles, other.fIncludeFiles))
|
||||
return false;
|
||||
if(!Arrays.equals(fMacroFiles, other.fMacroFiles))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hash = fHash;
|
||||
if(hash == 0){
|
||||
hash = EMPTY_CODE;
|
||||
|
||||
if(fIncludePaths.length != 0){
|
||||
for(int i = 0; i < fIncludePaths.length; i++){
|
||||
hash += fIncludePaths[i].hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
if(fQuoteIncludePaths.length != 0){
|
||||
for(int i = 0; i < fQuoteIncludePaths.length; i++){
|
||||
hash += fQuoteIncludePaths[i].hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
hash += fSymbols.hashCode();
|
||||
|
||||
if(fIncludeFiles.length != 0){
|
||||
for(int i = 0; i < fIncludeFiles.length; i++){
|
||||
hash += fIncludeFiles[i].hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
if(fMacroFiles.length != 0){
|
||||
for(int i = 0; i < fMacroFiles.length; i++){
|
||||
hash += fMacroFiles[i].hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
fHash = hash;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -141,9 +141,9 @@ public class ScannerInfoConsoleParserFactory {
|
|||
IScannerConfigBuilderInfo2 scBuildInfo,
|
||||
IMarkerGenerator markerGenerator,
|
||||
IScannerInfoCollector collector) {
|
||||
try {
|
||||
// try {
|
||||
// get the SC builder settings
|
||||
if (currentProject.hasNature(ScannerConfigNature.NATURE_ID)) {
|
||||
/*if (currentProject.hasNature(ScannerConfigNature.NATURE_ID))*/ {
|
||||
if (scBuildInfo == null) {
|
||||
try {
|
||||
IScannerConfigBuilderInfo2Set container = ScannerConfigProfileManager.
|
||||
|
@ -171,10 +171,10 @@ public class ScannerInfoConsoleParserFactory {
|
|||
IScannerInfoConsoleParser[] {clParser});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CoreException e) {
|
||||
MakeCorePlugin.log(e.getStatus());
|
||||
}
|
||||
// }
|
||||
// catch (CoreException e) {
|
||||
// MakeCorePlugin.log(e.getStatus());
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -38,7 +38,7 @@ public class BuildOutputReaderJob extends Job {
|
|||
* @param buildInfo
|
||||
*/
|
||||
public BuildOutputReaderJob(IProject project, IScannerConfigBuilderInfo2 buildInfo) {
|
||||
this(project, new InfoContext(project), buildInfo);
|
||||
this(project, buildInfo.getContext(), buildInfo);
|
||||
}
|
||||
|
||||
public BuildOutputReaderJob(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo) {
|
||||
|
@ -58,7 +58,7 @@ public class BuildOutputReaderJob extends Job {
|
|||
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
|
||||
project.getName());
|
||||
|
||||
boolean rc = SCJobsUtil.readBuildOutputFile(project, buildInfo, new SubProgressMonitor(monitor, 70));
|
||||
boolean rc = SCJobsUtil.readBuildOutputFile(project, context, buildInfo, new SubProgressMonitor(monitor, 70));
|
||||
rc |= SCJobsUtil.getProviderScannerInfo(project, context, buildInfo, new SubProgressMonitor(monitor, 20));
|
||||
if (rc) {
|
||||
rc = SCJobsUtil.updateScannerConfiguration(project, context, buildInfo, new SubProgressMonitor(monitor, 10));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2005 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -188,7 +188,7 @@ public class SCJobsUtil {
|
|||
ISafeRunnable runnable = new ISafeRunnable() {
|
||||
|
||||
public void run() {
|
||||
esiProvider.invokeProvider(monitor, project, null, buildInfo, collector);
|
||||
esiProvider.invokeProvider(monitor, project, context, null, buildInfo, collector, null);
|
||||
rc.set(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2006 IBM Corporation and others.
|
||||
* Copyright (c) 2004, 2007 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -25,6 +25,7 @@ import java.util.TreeSet;
|
|||
import java.util.Map.Entry;
|
||||
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
|
@ -32,6 +33,7 @@ import org.eclipse.cdt.make.core.scannerconfig.ScannerInfoTypes;
|
|||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo2;
|
||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
||||
|
@ -576,7 +578,7 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
*
|
||||
* @author vhirsl
|
||||
*/
|
||||
public class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo {
|
||||
public class PerFileDiscoveredPathInfo implements IPerFileDiscoveredPathInfo2 {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo#getProject()
|
||||
*/
|
||||
|
@ -712,6 +714,59 @@ public class PerFileSICollector implements IScannerInfoCollector3, IScannerInfoC
|
|||
return rc;
|
||||
}
|
||||
|
||||
public Map getPathInfoMap() {
|
||||
//TODO: do we need to cache this?
|
||||
return calculatePathInfoMap();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map calculatePathInfoMap(){
|
||||
Map map = new HashMap(sid.fileToCommandIdMap.size() + 1);
|
||||
Map.Entry entry;
|
||||
IFile file;
|
||||
CCommandDSC cmd;
|
||||
PathInfo fpi;
|
||||
for(Iterator iter = sid.fileToCommandIdMap.entrySet().iterator(); iter.hasNext();){
|
||||
entry = (Map.Entry)iter.next();
|
||||
file = (IFile)entry.getKey();
|
||||
if(file != null){
|
||||
cmd = (CCommandDSC)sid.commandIdCommandMap.get(entry.getValue());
|
||||
if(cmd != null){
|
||||
fpi = createFilePathInfo(cmd);
|
||||
map.put(file, fpi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(project != null){
|
||||
if(psi == null){
|
||||
generateProjectScannerInfo();
|
||||
}
|
||||
|
||||
fpi = new PathInfo(psi.includePaths, psi.quoteIncludePaths, psi.definedSymbols, psi.includeFiles, psi.macrosFiles);
|
||||
map.put(project, fpi);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private PathInfo createFilePathInfo(CCommandDSC cmd){
|
||||
IPath[] includes = stringListToPathArray(cmd.getIncludes());
|
||||
IPath[] quotedIncludes = stringListToPathArray(cmd.getQuoteIncludes());
|
||||
IPath[] incFiles = stringListToPathArray(cmd.getIncludeFile());
|
||||
IPath[] macroFiles = stringListToPathArray(cmd.getImacrosFile());
|
||||
List symbols = cmd.getSymbols();
|
||||
Map definedSymbols = new HashMap(symbols.size());
|
||||
for (Iterator i = symbols.iterator(); i.hasNext(); ) {
|
||||
String symbol = (String) i.next();
|
||||
String key = ScannerConfigUtil.getSymbolKey(symbol);
|
||||
String value = ScannerConfigUtil.getSymbolValue(symbol);
|
||||
definedSymbols.put(key, value);
|
||||
}
|
||||
|
||||
return new PathInfo(includes, quotedIncludes, definedSymbols, incFiles, macroFiles);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1095,6 +1095,10 @@ public class ScannerConfigInfoFactory2 {
|
|||
// runDescriptorOperation(project, op, null);
|
||||
// }
|
||||
}
|
||||
|
||||
public InfoContext getContext(){
|
||||
return context;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1294,6 +1298,9 @@ public class ScannerConfigInfoFactory2 {
|
|||
prefsContainer.save();
|
||||
}
|
||||
|
||||
public InfoContext getContext(){
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
public static IScannerConfigBuilderInfo2 create(IProject project, String profileId) throws CoreException {
|
||||
|
|
|
@ -31,4 +31,6 @@ public interface ICfgScannerConfigBuilderInfo2Set {
|
|||
IScannerConfigBuilderInfo2 applyInfo(CfgInfoContext context, IScannerConfigBuilderInfo2 base) throws CoreException;
|
||||
|
||||
IConfiguration getConfiguration();
|
||||
|
||||
boolean isProfileSupported(CfgInfoContext context, String profileId);
|
||||
}
|
||||
|
|
|
@ -10,21 +10,35 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.internal.core.scannerconfig;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||
import org.eclipse.cdt.build.core.scannerconfig.ScannerConfigBuilder;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig.PerFileSettingsCalculator.ILangSettingInfo;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig.PerFileSettingsCalculator.IRcSettingInfo;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.PerFileSICollector;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
|
@ -32,6 +46,9 @@ import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
|||
import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFileData;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFolderData;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildLanguageData;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||
|
@ -40,6 +57,7 @@ import org.eclipse.core.resources.IWorkspace;
|
|||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
|
||||
|
@ -50,6 +68,18 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
|
||||
private IDiscoveredPathManager fBaseMngr;
|
||||
|
||||
private static class ContextInfo {
|
||||
|
||||
public ContextInfo() {
|
||||
}
|
||||
CfgInfoContext fInitialContext;
|
||||
CfgInfoContext fCacheContext;
|
||||
CfgInfoContext fLoadContext;
|
||||
ICfgScannerConfigBuilderInfo2Set fCfgInfo;
|
||||
IScannerConfigBuilderInfo2 fInfo;
|
||||
boolean fIsFerFileCache;
|
||||
}
|
||||
|
||||
private CfgDiscoveredPathManager() {
|
||||
fBaseMngr = MakeCorePlugin.getDefault().getDiscoveryManager();
|
||||
}
|
||||
|
@ -111,15 +141,17 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
}
|
||||
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo getDiscoveredInfo(IProject project,
|
||||
public PathInfo getDiscoveredInfo(IProject project,
|
||||
CfgInfoContext context) throws CoreException {
|
||||
|
||||
context = adjustContext(context);
|
||||
ContextInfo cInfo = getContextInfo(context);
|
||||
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo info = getCachedPathInfo(context);
|
||||
PathInfo info = getCachedPathInfo(cInfo);
|
||||
if (info == null) {
|
||||
info = loadPathInfo(project, context.getConfiguration(), context);
|
||||
setCachedPathInfo(context, info);
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo baseInfo = loadPathInfo(project, context.getConfiguration(), cInfo);
|
||||
|
||||
info = resolveCacheBaseDiscoveredInfo(cInfo, baseInfo);
|
||||
// setCachedPathInfo(context, info);
|
||||
// if(info instanceof DiscoveredPathInfo && !((DiscoveredPathInfo)info).isLoadded()){
|
||||
// info = createPathInfo(project, context);
|
||||
// setCachedPathInfo(context, info);
|
||||
|
@ -128,17 +160,106 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return info;
|
||||
}
|
||||
|
||||
private IDiscoveredPathManager.IDiscoveredPathInfo loadPathInfo(IProject project, IConfiguration cfg, CfgInfoContext context) throws CoreException{
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo info = fBaseMngr.getDiscoveredInfo(cfg.getOwner().getProject(), context.toInfoContext());
|
||||
if(!DiscoveredScannerInfoStore.getInstance().hasInfo(project, context.toInfoContext(), info.getSerializable())){
|
||||
setCachedPathInfo(context, info);
|
||||
ICfgScannerConfigBuilderInfo2Set container = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(context.getConfiguration());
|
||||
IScannerConfigBuilderInfo2 buildInfo = container.getInfo(context);
|
||||
// private void adjustPerRcContextInfo(ContextInfo cInfo){
|
||||
// cInfo.fIsFerFileCache = true;
|
||||
// cInfo.fCacheContext = cInfo.fInitialContext;
|
||||
// cInfo.fLoadContext = new CfgInfoContext(cInfo.fInitialContext.getConfiguration());
|
||||
// }
|
||||
|
||||
private PathInfo resolveCacheBaseDiscoveredInfo(ContextInfo cInfo, IDiscoveredPathManager.IDiscoveredPathInfo baseInfo){
|
||||
if(cInfo.fIsFerFileCache){
|
||||
if(baseInfo instanceof IDiscoveredPathManager.IPerFileDiscoveredPathInfo2){
|
||||
resolveCachePerFileInfo(cInfo.fLoadContext.getConfiguration(), (IDiscoveredPathManager.IPerFileDiscoveredPathInfo2)baseInfo);
|
||||
}
|
||||
return getCachedPathInfo(cInfo);
|
||||
}
|
||||
|
||||
Map map = baseInfo.getSymbols();
|
||||
IPath paths[] = baseInfo.getIncludePaths();
|
||||
|
||||
PathInfo info = new PathInfo(paths, null, map, null, null);
|
||||
setCachedPathInfo(cInfo.fCacheContext, info);
|
||||
return info;
|
||||
}
|
||||
|
||||
private void resolveCachePerFileInfo(IConfiguration cfg, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 info){
|
||||
CConfigurationData data = cfg.getConfigurationData();
|
||||
if(data == null)
|
||||
return;
|
||||
|
||||
PerFileSettingsCalculator calculator = new PerFileSettingsCalculator();
|
||||
IRcSettingInfo[] rcInfos = calculator.getSettingInfos(data, info);
|
||||
|
||||
CResourceData rcDatas[] = data.getResourceDatas();
|
||||
Map rcDataMap = new HashMap(rcDatas.length);
|
||||
CResourceData rcData;
|
||||
for(int i = 0; i < rcDatas.length; i++){
|
||||
rcData = rcDatas[i];
|
||||
rcDataMap.put(rcData.getPath(), rcData);
|
||||
}
|
||||
|
||||
IRcSettingInfo rcInfo;
|
||||
|
||||
for(int i = 0; i < rcInfos.length; i++){
|
||||
rcInfo = rcInfos[i];
|
||||
rcData = rcInfo.getResourceData();
|
||||
|
||||
rcDataMap.remove(rcData.getPath());
|
||||
cache(rcInfo);
|
||||
}
|
||||
|
||||
if(!rcDataMap.isEmpty()){
|
||||
for(Iterator iter = rcDataMap.values().iterator(); iter.hasNext();){
|
||||
clearCache((CResourceData)iter.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void cache(IRcSettingInfo rcSetting){
|
||||
CResourceData rcData = rcSetting.getResourceData();
|
||||
clearCache(rcData);
|
||||
ILangSettingInfo lInfos[] = rcSetting.getLangInfos();
|
||||
for(int i = 0; i < lInfos.length; i++){
|
||||
cache(lInfos[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void cache(ILangSettingInfo lInfo){
|
||||
BuildLanguageData bld = (BuildLanguageData)lInfo.getLanguageData();
|
||||
((Tool)bld.getTool()).setDiscoveredPathInfo(bld.getInputType(), lInfo.getFilePathInfo());
|
||||
}
|
||||
|
||||
private void clearCache(CResourceData rcData){
|
||||
if(rcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
IFileInfo fiInfo = ((BuildFileData)rcData).getFileInfo();
|
||||
ITool tools[] = fiInfo.getTools();
|
||||
clearCache(tools);
|
||||
} else {
|
||||
IFolderInfo foInfo = ((BuildFolderData)rcData).getFolderInfo();
|
||||
ITool[] tools = foInfo.getTools();
|
||||
clearCache(tools);
|
||||
}
|
||||
}
|
||||
|
||||
private void clearCache(ITool[] tools){
|
||||
for(int i = 0; i < tools.length; i++){
|
||||
((Tool)tools[i]).clearAllDiscoveredInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private IDiscoveredPathManager.IDiscoveredPathInfo loadPathInfo(IProject project, IConfiguration cfg, ContextInfo cInfo) throws CoreException{
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo info = fBaseMngr.getDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext());
|
||||
if(!DiscoveredScannerInfoStore.getInstance().hasInfo(project, cInfo.fLoadContext.toInfoContext(), info.getSerializable())){
|
||||
// setCachedPathInfo(context, info);
|
||||
ICfgScannerConfigBuilderInfo2Set container = cInfo.fCfgInfo;
|
||||
IScannerConfigBuilderInfo2 buildInfo = container.getInfo(cInfo.fLoadContext);
|
||||
if(buildInfo != null){
|
||||
SCProfileInstance instance = ScannerConfigBuilder.build(context, buildInfo, 0, null, new NullProgressMonitor());
|
||||
SCProfileInstance instance = ScannerConfigBuilder.build(cInfo.fLoadContext, buildInfo, 0, null, new NullProgressMonitor());
|
||||
if(instance != null){
|
||||
|
||||
IScannerInfoCollector newC = instance.getScannerInfoCollector();
|
||||
if(newC instanceof IScannerInfoCollector2){
|
||||
if(newC instanceof IScannerInfoCollector2
|
||||
&& !(newC instanceof PerFileSICollector)){
|
||||
info = ((IScannerInfoCollector2)newC).createPathInfoObject();
|
||||
// setCachedPathInfo(context, info);
|
||||
}
|
||||
|
@ -148,90 +269,141 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return info;
|
||||
}
|
||||
|
||||
private IDiscoveredPathManager.IDiscoveredPathInfo getCachedPathInfo(CfgInfoContext context){
|
||||
ICfgScannerConfigBuilderInfo2Set cfgInfo = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(context.getConfiguration());
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo info = null;
|
||||
boolean queryCfg = !cfgInfo.isPerRcTypeDiscovery();
|
||||
if(!queryCfg){
|
||||
Tool tool = (Tool)context.getTool();
|
||||
if(tool != null){
|
||||
info = tool.getDiscoveredPathInfo(context.getInputType());
|
||||
} else {
|
||||
queryCfg = true;
|
||||
}
|
||||
}
|
||||
if(queryCfg) {
|
||||
info = ((Configuration)context.getConfiguration()).getDiscoveredPathInfo();
|
||||
}
|
||||
private PathInfo getCachedPathInfo(ContextInfo cInfo){
|
||||
// ICfgScannerConfigBuilderInfo2Set cfgInfo = cInfo.fCfgInfo;
|
||||
PathInfo info = getCachedPathInfo((Configuration)cInfo.fCacheContext.getConfiguration(),
|
||||
(Tool)cInfo.fCacheContext.getTool(), cInfo.fCacheContext.getInputType(), true);
|
||||
// boolean queryCfg = !cfgInfo.isPerRcTypeDiscovery();
|
||||
// if(!queryCfg){
|
||||
// Tool tool = (Tool)context.getTool();
|
||||
// if(tool != null){
|
||||
// info = tool.getDiscoveredPathInfo(context.getInputType());
|
||||
// } else {
|
||||
// queryCfg = true;
|
||||
// }
|
||||
// }
|
||||
// if(queryCfg) {
|
||||
// info = ((Configuration)context.getConfiguration()).getDiscoveredPathInfo();
|
||||
// }
|
||||
return info;
|
||||
}
|
||||
|
||||
private CfgInfoContext adjustContext(CfgInfoContext context){
|
||||
return adjustContext(context, null);
|
||||
|
||||
private PathInfo getCachedPathInfo(Configuration cfg, Tool tool, IInputType inType, boolean queryParent){
|
||||
PathInfo info = null;
|
||||
boolean queryCfg = false;
|
||||
if(tool != null){
|
||||
info = tool.getDiscoveredPathInfo(inType);
|
||||
if(info == null && queryParent){
|
||||
IResourceInfo rcInfo = tool.getParentResourceInfo();
|
||||
ITool superTool = tool.getSuperClass();
|
||||
if(!superTool.isExtensionElement()){
|
||||
if(inType != null){
|
||||
IInputType superInType = null;
|
||||
String exts[] = inType.getSourceExtensions(tool);
|
||||
for(int i = 0; i < exts.length; i++){
|
||||
superInType = superTool.getInputType(exts[i]);
|
||||
if(superInType != null)
|
||||
break;
|
||||
}
|
||||
if(superInType != null){
|
||||
info = getCachedPathInfo(cfg, (Tool)superTool, superInType, true);
|
||||
}
|
||||
} else {
|
||||
info = getCachedPathInfo(cfg, (Tool)superTool, null, true);
|
||||
}
|
||||
} else {
|
||||
info = getCachedPathInfo(cfg, null, null, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
info = cfg.getDiscoveredPathInfo();
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
private CfgInfoContext adjustContext(CfgInfoContext context, ICfgScannerConfigBuilderInfo2Set cfgInfo){
|
||||
private ContextInfo getContextInfo(CfgInfoContext context){
|
||||
return getContextInfo(context, null);
|
||||
}
|
||||
|
||||
private ContextInfo getContextInfo(CfgInfoContext context, ICfgScannerConfigBuilderInfo2Set cfgInfo){
|
||||
if(cfgInfo == null)
|
||||
cfgInfo = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(context.getConfiguration());
|
||||
|
||||
boolean queryCfg = !cfgInfo.isPerRcTypeDiscovery();
|
||||
boolean isPerRcType = cfgInfo.isPerRcTypeDiscovery();
|
||||
ContextInfo contextInfo = new ContextInfo();
|
||||
contextInfo.fInitialContext = context;
|
||||
contextInfo.fCfgInfo = cfgInfo;
|
||||
if(isPerRcType){
|
||||
contextInfo.fLoadContext = adjustPerRcTypeContext(contextInfo.fInitialContext);
|
||||
contextInfo.fCacheContext = contextInfo.fLoadContext;
|
||||
contextInfo.fIsFerFileCache = false;
|
||||
contextInfo.fInfo = cfgInfo.getInfo(contextInfo.fLoadContext);
|
||||
} else {
|
||||
contextInfo.fLoadContext = new CfgInfoContext(context.getConfiguration());
|
||||
contextInfo.fInfo = cfgInfo.getInfo(contextInfo.fLoadContext);
|
||||
contextInfo.fIsFerFileCache = CfgScannerConfigProfileManager.isPerFileProfile(contextInfo.fInfo.getSelectedProfileId());
|
||||
contextInfo.fCacheContext = contextInfo.fIsFerFileCache ? contextInfo.fInitialContext : contextInfo.fLoadContext;
|
||||
}
|
||||
|
||||
return contextInfo;
|
||||
}
|
||||
|
||||
private CfgInfoContext adjustPerRcTypeContext(CfgInfoContext context){
|
||||
Tool tool = (Tool)context.getTool();
|
||||
IResourceInfo rcInfo = context.getResourceInfo();
|
||||
IInputType inType = context.getInputType();
|
||||
boolean adjust = false;
|
||||
CfgInfoContext newContext = context;
|
||||
|
||||
if(!queryCfg){
|
||||
if(tool != null){
|
||||
if(inType != null){
|
||||
if(!tool.hasScannerConfigSettings(inType)){
|
||||
if(tool != null){
|
||||
if(inType != null){
|
||||
if(!tool.hasScannerConfigSettings(inType)){
|
||||
// tool = null;
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
if(inType == null){
|
||||
if(!tool.hasScannerConfigSettings(null)){
|
||||
tool = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tool == null){
|
||||
if(inType != null){
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
if(inType == null){
|
||||
if(!tool.hasScannerConfigSettings(null)){
|
||||
tool = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tool == null){
|
||||
if(inType != null){
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
|
||||
if(rcInfo != null){
|
||||
ToolChain tc = rcInfo instanceof FolderInfo ?
|
||||
(ToolChain)((FolderInfo)rcInfo).getToolChain()
|
||||
: (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain();
|
||||
|
||||
if(tc != null){
|
||||
if(!tc.hasScannerConfigSettings()){
|
||||
adjust = true;
|
||||
rcInfo = null;
|
||||
}
|
||||
}
|
||||
if(rcInfo != null){
|
||||
ToolChain tc = rcInfo instanceof FolderInfo ?
|
||||
(ToolChain)((FolderInfo)rcInfo).getToolChain()
|
||||
: (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain();
|
||||
|
||||
if(tc != null){
|
||||
if(!tc.hasScannerConfigSettings()){
|
||||
adjust = true;
|
||||
rcInfo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(tool != null){
|
||||
tool = null;
|
||||
adjust = true;
|
||||
}
|
||||
if(rcInfo != null){
|
||||
rcInfo = null;
|
||||
adjust = true;
|
||||
}
|
||||
if(inType != null){
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// if(tool != null){
|
||||
// tool = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// if(rcInfo != null){
|
||||
// rcInfo = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// if(inType != null){
|
||||
// inType = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(adjust){
|
||||
if(rcInfo == null)
|
||||
|
@ -243,10 +415,10 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return newContext;
|
||||
}
|
||||
|
||||
private IDiscoveredPathManager.IDiscoveredPathInfo setCachedPathInfo(CfgInfoContext context, IDiscoveredPathManager.IDiscoveredPathInfo info){
|
||||
private PathInfo setCachedPathInfo(CfgInfoContext context, PathInfo info){
|
||||
ICfgScannerConfigBuilderInfo2Set cfgInfo = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(context.getConfiguration());
|
||||
boolean cacheOnCfg = !cfgInfo.isPerRcTypeDiscovery();
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo oldInfo = null;
|
||||
PathInfo oldInfo = null;
|
||||
if(!cacheOnCfg){
|
||||
Tool tool = (Tool)context.getTool();
|
||||
if(tool != null){
|
||||
|
@ -264,16 +436,16 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return oldInfo;
|
||||
}
|
||||
|
||||
public void removeDiscoveredInfo(IProject project, CfgInfoContext context) {
|
||||
// if(context == null)
|
||||
// context = ScannerConfigUtil.createContextForProject(project);
|
||||
|
||||
context = adjustContext(context);
|
||||
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo info = setCachedPathInfo(context, null);
|
||||
fBaseMngr.removeDiscoveredInfo(project, context.toInfoContext());
|
||||
// if (info != null) {
|
||||
// fireUpdate(INFO_REMOVED, info);
|
||||
// }
|
||||
}
|
||||
// public void removeDiscoveredInfo(IProject project, CfgInfoContext context) {
|
||||
//// if(context == null)
|
||||
//// context = ScannerConfigUtil.createContextForProject(project);
|
||||
//
|
||||
// context = adjustContext(context);
|
||||
//
|
||||
// setCachedPathInfo(context, null);
|
||||
// fBaseMngr.removeDiscoveredInfo(project, context.toInfoContext());
|
||||
//// if (info != null) {
|
||||
//// fireUpdate(INFO_REMOVED, info);
|
||||
//// }
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,933 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.build.internal.core.scannerconfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
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.CLanguageData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CResourceData;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.core.settings.model.util.IPathSettingsContainerVisitor;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
public class PerFileSettingsCalculator {
|
||||
private static final String[] EMPTY_STRING_ARRAY = new String[0];
|
||||
// private static class ListIndex {
|
||||
// int fIndex;
|
||||
// List fList;
|
||||
//
|
||||
// public ListIndex(int index, List list) {
|
||||
// fIndex = index;
|
||||
// fList = list;
|
||||
// }
|
||||
//}
|
||||
|
||||
public interface IRcSettingInfo {
|
||||
CResourceData getResourceData();
|
||||
|
||||
ILangSettingInfo[] getLangInfos();
|
||||
}
|
||||
|
||||
public interface ILangSettingInfo {
|
||||
CLanguageData getLanguageData();
|
||||
|
||||
PathInfo getFilePathInfo();
|
||||
}
|
||||
|
||||
private static class RcSettingInfo implements IRcSettingInfo{
|
||||
private List fLangInfoList;
|
||||
private CResourceData fRcData;
|
||||
|
||||
RcSettingInfo(CResourceData rcData){
|
||||
fRcData = rcData;
|
||||
}
|
||||
|
||||
public ILangSettingInfo[] getLangInfos() {
|
||||
if(fLangInfoList != null && fLangInfoList.size() != 0)
|
||||
return (ILangSettingInfo[])fLangInfoList.toArray(new ILangSettingInfo[fLangInfoList.size()]);
|
||||
return new ILangSettingInfo[0];
|
||||
}
|
||||
|
||||
public CResourceData getResourceData() {
|
||||
return fRcData;
|
||||
}
|
||||
|
||||
void add(ILangSettingInfo info){
|
||||
if(fLangInfoList == null)
|
||||
fLangInfoList = new ArrayList();
|
||||
fLangInfoList.add(info);
|
||||
}
|
||||
}
|
||||
|
||||
private static class LangSettingInfo implements ILangSettingInfo {
|
||||
private CLanguageData fLangData;
|
||||
private PathInfo fPathInfo;
|
||||
|
||||
LangSettingInfo(CLanguageData langData, PathInfo info){
|
||||
fLangData = langData;
|
||||
fPathInfo = info;
|
||||
}
|
||||
|
||||
public PathInfo getFilePathInfo() {
|
||||
return fPathInfo;
|
||||
}
|
||||
|
||||
public CLanguageData getLanguageData() {
|
||||
return fLangData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ListIndexStore {
|
||||
private int fMaxIndex;
|
||||
private List[] fStore;
|
||||
|
||||
public ListIndexStore(int size){
|
||||
if(size < 0)
|
||||
size = 0;
|
||||
|
||||
fStore = new List[size];
|
||||
}
|
||||
|
||||
public void add(int index, Object value){
|
||||
List list = checkResize(index) ? new ArrayList() : fStore[index];
|
||||
if(list == null){
|
||||
list = new ArrayList();
|
||||
fStore[index] = list;
|
||||
}
|
||||
|
||||
if(fMaxIndex < index)
|
||||
fMaxIndex = index;
|
||||
|
||||
list.add(value);
|
||||
}
|
||||
|
||||
private boolean checkResize(int index){
|
||||
if(index >= fStore.length){
|
||||
int newSize = ++index;
|
||||
List resized[] = new List[newSize];
|
||||
if(fStore != null && fStore.length != 0){
|
||||
System.arraycopy(fStore, 0, resized, 0, fStore.length);
|
||||
}
|
||||
fStore = resized;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List[] getLists(){
|
||||
List list = new ArrayList(fMaxIndex);
|
||||
List l;
|
||||
for(int i = 0; i < fMaxIndex; i++){
|
||||
l = fStore[i];
|
||||
if(l != null)
|
||||
list.add(l);
|
||||
}
|
||||
|
||||
return (List[])list.toArray(new List[list.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
private static class PathFilePathInfo {
|
||||
IPath fPath;
|
||||
PathInfo fInfo;
|
||||
|
||||
PathFilePathInfo(IPath path, PathInfo info){
|
||||
fPath = path;
|
||||
fInfo = info;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ExtsSetSettings {
|
||||
// String[] fExts;
|
||||
// HashSet fExtsSet;
|
||||
private ExtsSet fExtsSet;
|
||||
Map fPathFilePathInfoMap;
|
||||
CLanguageData fBaseLangData;
|
||||
boolean fIsDerived;
|
||||
private PathInfo fMaxMatchInfo;
|
||||
private List fMaxMatchInfoList;
|
||||
private int fHash;
|
||||
|
||||
public ExtsSetSettings(CLanguageData baseLangData, ExtsSet extsSet, boolean isDerived) {
|
||||
fExtsSet = extsSet;
|
||||
fBaseLangData = baseLangData;
|
||||
fIsDerived = isDerived;
|
||||
}
|
||||
|
||||
void add(ExtsSetSettings setting){
|
||||
if(setting.fPathFilePathInfoMap != null){
|
||||
List list;
|
||||
int size;
|
||||
for(Iterator iter = setting.fPathFilePathInfoMap.values().iterator(); iter.hasNext();){
|
||||
list = (List)iter.next();
|
||||
size = list.size();
|
||||
for(int i = 0; i < size; i++){
|
||||
add((PathFilePathInfo)list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateLangData(CLanguageData lData, boolean isDerived){
|
||||
fBaseLangData = lData;
|
||||
fIsDerived = lData != null ? isDerived : false;
|
||||
}
|
||||
|
||||
public void add(PathFilePathInfo pInfo){
|
||||
if(fPathFilePathInfoMap == null)
|
||||
fPathFilePathInfoMap = new HashMap(3);
|
||||
|
||||
PathInfo fileInfo = pInfo.fInfo;
|
||||
List list = fileInfo == fMaxMatchInfo ? fMaxMatchInfoList : (List)fPathFilePathInfoMap.get(fileInfo);
|
||||
if(list == null){
|
||||
list = new ArrayList();
|
||||
fPathFilePathInfoMap.put(fileInfo, list);
|
||||
if(fMaxMatchInfo == null){
|
||||
fMaxMatchInfo = fileInfo;
|
||||
fMaxMatchInfoList = list;
|
||||
}
|
||||
// else {
|
||||
// fIsMultiple = true;
|
||||
// }
|
||||
} else if(fMaxMatchInfoList != list){
|
||||
// fIsMultiple = true;
|
||||
|
||||
if(fMaxMatchInfoList.size() == list.size()){
|
||||
fMaxMatchInfoList = list;
|
||||
fMaxMatchInfo = fileInfo;
|
||||
}
|
||||
}
|
||||
list.add(pInfo);
|
||||
}
|
||||
|
||||
public boolean isMultiple(){
|
||||
return fPathFilePathInfoMap != null && fPathFilePathInfoMap.size() > 1;
|
||||
}
|
||||
|
||||
public PathInfo getMaxMatchPathInfo(){
|
||||
return fMaxMatchInfo;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if(obj == this)
|
||||
return true;
|
||||
|
||||
if(isMultiple())
|
||||
return false;
|
||||
|
||||
if(!(obj instanceof ExtsSetSettings))
|
||||
return false;
|
||||
|
||||
ExtsSetSettings other = (ExtsSetSettings)obj;
|
||||
if(other.isMultiple())
|
||||
return false;
|
||||
|
||||
if(!fExtsSet.equals(other.fExtsSet))
|
||||
return false;
|
||||
|
||||
if(!CDataUtil.objectsEqual(fMaxMatchInfo, other.fMaxMatchInfo))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hash = fHash;
|
||||
if(hash == 0){
|
||||
if(isMultiple())
|
||||
hash = super.hashCode();
|
||||
else {
|
||||
hash = fExtsSet.hashCode();
|
||||
|
||||
if(fMaxMatchInfo != null)
|
||||
hash += fMaxMatchInfo.hashCode();
|
||||
}
|
||||
|
||||
fHash = hash;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class ExtsSet {
|
||||
private String[] fExts;
|
||||
private HashSet fExtsSet;
|
||||
private int fHash;
|
||||
|
||||
public ExtsSet(String[] exts){
|
||||
fExts = exts == null || exts.length == 0 ? EMPTY_STRING_ARRAY : (String[])exts.clone();
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if(this == obj)
|
||||
return true;
|
||||
|
||||
if(!(obj instanceof ExtsSet))
|
||||
return false;
|
||||
|
||||
ExtsSet other = (ExtsSet)obj;
|
||||
if(fExts.length != other.fExts.length)
|
||||
return false;
|
||||
|
||||
if(fExts.length != 0){
|
||||
HashSet set = (HashSet)calcExtsSet().clone();
|
||||
set.removeAll(other.calcExtsSet());
|
||||
if(set.size() != 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String[] getExtensions(){
|
||||
return (String[])fExts.clone();
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int hash = fHash;
|
||||
if(hash == 0){
|
||||
hash = 47;
|
||||
for(int i = 0; i < fExts.length; i++){
|
||||
hash += fExts[i].hashCode();
|
||||
}
|
||||
fHash = hash;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
private HashSet calcExtsSet(){
|
||||
if(fExtsSet == null)
|
||||
fExtsSet = new HashSet(Arrays.asList(fExts));
|
||||
return fExtsSet;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if(fExts.length == 0)
|
||||
return "<empty>";
|
||||
|
||||
StringBuffer buf = new StringBuffer();
|
||||
|
||||
for(int i = 0; i < fExts.length; i++){
|
||||
if(i != 0)
|
||||
buf.append(",");
|
||||
buf.append(fExts[i]);
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static class RcSetSettings {
|
||||
private CResourceData fRcData;
|
||||
private HashMap fExtToExtsSetMap;
|
||||
private HashMap fExtsSetToExtsSetSettingsMap;
|
||||
private PathSettingsContainer fContainer;
|
||||
private boolean fIsDerived;
|
||||
|
||||
RcSetSettings(PathSettingsContainer cr, CResourceData rcData, boolean isDerived){
|
||||
this.fContainer = cr;
|
||||
this.fRcData = rcData;
|
||||
this.fIsDerived = isDerived;
|
||||
cr.setValue(this);
|
||||
}
|
||||
|
||||
public RcSetSettings getChild(IPath path, boolean exactPath){
|
||||
PathSettingsContainer cr = fContainer.getChildContainer(path, false, exactPath);
|
||||
if(cr != null)
|
||||
return (RcSetSettings)cr.getValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
public RcSetSettings getChild(IPath path){
|
||||
PathSettingsContainer cr = fContainer.getChildContainer(path, false, true);
|
||||
if(cr != null)
|
||||
return (RcSetSettings)cr.getValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
public CResourceData getResourceData() {
|
||||
return fRcData;
|
||||
}
|
||||
|
||||
public RcSetSettings createChild(IPath path, CResourceData data, boolean isDerived){
|
||||
PathSettingsContainer cr = fContainer.getChildContainer(path, true, true);
|
||||
RcSetSettings child = (RcSetSettings)cr.getValue();
|
||||
if(child == null){
|
||||
child = new RcSetSettings(cr, data, isDerived);
|
||||
// cr.setValue(child);
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
void updateRcData(CResourceData data, boolean isDerived){
|
||||
fRcData = data;
|
||||
fIsDerived = data != null ? isDerived : false;
|
||||
updateLangDatas();
|
||||
}
|
||||
|
||||
private void updateLangDatas(){
|
||||
ExtsSetSettings extSetting;
|
||||
|
||||
if(fRcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
CLanguageData lData = ((CFileData)fRcData).getLanguageData();
|
||||
extSetting = (ExtsSetSettings)fExtToExtsSetMap.get(getFileExt(fRcData.getPath()));
|
||||
if(extSetting != null){
|
||||
extSetting.fBaseLangData = lData;
|
||||
extSetting.fIsDerived = lData != null ? fIsDerived : false;
|
||||
}
|
||||
|
||||
if(extSetting != null ?
|
||||
fExtsSetToExtsSetSettingsMap.size() > 1
|
||||
: fExtsSetToExtsSetSettingsMap.size() > 0){
|
||||
ExtsSetSettings s;
|
||||
for(Iterator iter = fExtsSetToExtsSetSettingsMap.values().iterator(); iter.hasNext();){
|
||||
s = (ExtsSetSettings)iter.next();
|
||||
if(s != extSetting){
|
||||
s.fBaseLangData = null;
|
||||
s.fIsDerived = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CLanguageData[] lDatas = ((CFolderData)fRcData).getLanguageDatas();
|
||||
Map map = (HashMap)fExtsSetToExtsSetSettingsMap.clone();
|
||||
|
||||
CLanguageData lData;
|
||||
for(int i = 0; i < lDatas.length; i++){
|
||||
lData = lDatas[i];
|
||||
extSetting = (ExtsSetSettings)map.remove(new ExtsSet(lData.getSourceExtensions()));
|
||||
if(extSetting != null){
|
||||
extSetting.fBaseLangData = lData;
|
||||
extSetting.fIsDerived = this.fIsDerived;
|
||||
}
|
||||
}
|
||||
|
||||
if(map.size() != 0){
|
||||
for(Iterator iter = map.values().iterator(); iter.hasNext();){
|
||||
extSetting = (ExtsSetSettings)iter.next();
|
||||
extSetting.fBaseLangData = null;
|
||||
extSetting.fIsDerived = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IPath getPath(){
|
||||
return fContainer.getPath();
|
||||
}
|
||||
|
||||
public RcSetSettings getParent(){
|
||||
PathSettingsContainer cr = fContainer.getParentContainer();
|
||||
if(cr != null)
|
||||
return (RcSetSettings)cr.getValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
void internalSetSettingsMap(HashMap map){
|
||||
fExtsSetToExtsSetSettingsMap = map;
|
||||
fExtToExtsSetMap = calcExtToExtSetSettingsMap(map);
|
||||
}
|
||||
|
||||
void internalAdd(ExtsSetSettings setting){
|
||||
if(fExtsSetToExtsSetSettingsMap == null){
|
||||
fExtsSetToExtsSetSettingsMap = new HashMap();
|
||||
}
|
||||
|
||||
ExtsSetSettings cur = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(setting.fExtsSet);
|
||||
if(cur != null){
|
||||
cur.add(setting);
|
||||
} else {
|
||||
fExtsSetToExtsSetSettingsMap.put(setting.fExtsSet, setting);
|
||||
fExtToExtsSetMap = addExtsInfoToMap(setting, fExtToExtsSetMap);
|
||||
}
|
||||
}
|
||||
|
||||
void internalAddSettingsMap(HashMap map){
|
||||
ExtsSetSettings setting;//, thisSetting;
|
||||
// ExtsSet extsSet;
|
||||
for(Iterator iter = map.values().iterator(); iter.hasNext();){
|
||||
setting = (ExtsSetSettings)iter.next();
|
||||
internalAdd(setting);
|
||||
// extsSet = setting.fExtsSet;
|
||||
// thisSetting = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(extsSet);
|
||||
// if(thisSetting != null){
|
||||
// thisSetting.add(setting);
|
||||
// } else {
|
||||
// fExtsSetToExtsSetSettingsMap.put(extsSet, setting);
|
||||
// fExtToExtsSetMap = addExtsInfoToMap(setting, fExtToExtsSetMap);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public boolean settingsEqual(RcSetSettings other){
|
||||
return fExtsSetToExtsSetSettingsMap.equals(other.fExtsSetToExtsSetSettingsMap);
|
||||
}
|
||||
|
||||
public RcSetSettings[] getChildren(final boolean includeCurrent){
|
||||
final List list = new ArrayList();
|
||||
fContainer.accept(new IPathSettingsContainerVisitor(){
|
||||
|
||||
public boolean visit(PathSettingsContainer container) {
|
||||
if(includeCurrent || container != fContainer){
|
||||
list.add(container.getValue());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return (RcSetSettings[])list.toArray(new RcSetSettings[list.size()]);
|
||||
}
|
||||
|
||||
public boolean containsEqualMaxMatches(RcSetSettings other, boolean ignoreGenerated){
|
||||
if(!ignoreGenerated && fExtsSetToExtsSetSettingsMap.size() < other.fExtsSetToExtsSetSettingsMap.size())
|
||||
return false;
|
||||
|
||||
ExtsSetSettings otherSetting, thisSetting;
|
||||
Map.Entry entry;
|
||||
|
||||
for(Iterator iter = other.fExtsSetToExtsSetSettingsMap.entrySet().iterator(); iter.hasNext();){
|
||||
entry = (Map.Entry)iter.next();
|
||||
otherSetting = (ExtsSetSettings)entry.getValue();
|
||||
if(ignoreGenerated && otherSetting.fBaseLangData == null)
|
||||
continue;
|
||||
|
||||
thisSetting = (ExtsSetSettings)fExtsSetToExtsSetSettingsMap.get(entry.getKey());
|
||||
if(thisSetting == null)
|
||||
return false;
|
||||
|
||||
if(otherSetting.fMaxMatchInfo != null && !otherSetting.fMaxMatchInfo.equals(thisSetting.fMaxMatchInfo))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void removeChild(RcSetSettings setting){
|
||||
IPath path = setting.fContainer.getPath();
|
||||
IPath thisPath = fContainer.getPath();
|
||||
if(!thisPath.isPrefixOf(path))
|
||||
throw new IllegalArgumentException();
|
||||
|
||||
path = path.removeFirstSegments(thisPath.segmentCount());
|
||||
fContainer.removeChildContainer(path);
|
||||
}
|
||||
}
|
||||
|
||||
private static HashMap calcExtToExtSetSettingsMap(Map extsSetMap){
|
||||
HashMap result = null;
|
||||
ExtsSetSettings setting;
|
||||
for(Iterator iter = extsSetMap.values().iterator(); iter.hasNext();){
|
||||
setting = (ExtsSetSettings)iter.next();
|
||||
result = addExtsInfoToMap(setting, result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static HashMap addExtsInfoToMap(ExtsSetSettings setting, HashMap map){
|
||||
boolean forceAdd = false;
|
||||
String[] exts = setting.fExtsSet.fExts;
|
||||
String ext;
|
||||
if(map == null){
|
||||
map = new HashMap();
|
||||
forceAdd = true;
|
||||
}
|
||||
|
||||
for(int i = 0; i < exts.length; i++){
|
||||
ext = exts[i];
|
||||
if(forceAdd || !map.containsKey(ext)){
|
||||
map.put(ext, setting);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private RcSetSettings createRcSetInfo (CConfigurationData data){
|
||||
CFolderData rootData = data.getRootFolderData();
|
||||
PathSettingsContainer container = PathSettingsContainer.createRootContainer();
|
||||
RcSetSettings rcSet = new RcSetSettings(container, rootData, false);
|
||||
rcSet.internalSetSettingsMap(createExtsSetSettingsMap(rootData));
|
||||
// rcSet.fExtToExtsSetMap = new HashMap();
|
||||
// rcSet.fExtsSetToExtsSetSettingsMap = new HashMap();
|
||||
|
||||
CResourceData[] rcDatas = data.getResourceDatas();
|
||||
CResourceData rcData;
|
||||
RcSetSettings curRcSet;
|
||||
HashMap fileMap;
|
||||
ExtsSetSettings fileSetting;
|
||||
IPath path;
|
||||
|
||||
for(int i = 0; i < rcDatas.length; i++){
|
||||
rcData = rcDatas[i];
|
||||
if(rcData == rootData)
|
||||
continue;
|
||||
|
||||
if(!includeRcDataInCalculation(data, rcData))
|
||||
continue;
|
||||
|
||||
path = rcData.getPath();
|
||||
curRcSet = rcSet.createChild(path, rcData, false);
|
||||
if(rcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
fileMap = new HashMap(1);
|
||||
fileSetting = createExtsSetSettings(path, (CFileData)rcData);
|
||||
fileMap.put(fileSetting.fExtsSet, fileSetting);
|
||||
curRcSet.internalSetSettingsMap(fileMap);
|
||||
} else {
|
||||
curRcSet.internalSetSettingsMap(createExtsSetSettingsMap((CFolderData)rcData));
|
||||
}
|
||||
}
|
||||
|
||||
return rcSet;
|
||||
}
|
||||
|
||||
protected boolean includeRcDataInCalculation(CConfigurationData cfgData, CResourceData rcData){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFileData base) throws CoreException{
|
||||
return cfgData.createFileData(path, base);
|
||||
}
|
||||
|
||||
protected CFileData createFileData(CConfigurationData cfgData, IPath path, CFolderData base, CLanguageData langBase) throws CoreException{
|
||||
return cfgData.createFileData(path, base, langBase);
|
||||
}
|
||||
|
||||
protected CFolderData createFolderData(CConfigurationData cfgData, IPath path, CFolderData base) throws CoreException{
|
||||
return cfgData.createFolderData(path, base);
|
||||
}
|
||||
|
||||
private RcSetSettings createRcSetSettings(CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo){
|
||||
RcSetSettings rcSet = createRcSetInfo(data);
|
||||
Map map = discoveredInfo.getPathInfoMap();
|
||||
PathFilePathInfo pInfos[] = createOrderedInfo(map);
|
||||
mapDiscoveredInfo(rcSet, pInfos);
|
||||
checkRemoveDups(rcSet);
|
||||
return rcSet;
|
||||
}
|
||||
|
||||
public IRcSettingInfo[] getSettingInfos(CConfigurationData data, IDiscoveredPathManager.IPerFileDiscoveredPathInfo2 discoveredInfo){
|
||||
RcSetSettings settings = createRcSetSettings(data, discoveredInfo);
|
||||
return createInfos(data, settings);
|
||||
}
|
||||
|
||||
private IRcSettingInfo[] createInfos(CConfigurationData data, RcSetSettings rootSetting){
|
||||
RcSetSettings settings[] = rootSetting.getChildren(true);
|
||||
RcSetSettings setting;
|
||||
CResourceData rcData;
|
||||
ExtsSetSettings extSetting;
|
||||
List resultList = new ArrayList();
|
||||
LangSettingInfo langInfo;
|
||||
RcSettingInfo rcInfo;
|
||||
PathInfo pathInfo;
|
||||
for(int i = 0; i < settings.length; i++){
|
||||
setting = settings[i];
|
||||
rcData = setting.fRcData;
|
||||
if(rcData == null)
|
||||
continue;
|
||||
if(setting.fIsDerived){
|
||||
// rcData = null;
|
||||
try {
|
||||
rcData = createFolderData(data, rcData, setting);
|
||||
} catch (CoreException e) {
|
||||
rcData = null;
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
}
|
||||
if(rcData != null){
|
||||
setting.updateRcData(rcData, false);
|
||||
} else {
|
||||
//TODO:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(rcData.getType() == ICSettingBase.SETTING_FILE){
|
||||
extSetting = (ExtsSetSettings)setting.fExtToExtsSetMap.get(getFileExt(rcData.getPath()));
|
||||
if(extSetting != null){
|
||||
pathInfo = extSetting.fMaxMatchInfo;
|
||||
if(pathInfo != null){
|
||||
langInfo = new LangSettingInfo(extSetting.fBaseLangData, pathInfo);
|
||||
rcInfo = new RcSettingInfo(rcData);
|
||||
rcInfo.fLangInfoList = new ArrayList(1);
|
||||
rcInfo.fLangInfoList.add(langInfo);
|
||||
resultList.add(rcInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(setting.fExtsSetToExtsSetSettingsMap.size() != 0 ){
|
||||
rcInfo = new RcSettingInfo(rcData);
|
||||
rcInfo.fLangInfoList = new ArrayList(setting.fExtsSetToExtsSetSettingsMap.size());
|
||||
resultList.add(rcInfo);
|
||||
|
||||
for(Iterator iter = setting.fExtsSetToExtsSetSettingsMap.values().iterator(); iter.hasNext();){
|
||||
extSetting = (ExtsSetSettings)iter.next();
|
||||
if(extSetting.fMaxMatchInfo == null)
|
||||
continue;
|
||||
|
||||
if(extSetting.fBaseLangData == null)
|
||||
continue;
|
||||
|
||||
if(extSetting.fIsDerived){
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
|
||||
rcInfo.add(new LangSettingInfo(extSetting.fBaseLangData, extSetting.fMaxMatchInfo));
|
||||
|
||||
if(extSetting.isMultiple()){
|
||||
Map.Entry entry;
|
||||
List piList;
|
||||
int sz;
|
||||
PathFilePathInfo pi;
|
||||
CFileData fiData;
|
||||
RcSettingInfo fiInfo;
|
||||
CLanguageData fiLangData;
|
||||
|
||||
for(Iterator pathInfoIter = extSetting.fPathFilePathInfoMap.entrySet().iterator(); pathInfoIter.hasNext();){
|
||||
entry = (Map.Entry)pathInfoIter.next();
|
||||
if(entry.getKey().equals(extSetting.fMaxMatchInfo))
|
||||
continue;
|
||||
piList = (List)entry.getValue();
|
||||
sz = piList.size();
|
||||
|
||||
for(int k = 0; k < sz; k++){
|
||||
pi = (PathFilePathInfo)piList.get(k);
|
||||
try {
|
||||
fiData = createFileData(data, pi.fPath, (CFolderData)rcData, extSetting.fBaseLangData);
|
||||
fiLangData = fiData.getLanguageData();
|
||||
if(fiLangData != null){
|
||||
fiInfo = new RcSettingInfo(fiData);
|
||||
fiInfo.add(new LangSettingInfo(fiLangData, pi.fInfo));
|
||||
resultList.add(fiInfo);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
return (RcSettingInfo[])resultList.toArray(new RcSettingInfo[resultList.size()]);
|
||||
}
|
||||
|
||||
private CFolderData createFolderData(CConfigurationData cfg, CResourceData base, RcSetSettings setting) throws CoreException{
|
||||
if(base.getType() == ICSettingBase.SETTING_FOLDER)
|
||||
return createFolderData(cfg, setting.getPath(), (CFolderData)base);
|
||||
|
||||
//should not be here
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
private static void checkRemoveDups(RcSetSettings rcSet){
|
||||
RcSetSettings settings[] = rcSet.getChildren(true);
|
||||
RcSetSettings setting, parent;
|
||||
for(int i = 0; i < settings.length; i++){
|
||||
setting = settings[i];
|
||||
if(!setting.fIsDerived)
|
||||
continue;
|
||||
|
||||
parent = setting.getParent();
|
||||
if(parent == null)
|
||||
continue;
|
||||
|
||||
if(parent.containsEqualMaxMatches(setting, true))
|
||||
removeChildAddingChildSettings(parent, setting);
|
||||
}
|
||||
}
|
||||
|
||||
private static void removeChildAddingChildSettings(RcSetSettings parent, RcSetSettings child){
|
||||
parent.internalAddSettingsMap(child.fExtsSetToExtsSetSettingsMap);
|
||||
parent.removeChild(child);
|
||||
}
|
||||
|
||||
private static void mapDiscoveredInfo(RcSetSettings rcSet, PathFilePathInfo[] pInfos){
|
||||
PathFilePathInfo pInfo;
|
||||
RcSetSettings child, parent;
|
||||
String ext;
|
||||
ExtsSetSettings extsSet;
|
||||
// boolean isDerived;
|
||||
IPath dirPath;
|
||||
for(int i = 0; i < pInfos.length; i++){
|
||||
pInfo = pInfos[i];
|
||||
child = rcSet.getChild(pInfo.fPath);
|
||||
if(child == null) {
|
||||
dirPath = pInfo.fPath.removeLastSegments(1);
|
||||
child = rcSet.getChild(dirPath);
|
||||
if(child == null){
|
||||
child = rcSet.createChild(dirPath, null, true);
|
||||
if(child.fExtToExtsSetMap == null){
|
||||
parent = child.getParent();
|
||||
child.fRcData = parent.fRcData;
|
||||
child.internalSetSettingsMap(createEmptyExtSetMapCopy(parent.fExtsSetToExtsSetSettingsMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// isDerived = child.fIsDerived;
|
||||
|
||||
if(pInfo.fPath.segmentCount() == 0){
|
||||
processProjectPaths(child, pInfo);
|
||||
} else {
|
||||
ext = getFileExt(pInfo.fPath);
|
||||
extsSet = (ExtsSetSettings)child.fExtToExtsSetMap.get(ext);
|
||||
if(extsSet == null){
|
||||
extsSet = new ExtsSetSettings(null, new ExtsSet(new String[]{ext}), false);
|
||||
child.internalAdd(extsSet);
|
||||
// child.fExtToExtsSetMap.put(ext, extsSet);
|
||||
}
|
||||
extsSet.add(pInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void processProjectPaths(RcSetSettings rcSet, PathFilePathInfo pfpi){
|
||||
ExtsSetSettings setting;
|
||||
for(Iterator iter = rcSet.fExtsSetToExtsSetSettingsMap.values().iterator(); iter.hasNext();){
|
||||
setting = (ExtsSetSettings)iter.next();
|
||||
setting.add(pfpi);
|
||||
}
|
||||
}
|
||||
|
||||
private static String getFileExt(IPath path){
|
||||
String ext = path.getFileExtension();
|
||||
if(ext != null)
|
||||
return ext;
|
||||
return "";
|
||||
}
|
||||
|
||||
private static HashMap createEmptyExtSetMapCopy(HashMap base){
|
||||
HashMap map = (HashMap)base.clone();
|
||||
ExtsSetSettings extsSet;
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
extsSet = (ExtsSetSettings)entry.getValue();
|
||||
extsSet = new ExtsSetSettings(extsSet.fBaseLangData, extsSet.fExtsSet, true);
|
||||
entry.setValue(extsSet);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private static ExtsSetSettings createExtsSetSettings(IPath path, CFileData data){
|
||||
CLanguageData lData = data.getLanguageData();
|
||||
if(lData != null){
|
||||
String ext = getFileExt(path);
|
||||
return createExtsSetSettings(lData, new String[]{ext});
|
||||
}
|
||||
return new ExtsSetSettings(null, new ExtsSet(EMPTY_STRING_ARRAY), false);
|
||||
}
|
||||
|
||||
private static ExtsSetSettings createExtsSetSettings(CLanguageData lData, String exts[]){
|
||||
return new ExtsSetSettings(lData, new ExtsSet(exts), false);
|
||||
}
|
||||
|
||||
private static HashMap createExtsSetSettingsMap(CFolderData data){
|
||||
CLanguageData[] lDatas = data.getLanguageDatas();
|
||||
HashMap map = new HashMap(lDatas.length);
|
||||
ExtsSetSettings settings;
|
||||
|
||||
if(lDatas.length != 0) {
|
||||
CLanguageData lData;
|
||||
for( int i = 0; i < lDatas.length; i++){
|
||||
lData = lDatas[i];
|
||||
settings = createExtsSetSettings(lData, lData.getSourceExtensions());
|
||||
map.put(settings.fExtsSet, settings);
|
||||
}
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
private static PathFilePathInfo[] createOrderedInfo(Map map){
|
||||
Map.Entry entry;
|
||||
IResource rc;
|
||||
IPath path;
|
||||
PathInfo info, storedInfo;
|
||||
ListIndexStore store = new ListIndexStore(10);
|
||||
HashMap infoMap = new HashMap();
|
||||
// LinkedHashMap result;
|
||||
|
||||
for(Iterator iter = map.entrySet().iterator(); iter.hasNext();){
|
||||
entry = (Map.Entry)iter.next();
|
||||
rc = (IResource)entry.getKey();
|
||||
path = rc.getFullPath();
|
||||
int segCount = path.segmentCount();
|
||||
if(segCount < 1)
|
||||
continue;
|
||||
|
||||
path = path.removeFirstSegments(1);
|
||||
segCount--;
|
||||
|
||||
info = (PathInfo)entry.getValue();
|
||||
storedInfo = (PathInfo)infoMap.get(info);
|
||||
if(storedInfo == null){
|
||||
storedInfo = info;
|
||||
infoMap.put(storedInfo, storedInfo);
|
||||
}
|
||||
|
||||
store.add(segCount, new PathFilePathInfo(path, storedInfo));
|
||||
}
|
||||
|
||||
List lists[] = store.getLists();
|
||||
// result = new LinkedHashMap(map.size());
|
||||
// List l;
|
||||
// int lSize;
|
||||
// PathFilePathInfo pfpi;
|
||||
// for(int i = 0; i < lists.length; i++){
|
||||
// l = lists[i];
|
||||
// lSize = l.size();
|
||||
// if(lSize != 0){
|
||||
// for(int k = 0; k < lSize; k++){
|
||||
// pfpi = (PathFilePathInfo)l.get(k);
|
||||
// result.put(pfpi.fPath, pfpi.fInfo);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
int size = 0;
|
||||
PathFilePathInfo infos[];
|
||||
for(int i = 0; i < lists.length; i++){
|
||||
size += lists[i].size();
|
||||
}
|
||||
|
||||
infos = new PathFilePathInfo[size];
|
||||
int num = 0;
|
||||
int listSize;
|
||||
List list;
|
||||
for(int i = 0; i < lists.length; i++){
|
||||
list = lists[i];
|
||||
listSize = list.size();
|
||||
for(int k = 0; k < listSize; k++){
|
||||
infos[num++] = (PathFilePathInfo)list.get(k);
|
||||
}
|
||||
}
|
||||
|
||||
return infos;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,9 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.ICDescriptor;
|
||||
import org.eclipse.cdt.core.ICDescriptorOperation;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
|
@ -34,7 +37,10 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
|||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.InputType;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
|
||||
|
@ -266,6 +272,14 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
public IConfiguration getConfiguration() {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
public boolean isProfileSupported(CfgInfoContext context,
|
||||
String profileId) {
|
||||
if(!isPerRcTypeDiscovery())
|
||||
return true;
|
||||
|
||||
return !CfgScannerConfigProfileManager.isPerFileProfile(profileId);
|
||||
}
|
||||
}
|
||||
|
||||
public static ICfgScannerConfigBuilderInfo2Set create(IConfiguration cfg){
|
||||
|
@ -277,8 +291,8 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
public static void save(ICProjectDescription des, ICProjectDescription baseDescription) throws CoreException{
|
||||
|
||||
public static void save(BuildConfigurationData data, ICProjectDescription des, ICProjectDescription baseDescription, boolean force) throws CoreException{
|
||||
ContainerInfo info = (ContainerInfo)des.getSessionProperty(CONTAINER_INFO_PROPERTY);
|
||||
if(info != null){
|
||||
if(info.fDes == baseDescription){
|
||||
|
@ -286,6 +300,13 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
baseContainer.save();
|
||||
}
|
||||
des.setSessionProperty(CONTAINER_INFO_PROPERTY, null);
|
||||
} else if (force){
|
||||
Configuration cfg = (Configuration)data.getConfiguration();
|
||||
CfgInfo cfgInfo = new CfgInfo(cfg);
|
||||
cfg.setCfgScannerConfigInfo(cfgInfo);
|
||||
cfgInfo.getInfoMap();
|
||||
cfgInfo.fContainer.save();
|
||||
des.setSessionProperty(CONTAINER_INFO_PROPERTY, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ package org.eclipse.cdt.build.internal.core.scannerconfig2;
|
|||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ScannerConfigScope;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfile;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
|
@ -24,6 +27,11 @@ public class CfgScannerConfigProfileManager {
|
|||
return CfgScannerConfigInfoFactory2.create(cfg);
|
||||
}
|
||||
|
||||
public static boolean isPerFileProfile(String profileId){
|
||||
ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(profileId);
|
||||
return profile.getProfileScope().equals(ScannerConfigScope.FILE_SCOPE);
|
||||
}
|
||||
|
||||
public static InfoContext createDefaultContext(IProject project){
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||
IConfiguration cfg = null;
|
||||
|
|
|
@ -4253,7 +4253,13 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
for(;extTool != null && !extTool.isExtensionElement(); extTool = extTool.getSuperClass());
|
||||
return extTool;
|
||||
}
|
||||
|
||||
|
||||
public static IInputType getExtensionInputType(IInputType inType){
|
||||
IInputType extIT = inType;
|
||||
for(;extIT != null && !extIT.isExtensionElement(); extIT = extIT.getSuperClass());
|
||||
return extIT;
|
||||
}
|
||||
|
||||
public static IConfiguration getPreferenceConfiguration(boolean write){
|
||||
try {
|
||||
ICConfigurationDescription des = CCorePlugin.getDefault().getPreferenceConfiguration(CFG_DATA_PROVIDER_ID, write);
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
|||
import org.eclipse.cdt.core.settings.model.extension.CBuildData;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.core.settings.model.util.PathSettingsContainer;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
|
@ -2761,12 +2761,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
// return tc.setScannerConfigBuilderInfo(info);
|
||||
// }
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo setDiscoveredPathInfo(IDiscoveredPathManager.IDiscoveredPathInfo info){
|
||||
public PathInfo setDiscoveredPathInfo(PathInfo info){
|
||||
ToolChain tc = (ToolChain)getRootFolderInfo().getToolChain();
|
||||
return tc.setDiscoveredPathInfo(info);
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo getDiscoveredPathInfo(){
|
||||
public PathInfo getDiscoveredPathInfo(){
|
||||
ToolChain tc = (ToolChain)getRootFolderInfo().getToolChain();
|
||||
return tc.getDiscoveredPathInfo();
|
||||
}
|
||||
|
@ -2776,7 +2776,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
return tc.getScannerConfigDiscoveryProfileId();
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo clearDiscoveredPathInfo(){
|
||||
public PathInfo clearDiscoveredPathInfo(){
|
||||
ToolChain tc = (ToolChain)getRootFolderInfo().getToolChain();
|
||||
return tc.setDiscoveredPathInfo(null);
|
||||
}
|
||||
|
@ -2792,4 +2792,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
|||
public boolean isPreference(){
|
||||
return isPreferenceConfig;
|
||||
}
|
||||
|
||||
// public boolean isPerFileDiscoveryCache(){
|
||||
// return isPerFileDiscoveryCache;
|
||||
// }
|
||||
//
|
||||
// public void setPerFileDiscoveryCache(boolean perFile){
|
||||
// isPerFileDiscoveryCache = perFile;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
|
||||
ResourceInfo(IConfiguration cfg, ResourceInfo base, String id) {
|
||||
config = cfg;
|
||||
path = base.path;
|
||||
path = normalizePath(base.path);
|
||||
internalSetExclude(base.isExcluded);
|
||||
|
||||
setId(id);
|
||||
|
@ -89,6 +89,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
|
||||
ResourceInfo(IConfiguration cfg, IPath path, String id, String name) {
|
||||
config = cfg;
|
||||
path = normalizePath(path);
|
||||
this.path = path;
|
||||
|
||||
// inheritParentInfo = inherit;
|
||||
|
@ -102,6 +103,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
setId(id);
|
||||
setName(name);
|
||||
|
||||
path = normalizePath(path);
|
||||
|
||||
this.path = path;
|
||||
internalSetExclude(base.isExcluded());
|
||||
// parentFolderInfoId = base.getId();
|
||||
|
@ -117,6 +120,8 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
setId(id);
|
||||
setName(name);
|
||||
|
||||
path = normalizePath(path);
|
||||
|
||||
this.path = path;
|
||||
internalSetExclude(base.isExcluded());
|
||||
// parentFolderInfoId = base.getId();
|
||||
|
@ -145,9 +150,13 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
|
||||
// resourcePath
|
||||
String tmp = element.getAttribute(RESOURCE_PATH);
|
||||
if(tmp != null)
|
||||
if(tmp != null){
|
||||
path = new Path(tmp);
|
||||
else {
|
||||
if(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME.equals(element.getName())){
|
||||
path = path.removeFirstSegments(1);
|
||||
}
|
||||
path = normalizePath(path);
|
||||
} else {
|
||||
//TODO
|
||||
}
|
||||
|
||||
|
@ -178,6 +187,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
if(IResourceConfiguration.RESOURCE_CONFIGURATION_ELEMENT_NAME.equals(element.getName())){
|
||||
path = path.removeFirstSegments(1);
|
||||
}
|
||||
path = normalizePath(path);
|
||||
} else {
|
||||
//TODO
|
||||
}
|
||||
|
@ -214,7 +224,7 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
*/
|
||||
public IPath getPath() {
|
||||
return path;
|
||||
return normalizePath(path);
|
||||
}
|
||||
|
||||
public boolean isDirty() {
|
||||
|
@ -248,9 +258,10 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
}
|
||||
|
||||
public void setPath(IPath p) {
|
||||
p = normalizePath(p);
|
||||
if(path == null)
|
||||
path = p;
|
||||
else if (!p.equals(this.path)) {
|
||||
else if (!p.equals(normalizePath(this.path))) {
|
||||
ResourceInfoContainer info = getRcInfo();
|
||||
info.changeCurrentPath(p, true);
|
||||
this.path = p;
|
||||
|
@ -445,6 +456,10 @@ public abstract class ResourceInfo extends BuildObject implements IResourceInfo
|
|||
return null;
|
||||
}
|
||||
|
||||
public static IPath normalizePath(IPath path){
|
||||
return path.makeRelative();
|
||||
}
|
||||
|
||||
abstract void resolveProjectReferences(boolean onLoad);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
|
@ -28,7 +29,7 @@ import java.util.Vector;
|
|||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CLanguageData;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
|
@ -1179,7 +1180,9 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
* @see org.eclipse.cdt.managedbuilder.core.ITool#createInputType(IInputType, String, String, boolean)
|
||||
*/
|
||||
public IInputType createInputType(IInputType superClass, String Id, String name, boolean isExtensionElement) {
|
||||
InputType type = new InputType(this, superClass, Id, name, isExtensionElement);
|
||||
InputType type = superClass == null || superClass.isExtensionElement() ?
|
||||
new InputType(this, superClass, Id, name, isExtensionElement)
|
||||
: new InputType(this, Id, name, (InputType)superClass);
|
||||
|
||||
if(superClass != null){
|
||||
BuildLanguageData data = (BuildLanguageData)typeToDataMap.remove(superClass);
|
||||
|
@ -1233,8 +1236,12 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
IInputType ourType = (IInputType)ourTypes.get(i);
|
||||
int j;
|
||||
for (j = 0; j < types.length; j++) {
|
||||
IInputType otherTypeToCheck = ManagedBuildManager.getExtensionInputType(types[j]);
|
||||
if(otherTypeToCheck == null)
|
||||
otherTypeToCheck = types[j];
|
||||
|
||||
if (ourType.getSuperClass() != null &&
|
||||
ourType.getSuperClass().getId().equals(types[j].getId())) {
|
||||
ourType.getSuperClass().getId().equals(otherTypeToCheck.getId())) {
|
||||
types[j] = ourType;
|
||||
break;
|
||||
}
|
||||
|
@ -3376,7 +3383,9 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
if(fDataMapInited)
|
||||
return;
|
||||
|
||||
Collection types = getLanguageInputTypes();
|
||||
List types = getLanguageInputTypes();
|
||||
// List datas = new ArrayList();
|
||||
|
||||
if(types != null){
|
||||
if(types.size() == 0){
|
||||
CLanguageData data = (CLanguageData)typeToDataMap.get(null);
|
||||
|
@ -3387,15 +3396,26 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
}
|
||||
typeToDataMap.put(null, data);
|
||||
}
|
||||
|
||||
// datas.add(data);
|
||||
} else {
|
||||
//create editable input types for lang datas first
|
||||
|
||||
for(ListIterator iter = types.listIterator(); iter.hasNext();){
|
||||
IInputType type = (IInputType)iter.next();
|
||||
iter.set(getEdtableInputType(type));
|
||||
}
|
||||
|
||||
Map map = (Map)typeToDataMap.clone();
|
||||
for(Iterator iter = types.iterator(); iter.hasNext();){
|
||||
for(ListIterator iter = types.listIterator(); iter.hasNext();){
|
||||
IInputType type = (IInputType)iter.next();
|
||||
CLanguageData data = (CLanguageData)map.remove(type);
|
||||
if(data == null){
|
||||
data = new BuildLanguageData(this, type);
|
||||
typeToDataMap.put(type, data);
|
||||
}
|
||||
|
||||
// datas.add(data);
|
||||
}
|
||||
|
||||
if(map.size() > 0){
|
||||
|
@ -3403,7 +3423,12 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
typeToDataMap.remove(iter.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// int size = datas.size();
|
||||
// for(int i = 0; i < size; i++){
|
||||
// ((BuildLanguageData)datas.get(i)).obtainEditableInputType();
|
||||
// }
|
||||
}
|
||||
fDataMapInited = true;
|
||||
}
|
||||
|
@ -3436,7 +3461,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
return found;
|
||||
}
|
||||
|
||||
private Collection getLanguageInputTypes(){
|
||||
private List getLanguageInputTypes(){
|
||||
List list = new ArrayList();
|
||||
IInputType types[] = getInputTypes();
|
||||
for(int i = 0; i < types.length; i++){
|
||||
|
@ -3495,7 +3520,7 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
} else {
|
||||
id = ManagedBuildManager.calculateChildId(getId(), null);
|
||||
}
|
||||
return createInputType(extType, id, base.getName(), false);
|
||||
return createInputType(base, id, base.getName(), false);
|
||||
}
|
||||
|
||||
public boolean supportsType(IBuildPropertyType type) {
|
||||
|
@ -3864,18 +3889,22 @@ public class Tool extends HoldsOptions implements ITool, IOptionCategory, IMatch
|
|||
return false;
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo setDiscoveredPathInfo(IInputType type, IDiscoveredPathManager.IDiscoveredPathInfo info){
|
||||
return (IDiscoveredPathManager.IDiscoveredPathInfo)discoveredInfoMap.put(getTypeKey(type), info);
|
||||
public PathInfo setDiscoveredPathInfo(IInputType type, PathInfo info){
|
||||
return (PathInfo)discoveredInfoMap.put(getTypeKey(type), info);
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo getDiscoveredPathInfo(IInputType type){
|
||||
return (IDiscoveredPathManager.IDiscoveredPathInfo)discoveredInfoMap.get(getTypeKey(type));
|
||||
public PathInfo getDiscoveredPathInfo(IInputType type){
|
||||
return (PathInfo)discoveredInfoMap.get(getTypeKey(type));
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo clearDiscoveredPathInfo(IInputType type){
|
||||
return (IDiscoveredPathManager.IDiscoveredPathInfo)discoveredInfoMap.remove(getTypeKey(type));
|
||||
public PathInfo clearDiscoveredPathInfo(IInputType type){
|
||||
return (PathInfo)discoveredInfoMap.remove(getTypeKey(type));
|
||||
}
|
||||
|
||||
|
||||
public void clearAllDiscoveredInfo(){
|
||||
discoveredInfoMap.clear();
|
||||
}
|
||||
|
||||
private Object getTypeKey(IInputType type){
|
||||
if(type != null)
|
||||
return type.getId();
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.util.StringTokenizer;
|
|||
|
||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||
|
@ -116,7 +116,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
|
|||
|
||||
private IFolderInfo parentFolderInfo;
|
||||
|
||||
private IDiscoveredPathManager.IDiscoveredPathInfo discoveredInfo;
|
||||
private PathInfo discoveredInfo;
|
||||
private Boolean isRcTypeBasedDiscovery;
|
||||
|
||||
|
||||
|
@ -2601,18 +2601,18 @@ public class ToolChain extends HoldsOptions implements IToolChain, IBuildPropert
|
|||
isRcTypeBasedDiscovery = Boolean.valueOf(on);
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo setDiscoveredPathInfo(IDiscoveredPathManager.IDiscoveredPathInfo info){
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo oldInfo = discoveredInfo;
|
||||
public PathInfo setDiscoveredPathInfo(PathInfo info){
|
||||
PathInfo oldInfo = discoveredInfo;
|
||||
discoveredInfo = info;
|
||||
return oldInfo;
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo getDiscoveredPathInfo(){
|
||||
public PathInfo getDiscoveredPathInfo(){
|
||||
return discoveredInfo;
|
||||
}
|
||||
|
||||
public IDiscoveredPathManager.IDiscoveredPathInfo clearDiscoveredPathInfo(){
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo oldInfo = discoveredInfo;
|
||||
public PathInfo clearDiscoveredPathInfo(){
|
||||
PathInfo oldInfo = discoveredInfo;
|
||||
discoveredInfo = null;
|
||||
return oldInfo;
|
||||
}
|
||||
|
|
|
@ -46,22 +46,36 @@ public class BuildLanguageData extends CLanguageData {
|
|||
|
||||
public BuildLanguageData(ITool tool, IInputType inType){
|
||||
fTool = tool;
|
||||
fInputType = inType;
|
||||
if(inType != null){
|
||||
IInputType extType = inType;
|
||||
for(;extType != null && !extType.isExtensionElement(); extType = extType.getSuperClass());
|
||||
String typeId;
|
||||
if(extType != null)
|
||||
typeId = extType.getId();
|
||||
else
|
||||
typeId = inType.getId();
|
||||
fId = new StringBuffer(fTool.getId()).append(".").append(typeId).toString(); //$NON-NLS-1$
|
||||
// inType = tool.getEdtableInputType(inType);
|
||||
fInputType = inType;
|
||||
if(inType.getParent() != tool)
|
||||
throw new IllegalArgumentException();
|
||||
// IInputType extType = inType;
|
||||
// for(;extType != null && !extType.isExtensionElement(); extType = extType.getSuperClass());
|
||||
// String typeId;
|
||||
// if(extType != null)
|
||||
// typeId = extType.getId();
|
||||
// else
|
||||
// typeId = inType.getId();
|
||||
fId = inType.getId();//new StringBuffer(fTool.getId()).append(".").append(typeId).toString(); //$NON-NLS-1$
|
||||
} else {
|
||||
fInputType = null;
|
||||
fId = new StringBuffer(fTool.getId()).append(".").append("languagedata").toString(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
fDiscoveredInfo = new ProfileInfoProvider(this);
|
||||
}
|
||||
|
||||
private void obtainEditableInputType(){
|
||||
if(fInputType != null){
|
||||
IInputType old = fInputType;
|
||||
fInputType = fTool.getEdtableInputType(fInputType);
|
||||
if(old != fInputType){
|
||||
fDiscoveredInfo.checkUpdateInputType(fInputType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setEntries(int kind, ICLanguageSettingEntry entries[]) {
|
||||
EntryStorage storage = getEntryStorage(kind);
|
||||
|
@ -349,7 +363,8 @@ public class BuildLanguageData extends CLanguageData {
|
|||
|
||||
public void setLanguageId(String id) {
|
||||
if(CDataUtil.objectsEqual(id, fInputType.getLanguageId(fTool))){
|
||||
fInputType = fTool.getEdtableInputType(fInputType);
|
||||
// fInputType = fTool.getEdtableInputType(fInputType);
|
||||
obtainEditableInputType();
|
||||
fInputType.setLanguageIdAttribute(id);
|
||||
}
|
||||
}
|
||||
|
@ -440,12 +455,14 @@ public class BuildLanguageData extends CLanguageData {
|
|||
String newHeaderIds[] = (String[])newHeaders.toArray(new String[newHeaders.size()]);
|
||||
|
||||
if(!Arrays.equals(newSrcIds, fInputType.getSourceContentTypeIds())){
|
||||
fInputType = fTool.getEdtableInputType(fInputType);
|
||||
// fInputType = fTool.getEdtableInputType(fInputType);
|
||||
obtainEditableInputType();
|
||||
fInputType.setSourceContentTypeIds(newSrcIds);
|
||||
}
|
||||
|
||||
if(!Arrays.equals(newHeaderIds, fInputType.getHeaderContentTypeIds())){
|
||||
fInputType = fTool.getEdtableInputType(fInputType);
|
||||
// fInputType = fTool.getEdtableInputType(fInputType);
|
||||
obtainEditableInputType();
|
||||
fInputType.setHeaderContentTypeIds(newHeaderIds);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.NotificationManager;
|
|||
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.QualifiedName;
|
||||
import org.eclipse.core.runtime.content.IContentType;
|
||||
|
||||
public class ConfigurationDataProvider extends CConfigurationDataProvider implements ISettingsChangeListener {
|
||||
|
@ -56,6 +57,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
|||
private static final String PREF_CFG_ID = "org.eclipse.cdt.build.core.prefbase.cfg"; //$NON-NLS-1$
|
||||
public static final String PREF_TC_ID = "org.eclipse.cdt.build.core.prefbase.toolchain"; //$NON-NLS-1$
|
||||
private static final String PREF_TOOL_ID = "org.eclipse.cdt.build.core.settings.holder"; //$NON-NLS-1$
|
||||
private static final QualifiedName CFG_PERSISTED_PROPERTY = new QualifiedName(ManagedBuilderCorePlugin.getUniqueIdentifier(), "configPersisted"); //$NON-NLS-1$
|
||||
|
||||
private static boolean registered;
|
||||
|
||||
|
@ -111,15 +113,20 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
|||
mProj.applyConfiguration((Configuration)appliedCfg.getConfiguration());
|
||||
writeManagedProjectInfo(des.getProjectDescription(), mProj);
|
||||
try {
|
||||
CfgScannerConfigInfoFactory2.save(des.getProjectDescription(), baseDescription.getProjectDescription());
|
||||
CfgScannerConfigInfoFactory2.save(appliedCfg, des.getProjectDescription(), baseDescription.getProjectDescription(), !isPersistedCfg(des));
|
||||
} catch (CoreException e){
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
}
|
||||
info.setValid(true);
|
||||
|
||||
setPersistedFlag(des);
|
||||
return appliedCfg;
|
||||
}
|
||||
|
||||
private void setPersistedFlag(ICConfigurationDescription cfg){
|
||||
cfg.setSessionProperty(CFG_PERSISTED_PROPERTY, Boolean.TRUE);
|
||||
}
|
||||
|
||||
private static void writeManagedProjectInfo(ICProjectDescription des,
|
||||
ManagedProject mProj) throws CoreException {
|
||||
ICStorageElement rootElement = des.getStorage(BUILD_SYSTEM_DATA_MODULE_NAME, true);
|
||||
|
@ -164,6 +171,8 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
|||
newCfg.exportArtifactInfo();
|
||||
}
|
||||
|
||||
setPersistedFlag(des);
|
||||
|
||||
return newCfg.getConfigurationData();
|
||||
}
|
||||
|
||||
|
@ -397,10 +406,15 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
|||
if(cfg != null){
|
||||
cfg.setConfigurationDescription(des);
|
||||
info.setValid(true);
|
||||
setPersistedFlag(des);
|
||||
return cfg.getConfigurationData();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isPersistedCfg(ICConfigurationDescription cfgDes){
|
||||
return cfgDes.getSessionProperty(CFG_PERSISTED_PROPERTY) != null;
|
||||
}
|
||||
|
||||
public void optionChanged(IResourceInfo rcInfo, IHoldsOptions holder, IOption option, Object oldValue) {
|
||||
BuildLanguageData datas[] = (BuildLanguageData[])rcInfo.getCLanguageDatas();
|
||||
|
|
|
@ -17,7 +17,8 @@ import java.util.Map;
|
|||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.PathInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
|
@ -76,6 +77,16 @@ public class ProfileInfoProvider {
|
|||
// clear();
|
||||
}
|
||||
|
||||
void checkUpdateInputType(IInputType inType){
|
||||
if(inType != fContext.getInputType()){
|
||||
// IResourceInfo rcInfo = fContext.getResourceInfo();
|
||||
// if(rcInfo == null){
|
||||
// rcInfo = fContext.getConfiguration().getRootFolderInfo();
|
||||
// }
|
||||
fContext = new CfgInfoContext(fContext.getResourceInfo(), fContext.getTool(), inType);
|
||||
}
|
||||
}
|
||||
|
||||
// public void clear(){
|
||||
// fDataCollected = false;
|
||||
// }
|
||||
|
@ -118,7 +129,7 @@ public class ProfileInfoProvider {
|
|||
// if(type != null){
|
||||
if(fProject != null){
|
||||
try {
|
||||
IDiscoveredPathManager.IDiscoveredPathInfo info = fMngr.getDiscoveredInfo(fProject, fContext);
|
||||
PathInfo info = fMngr.getDiscoveredInfo(fProject, fContext);
|
||||
if(info != null){
|
||||
return entriesForKind(info, kind);
|
||||
}
|
||||
|
@ -140,12 +151,29 @@ public class ProfileInfoProvider {
|
|||
// return null;
|
||||
// }
|
||||
|
||||
private DiscoveredEntry[] entriesForKind(IDiscoveredPathManager.IDiscoveredPathInfo info, int kind){
|
||||
private DiscoveredEntry[] entriesForKind(PathInfo info, int kind){
|
||||
switch (kind) {
|
||||
case ICLanguageSettingEntry.INCLUDE_PATH:
|
||||
return calculateEntries(info.getIncludePaths());
|
||||
DiscoveredEntry[] incPaths = calculateEntries(info.getIncludePaths());
|
||||
IPath[] quotedPaths = info.getQuoteIncludePaths();
|
||||
if(quotedPaths.length != 0){
|
||||
if(incPaths.length != 0){
|
||||
DiscoveredEntry quotedEntries[] = calculateEntries(quotedPaths);
|
||||
DiscoveredEntry[] tmp = new DiscoveredEntry[incPaths.length + quotedEntries.length];
|
||||
System.arraycopy(incPaths, 0, tmp, 0, incPaths.length);
|
||||
System.arraycopy(quotedEntries, 0, tmp, incPaths.length, quotedEntries.length);
|
||||
incPaths = tmp;
|
||||
} else {
|
||||
incPaths = calculateEntries(quotedPaths);
|
||||
}
|
||||
}
|
||||
return incPaths;
|
||||
case ICLanguageSettingEntry.MACRO:
|
||||
return calculateEntries(info.getSymbols());
|
||||
case ICLanguageSettingEntry.MACRO_FILE:
|
||||
return calculateEntries(info.getMacroFiles());
|
||||
case ICLanguageSettingEntry.INCLUDE_FILE:
|
||||
return calculateEntries(info.getIncludeFiles());
|
||||
}
|
||||
return new DiscoveredEntry[0];
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ public class ProjectConverter implements ICProjectConverter {
|
|||
IMakeTarget newT = mngr.createTarget(project, t.getName(), NEW_MAKE_TARGET_BUIDER_ID);
|
||||
copySettings(t, newT);
|
||||
mngr.removeTarget(t);
|
||||
mngr.addTarget(newT);
|
||||
mngr.addTarget(cr, newT);
|
||||
}
|
||||
} catch ( CoreException e){
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
|
|
|
@ -109,7 +109,7 @@ public class PathSettingsContainer {
|
|||
return fListeners;
|
||||
}
|
||||
|
||||
private boolean hasChildren(){
|
||||
public boolean hasChildren(){
|
||||
Map map = getChildrenMap(false);
|
||||
return map != null && map.size() != 0;
|
||||
}
|
||||
|
@ -407,5 +407,4 @@ public class PathSettingsContainer {
|
|||
private void setParent(PathSettingsContainer parent){
|
||||
fDirectParentContainer = parent;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ public class PathEntryStoreProxy extends AbstractCExtensionProxy implements IPat
|
|||
|
||||
protected void postProcessProviderChange(Object newProvider,
|
||||
Object oldProvider) {
|
||||
if(oldProvider != null)
|
||||
// if(oldProvider != null)
|
||||
fireContentChangedEvent(getProject());
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public class CFileDescription extends CDataProxyContainer implements
|
|||
|
||||
public IPath getPath() {
|
||||
CResourceData data = (CResourceData)getData(false);
|
||||
return data.getPath();
|
||||
return ResourceDescriptionHolder.normalizePath(data.getPath());
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
|
@ -50,6 +50,9 @@ public class CFileDescription extends CDataProxyContainer implements
|
|||
}
|
||||
|
||||
public void setPath(IPath path) {
|
||||
path = ResourceDescriptionHolder.normalizePath(path);
|
||||
if(getPath().equals(path))
|
||||
return;
|
||||
CResourceData data = (CResourceData)getData(true);
|
||||
data.setPath(path);
|
||||
}
|
||||
|
|
|
@ -80,4 +80,8 @@ public class CFileDescriptionCache extends CDefaultFileData implements
|
|||
public ICFolderDescription getParentFolderDescription() {
|
||||
return getRcDesHolder().getParentFolderDescription();
|
||||
}
|
||||
|
||||
public IPath getPath() {
|
||||
return ResourceDescriptionHolder.normalizePath(super.getPath());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class CFolderDescription extends CDataProxyContainer implements
|
|||
|
||||
public IPath getPath() {
|
||||
CResourceData data = (CResourceData)getData(false);
|
||||
return data.getPath();
|
||||
return ResourceDescriptionHolder.normalizePath(data.getPath());
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
|
@ -52,6 +52,10 @@ public class CFolderDescription extends CDataProxyContainer implements
|
|||
}
|
||||
|
||||
public void setPath(IPath path) {
|
||||
path = ResourceDescriptionHolder.normalizePath(path);
|
||||
if(getPath().equals(path))
|
||||
return;
|
||||
|
||||
CResourceData data = (CResourceData)getData(true);
|
||||
data.setPath(path);
|
||||
}
|
||||
|
|
|
@ -126,4 +126,8 @@ public class CFolderDescriptionCache extends CDefaultFolderData implements
|
|||
public boolean isRoot() {
|
||||
return getPath().segmentCount() == 0;
|
||||
}
|
||||
|
||||
public IPath getPath() {
|
||||
return ResourceDescriptionHolder.normalizePath(super.getPath());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ public class CTargetPlatformSettingCache extends CDefaultTargetPlatformData
|
|||
fCfgCache = cfgCache;
|
||||
|
||||
fCfgCache.addTargetPlatformSetting(this);
|
||||
|
||||
copyDataFrom(base);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,8 +14,10 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICExternalSetting;
|
||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||
|
@ -295,9 +297,26 @@ public class PathEntryConfigurationDataProvider extends
|
|||
|
||||
cproject.close();
|
||||
|
||||
String[] ids = getIds(des.get(CCorePlugin.BINARY_PARSER_UNIQ_ID));
|
||||
data.getTargetPlatformData().setBinaryParserIds(ids);
|
||||
|
||||
ids = getIds(des.get(CCorePlugin.ERROR_PARSER_UNIQ_ID));
|
||||
data.getBuildData().setErrorParserIDs(ids);
|
||||
|
||||
data.setModified(false);
|
||||
return data;
|
||||
}
|
||||
|
||||
private String[] getIds(ICConfigExtensionReference refs[]){
|
||||
if(refs == null || refs.length == 0)
|
||||
return new String[0];
|
||||
|
||||
String[] ids = new String[refs.length];
|
||||
for(int i = 0; i < refs.length; i++){
|
||||
ids[i] = refs[i].getID();
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
public CConfigurationData loadConfiguration(ICConfigurationDescription des)
|
||||
throws CoreException {
|
||||
|
|
|
@ -176,4 +176,8 @@ public class ResourceDescriptionHolder {
|
|||
return (ICFolderDescription)parent.getValue();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IPath normalizePath(IPath path){
|
||||
return path.makeRelative();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,6 +237,7 @@ public class CConfigBasedDescriptorManager implements ICDescriptorManager {
|
|||
dr.setApplyOnChange(false);
|
||||
try {
|
||||
op.execute(dr, monitor);
|
||||
reconsile(dr, des);
|
||||
} finally {
|
||||
clearOperatingDescriptor(project);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue