mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
JavaDoc, high level descriptions for language settings providers in
build plugins
This commit is contained in:
parent
3429983cb4
commit
bde0e7a154
6 changed files with 33 additions and 27 deletions
|
@ -36,11 +36,12 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
|
||||
/**
|
||||
* TODO - class description
|
||||
* Abstract class for providers parsing compiler option from build command when it
|
||||
* is present in build output.
|
||||
*
|
||||
* Note: IErrorParser interface is used here to work around {@link ConsoleOutputSniffer} having
|
||||
* no access from CDT core to build packages. TODO - elaborate?
|
||||
*
|
||||
*
|
||||
* @since 7.2
|
||||
*/
|
||||
public abstract class AbstractBuildCommandParser extends AbstractLanguageSettingsOutputScanner
|
||||
|
|
|
@ -68,6 +68,9 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Abstract parser capable to execute compiler command printing built-in compiler
|
||||
* specs and parse built-in language settings out of it.
|
||||
*
|
||||
* @since 7.2
|
||||
*/
|
||||
public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSettingsOutputScanner implements ICListenerAgent {
|
||||
|
|
|
@ -55,6 +55,8 @@ import org.eclipse.core.runtime.content.IContentTypeManager;
|
|||
import org.w3c.dom.Element;
|
||||
|
||||
/**
|
||||
* Abstract class for providers capable to parse build output.
|
||||
*
|
||||
* @since 7.2
|
||||
*/
|
||||
public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSettingsSerializableProvider {
|
||||
|
|
|
@ -21,17 +21,15 @@ import org.eclipse.cdt.managedbuilder.scannerconfig.ToolchainBuiltinSpecsDetecto
|
|||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* Class to detect built-in compiler settings. Note that currently this class is hardwired
|
||||
* to GCC toolchain {@code cdt.managedbuild.toolchain.gnu.base}.
|
||||
*
|
||||
* Language settings provider to detect built-in compiler settings for GCC compiler.
|
||||
*/
|
||||
public class GCCBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector implements ILanguageSettingsEditableProvider {
|
||||
// ID must match the toolchain definition in org.eclipse.cdt.managedbuilder.core.buildDefinitions extension point
|
||||
private static final String GCC_TOOLCHAIN_ID = "cdt.managedbuild.toolchain.gnu.base"; //$NON-NLS-1$
|
||||
|
||||
|
||||
private enum State {NONE, EXPECTING_LOCAL_INCLUDE, EXPECTING_SYSTEM_INCLUDE, EXPECTING_FRAMEWORKS}
|
||||
private State state = State.NONE;
|
||||
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
private static final AbstractOptionParser[] optionParsers = {
|
||||
new IncludePathOptionParser("#include \"(\\S.*)\"", "$1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.LOCAL),
|
||||
|
@ -54,7 +52,7 @@ public class GCCBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
|
|||
private List<String> makeList(final String line) {
|
||||
return new ArrayList<String>() {{ add(line); }};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected List<String> parseForOptions(String line) {
|
||||
line = line.trim();
|
||||
|
@ -102,10 +100,10 @@ public class GCCBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
|
|||
@Override
|
||||
public void startup(ICConfigurationDescription cfgDescription) throws CoreException {
|
||||
super.startup(cfgDescription);
|
||||
|
||||
|
||||
state = State.NONE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
state = State.NONE;
|
||||
|
@ -123,5 +121,5 @@ public class GCCBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
|
|||
return (GCCBuiltinSpecsDetector) super.clone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
|||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
|
||||
/**
|
||||
* Abstract parser capable to execute compiler command printing built-in compiler
|
||||
* specs and parse built-in language settings out of it. The compiler to be used
|
||||
* is taken from MBS tool-chain definition.
|
||||
*
|
||||
* @since 8.1
|
||||
*/
|
||||
public abstract class ToolchainBuiltinSpecsDetector extends AbstractBuiltinSpecsDetector {
|
||||
|
|
|
@ -21,32 +21,30 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
|||
import org.eclipse.cdt.managedbuilder.scannerconfig.ToolchainBuiltinSpecsDetector;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
> xlC -E -V -P -w ~/tmp/spec.C
|
||||
export XL_CONFIG=/etc/vac.cfg:xlC
|
||||
/usr/vac/exe/xlCcpp /home/me/tmp/spec.C - -qc++=/usr/vacpp/include -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX50 -D_AIX51 -D_AIX52 -D_IBMR2 -D_POWER -E -P -w -qlanglvl=ansi -qansialias
|
||||
rm /tmp/xlcW0lt4Jia
|
||||
rm /tmp/xlcW1lt4Jib
|
||||
rm /tmp/xlcW2lt4Jic
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to detect built-in compiler settings. Note that currently this class is hardwired
|
||||
* to GCC toolchain {@code cdt.managedbuild.toolchain.gnu.base}.
|
||||
*
|
||||
* Language settings provider to detect built-in compiler settings for IBM XLC compiler.
|
||||
* Note that currently this class is hardwired to GCC toolchain
|
||||
* {@code cdt.managedbuild.toolchain.gnu.base}.
|
||||
*/
|
||||
public class XlcBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector implements ILanguageSettingsEditableProvider {
|
||||
// must match the toolchain definition in org.eclipse.cdt.managedbuilder.core.buildDefinitions extension point
|
||||
// FIXME - ill defined XLC toolchain
|
||||
// private static final String XLC_TOOLCHAIN_ID = "cdt.managedbuild.toolchain.xlc.exe.debug"; //$NON-NLS-1$
|
||||
private static final String GCC_TOOLCHAIN_ID = "cdt.managedbuild.toolchain.gnu.base"; //$NON-NLS-1$
|
||||
|
||||
|
||||
private static final Pattern OPTIONS_PATTERN = Pattern.compile("-[^\\s\"']*(\\s*((\".*?\")|('.*?')|([^-\\s][^\\s]+)))?"); //$NON-NLS-1$
|
||||
private static final int OPTION_GROUP = 0;
|
||||
|
||||
/* Sample output:
|
||||
|
||||
> xlC -E -V -P -w ~/tmp/spec.C
|
||||
export XL_CONFIG=/etc/vac.cfg:xlC
|
||||
/usr/vac/exe/xlCcpp /home/me/tmp/spec.C - -qc++=/usr/vacpp/include -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX50 -D_AIX51 -D_AIX52 -D_IBMR2 -D_POWER -E -P -w -qlanglvl=ansi -qansialias
|
||||
rm /tmp/xlcW0lt4Jia
|
||||
rm /tmp/xlcW1lt4Jib
|
||||
rm /tmp/xlcW2lt4Jic
|
||||
*/
|
||||
@SuppressWarnings("nls")
|
||||
private static final AbstractOptionParser[] optionParsers = {
|
||||
new IncludePathOptionParser("-I\\s*([\"'])(.*)\\1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.LOCAL),
|
||||
|
@ -93,5 +91,5 @@ public class XlcBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
|
|||
return (XlcBuiltinSpecsDetector) super.clone();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue