mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-15 04:05:38 +02:00
Fix up build output console parsers to handle the case where the compiler is called with a wrapper script.
This commit is contained in:
parent
75131a463b
commit
f097879171
2 changed files with 29 additions and 32 deletions
|
@ -41,9 +41,6 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||||
private String[] compilerInvocation;
|
private String[] compilerInvocation;
|
||||||
private GCCPerFileBOPConsoleParserUtility fUtil;
|
private GCCPerFileBOPConsoleParserUtility fUtil;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser#startup(org.eclipse.core.resources.IProject, org.eclipse.core.runtime.IPath, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.core.IMarkerGenerator)
|
|
||||||
*/
|
|
||||||
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
public void startup(IProject project, IPath workingDirectory, IScannerInfoCollector collector, IMarkerGenerator markerGenerator) {
|
||||||
fUtil = (project != null && workingDirectory != null && markerGenerator != null) ?
|
fUtil = (project != null && workingDirectory != null && markerGenerator != null) ?
|
||||||
new GCCPerFileBOPConsoleParserUtility(project, workingDirectory, markerGenerator) : null;
|
new GCCPerFileBOPConsoleParserUtility(project, workingDirectory, markerGenerator) : null;
|
||||||
|
@ -53,16 +50,10 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||||
compilerInvocation = getCompilerCommands();
|
compilerInvocation = getCompilerCommands();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#getUtility()
|
|
||||||
*/
|
|
||||||
protected AbstractGCCBOPConsoleParserUtility getUtility() {
|
protected AbstractGCCBOPConsoleParserUtility getUtility() {
|
||||||
return fUtil;
|
return fUtil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser#processSingleLine(java.lang.String)
|
|
||||||
*/
|
|
||||||
protected boolean processSingleLine(String line) {
|
protected boolean processSingleLine(String line) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
// GCC C/C++ compiler invocation
|
// GCC C/C++ compiler invocation
|
||||||
|
@ -77,18 +68,24 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||||
|
|
||||||
// expecting that compiler invocation is the first token in the line
|
// expecting that compiler invocation is the first token in the line
|
||||||
String[] split = line.split("\\s+"); //$NON-NLS-1$
|
String[] split = line.split("\\s+"); //$NON-NLS-1$
|
||||||
String command = split[0];
|
|
||||||
// verify that it is compiler invocation
|
|
||||||
int cii2 = -1;
|
int cii2 = -1;
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
// Checking the first two tokens since the first may be a wrapper script
|
||||||
|
String command = split[i];
|
||||||
|
// verify that it is compiler invocation
|
||||||
for (int cii = 0; cii < compilerInvocation.length; ++cii) {
|
for (int cii = 0; cii < compilerInvocation.length; ++cii) {
|
||||||
cii2 = command.indexOf(compilerInvocation[cii]);
|
cii2 = command.indexOf(compilerInvocation[cii]);
|
||||||
if (cii2 != -1)
|
if (cii2 != -1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (cii2 != -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (cii2 == -1) {
|
if (cii2 == -1) {
|
||||||
TraceUtil.outputTrace("Error identifying compiler command", line, TraceUtil.EOL); //$NON-NLS-1$
|
TraceUtil.outputTrace("Error identifying compiler command", line, TraceUtil.EOL); //$NON-NLS-1$
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find a file name
|
// find a file name
|
||||||
int extensionsIndex = -1;
|
int extensionsIndex = -1;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
@ -105,24 +102,18 @@ public class GCCPerFileBOPConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for (int j = 0; j < FILE_EXTENSIONS.length; ++j) {
|
|
||||||
// if (split[i].endsWith(FILE_EXTENSIONS[j])) {
|
|
||||||
// filePath = split[i];
|
|
||||||
// extensionsIndex = j;
|
|
||||||
// found = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (found) break;
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
TraceUtil.outputTrace("Error identifying file name :1", line, TraceUtil.EOL); //$NON-NLS-1$
|
TraceUtil.outputTrace("Error identifying file name :1", line, TraceUtil.EOL); //$NON-NLS-1$
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanity check
|
// sanity check
|
||||||
if (filePath.indexOf(FILE_EXTENSIONS[extensionsIndex]) == -1) {
|
if (filePath.indexOf(FILE_EXTENSIONS[extensionsIndex]) == -1) {
|
||||||
TraceUtil.outputTrace("Error identifying file name :2", line, TraceUtil.EOL); //$NON-NLS-1$
|
TraceUtil.outputTrace("Error identifying file name :2", line, TraceUtil.EOL); //$NON-NLS-1$
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fUtil != null) {
|
if (fUtil != null) {
|
||||||
IPath pFilePath = fUtil.getAbsolutePath(filePath);
|
IPath pFilePath = fUtil.getAbsolutePath(filePath);
|
||||||
String shortFileName = pFilePath.removeFileExtension().lastSegment();
|
String shortFileName = pFilePath.removeFileExtension().lastSegment();
|
||||||
|
|
|
@ -72,16 +72,22 @@ public class GCCScannerInfoConsoleParser extends AbstractGCCBOPConsoleParser {
|
||||||
// ArrayList allTokens = new ArrayList(Arrays.asList(line.split("\\s+")));//$NON-NLS-1$
|
// ArrayList allTokens = new ArrayList(Arrays.asList(line.split("\\s+")));//$NON-NLS-1$
|
||||||
if (allTokens.size() <= 1)
|
if (allTokens.size() <= 1)
|
||||||
return false;
|
return false;
|
||||||
Iterator I = allTokens.iterator();
|
|
||||||
String token = ((String) I.next()).toLowerCase();
|
|
||||||
|
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
Iterator I = allTokens.iterator();
|
||||||
|
String token;
|
||||||
|
for (int ti = 0; ti < 2; ++ti) {
|
||||||
|
token = ((String) I.next()).toLowerCase();
|
||||||
for (int i = 0; i < compilerInvocation.length; i++) {
|
for (int i = 0; i < compilerInvocation.length; i++) {
|
||||||
if (token.indexOf(compilerInvocation[i]) != -1) {
|
if (token.indexOf(compilerInvocation[i]) != -1) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (found)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
// Recognized gcc or g++ compiler invocation
|
// Recognized gcc or g++ compiler invocation
|
||||||
List includes = new ArrayList();
|
List includes = new ArrayList();
|
||||||
|
|
Loading…
Add table
Reference in a new issue