mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
This patch fixes:
1. PR 62349: [Managed Build] Funny include paths - added -P option to 'generate scanner info command' to suppress line numbering 2. Account for simple gcc names like: gcc.c2.95.3-p10.mips64 3. Exporting make.core plugin's .options file as a part of binaries. Customers now can turn scanner config discovery debugging on or off.
This commit is contained in:
parent
09fd1318d0
commit
f909efeb3c
9 changed files with 18 additions and 11 deletions
|
@ -3,8 +3,9 @@ bin.includes = plugin.xml,\
|
||||||
cdtmakecore.jar,\
|
cdtmakecore.jar,\
|
||||||
*.html,\
|
*.html,\
|
||||||
plugin.properties,\
|
plugin.properties,\
|
||||||
schema/,\
|
builtin/,\
|
||||||
builtin/
|
.options,\
|
||||||
|
schema/
|
||||||
src.includes = builtin/,\
|
src.includes = builtin/,\
|
||||||
src/,\
|
src/,\
|
||||||
schema/
|
schema/
|
||||||
|
|
|
@ -119,7 +119,7 @@
|
||||||
</parameter>
|
</parameter>
|
||||||
<parameter
|
<parameter
|
||||||
name="defaultAttributes"
|
name="defaultAttributes"
|
||||||
value="-E -v ${plugin_state_location}/${specs_file}">
|
value="-E -P -v ${plugin_state_location}/${specs_file}">
|
||||||
</parameter>
|
</parameter>
|
||||||
</run>
|
</run>
|
||||||
</externalScannerInfoProvider>
|
</externalScannerInfoProvider>
|
||||||
|
|
|
@ -129,7 +129,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("-E -v ${plugin_state_location}/${specs_file}"); //$NON-NLS-1$
|
scInfo.setESIProviderArguments("-E -P -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) {
|
||||||
|
|
|
@ -32,6 +32,7 @@ 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.cdt.make.internal.core.scannerconfig.util.ScannerConfigUtil;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.util.TraceUtil;
|
||||||
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;
|
||||||
|
@ -99,6 +100,7 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
|
|
||||||
OutputStream sniffer = ScannerInfoConsoleParserFactory.getESIProviderOutputSniffer(
|
OutputStream sniffer = ScannerInfoConsoleParserFactory.getESIProviderOutputSniffer(
|
||||||
cos, currentProject, buildInfo, collector);
|
cos, currentProject, buildInfo, collector);
|
||||||
|
TraceUtil.outputTrace("Default provider running command:", fCompileCommand.toString() + ca, ""); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
Process p = launcher.execute(fCompileCommand, compileArguments, setEnvironment(launcher), fWorkingDirectory);
|
Process p = launcher.execute(fCompileCommand, compileArguments, setEnvironment(launcher), fWorkingDirectory);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -157,7 +159,7 @@ public class DefaultExternalScannerInfoProvider implements IExternalScannerInfoP
|
||||||
//TODO VMIR better error handling
|
//TODO VMIR better error handling
|
||||||
MakeCorePlugin.log(e.getStatus());
|
MakeCorePlugin.log(e.getStatus());
|
||||||
}
|
}
|
||||||
IPath path2File = fWorkingDirectory.append(targetFile);
|
IPath path2File = MakeCorePlugin.getWorkingDirectory().append(targetFile);
|
||||||
if (!path2File.toFile().exists()) {
|
if (!path2File.toFile().exists()) {
|
||||||
GCCScannerConfigUtil.createSpecs();
|
GCCScannerConfigUtil.createSpecs();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 = "-E -v ${plugin_state_location}/{specs_file}"; //$NON-NLS-1$
|
attributes = "-E -P -v ${plugin_state_location}/{specs_file}"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return attributes;
|
return attributes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class ScannerInfoCollector implements IScannerInfoCollector {
|
||||||
// cumulative values
|
// cumulative values
|
||||||
private Map sumDiscoveredIncludes;
|
private Map sumDiscoveredIncludes;
|
||||||
private Map sumDiscoveredSymbols;
|
private Map sumDiscoveredSymbols;
|
||||||
private Map sumDiscoveredTSO; // target specific options
|
// private Map sumDiscoveredTSO; // target specific options
|
||||||
|
|
||||||
private IProject currentProject; // project being built
|
private IProject currentProject; // project being built
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class ScannerInfoCollector implements IScannerInfoCollector {
|
||||||
|
|
||||||
sumDiscoveredIncludes = new HashMap();
|
sumDiscoveredIncludes = new HashMap();
|
||||||
sumDiscoveredSymbols = new HashMap();
|
sumDiscoveredSymbols = new HashMap();
|
||||||
sumDiscoveredTSO = new HashMap();
|
// sumDiscoveredTSO = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ScannerInfoCollector getInstance() {
|
public static ScannerInfoCollector getInstance() {
|
||||||
|
@ -250,7 +250,7 @@ public class ScannerInfoCollector implements IScannerInfoCollector {
|
||||||
// Step 4. Set resulting scanner config
|
// Step 4. Set resulting scanner config
|
||||||
discScanInfo.setDiscoveredIncludePaths(newPersistedIncludes);
|
discScanInfo.setDiscoveredIncludePaths(newPersistedIncludes);
|
||||||
|
|
||||||
// Step 5. Invalidate discovered include paths and symbol definitions
|
// Step 5. Invalidate discovered include paths
|
||||||
discoveredIncludes.put(projectName, null);
|
discoveredIncludes.put(projectName, null);
|
||||||
}
|
}
|
||||||
return addedIncludes;
|
return addedIncludes;
|
||||||
|
@ -286,7 +286,7 @@ public class ScannerInfoCollector implements IScannerInfoCollector {
|
||||||
// Step 4. Set resulting scanner config
|
// Step 4. Set resulting scanner config
|
||||||
discScanInfo.setDiscoveredSymbolDefinitions(candidateSymbols);
|
discScanInfo.setDiscoveredSymbolDefinitions(candidateSymbols);
|
||||||
|
|
||||||
// Step 5. Invalidate discovered include paths and symbol definitions
|
// Step 5. Invalidate discovered symbol definitions
|
||||||
discoveredSymbols.put(projectName, null);
|
discoveredSymbols.put(projectName, null);
|
||||||
}
|
}
|
||||||
return addedSymbols;
|
return addedSymbols;
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser {
|
||||||
*/
|
*/
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
|
TraceUtil.outputTrace("GCCScannerInfoConsoleParser parsing line:", TraceUtil.EOL, line); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// make\[[0-9]*\]: error_desc
|
// make\[[0-9]*\]: error_desc
|
||||||
int firstColon= line.indexOf(':');
|
int firstColon= line.indexOf(':');
|
||||||
String make = line.substring(0, firstColon + 1);
|
String make = line.substring(0, firstColon + 1);
|
||||||
|
@ -75,7 +76,7 @@ public class GCCScannerInfoConsoleParser implements IScannerInfoConsoleParser {
|
||||||
return false;
|
return false;
|
||||||
Iterator I = allTokens.iterator();
|
Iterator I = allTokens.iterator();
|
||||||
String token = ((String) I.next()).toLowerCase();
|
String token = ((String) I.next()).toLowerCase();
|
||||||
if (token.endsWith("gcc") || token.endsWith("g++")) {//$NON-NLS-1$ //$NON-NLS-2$
|
if (token.indexOf("gcc") != -1 || token.indexOf("g++") != -1) {//$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// Recognized gcc or g++ compiler invocation
|
// Recognized gcc or g++ compiler invocation
|
||||||
List includes = new ArrayList();
|
List includes = new ArrayList();
|
||||||
List symbols = new ArrayList();
|
List symbols = new ArrayList();
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class GCCSpecsConsoleParser implements IScannerInfoConsoleParser {
|
||||||
*/
|
*/
|
||||||
public boolean processLine(String line) {
|
public boolean processLine(String line) {
|
||||||
boolean rc = false;
|
boolean rc = false;
|
||||||
|
TraceUtil.outputTrace("GCCSpecsConsoleParser parsing line:", TraceUtil.EOL, line); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// Known patterns:
|
// Known patterns:
|
||||||
// (a) gcc|g++ ... -Dxxx -Iyyy ...
|
// (a) gcc|g++ ... -Dxxx -Iyyy ...
|
||||||
switch (state) {
|
switch (state) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.util.List;
|
||||||
* @author vhirsl
|
* @author vhirsl
|
||||||
*/
|
*/
|
||||||
public class TraceUtil {
|
public class TraceUtil {
|
||||||
|
public static final String EOL = System.getProperty("line.separator");
|
||||||
public static boolean SCANNER_CONFIG = false;
|
public static boolean SCANNER_CONFIG = false;
|
||||||
|
|
||||||
public static boolean isTracing() {
|
public static boolean isTracing() {
|
||||||
|
@ -26,6 +27,7 @@ public class TraceUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void outputTrace(String prefix, String msg, String postfix) {
|
public static void outputTrace(String prefix, String msg, String postfix) {
|
||||||
|
System.out.println();
|
||||||
System.out.println(prefix + ' ' + msg + ' ' + postfix);
|
System.out.println(prefix + ' ' + msg + ' ' + postfix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue