mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
patch from vlad.
PR 59971 - [Scanner Config] Cannot change default scanner info command, No PR - improvement in transformation of relative to absolute paths Also a change in IScannerInfoCollector interface to allow console parsers to contribute arbitrary information (like compiler version info, imacros, target specific options, ...) to the collector.
This commit is contained in:
parent
5d46138a5d
commit
41201a534a
9 changed files with 110 additions and 94 deletions
|
@ -119,7 +119,7 @@
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter
|
<parameter
|
||||||
name="defaultAttributes"
|
name="defaultAttributes"
|
||||||
value="-c -v">
|
value="-E -v ${plugin_state_location}/${specs_file}">
|
||||||
</parameter>
|
</parameter>
|
||||||
</run>
|
</run>
|
||||||
</externalScannerInfoProvider>
|
</externalScannerInfoProvider>
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class MakeCorePlugin extends Plugin {
|
||||||
scInfo.setESIProviderCommandEnabled(true);
|
scInfo.setESIProviderCommandEnabled(true);
|
||||||
scInfo.setUseDefaultESIProviderCmd(true);
|
scInfo.setUseDefaultESIProviderCmd(true);
|
||||||
scInfo.setESIProviderCommand(new Path("gcc")); //$NON-NLS-1$
|
scInfo.setESIProviderCommand(new Path("gcc")); //$NON-NLS-1$
|
||||||
scInfo.setESIProviderArguments("-c -v"); //$NON-NLS-1$
|
scInfo.setESIProviderArguments("-E -v ${plugin_state_location}/${specs_file}"); //$NON-NLS-1$
|
||||||
scInfo.setESIProviderConsoleParserId(GCC_SPECS_CONSOLE_PARSER_ID);
|
scInfo.setESIProviderConsoleParserId(GCC_SPECS_CONSOLE_PARSER_ID);
|
||||||
scInfo.setMakeBuilderConsoleParserId(GCC_SCANNER_INFO_CONSOLE_PARSER_ID);
|
scInfo.setMakeBuilderConsoleParserId(GCC_SCANNER_INFO_CONSOLE_PARSER_ID);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.make.core.scannerconfig;
|
package org.eclipse.cdt.make.core.scannerconfig;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
|
@ -21,16 +22,22 @@ import org.eclipse.core.resources.IResource;
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public interface IScannerInfoCollector {
|
public interface IScannerInfoCollector {
|
||||||
|
// for a list of target specific options i.e. -pthread, -ansi, -no_
|
||||||
|
public static Integer TARGET_SPECIFIC_OPTION = new Integer(1) ;
|
||||||
|
public static Integer IMACROS = new Integer(2);
|
||||||
|
public static Integer COMPILER_VERSION_INFO = new Integer(3);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contribute to resource's scanner configuration
|
* Contribute to resource's scanner configuration
|
||||||
*
|
*
|
||||||
* @param resource
|
* @param resource
|
||||||
* @param includes
|
* @param includes
|
||||||
* @param symbols
|
* @param symbols
|
||||||
* @param targetSpecificOptions
|
* @param extraInfo - a map of key - list pairs, where key is the type of extra info
|
||||||
|
* i.e. target specific options or imacros commands,...
|
||||||
*/
|
*/
|
||||||
public void contributeToScannerConfig(IResource resource,
|
public void contributeToScannerConfig(IResource resource,
|
||||||
List includes,
|
List includes,
|
||||||
List symbols,
|
List symbols,
|
||||||
List targetSpecificOptions);
|
Map extraInfo);
|
||||||
}
|
}
|
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -32,6 +31,7 @@ import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||||
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||||
import org.eclipse.cdt.make.internal.core.StreamMonitor;
|
import org.eclipse.cdt.make.internal.core.StreamMonitor;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerConfigUtil;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.ScannerConfigUtil;
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -54,7 +54,7 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
|
|
||||||
private IPath fWorkingDirectory;
|
private IPath fWorkingDirectory;
|
||||||
private IPath fCompileCommand;
|
private IPath fCompileCommand;
|
||||||
private String fCompileArguments;
|
private String[] fCompileArguments;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider#invokeProvider(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.resources.IProject, org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo, java.util.List, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IExternalScannerInfoProvider#invokeProvider(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.resources.IProject, org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo, java.util.List, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector)
|
||||||
|
@ -144,32 +144,31 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
private boolean initialize(IProject currentProject, IScannerConfigBuilderInfo buildInfo, List targetSpecificOptions) {
|
private boolean initialize(IProject currentProject, IScannerConfigBuilderInfo buildInfo, List targetSpecificOptions) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
|
|
||||||
if (buildInfo.isDefaultESIProviderCmd()) {
|
fWorkingDirectory = currentProject.getLocation();
|
||||||
fWorkingDirectory = MakeCorePlugin.getWorkingDirectory();
|
String targetFile = "dummy"; //$NON-NLS-1$
|
||||||
String targetFile = "dummy"; //$NON-NLS-1$
|
try {
|
||||||
try {
|
if (currentProject.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||||
if (currentProject.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
|
||||||
targetFile = GCCScannerConfigUtil.CPP_SPECS_FILE;
|
|
||||||
}
|
|
||||||
else if (currentProject.hasNature(CProjectNature.C_NATURE_ID)) {
|
|
||||||
targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
//TODO VMIR better error handling
|
|
||||||
MakeCorePlugin.log(e.getStatus());
|
|
||||||
}
|
}
|
||||||
IPath path2File = fWorkingDirectory.append(targetFile);
|
else if (currentProject.hasNature(CProjectNature.C_NATURE_ID)) {
|
||||||
if (!path2File.toFile().exists()) {
|
targetFile = GCCScannerConfigUtil.C_SPECS_FILE;
|
||||||
GCCScannerConfigUtil.createSpecs();
|
|
||||||
}
|
}
|
||||||
targetSpecificOptions.add(targetFile);
|
} catch (CoreException e) {
|
||||||
|
//TODO VMIR better error handling
|
||||||
|
MakeCorePlugin.log(e.getStatus());
|
||||||
}
|
}
|
||||||
else {
|
IPath path2File = fWorkingDirectory.append(targetFile);
|
||||||
fWorkingDirectory = currentProject.getLocation();
|
if (!path2File.toFile().exists()) {
|
||||||
|
GCCScannerConfigUtil.createSpecs();
|
||||||
}
|
}
|
||||||
fCompileCommand = buildInfo.getESIProviderCommand();
|
fCompileCommand = buildInfo.getESIProviderCommand();
|
||||||
if (fCompileCommand != null) {
|
if (fCompileCommand != null) {
|
||||||
fCompileArguments = buildInfo.getESIProviderArguments();
|
fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getESIProviderArguments());
|
||||||
|
for (int i = 0; i < fCompileArguments.length; ++i) {
|
||||||
|
fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{plugin_state_location\\}", //$NON-NLS-1$
|
||||||
|
MakeCorePlugin.getWorkingDirectory().toString());
|
||||||
|
fCompileArguments[i] = fCompileArguments[i].replaceAll("\\$\\{specs_file\\}", targetFile); //$NON-NLS-1$
|
||||||
|
}
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -183,17 +182,12 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
String[] rv = null;
|
String[] rv = null;
|
||||||
// commandArguments may have multiple arguments; tokenizing
|
// commandArguments may have multiple arguments; tokenizing
|
||||||
int nTokens = 0;
|
int nTokens = 0;
|
||||||
if (fCompileArguments != null && fCompileArguments.length() > 0) {
|
if (fCompileArguments != null && fCompileArguments.length > 0) {
|
||||||
StringTokenizer tokenizer = new StringTokenizer(fCompileArguments, " ");//$NON-NLS-1$
|
nTokens = fCompileArguments.length;
|
||||||
nTokens = tokenizer.countTokens();
|
rv = new String[nTokens + tso.size()];
|
||||||
if (nTokens > 0) {
|
System.arraycopy(fCompileArguments, 0, rv, 0, nTokens);
|
||||||
rv = new String[nTokens + tso.size()];
|
|
||||||
for (int i = 0; tokenizer.hasMoreTokens(); ++i) {
|
|
||||||
rv[i] = tokenizer.nextToken();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (rv == null) {
|
else {
|
||||||
rv = new String[tso.size()];
|
rv = new String[tso.size()];
|
||||||
}
|
}
|
||||||
for (int i = 0; i < tso.size(); ++i) {
|
for (int i = 0; i < tso.size(); ++i) {
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class ScannerConfigInfoFactory {
|
||||||
if (isDefaultESIProviderCmd()) {
|
if (isDefaultESIProviderCmd()) {
|
||||||
String attributes = getESIProviderParameter("defaultAttributes"); //$NON-NLS-1$
|
String attributes = getESIProviderParameter("defaultAttributes"); //$NON-NLS-1$
|
||||||
if (attributes == null) {
|
if (attributes == null) {
|
||||||
attributes = "-c -v"; //$NON-NLS-1$
|
attributes = "-E -v ${plugin_state_location}/{specs_file}"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,9 @@ public class ScannerInfoCollector implements IScannerInfoCollector {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(org.eclipse.core.resources.IResource, java.util.List, java.util.List, java.util.List)
|
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector#contributeToScannerConfig(org.eclipse.core.resources.IResource, java.util.List, java.util.List, java.util.Map)
|
||||||
*/
|
*/
|
||||||
public synchronized void contributeToScannerConfig(IResource resource, List includes, List symbols, List targetSpecificOptions) {
|
public void contributeToScannerConfig(IResource resource, List includes, List symbols, Map extraInfo) {
|
||||||
IProject project;
|
IProject project;
|
||||||
if (resource == null || (project = resource.getProject()) == null) {
|
if (resource == null || (project = resource.getProject()) == null) {
|
||||||
TraceUtil.outputError("IScannerInfoCollector.contributeToScannerConfig : ", "resource or project is null"); //$NON-NLS-1$ //$NON-NLS-2$
|
TraceUtil.outputError("IScannerInfoCollector.contributeToScannerConfig : ", "resource or project is null"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -96,7 +96,10 @@ public class ScannerInfoCollector implements IScannerInfoCollector {
|
||||||
String projectName = project.getName();
|
String projectName = project.getName();
|
||||||
contribute(projectName, discoveredIncludes, includes, true);
|
contribute(projectName, discoveredIncludes, includes, true);
|
||||||
contribute(projectName, discoveredSymbols, symbols, false);
|
contribute(projectName, discoveredSymbols, symbols, false);
|
||||||
contribute(projectName, discoveredTSO, targetSpecificOptions, false);
|
contribute(projectName,
|
||||||
|
discoveredTSO,
|
||||||
|
(extraInfo == null) ? null : (List) extraInfo.get(IScannerInfoCollector.TARGET_SPECIFIC_OPTION),
|
||||||
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (CoreException e) {
|
catch (CoreException e) {
|
||||||
|
|
|
@ -16,12 +16,15 @@ import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.IScannerInfoConsoleParserUtility;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.ScannerConfigUtil;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses gcc and g++ output for -I and -D parameters.
|
* Parses gcc and g++ output for -I and -D parameters.
|
||||||
|
@ -67,17 +70,7 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser {
|
||||||
}
|
}
|
||||||
// Known patterns:
|
// Known patterns:
|
||||||
// (a) gcc|g++ ... -Dxxx -Iyyy ...
|
// (a) gcc|g++ ... -Dxxx -Iyyy ...
|
||||||
ArrayList allTokens = new ArrayList();
|
ArrayList allTokens = new ArrayList(Arrays.asList(ScannerConfigUtil.tokenizeStringWithQuotes(line)));
|
||||||
String[] tokens = line.split("\"");
|
|
||||||
for (int i = 0; i < tokens.length; ++i) {
|
|
||||||
if (i % 2 == 0) { // even tokens need further tokenization
|
|
||||||
String[] sTokens = tokens[i].split("\\s");
|
|
||||||
allTokens.addAll(Arrays.asList(sTokens));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
allTokens.add(tokens[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (allTokens.size() <= 1)
|
if (allTokens.size() <= 1)
|
||||||
return false;
|
return false;
|
||||||
Iterator I = allTokens.iterator();
|
Iterator I = allTokens.iterator();
|
||||||
|
@ -181,7 +174,9 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser {
|
||||||
}
|
}
|
||||||
// Contribute discovered includes and symbols to the ScannerInfoCollector
|
// Contribute discovered includes and symbols to the ScannerInfoCollector
|
||||||
if (translatedIncludes.size() > 0 || symbols.size() > 0) {
|
if (translatedIncludes.size() > 0 || symbols.size() > 0) {
|
||||||
fCollector.contributeToScannerConfig(project, translatedIncludes, symbols, targetSpecificOptions);
|
Map extraInfo = new HashMap();
|
||||||
|
extraInfo.put(IScannerInfoCollector.TARGET_SPECIFIC_OPTION, targetSpecificOptions);
|
||||||
|
fCollector.contributeToScannerConfig(project, translatedIncludes, symbols, extraInfo);
|
||||||
|
|
||||||
TraceUtil.outputTrace("Discovered scanner info for file \'" + fileName + '\'', //$NON-NLS-1$
|
TraceUtil.outputTrace("Discovered scanner info for file \'" + fileName + '\'', //$NON-NLS-1$
|
||||||
"Include paths", includes, translatedIncludes, "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
|
"Include paths", includes, translatedIncludes, "Defined symbols", symbols); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
package org.eclipse.cdt.make.internal.core.scannerconfig.util;
|
package org.eclipse.cdt.make.internal.core.scannerconfig.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
@ -248,4 +249,25 @@ public final class ScannerConfigUtil {
|
||||||
}
|
}
|
||||||
return newSumPaths;
|
return newSumPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tokenizes string with quuotes
|
||||||
|
*
|
||||||
|
* @param String
|
||||||
|
* @return String[]
|
||||||
|
*/
|
||||||
|
public static String[] tokenizeStringWithQuotes(String line) {
|
||||||
|
ArrayList allTokens = new ArrayList();
|
||||||
|
String[] tokens = line.split("\""); //$NON-NLS-1$
|
||||||
|
for (int i = 0; i < tokens.length; ++i) {
|
||||||
|
if (i % 2 == 0) { // even tokens need further tokenization
|
||||||
|
String[] sTokens = tokens[i].split("\\s"); //$NON-NLS-1$
|
||||||
|
allTokens.addAll(Arrays.asList(sTokens));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
allTokens.add(tokens[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (String[]) allTokens.toArray(new String[allTokens.size()]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,52 +323,47 @@ public class ScannerInfoConsoleParserUtility implements IScannerInfoConsoleParse
|
||||||
String include = (String) i.next();
|
String include = (String) i.next();
|
||||||
IPath includePath = new Path(include);
|
IPath includePath = new Path(include);
|
||||||
if (!includePath.isAbsolute()) {
|
if (!includePath.isAbsolute()) {
|
||||||
// check if it is a relative path
|
// First try the current working directory
|
||||||
if (include.startsWith("..") || include.startsWith(".")) { //$NON-NLS-1$ //$NON-NLS-2$
|
IPath cwd = getWorkingDirectory();
|
||||||
// First try the current working directory
|
if (!cwd.isAbsolute()) {
|
||||||
IPath cwd = getWorkingDirectory();
|
cwd = fProject.getLocation().append(cwd);
|
||||||
if (!cwd.isAbsolute()) {
|
}
|
||||||
cwd = fProject.getLocation().append(cwd);
|
// check if the cwd is the right one
|
||||||
}
|
// appending fileName to cwd should yield file path
|
||||||
// check if the cwd is the right one
|
IPath filePath = cwd.append(fileName);
|
||||||
// appending fileName to cwd should yield file path
|
if (!filePath.toString().equalsIgnoreCase(file.getLocation().toString())) {
|
||||||
IPath filePath = cwd.append(fileName);
|
// must be the cwd is wrong
|
||||||
if (!filePath.toString().equalsIgnoreCase(file.getLocation().toString())) {
|
// check if file name starts with ".."
|
||||||
// must be the cwd is wrong
|
if (fileName.startsWith("..")) { //$NON-NLS-1$
|
||||||
// check if file name starts with ".."
|
// probably multiple choices for cwd, hopeless
|
||||||
if (fileName.startsWith("..")) { //$NON-NLS-1$
|
TraceUtil.outputError("Unable to determine working directory for ", fileName); //$NON-NLS-1$
|
||||||
// probably multiple choices for cwd, hopeless
|
generateMarker(file, -1, "Unable to determine working directory for", //$NON-NLS-1$
|
||||||
TraceUtil.outputError("Unable to determine working directory for ", fileName); //$NON-NLS-1$
|
IMarkerGenerator.SEVERITY_WARNING, fileName);
|
||||||
generateMarker(file, -1, "Unable to determine working directory for", //$NON-NLS-1$
|
break;
|
||||||
IMarkerGenerator.SEVERITY_WARNING, fileName);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// remove common segments at the end
|
|
||||||
IPath tPath = new Path(fileName);
|
|
||||||
if (fileName.startsWith(".")) { //$NON-NLS-1$
|
|
||||||
tPath = tPath.removeFirstSegments(1);
|
|
||||||
}
|
|
||||||
// get the file path from the file
|
|
||||||
filePath = file.getLocation();
|
|
||||||
IPath lastFileSegment = filePath.removeFirstSegments(filePath.segmentCount() - tPath.segmentCount());
|
|
||||||
if (lastFileSegment.matchingFirstSegments(tPath) == tPath.segmentCount()) {
|
|
||||||
cwd = filePath.removeLastSegments(tPath.segmentCount());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IPath candidatePath = cwd.append(includePath);
|
|
||||||
File dir = candidatePath.toFile();
|
|
||||||
if (dir.exists()) {
|
|
||||||
translatedIncludes.add(candidatePath.toString());
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
generateMarker(file, -1, "Nonexistent include path: "+include,
|
// remove common segments at the end
|
||||||
IMarkerGenerator.SEVERITY_WARNING, fileName);
|
IPath tPath = new Path(fileName);
|
||||||
|
if (fileName.startsWith(".")) { //$NON-NLS-1$
|
||||||
|
tPath = tPath.removeFirstSegments(1);
|
||||||
|
}
|
||||||
|
// get the file path from the file
|
||||||
|
filePath = file.getLocation();
|
||||||
|
IPath lastFileSegment = filePath.removeFirstSegments(filePath.segmentCount() - tPath.segmentCount());
|
||||||
|
if (lastFileSegment.matchingFirstSegments(tPath) == tPath.segmentCount()) {
|
||||||
|
cwd = filePath.removeLastSegments(tPath.segmentCount());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IPath candidatePath = cwd.append(includePath);
|
||||||
|
File dir = candidatePath.toFile();
|
||||||
|
include = candidatePath.toString();
|
||||||
|
if (!dir.exists()) {
|
||||||
|
TraceUtil.outputError("Nonexistent include path: ", include); //$NON-NLS-1$
|
||||||
|
generateMarker(file, -1, "Nonexistent include path: "+include, //$NON-NLS-1$
|
||||||
|
IMarkerGenerator.SEVERITY_WARNING, fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// TODO VMIR for now add unresolved paths as well
|
// TODO VMIR for now add unresolved paths as well
|
||||||
translatedIncludes.add(include);
|
translatedIncludes.add(include);
|
||||||
|
|
Loading…
Add table
Reference in a new issue