mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Revised BOP and Specs Detectors interface hierarchy -
replaced interfaces with abstract classes
This commit is contained in:
parent
66e7277289
commit
3f9cdb6fb8
10 changed files with 16 additions and 104 deletions
|
@ -40,7 +40,6 @@ import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
|||
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||
import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ILanguageSettingsBuildOutputScanner;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.GCCBuildCommandParser;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
|
@ -255,7 +254,7 @@ public class GCCBuildCommandParserTest extends TestCase {
|
|||
final IFile file=ResourceHelper.createFile(project, "file.cpp");
|
||||
|
||||
// create test class
|
||||
ILanguageSettingsBuildOutputScanner parser = new MockBuildCommandParser() {
|
||||
AbstractBuildCommandParser parser = new MockBuildCommandParser() {
|
||||
@Override
|
||||
public boolean processLine(String line, ErrorParserManager epm) {
|
||||
// pretending that we parsed the line
|
||||
|
|
|
@ -17,14 +17,22 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.ICConsoleParser;
|
||||
import org.eclipse.cdt.core.IErrorParser;
|
||||
import org.eclipse.cdt.core.IErrorParser2;
|
||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
import org.eclipse.cdt.core.errorparsers.RegexErrorParser;
|
||||
import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
|
||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||
|
||||
public abstract class AbstractBuildCommandParser extends AbstractLanguageSettingsOutputScanner implements
|
||||
ILanguageSettingsBuildOutputScanner {
|
||||
/**
|
||||
* TODO - class description
|
||||
*
|
||||
* Note: IErrorParser interface is used here to work around {@link ConsoleOutputSniffer} having
|
||||
* no access from CDT core to build packages. TODO - elaborate?
|
||||
*/
|
||||
public abstract class AbstractBuildCommandParser extends AbstractLanguageSettingsOutputScanner
|
||||
implements ICConsoleParser, IErrorParser {
|
||||
|
||||
private static final String LEADING_PATH_PATTERN = "\\S+[/\\\\]"; //$NON-NLS-1$
|
||||
private static final Pattern OPTIONS_PATTERN = Pattern.compile("-[^\\s\"']*(\\s*((\".*?\")|('.*?')|([^-\\s][^\\s]+)))?"); //$NON-NLS-1$
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.eclipse.core.runtime.SubProgressMonitor;
|
|||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSettingsOutputScanner implements ILanguageSettingsBuiltinSpecsDetector {
|
||||
public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSettingsOutputScanner {
|
||||
private static final String NEWLINE = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
private static final String PLUGIN_CDT_MAKE_UI_ID = "org.eclipse.cdt.make.ui"; //$NON-NLS-1$
|
||||
private static final String GMAKE_ERROR_PARSER_ID = "org.eclipse.cdt.core.GmakeErrorParser"; //$NON-NLS-1$
|
||||
|
|
|
@ -55,8 +55,7 @@ import org.eclipse.core.runtime.content.IContentType;
|
|||
import org.eclipse.core.runtime.content.IContentTypeManager;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSettingsSerializable implements
|
||||
ILanguageSettingsOutputScanner {
|
||||
public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSettingsSerializable {
|
||||
|
||||
protected static final String ATTR_EXPAND_RELATIVE_PATHS = "expand-relative-paths"; //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011, 2011 Andrew Gvozdev 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:
|
||||
* Andrew Gvozdev - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.make.core.scannerconfig;
|
||||
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.IErrorParser;
|
||||
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||
|
||||
/**
|
||||
* Note: IErrorParser interface is used here to work around {@link ConsoleOutputSniffer} having
|
||||
* no access from CDT core to build packages.
|
||||
*/
|
||||
public interface ILanguageSettingsBuildOutputScanner extends ILanguageSettingsOutputScanner, IErrorParser {
|
||||
|
||||
/**
|
||||
* This method is expected to populate this.settingEntries with specific values
|
||||
* parsed from supplied lines.
|
||||
*/
|
||||
public boolean processLine(String line, ErrorParserManager epm);
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2011, 2011 Andrew Gvozdev 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:
|
||||
* Andrew Gvozdev - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.make.core.scannerconfig;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
public interface ILanguageSettingsBuiltinSpecsDetector extends ILanguageSettingsProvider {
|
||||
public List<String> getLanguageScope();
|
||||
public void run(IProject project, String languageId, IPath workingDirectory, String[] env, IProgressMonitor monitor) throws CoreException, IOException;
|
||||
public void run(ICConfigurationDescription cfgDescription, String languageId, IPath workingDirectory, String[] env, IProgressMonitor monitor) throws CoreException, IOException;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2009 Andrew Gvozdev (Quoin Inc.) 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:
|
||||
* Andrew Gvozdev (Quoin Inc.) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.make.core.scannerconfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.ICConsoleParser;
|
||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
/**
|
||||
* TODO: Is this interface superfluous?
|
||||
*/
|
||||
public interface ILanguageSettingsOutputScanner extends ILanguageSettingsProvider, ICConsoleParser {
|
||||
|
||||
// Inherited from ICConsoleParser
|
||||
public void startup(ICConfigurationDescription cfgDescription) throws CoreException;
|
||||
public boolean processLine(String line);
|
||||
public void shutdown();
|
||||
|
||||
// Inherited from ICLanguageSettingsProvider
|
||||
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId);
|
||||
}
|
|
@ -42,7 +42,6 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
|||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ILanguageSettingsBuiltinSpecsDetector;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser;
|
||||
|
@ -409,7 +408,7 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
|||
List<ILanguageSettingsProvider> lsProviders = cfgDescription.getLanguageSettingProviders();
|
||||
for (ILanguageSettingsProvider lsProvider : lsProviders) {
|
||||
ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(lsProvider);
|
||||
if (rawProvider instanceof ICConsoleParser && !(rawProvider instanceof ILanguageSettingsBuiltinSpecsDetector)) {
|
||||
if (rawProvider instanceof ICConsoleParser) {
|
||||
ICConsoleParser consoleParser = (ICConsoleParser) rawProvider;
|
||||
try {
|
||||
consoleParser.startup(cfgDescription);
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.eclipse.cdt.core.resources.IConsole;
|
|||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ILanguageSettingsBuildOutputScanner;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser;
|
||||
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
||||
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildDescription;
|
||||
|
@ -164,7 +164,7 @@ public class InternalBuildRunner extends AbstractBuildRunner {
|
|||
|
||||
List<ILanguageSettingsProvider> providers = cfgDescription.getLanguageSettingProviders();
|
||||
for (ILanguageSettingsProvider provider : providers) {
|
||||
if (provider instanceof ILanguageSettingsBuildOutputScanner) {
|
||||
if (provider instanceof AbstractBuildCommandParser) {
|
||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String msg = ManagedMakeMessages.getFormattedString("BOP Language Settings Provider [{0}] is not supported by Internal Builder.", provider.getName());
|
||||
buf.append("**** "+msg+" ****");
|
||||
|
|
|
@ -67,7 +67,6 @@ import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
|||
import org.eclipse.cdt.core.settings.model.XmlStorageUtil;
|
||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.ILanguageSettingsBuiltinSpecsDetector;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
|
||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyManager;
|
||||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentBuildPathsChangeListener;
|
||||
|
|
Loading…
Add table
Reference in a new issue