Merge remote-tracking branch 'cdt/master' into sd90
|
@ -5,7 +5,8 @@ Bundle-SymbolicName: org.eclipse.cdt.make.core.tests;singleton:=true
|
||||||
Bundle-Version: 7.0.0.qualifier
|
Bundle-Version: 7.0.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.make.core.tests.MakeTestsPlugin
|
Bundle-Activator: org.eclipse.cdt.make.core.tests.MakeTestsPlugin
|
||||||
Export-Package: org.eclipse.cdt.make.builder.tests,
|
Export-Package: org.eclipse.cdt.make.builder.tests,
|
||||||
org.eclipse.cdt.make.core.tests
|
org.eclipse.cdt.make.core.tests,
|
||||||
|
org.eclipse.cdt.make.scannerdiscovery;x-internal:=true
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.junit,
|
org.junit,
|
||||||
org.eclipse.cdt.make.core,
|
org.eclipse.cdt.make.core,
|
||||||
|
|
14
build/org.eclipse.cdt.make.core.tests/plugin.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?eclipse version="3.4"?>
|
||||||
|
<plugin>
|
||||||
|
<extension
|
||||||
|
id="org.eclipse.cdt.make.core.tests.ErrorParsers"
|
||||||
|
name="org.eclipse.cdt.make.core.tests ErrorParsers"
|
||||||
|
point="org.eclipse.cdt.core.ErrorParser">
|
||||||
|
<errorparser
|
||||||
|
class="org.eclipse.cdt.make.internal.core.scannerconfig.GCCBuildCommandParser$GCCBuildCommandPatternHighlighter"
|
||||||
|
id="org.eclipse.cdt.core.tests.make.core.GCCBuildCommandPatternHighlighter"
|
||||||
|
name="Test Plugin GCC BOP Patterns Highlighter">
|
||||||
|
</errorparser>
|
||||||
|
</extension>
|
||||||
|
</plugin>
|
|
@ -0,0 +1,27 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 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.scannerdiscovery;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
public class AllLanguageSettingsProvidersMakeCoreTests extends TestSuite {
|
||||||
|
|
||||||
|
public static TestSuite suite() {
|
||||||
|
return new AllLanguageSettingsProvidersMakeCoreTests();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AllLanguageSettingsProvidersMakeCoreTests() {
|
||||||
|
super(AllLanguageSettingsProvidersMakeCoreTests.class.getName());
|
||||||
|
|
||||||
|
addTestSuite(GCCBuildCommandParserTest.class);
|
||||||
|
addTestSuite(BuiltinSpecsDetectorTest.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,443 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 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.scannerdiscovery;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CIncludeFileEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CLibraryFileEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CLibraryPathEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CMacroEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CMacroFileEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuiltinSpecsDetector;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
|
||||||
|
public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
private static final String PROVIDER_ID = "provider.id";
|
||||||
|
private static final String PROVIDER_NAME = "provider name";
|
||||||
|
private static final String LANGUAGE_ID = "language.test.id";
|
||||||
|
private static final String CUSTOM_PARAMETER = "customParameter";
|
||||||
|
private static final String CUSTOM_PARAMETER_2 = "customParameter2";
|
||||||
|
private static final String ELEM_TEST = "test";
|
||||||
|
|
||||||
|
// those attributes must match that in AbstractBuiltinSpecsDetector
|
||||||
|
private static final String ATTR_PARAMETER = "parameter"; //$NON-NLS-1$
|
||||||
|
private static final String ATTR_CONSOLE = "console"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private class MockBuiltinSpecsDetector extends AbstractBuiltinSpecsDetector {
|
||||||
|
@Override
|
||||||
|
protected void startupForLanguage(String languageId) throws CoreException {
|
||||||
|
super.startupForLanguage(languageId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void shutdownForLanguage() {
|
||||||
|
super.shutdownForLanguage();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected List<String> parseForOptions(String line) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MockBuiltinSpecsDetectorExecutedFlag extends AbstractBuiltinSpecsDetector {
|
||||||
|
@Override
|
||||||
|
protected List<String> parseForOptions(String line) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void execute() {
|
||||||
|
super.execute();
|
||||||
|
}
|
||||||
|
protected boolean isExecuted() {
|
||||||
|
return isExecuted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MockConsoleBuiltinSpecsDetector extends AbstractBuiltinSpecsDetector {
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
private final AbstractOptionParser[] optionParsers = {
|
||||||
|
new MacroOptionParser("#define (\\S*) *(\\S*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
};
|
||||||
|
@Override
|
||||||
|
protected boolean runProgram(String command, String[] env, IPath workingDirectory, IProgressMonitor monitor,
|
||||||
|
OutputStream consoleOut, OutputStream consoleErr) throws CoreException, IOException {
|
||||||
|
printLine(consoleOut, "#define MACRO VALUE");
|
||||||
|
consoleOut.close();
|
||||||
|
consoleErr.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected IStatus runForEachLanguage(ICConfigurationDescription cfgDescription, IPath workingDirectory,
|
||||||
|
String[] env, IProgressMonitor monitor) {
|
||||||
|
return super.runForEachLanguage(cfgDescription, workingDirectory, env, monitor);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected List<String> parseForOptions(final String line) {
|
||||||
|
return new ArrayList<String>() {{ add(line); }};
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
|
return optionParsers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
Job.getJobManager().join(AbstractBuiltinSpecsDetector.JOB_FAMILY_BUILTIN_SPECS_DETECTOR, null);
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
|
||||||
|
CoreModel coreModel = CoreModel.getDefault();
|
||||||
|
ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
|
||||||
|
// project description
|
||||||
|
ICProjectDescription projectDescription = mngr.getProjectDescription(project, false);
|
||||||
|
assertNotNull(projectDescription);
|
||||||
|
assertEquals(1, projectDescription.getConfigurations().length);
|
||||||
|
// configuration description
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
|
||||||
|
return cfgDescriptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAbstractBuiltinSpecsDetector_GettersSetters() throws Exception {
|
||||||
|
{
|
||||||
|
// provider configured with null parameters
|
||||||
|
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
|
||||||
|
provider.configureProvider(PROVIDER_ID, PROVIDER_NAME, null, null, null);
|
||||||
|
|
||||||
|
assertEquals(PROVIDER_ID, provider.getId());
|
||||||
|
assertEquals(PROVIDER_NAME, provider.getName());
|
||||||
|
assertEquals(null, provider.getLanguageScope());
|
||||||
|
assertEquals(null, provider.getSettingEntries(null, null, null));
|
||||||
|
assertEquals("", provider.getCommand());
|
||||||
|
assertEquals(false, provider.isExecuted());
|
||||||
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// provider configured with non-null parameters
|
||||||
|
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
|
||||||
|
List<String> languages = new ArrayList<String>();
|
||||||
|
languages.add(LANGUAGE_ID);
|
||||||
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
|
properties.put(ATTR_PARAMETER, CUSTOM_PARAMETER);
|
||||||
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
entries.add(entry);
|
||||||
|
|
||||||
|
provider.configureProvider(PROVIDER_ID, PROVIDER_NAME, languages, entries, properties);
|
||||||
|
assertEquals(PROVIDER_ID, provider.getId());
|
||||||
|
assertEquals(PROVIDER_NAME, provider.getName());
|
||||||
|
assertEquals(languages, provider.getLanguageScope());
|
||||||
|
assertEquals(entries, provider.getSettingEntries(null, null, null));
|
||||||
|
assertEquals(CUSTOM_PARAMETER, provider.getCommand());
|
||||||
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
|
assertEquals(false, provider.isExecuted());
|
||||||
|
|
||||||
|
// setters
|
||||||
|
provider.setCommand(CUSTOM_PARAMETER_2);
|
||||||
|
assertEquals(CUSTOM_PARAMETER_2, provider.getCommand());
|
||||||
|
provider.setConsoleEnabled(true);
|
||||||
|
assertEquals(true, provider.isConsoleEnabled());
|
||||||
|
|
||||||
|
provider.execute();
|
||||||
|
assertEquals(true, provider.isExecuted());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAbstractBuiltinSpecsDetector_CloneAndEquals() throws Exception {
|
||||||
|
// define mock detector
|
||||||
|
class MockDetectorCloneable extends MockBuiltinSpecsDetectorExecutedFlag implements Cloneable {
|
||||||
|
@Override
|
||||||
|
public MockDetectorCloneable clone() throws CloneNotSupportedException {
|
||||||
|
return (MockDetectorCloneable) super.clone();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public MockDetectorCloneable cloneShallow() throws CloneNotSupportedException {
|
||||||
|
return (MockDetectorCloneable) super.cloneShallow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// create instance to compare to
|
||||||
|
MockDetectorCloneable provider = new MockDetectorCloneable();
|
||||||
|
|
||||||
|
List<String> languages = new ArrayList<String>();
|
||||||
|
languages.add(LANGUAGE_ID);
|
||||||
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
ICLanguageSettingEntry entry = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
entries.add(entry);
|
||||||
|
|
||||||
|
// check clone after initialization
|
||||||
|
MockDetectorCloneable clone0 = provider.clone();
|
||||||
|
assertTrue(provider.equals(clone0));
|
||||||
|
|
||||||
|
// configure provider
|
||||||
|
Map<String, String> properties = new HashMap<String, String>();
|
||||||
|
properties.put(ATTR_PARAMETER, CUSTOM_PARAMETER);
|
||||||
|
provider.configureProvider(PROVIDER_ID, PROVIDER_NAME, languages, entries, properties);
|
||||||
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
|
provider.setConsoleEnabled(true);
|
||||||
|
provider.execute();
|
||||||
|
assertEquals(true, provider.isExecuted());
|
||||||
|
assertFalse(provider.equals(clone0));
|
||||||
|
|
||||||
|
// check another clone after configuring
|
||||||
|
{
|
||||||
|
MockDetectorCloneable clone = provider.clone();
|
||||||
|
assertTrue(provider.equals(clone));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check custom parameter
|
||||||
|
{
|
||||||
|
MockDetectorCloneable clone = provider.clone();
|
||||||
|
clone.setCommand("changed");
|
||||||
|
assertFalse(provider.equals(clone));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check language scope
|
||||||
|
{
|
||||||
|
MockDetectorCloneable clone = provider.clone();
|
||||||
|
clone.setLanguageScope(null);
|
||||||
|
assertFalse(provider.equals(clone));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check console flag
|
||||||
|
{
|
||||||
|
MockDetectorCloneable clone = provider.clone();
|
||||||
|
boolean isConsoleEnabled = clone.isConsoleEnabled();
|
||||||
|
clone.setConsoleEnabled( ! isConsoleEnabled );
|
||||||
|
assertFalse(provider.equals(clone));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check isExecuted flag
|
||||||
|
{
|
||||||
|
MockDetectorCloneable clone = provider.clone();
|
||||||
|
assertEquals(true, clone.isExecuted());
|
||||||
|
clone.clear();
|
||||||
|
assertEquals(false, clone.isExecuted());
|
||||||
|
assertFalse(provider.equals(clone));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check entries
|
||||||
|
{
|
||||||
|
MockDetectorCloneable clone = provider.clone();
|
||||||
|
clone.setSettingEntries(null, null, null, null);
|
||||||
|
assertFalse(provider.equals(clone));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check cloneShallow()
|
||||||
|
{
|
||||||
|
MockDetectorCloneable provider2 = provider.clone();
|
||||||
|
MockDetectorCloneable clone = provider2.cloneShallow();
|
||||||
|
assertEquals(false, clone.isExecuted());
|
||||||
|
assertFalse(provider2.equals(clone));
|
||||||
|
|
||||||
|
provider2.setSettingEntries(null, null, null, null);
|
||||||
|
assertFalse(provider2.equals(clone));
|
||||||
|
|
||||||
|
clone.execute();
|
||||||
|
assertTrue(provider2.equals(clone));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public void testAbstractBuiltinSpecsDetector_Serialize() throws Exception {
|
||||||
|
{
|
||||||
|
// create empty XML
|
||||||
|
Document doc = XmlUtil.newDocument();
|
||||||
|
Element rootElement = XmlUtil.appendElement(doc, ELEM_TEST);
|
||||||
|
|
||||||
|
// load it to new provider
|
||||||
|
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
|
||||||
|
provider.load(rootElement);
|
||||||
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
Element elementProvider;
|
||||||
|
{
|
||||||
|
// define mock detector
|
||||||
|
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
|
||||||
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
|
|
||||||
|
// redefine the settings
|
||||||
|
provider.setConsoleEnabled(true);
|
||||||
|
assertEquals(true, provider.isConsoleEnabled());
|
||||||
|
|
||||||
|
// serialize in XML
|
||||||
|
Document doc = XmlUtil.newDocument();
|
||||||
|
Element rootElement = XmlUtil.appendElement(doc, ELEM_TEST);
|
||||||
|
elementProvider = provider.serialize(rootElement);
|
||||||
|
String xmlString = XmlUtil.toString(doc);
|
||||||
|
|
||||||
|
assertTrue(xmlString.contains(ATTR_CONSOLE));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// create another instance of the provider
|
||||||
|
MockBuiltinSpecsDetectorExecutedFlag provider = new MockBuiltinSpecsDetectorExecutedFlag();
|
||||||
|
assertEquals(false, provider.isConsoleEnabled());
|
||||||
|
|
||||||
|
// load element
|
||||||
|
provider.load(elementProvider);
|
||||||
|
assertEquals(true, provider.isConsoleEnabled());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAbstractBuiltinSpecsDetector_Nulls() throws Exception {
|
||||||
|
{
|
||||||
|
// test AbstractBuiltinSpecsDetector.processLine(...) flow
|
||||||
|
MockBuiltinSpecsDetector provider = new MockBuiltinSpecsDetector();
|
||||||
|
provider.startup(null);
|
||||||
|
provider.startupForLanguage(null);
|
||||||
|
provider.processLine(null, null);
|
||||||
|
provider.shutdownForLanguage();
|
||||||
|
provider.shutdown();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
// test AbstractBuiltinSpecsDetector.processLine(...) flow
|
||||||
|
MockConsoleBuiltinSpecsDetector provider = new MockConsoleBuiltinSpecsDetector();
|
||||||
|
provider.runForEachLanguage(null, null, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAbstractBuiltinSpecsDetector_RunConfiguration() throws Exception {
|
||||||
|
// Create model project and accompanied descriptions
|
||||||
|
String projectName = getName();
|
||||||
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
||||||
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
|
|
||||||
|
MockConsoleBuiltinSpecsDetector provider = new MockConsoleBuiltinSpecsDetector();
|
||||||
|
provider.setLanguageScope(new ArrayList<String>() {{add(LANGUAGE_ID);}});
|
||||||
|
|
||||||
|
provider.runForEachLanguage(cfgDescription, null, null, null);
|
||||||
|
assertFalse(provider.isEmpty());
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> noentries = provider.getSettingEntries(null, null, null);
|
||||||
|
assertNull(noentries);
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(cfgDescription, null, LANGUAGE_ID);
|
||||||
|
ICLanguageSettingEntry expected = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
assertEquals(expected, entries.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAbstractBuiltinSpecsDetector_RunGlobal() throws Exception {
|
||||||
|
MockConsoleBuiltinSpecsDetector provider = new MockConsoleBuiltinSpecsDetector();
|
||||||
|
provider.setLanguageScope(new ArrayList<String>() {{add(LANGUAGE_ID);}});
|
||||||
|
|
||||||
|
provider.runForEachLanguage(null, null, null, null);
|
||||||
|
assertFalse(provider.isEmpty());
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, LANGUAGE_ID);
|
||||||
|
ICLanguageSettingEntry expected = new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
assertEquals(expected, entries.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAbstractBuiltinSpecsDetector_GroupSettings() throws Exception {
|
||||||
|
// define benchmarks
|
||||||
|
final CIncludePathEntry includePath_1 = new CIncludePathEntry("/include/path_1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CIncludePathEntry includePath_2 = new CIncludePathEntry("/include/path_2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CIncludeFileEntry includeFile_1 = new CIncludeFileEntry(new Path("/include.file1"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CIncludeFileEntry includeFile_2 = new CIncludeFileEntry(new Path("/include.file2"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CMacroEntry macro_1 = new CMacroEntry("MACRO_1", "", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CMacroEntry macro_2 = new CMacroEntry("MACRO_2", "", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY |ICSettingEntry.UNDEFINED);
|
||||||
|
final CMacroFileEntry macroFile_1 = new CMacroFileEntry(new Path("/macro.file1"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CMacroFileEntry macroFile_2 = new CMacroFileEntry(new Path("/macro.file2"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CLibraryPathEntry libraryPath_1 = new CLibraryPathEntry(new Path("/lib/path_1"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CLibraryPathEntry libraryPath_2 = new CLibraryPathEntry(new Path("/lib/path_2"), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CLibraryFileEntry libraryFile_1 = new CLibraryFileEntry("lib_1.a", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
final CLibraryFileEntry libraryFile_2 = new CLibraryFileEntry("lib_2.a", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY);
|
||||||
|
|
||||||
|
// Define mock detector adding unorganized entries
|
||||||
|
MockBuiltinSpecsDetector provider = new MockBuiltinSpecsDetector() {
|
||||||
|
@Override
|
||||||
|
public boolean processLine(String line, ErrorParserManager epm) {
|
||||||
|
detectedSettingEntries.add(libraryFile_1);
|
||||||
|
detectedSettingEntries.add(libraryPath_1);
|
||||||
|
detectedSettingEntries.add(macroFile_1);
|
||||||
|
detectedSettingEntries.add(macro_1);
|
||||||
|
detectedSettingEntries.add(includeFile_1);
|
||||||
|
detectedSettingEntries.add(includePath_1);
|
||||||
|
|
||||||
|
detectedSettingEntries.add(includePath_2);
|
||||||
|
detectedSettingEntries.add(includeFile_2);
|
||||||
|
detectedSettingEntries.add(macro_2);
|
||||||
|
detectedSettingEntries.add(macroFile_2);
|
||||||
|
detectedSettingEntries.add(libraryPath_2);
|
||||||
|
detectedSettingEntries.add(libraryFile_2);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// run specs detector
|
||||||
|
provider.startup(null);
|
||||||
|
provider.startupForLanguage(null);
|
||||||
|
provider.processLine("", null);
|
||||||
|
provider.shutdownForLanguage();
|
||||||
|
provider.shutdown();
|
||||||
|
|
||||||
|
// compare benchmarks, expected well-sorted
|
||||||
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, null, null);
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
assertEquals(includePath_1, entries.get(i++));
|
||||||
|
assertEquals(includePath_2, entries.get(i++));
|
||||||
|
assertEquals(includeFile_1, entries.get(i++));
|
||||||
|
assertEquals(includeFile_2, entries.get(i++));
|
||||||
|
assertEquals(macro_1, entries.get(i++));
|
||||||
|
assertEquals(macro_2, entries.get(i++));
|
||||||
|
assertEquals(macroFile_1, entries.get(i++));
|
||||||
|
assertEquals(macroFile_2, entries.get(i++));
|
||||||
|
assertEquals(libraryPath_1, entries.get(i++));
|
||||||
|
assertEquals(libraryPath_2, entries.get(i++));
|
||||||
|
assertEquals(libraryFile_1, entries.get(i++));
|
||||||
|
assertEquals(libraryFile_2, entries.get(i++));
|
||||||
|
|
||||||
|
assertEquals(12, entries.size());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2009 Andrew Gvozdev and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Andrew Gvozdev - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.make.scannerdiscovery;
|
package org.eclipse.cdt.make.scannerdiscovery;
|
||||||
|
|
|
@ -182,5 +182,15 @@
|
||||||
class="org.eclipse.cdt.make.internal.core.dataprovider.MakeConfigurationDataProvider"
|
class="org.eclipse.cdt.make.internal.core.dataprovider.MakeConfigurationDataProvider"
|
||||||
/>
|
/>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.make.internal.core.scannerconfig.GCCBuildCommandParser"
|
||||||
|
id="org.eclipse.cdt.make.core.GCCBuildCommandParser"
|
||||||
|
name="CDT GCC Build Output Parser"
|
||||||
|
parameter="(gcc)|([gc]\+\+)"
|
||||||
|
prefer-non-shared="true">
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,222 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
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;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
implements ICConsoleParser, IErrorParser {
|
||||||
|
public static final Object JOB_FAMILY_BUILD_COMMAND_PARSER = "org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser";
|
||||||
|
private static final String ATTR_PARAMETER = "parameter"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
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$
|
||||||
|
private static final int OPTION_GROUP = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note: design patterns to keep file group the same and matching {@link #FILE_GROUP}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
private static final String[] PATTERN_TEMPLATES = {
|
||||||
|
"${COMPILER_PATTERN}.*\\s" + "()([^'\"\\s]*\\.${EXTENSIONS_PATTERN})(\\s.*)?[\r\n]*", // compiling unquoted file
|
||||||
|
"${COMPILER_PATTERN}.*\\s" + "(['\"])(.*\\.${EXTENSIONS_PATTERN})\\${COMPILER_GROUPS+1}(\\s.*)?[\r\n]*" // compiling quoted file
|
||||||
|
};
|
||||||
|
private static final int FILE_GROUP = 2;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The compiler command pattern without specifying compiler options.
|
||||||
|
* The options are intended to be handled with option parsers,
|
||||||
|
* see {@link #getOptionParsers()}.
|
||||||
|
* This is regular expression pattern.
|
||||||
|
*
|
||||||
|
* @return the compiler command pattern.
|
||||||
|
*/
|
||||||
|
public String getCompilerPattern() {
|
||||||
|
return getProperty(ATTR_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set compiler command pattern for the provider. See {@link #getCompilerPattern()}.
|
||||||
|
* @param commandPattern - value of the command pattern to set.
|
||||||
|
* This is regular expression pattern.
|
||||||
|
*/
|
||||||
|
public void setCompilerPattern(String commandPattern) {
|
||||||
|
setProperty(ATTR_PARAMETER, commandPattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
private String getCompilerPatternExtended() {
|
||||||
|
String compilerPattern = getCompilerPattern();
|
||||||
|
return "\\s*\"?("+LEADING_PATH_PATTERN+")?(" + compilerPattern + ")\"?";
|
||||||
|
}
|
||||||
|
|
||||||
|
private int adjustFileGroup() {
|
||||||
|
return countGroups(getCompilerPatternExtended()) + FILE_GROUP;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String makePattern(String template) {
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
String pattern = template
|
||||||
|
.replace("${COMPILER_PATTERN}", getCompilerPatternExtended())
|
||||||
|
.replace("${EXTENSIONS_PATTERN}", getPatternFileExtensions())
|
||||||
|
.replace("${COMPILER_GROUPS+1}", new Integer(countGroups(getCompilerPatternExtended()) + 1).toString());
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String parseForResourceName(String line) {
|
||||||
|
if (line==null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String template : PATTERN_TEMPLATES) {
|
||||||
|
String pattern = makePattern(template);
|
||||||
|
Matcher fileMatcher = Pattern.compile(pattern).matcher(line);
|
||||||
|
if (fileMatcher.matches()) {
|
||||||
|
int fileGroup = adjustFileGroup();
|
||||||
|
String sourceFileName = fileMatcher.group(fileGroup);
|
||||||
|
return sourceFileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> parseForOptions(String line) {
|
||||||
|
if (line==null || currentResource==null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<String> options = new ArrayList<String>();
|
||||||
|
Matcher optionMatcher = OPTIONS_PATTERN.matcher(line);
|
||||||
|
while (optionMatcher.find()) {
|
||||||
|
String option = optionMatcher.group(OPTION_GROUP);
|
||||||
|
if (option!=null) {
|
||||||
|
options.add(option);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean processLine(String line) {
|
||||||
|
return processLine(line, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is redundant but let us keep it here to navigate in java code easier
|
||||||
|
@Override
|
||||||
|
public boolean processLine(String line, ErrorParserManager epm) {
|
||||||
|
return super.processLine(line, epm);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
scheduleSerializingJob(currentCfgDescription);
|
||||||
|
super.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void scheduleSerializingJob(final ICConfigurationDescription cfgDescription) {
|
||||||
|
Job job = new Job("Serialize CDT language settings entries") {
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
return serializeLanguageSettings(cfgDescription);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean belongsTo(Object family) {
|
||||||
|
return family == JOB_FAMILY_BUILD_COMMAND_PARSER;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
ISchedulingRule rule = null;
|
||||||
|
if (currentProject != null) {
|
||||||
|
IFolder settingsFolder = currentProject.getFolder(".settings");
|
||||||
|
if (!settingsFolder.exists()) {
|
||||||
|
try {
|
||||||
|
settingsFolder.create(true, true, null);
|
||||||
|
if (settingsFolder.isAccessible())
|
||||||
|
rule = currentProject.getFile(".settings/language.settings.xml");
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rule == null) {
|
||||||
|
rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
}
|
||||||
|
job.setRule(rule);
|
||||||
|
job.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trivial Error Parser which allows highlighting of output lines matching the patterns
|
||||||
|
* of this parser. Intended for better troubleshooting experience.
|
||||||
|
* Implementers are supposed to add the error parser as an extension. Initialize with
|
||||||
|
* build command parser extension ID.
|
||||||
|
*/
|
||||||
|
protected static abstract class AbstractBuildCommandPatternHighlighter extends RegexErrorParser implements IErrorParser2 {
|
||||||
|
public AbstractBuildCommandPatternHighlighter(String buildCommandParserPluginExtension) {
|
||||||
|
init(buildCommandParserPluginExtension);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init(String buildCommandParserId) {
|
||||||
|
AbstractBuildCommandParser buildCommandParser = (AbstractBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(buildCommandParserId, false);
|
||||||
|
if (buildCommandParser != null) {
|
||||||
|
for (String template : PATTERN_TEMPLATES) {
|
||||||
|
String pattern = buildCommandParser.makePattern(template);
|
||||||
|
String fileExpr = "$"+buildCommandParser.adjustFileGroup(); //$NON-NLS-1$
|
||||||
|
String descExpr = "$0"; //$NON-NLS-1$
|
||||||
|
addPattern(new RegexErrorPattern(pattern, fileExpr, null, descExpr, null, IMarkerGenerator.SEVERITY_WARNING, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getProcessLineBehaviour() {
|
||||||
|
return KEEP_LONGLINES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,784 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.io.OutputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.CommandLauncher;
|
||||||
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
|
import org.eclipse.cdt.core.ICConsoleParser;
|
||||||
|
import org.eclipse.cdt.core.ICommandLauncher;
|
||||||
|
import org.eclipse.cdt.core.IConsoleParser;
|
||||||
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
||||||
|
import org.eclipse.cdt.core.index.IIndexManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ICListenerAgent;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
|
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
||||||
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
|
import org.eclipse.cdt.core.resources.IConsole;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||||
|
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||||
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
|
||||||
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
import org.eclipse.cdt.make.internal.core.MakeMessages;
|
||||||
|
import org.eclipse.cdt.make.internal.core.StreamMonitor;
|
||||||
|
import org.eclipse.cdt.utils.CommandLineUtil;
|
||||||
|
import org.eclipse.cdt.utils.PathUtil;
|
||||||
|
import org.eclipse.core.resources.IMarker;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
|
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 {
|
||||||
|
public static final Object JOB_FAMILY_BUILTIN_SPECS_DETECTOR = "org.eclipse.cdt.make.core.scannerconfig.AbstractBuiltinSpecsDetector";
|
||||||
|
|
||||||
|
private static final int TICKS_STREAM_MONITOR = 100;
|
||||||
|
private static final int TICKS_CLEAN_MARKERS = 1;
|
||||||
|
private static final int TICKS_RUN_FOR_ONE_LANGUAGE = 10;
|
||||||
|
private static final int TICKS_SERIALIZATION = 1;
|
||||||
|
private static final int TICKS_SCALE = 100;
|
||||||
|
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$
|
||||||
|
private static final String PATH_ENV = "PATH"; //$NON-NLS-1$
|
||||||
|
private static final String ATTR_PARAMETER = "parameter"; //$NON-NLS-1$
|
||||||
|
private static final String ATTR_CONSOLE = "console"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
protected static final String COMPILER_MACRO = "${COMMAND}"; //$NON-NLS-1$
|
||||||
|
protected static final String SPEC_FILE_MACRO = "${INPUTS}"; //$NON-NLS-1$
|
||||||
|
protected static final String SPEC_EXT_MACRO = "${EXT}"; //$NON-NLS-1$
|
||||||
|
protected static final String SPEC_FILE_BASE = "spec"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private String currentCommandResolved = null;
|
||||||
|
protected List<ICLanguageSettingEntry> detectedSettingEntries = null;
|
||||||
|
|
||||||
|
protected boolean isExecuted = false;
|
||||||
|
protected int collected = 0;
|
||||||
|
|
||||||
|
private boolean isConsoleEnabled = false;
|
||||||
|
protected java.io.File specFile = null;
|
||||||
|
protected boolean preserveSpecFile = false;
|
||||||
|
|
||||||
|
protected URI mappedRootURI = null;
|
||||||
|
protected URI buildDirURI = null;
|
||||||
|
|
||||||
|
private class SDMarkerGenerator implements IMarkerGenerator {
|
||||||
|
protected static final String SCANNER_DISCOVERY_PROBLEM_MARKER = MakeCorePlugin.PLUGIN_ID + ".scanner.discovery.problem"; //$NON-NLS-1$
|
||||||
|
protected static final String ATTR_PROVIDER = "provider"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||||
|
ProblemMarkerInfo info = new ProblemMarkerInfo(file, lineNumber, errorDesc, severity, errorVar);
|
||||||
|
addMarker(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
|
||||||
|
final String providerName = getName();
|
||||||
|
final String providerId = getId();
|
||||||
|
// we have to add the marker in the job or we can deadlock other
|
||||||
|
// threads that are responding to a resource delta by doing something
|
||||||
|
// that accesses the project description
|
||||||
|
Job markerJob = new Job("Adding Scanner Discovery markers") {
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
// Try to find matching markers and don't put in duplicates
|
||||||
|
try {
|
||||||
|
IMarker[] cur = problemMarkerInfo.file.findMarkers(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
||||||
|
if ((cur != null) && (cur.length > 0)) {
|
||||||
|
for (int i = 0; i < cur.length; i++) {
|
||||||
|
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
|
||||||
|
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
|
||||||
|
if (sev == problemMarkerInfo.severity && mesg.equals(problemMarkerInfo.description)) {
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), "Error removing markers.", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add new marker
|
||||||
|
try {
|
||||||
|
IMarker marker = problemMarkerInfo.file.createMarker(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER);
|
||||||
|
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||||
|
marker.setAttribute(IMarker.SEVERITY, problemMarkerInfo.severity);
|
||||||
|
marker.setAttribute(SDMarkerGenerator.ATTR_PROVIDER, providerId);
|
||||||
|
|
||||||
|
if (problemMarkerInfo.file instanceof IWorkspaceRoot) {
|
||||||
|
marker.setAttribute(IMarker.LOCATION, "SD90 Providers, [" + providerName + "] options in Preferences");
|
||||||
|
} else {
|
||||||
|
marker.setAttribute(IMarker.LOCATION, "SD90 Providers, [" + providerName + "] options in project properties");
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), "Error adding markers.", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status.OK_STATUS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
markerJob.setRule(problemMarkerInfo.file);
|
||||||
|
markerJob.schedule();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This ICConsoleParser handles each individual run for one language from
|
||||||
|
* {@link AbstractBuiltinSpecsDetector#runForEachLanguage(ICConfigurationDescription, IPath, String[], IProgressMonitor)}
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private class ConsoleParser implements ICConsoleParser {
|
||||||
|
@Override
|
||||||
|
public void startup(ICConfigurationDescription cfgDescription) throws CoreException {
|
||||||
|
// not used here, see instead startupForLanguage() in AbstractBuiltinSpecsDetector.runForEachLanguage(...)
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean processLine(String line) {
|
||||||
|
return AbstractBuiltinSpecsDetector.this.processLine(line, errorParserManager);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
// not used here, see instead shutdownForLanguage() in AbstractBuiltinSpecsDetector.runForEachLanguage(...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The command to run. Some macros could be specified in there:
|
||||||
|
* <ul>
|
||||||
|
* <b>${COMMAND}</b> - compiler command taken from the toolchain.<br>
|
||||||
|
* <b>${INPUTS}</b> - path to spec file which will be placed in workspace area.<br>
|
||||||
|
* <b>${EXT}</b> - file extension calculated from language ID.
|
||||||
|
* </ul>
|
||||||
|
* The parameter could be taken from the extension
|
||||||
|
* in {@code plugin.xml} or from property file.
|
||||||
|
*
|
||||||
|
* @return the command to run.
|
||||||
|
*/
|
||||||
|
public String getCommand() {
|
||||||
|
return getProperty(ATTR_PARAMETER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set custom command for the provider. See {@link #getCommand()}.
|
||||||
|
* @param command - value of custom command to set.
|
||||||
|
*/
|
||||||
|
public void setCommand(String command) {
|
||||||
|
setProperty(ATTR_PARAMETER, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConsoleEnabled(boolean enable) {
|
||||||
|
isConsoleEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConsoleEnabled() {
|
||||||
|
return isConsoleEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String resolveCommand(String languageId) throws CoreException {
|
||||||
|
String cmd = getCommand();
|
||||||
|
if (cmd!=null && (cmd.contains(COMPILER_MACRO) || cmd.contains(SPEC_FILE_MACRO) || cmd.contains(SPEC_EXT_MACRO))) {
|
||||||
|
if (cmd.contains(COMPILER_MACRO)) {
|
||||||
|
String compiler = getCompilerCommand(languageId);
|
||||||
|
if (compiler!=null)
|
||||||
|
cmd = cmd.replace(COMPILER_MACRO, compiler);
|
||||||
|
}
|
||||||
|
if (cmd.contains(SPEC_FILE_MACRO)) {
|
||||||
|
String specFileName = getSpecFile(languageId);
|
||||||
|
if (specFileName!=null)
|
||||||
|
cmd = cmd.replace(SPEC_FILE_MACRO, specFileName);
|
||||||
|
}
|
||||||
|
if (cmd.contains(SPEC_EXT_MACRO)) {
|
||||||
|
String specFileExt = getSpecFileExtension(languageId);
|
||||||
|
if (specFileExt!=null)
|
||||||
|
cmd = cmd.replace(SPEC_EXT_MACRO, specFileExt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected String parseForResourceName(String line) {
|
||||||
|
// This works as if workspace-wide
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String determineLanguage() {
|
||||||
|
// language id is supposed to be set by run(), just return it
|
||||||
|
return currentLanguageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected URI getMappedRootURI(IResource sourceFile, String parsedResourceName) {
|
||||||
|
if (mappedRootURI==null) {
|
||||||
|
mappedRootURI = super.getMappedRootURI(sourceFile, parsedResourceName);
|
||||||
|
}
|
||||||
|
return mappedRootURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected URI getBuildDirURI(URI mappedRootURI) {
|
||||||
|
if (buildDirURI==null) {
|
||||||
|
buildDirURI = super.getBuildDirURI(mappedRootURI);
|
||||||
|
}
|
||||||
|
return buildDirURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(ICConfigurationDescription cfgDescription) {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logInfo(getPrefixForLog() + "registerListener [" + System.identityHashCode(this) + "] " + this);
|
||||||
|
|
||||||
|
currentCfgDescription = cfgDescription;
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unregisterListener() {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logInfo(getPrefixForLog() + "unregisterListener [" + System.identityHashCode(this) + "] " + this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void execute() {
|
||||||
|
if (isExecuted) {
|
||||||
|
// // TODO - remove me
|
||||||
|
// CCorePlugin.log(new Status(IStatus.INFO,CCorePlugin.PLUGIN_ID,
|
||||||
|
// getPrefixForLog() + "Already executed [" + System.identityHashCode(this) + "] " + this));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isExecuted = true;
|
||||||
|
|
||||||
|
Job job = new Job("Discover compiler's built-in language settings") {
|
||||||
|
@Override
|
||||||
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
return runForEachLanguage(currentCfgDescription, null, null, monitor);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean belongsTo(Object family) {
|
||||||
|
return family == JOB_FAMILY_BUILTIN_SPECS_DETECTOR;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IProject ownerProject = null;
|
||||||
|
if (currentCfgDescription != null) {
|
||||||
|
ICProjectDescription prjDescription = currentCfgDescription.getProjectDescription();
|
||||||
|
if (prjDescription != null) {
|
||||||
|
ownerProject = prjDescription.getProject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ISchedulingRule rule = null;
|
||||||
|
if (ownerProject != null) {
|
||||||
|
rule = ownerProject.getFile(".settings/language.settings.xml");
|
||||||
|
}
|
||||||
|
if (rule == null) {
|
||||||
|
rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
}
|
||||||
|
job.setRule(rule);
|
||||||
|
job.schedule();
|
||||||
|
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logInfo(getPrefixForLog() + "Execution scheduled [" + System.identityHashCode(this) + "] " + this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*/
|
||||||
|
protected IStatus runForEachLanguage(ICConfigurationDescription cfgDescription, IPath workingDirectory,
|
||||||
|
String[] env, IProgressMonitor monitor) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
startup(cfgDescription);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
IStatus status = new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error preparing to run Builtin Specs Detector", e);
|
||||||
|
MakeCorePlugin.log(status);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiStatus status = new MultiStatus(MakeCorePlugin.PLUGIN_ID, IStatus.OK, "Problem running CDT Scanner Discovery provider " + getId(), null);
|
||||||
|
|
||||||
|
boolean isChanged = false;
|
||||||
|
mappedRootURI = null;
|
||||||
|
buildDirURI = null;
|
||||||
|
|
||||||
|
if (monitor == null) {
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
List<String> languageIds = getLanguageScope();
|
||||||
|
if (languageIds != null) {
|
||||||
|
int totalWork = TICKS_CLEAN_MARKERS + languageIds.size()*TICKS_RUN_FOR_ONE_LANGUAGE + TICKS_SERIALIZATION;
|
||||||
|
monitor.beginTask("CDT Scanner Discovery", totalWork * TICKS_SCALE);
|
||||||
|
|
||||||
|
IResource markersResource = currentProject!= null ? currentProject : ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
|
// clear old markers
|
||||||
|
monitor.subTask("Clearing stale markers");
|
||||||
|
try {
|
||||||
|
IMarker[] cur = markersResource.findMarkers(SDMarkerGenerator.SCANNER_DISCOVERY_PROBLEM_MARKER, false, IResource.DEPTH_ZERO);
|
||||||
|
for (IMarker marker : cur) {
|
||||||
|
if (getId().equals(marker.getAttribute(SDMarkerGenerator.ATTR_PROVIDER))) {
|
||||||
|
marker.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
throw new OperationCanceledException();
|
||||||
|
|
||||||
|
monitor.worked(TICKS_CLEAN_MARKERS * TICKS_SCALE);
|
||||||
|
|
||||||
|
for (String languageId : languageIds) {
|
||||||
|
List<ICLanguageSettingEntry> oldEntries = getSettingEntries(cfgDescription, null, languageId);
|
||||||
|
try {
|
||||||
|
startupForLanguage(languageId);
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
throw new OperationCanceledException();
|
||||||
|
|
||||||
|
runForLanguage(workingDirectory, env, new SubProgressMonitor(monitor, TICKS_RUN_FOR_ONE_LANGUAGE * TICKS_SCALE));
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
throw new OperationCanceledException();
|
||||||
|
} catch (CoreException e) {
|
||||||
|
IStatus s = new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error running Builtin Specs Detector", e);
|
||||||
|
MakeCorePlugin.log(s);
|
||||||
|
status.merge(s);
|
||||||
|
} finally {
|
||||||
|
shutdownForLanguage();
|
||||||
|
}
|
||||||
|
List<ICLanguageSettingEntry> newEntries = getSettingEntries(cfgDescription, null, languageId);
|
||||||
|
isChanged = isChanged || newEntries != oldEntries;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
monitor.subTask("Serializing results");
|
||||||
|
if (isChanged) { // avoids resource and settings change notifications
|
||||||
|
IStatus s = serializeLanguageSettings(currentCfgDescription);
|
||||||
|
status.merge(s);
|
||||||
|
|
||||||
|
// AG: FIXME - rather send event that ls settings changed
|
||||||
|
if (currentCfgDescription != null) {
|
||||||
|
ICProject icProject = CoreModel.getDefault().create(currentProject);
|
||||||
|
ICElement[] tuSelection = new ICElement[] {icProject};
|
||||||
|
try {
|
||||||
|
CCorePlugin.getIndexManager().update(tuSelection, IIndexManager.UPDATE_ALL | IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
IStatus s2 = new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, IStatus.ERROR, "Error updating CDT index", e);
|
||||||
|
MakeCorePlugin.log(s2);
|
||||||
|
status.merge(s2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (monitor.isCanceled())
|
||||||
|
throw new OperationCanceledException();
|
||||||
|
|
||||||
|
monitor.worked(TICKS_SERIALIZATION * TICKS_SCALE);
|
||||||
|
} catch (OperationCanceledException e) {
|
||||||
|
if (!status.isOK()) {
|
||||||
|
MakeCorePlugin.log(status);
|
||||||
|
}
|
||||||
|
status.merge(new Status(IStatus.CANCEL, MakeCorePlugin.PLUGIN_ID, IStatus.OK, "Operation cancelled by user", e));
|
||||||
|
} finally {
|
||||||
|
monitor.done();
|
||||||
|
|
||||||
|
// release resources
|
||||||
|
buildDirURI = null;
|
||||||
|
mappedRootURI = null;
|
||||||
|
shutdown();
|
||||||
|
currentCfgDescription = cfgDescription; // current description gets cleared in super.shutdown(), keep it
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void startupForLanguage(String languageId) throws CoreException {
|
||||||
|
currentLanguageId = languageId;
|
||||||
|
|
||||||
|
specFile = null; // can get set in resolveCommand()
|
||||||
|
currentCommandResolved = resolveCommand(currentLanguageId);
|
||||||
|
|
||||||
|
detectedSettingEntries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
collected = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void shutdownForLanguage() {
|
||||||
|
if (detectedSettingEntries != null && detectedSettingEntries.size() > 0) {
|
||||||
|
collected = detectedSettingEntries.size();
|
||||||
|
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logInfo(getPrefixForLog()
|
||||||
|
+ getClass().getSimpleName() + " collected " + detectedSettingEntries.size() + " entries" + " for language " + currentLanguageId);
|
||||||
|
|
||||||
|
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, detectedSettingEntries);
|
||||||
|
}
|
||||||
|
detectedSettingEntries = null;
|
||||||
|
|
||||||
|
currentCommandResolved = null;
|
||||||
|
if (specFile!=null && !preserveSpecFile) {
|
||||||
|
specFile.delete();
|
||||||
|
specFile = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentLanguageId = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: test case for this function
|
||||||
|
*/
|
||||||
|
private void runForLanguage(IPath workingDirectory, String[] env, IProgressMonitor monitor) throws CoreException {
|
||||||
|
IConsole console;
|
||||||
|
if (isConsoleEnabled) {
|
||||||
|
console = startProviderConsole();
|
||||||
|
} else {
|
||||||
|
// that looks in extension points registry and won't find the id, this console is not shown
|
||||||
|
console = CCorePlugin.getDefault().getConsole(MakeCorePlugin.PLUGIN_ID + ".console.hidden"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
console.start(currentProject);
|
||||||
|
OutputStream cos = console.getOutputStream();
|
||||||
|
|
||||||
|
// Using GMAKE_ERROR_PARSER_ID as it can handle shell error messages
|
||||||
|
errorParserManager = new ErrorParserManager(currentProject, new SDMarkerGenerator(), new String[] {GMAKE_ERROR_PARSER_ID});
|
||||||
|
errorParserManager.setOutputStream(cos);
|
||||||
|
|
||||||
|
if (monitor == null) {
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// StreamMonitor will do monitor.beginTask(...)
|
||||||
|
StreamMonitor streamMon = new StreamMonitor(monitor, errorParserManager, TICKS_STREAM_MONITOR);
|
||||||
|
OutputStream stdout = streamMon;
|
||||||
|
OutputStream stderr = streamMon;
|
||||||
|
|
||||||
|
String msg = "Running scanner discovery: " + getName();
|
||||||
|
printLine(stdout, "**** " + msg + " ****" + NEWLINE);
|
||||||
|
|
||||||
|
ConsoleParser consoleParser = new ConsoleParser();
|
||||||
|
ConsoleOutputSniffer sniffer = new ConsoleOutputSniffer(stdout, stderr, new IConsoleParser[] { consoleParser }, errorParserManager);
|
||||||
|
OutputStream consoleOut = sniffer.getOutputStream();
|
||||||
|
OutputStream consoleErr = sniffer.getErrorStream();
|
||||||
|
|
||||||
|
boolean isSuccess = false;
|
||||||
|
try {
|
||||||
|
isSuccess = runProgram(currentCommandResolved, env, workingDirectory, monitor, consoleOut, consoleErr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
if (!isSuccess) {
|
||||||
|
try {
|
||||||
|
consoleOut.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
consoleErr.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
// ensure monitor.done() is called in cases when StreamMonitor fails to do that
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
* Note that progress monitor life cycle is handled elsewhere. This method assumes that
|
||||||
|
* monitor.beginTask(...) has already been called.
|
||||||
|
*/
|
||||||
|
protected boolean runProgram(String command, String[] env, IPath workingDirectory, IProgressMonitor monitor,
|
||||||
|
OutputStream consoleOut, OutputStream consoleErr) throws CoreException, IOException {
|
||||||
|
|
||||||
|
if (command==null || command.trim().length()==0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String errMsg = null;
|
||||||
|
ICommandLauncher launcher = new CommandLauncher();
|
||||||
|
|
||||||
|
launcher.setProject(currentProject);
|
||||||
|
|
||||||
|
// Print the command for visual interaction.
|
||||||
|
launcher.showCommand(true);
|
||||||
|
|
||||||
|
String[] cmdArray = CommandLineUtil.argumentsToArray(command);
|
||||||
|
IPath program = new Path(cmdArray[0]);
|
||||||
|
String[] args = new String[0];
|
||||||
|
if (cmdArray.length>1) {
|
||||||
|
args = new String[cmdArray.length-1];
|
||||||
|
System.arraycopy(cmdArray, 1, args, 0, args.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (monitor==null) {
|
||||||
|
monitor = new NullProgressMonitor();
|
||||||
|
}
|
||||||
|
Process p = launcher.execute(program, args, env, workingDirectory, monitor);
|
||||||
|
|
||||||
|
if (p != null) {
|
||||||
|
// Before launching give visual cues via the monitor
|
||||||
|
monitor.subTask("Invoking command " + command);
|
||||||
|
if (launcher.waitAndRead(consoleOut, consoleErr, monitor) != ICommandLauncher.OK) {
|
||||||
|
errMsg = launcher.getErrorMessage();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errMsg = launcher.getErrorMessage();
|
||||||
|
}
|
||||||
|
if (errMsg!=null) {
|
||||||
|
String errorPrefix = MakeMessages.getString("ExternalScannerInfoProvider.Error_Prefix"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
String msg = MakeMessages.getFormattedString("ExternalScannerInfoProvider.Provider_Error", command);
|
||||||
|
printLine(consoleErr, errorPrefix + msg + NEWLINE);
|
||||||
|
|
||||||
|
// Launching failed, trying to figure out possible cause
|
||||||
|
String envPath = getEnvVar(env, PATH_ENV);
|
||||||
|
if (!program.isAbsolute() && PathUtil.findProgramLocation(program.toString(), envPath) == null) {
|
||||||
|
printLine(consoleErr, errMsg);
|
||||||
|
msg = MakeMessages.getFormattedString("ExternalScannerInfoProvider.Working_Directory", workingDirectory); //$NON-NLS-1$
|
||||||
|
msg = MakeMessages.getFormattedString("ExternalScannerInfoProvider.Program_Not_In_Path", program); //$NON-NLS-1$
|
||||||
|
printLine(consoleErr, errorPrefix + msg + NEWLINE);
|
||||||
|
printLine(consoleErr, PATH_ENV + "=[" + envPath + "]" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
} else {
|
||||||
|
printLine(consoleErr, errorPrefix + errMsg);
|
||||||
|
msg = MakeMessages.getFormattedString("ExternalScannerInfoProvider.Working_Directory", workingDirectory); //$NON-NLS-1$
|
||||||
|
printLine(consoleErr, PATH_ENV + "=[" + envPath + "]" + NEWLINE); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
printLine(consoleOut, NEWLINE + "**** Collected " + detectedSettingEntries.size() + " entries. ****");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void setSettingEntries(List<ICLanguageSettingEntry> entries) {
|
||||||
|
// Builtin specs detectors collect entries not per line but for the whole output
|
||||||
|
if (entries!=null)
|
||||||
|
detectedSettingEntries.addAll(entries);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IConsole startProviderConsole() {
|
||||||
|
String extConsoleId;
|
||||||
|
if (currentProject != null) {
|
||||||
|
extConsoleId = "org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryConsole";
|
||||||
|
} else {
|
||||||
|
extConsoleId = "org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryGlobalConsole";
|
||||||
|
}
|
||||||
|
ILanguage ld = LanguageManager.getInstance().getLanguage(currentLanguageId);
|
||||||
|
String consoleId = MakeCorePlugin.PLUGIN_ID + '.' + getId() + '.' + currentLanguageId;
|
||||||
|
String consoleName = getName() + ", " + ld.getName();
|
||||||
|
URL defaultIcon = Platform.getBundle(PLUGIN_CDT_MAKE_UI_ID).getEntry("icons/obj16/inspect_system.gif");
|
||||||
|
|
||||||
|
IConsole console = CCorePlugin.getDefault().getConsole(extConsoleId, consoleId, consoleName, defaultIcon);
|
||||||
|
return console;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getEnvVar(String[] envStrings, String envVar) {
|
||||||
|
String envPath = null;
|
||||||
|
if (envStrings!=null) {
|
||||||
|
String varPrefix = envVar+'=';
|
||||||
|
for (String envStr : envStrings) {
|
||||||
|
boolean found = false;
|
||||||
|
// need to convert "Path" to "PATH" on Windows
|
||||||
|
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||||
|
found = envStr.substring(0,varPrefix.length()).toUpperCase().startsWith(varPrefix);
|
||||||
|
} else {
|
||||||
|
found = envStr.startsWith(varPrefix);
|
||||||
|
}
|
||||||
|
if (found) {
|
||||||
|
envPath = envStr.substring(varPrefix.length());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
envPath = System.getenv(envVar);
|
||||||
|
}
|
||||||
|
return envPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getCompilerCommand(String languageId) {
|
||||||
|
IStatus status = new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, "Provider "+getId()
|
||||||
|
+" unable to find the compiler tool for language " + languageId);
|
||||||
|
MakeCorePlugin.log(new CoreException(status));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getSpecFile(String languageId) {
|
||||||
|
String specExt = getSpecFileExtension(languageId);
|
||||||
|
String ext = ""; //$NON-NLS-1$
|
||||||
|
if (specExt != null) {
|
||||||
|
ext = '.' + specExt;
|
||||||
|
}
|
||||||
|
|
||||||
|
String specFileName = SPEC_FILE_BASE + ext;
|
||||||
|
IPath workingLocation = MakeCorePlugin.getWorkingDirectory();
|
||||||
|
IPath fileLocation = workingLocation.append(specFileName);
|
||||||
|
|
||||||
|
specFile = new java.io.File(fileLocation.toOSString());
|
||||||
|
// will preserve spec file if it was already there otherwise will delete upon finishing
|
||||||
|
preserveSpecFile = specFile.exists();
|
||||||
|
if (!preserveSpecFile) {
|
||||||
|
try {
|
||||||
|
specFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileLocation.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine file extension by language id. This implementation retrieves first extension
|
||||||
|
* from the list as there could be multiple extensions associated with the given language.
|
||||||
|
*
|
||||||
|
* @param languageId - given language ID.
|
||||||
|
* @return file extension associated with the language or {@code null} if not found.
|
||||||
|
*/
|
||||||
|
protected String getSpecFileExtension(String languageId) {
|
||||||
|
String ext = null;
|
||||||
|
ILanguageDescriptor langDescriptor = LanguageManager.getInstance().getLanguageDescriptor(languageId);
|
||||||
|
if (langDescriptor != null) {
|
||||||
|
IContentType[] contentTypes = langDescriptor.getContentTypes();
|
||||||
|
if (contentTypes != null && contentTypes.length > 0) {
|
||||||
|
String[] fileExtensions = contentTypes[0].getFileSpecs(IContentType.FILE_EXTENSION_SPEC);
|
||||||
|
if (fileExtensions != null && fileExtensions.length > 0) {
|
||||||
|
ext = fileExtensions[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ext == null) {
|
||||||
|
MakeCorePlugin.log(new Status(IStatus.ERROR, MakeCorePlugin.PLUGIN_ID, "Unable to find file extension for language "+languageId));
|
||||||
|
}
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void printLine(OutputStream stream, String msg) {
|
||||||
|
try {
|
||||||
|
stream.write((msg + NEWLINE).getBytes());
|
||||||
|
stream.flush();
|
||||||
|
} catch (IOException e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element serializeAttributes(Element parentElement) {
|
||||||
|
Element elementProvider = super.serializeAttributes(parentElement);
|
||||||
|
elementProvider.setAttribute(ATTR_CONSOLE, Boolean.toString(isConsoleEnabled));
|
||||||
|
return elementProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadAttributes(Element providerNode) {
|
||||||
|
super.loadAttributes(providerNode);
|
||||||
|
|
||||||
|
String consoleValue = XmlUtil.determineAttributeValue(providerNode, ATTR_CONSOLE);
|
||||||
|
if (consoleValue!=null)
|
||||||
|
isConsoleEnabled = Boolean.parseBoolean(consoleValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadEntries(Element providerNode) {
|
||||||
|
super.loadEntries(providerNode);
|
||||||
|
// TODO - test case for that or maybe introduce "isExecuted" attribute in XML?
|
||||||
|
if (!isEmpty())
|
||||||
|
isExecuted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
super.clear();
|
||||||
|
isExecuted = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractBuiltinSpecsDetector cloneShallow() throws CloneNotSupportedException {
|
||||||
|
AbstractBuiltinSpecsDetector clone = (AbstractBuiltinSpecsDetector) super.cloneShallow();
|
||||||
|
clone.isExecuted = false;
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + (isConsoleEnabled ? 1231 : 1237);
|
||||||
|
result = prime * result + (isExecuted ? 1231 : 1237);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (!super.equals(obj))
|
||||||
|
return false;
|
||||||
|
if (!(obj instanceof AbstractBuiltinSpecsDetector))
|
||||||
|
return false;
|
||||||
|
AbstractBuiltinSpecsDetector other = (AbstractBuiltinSpecsDetector) obj;
|
||||||
|
if (isConsoleEnabled != other.isConsoleEnabled)
|
||||||
|
return false;
|
||||||
|
if (isExecuted != other.isExecuted)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,872 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
|
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||||
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
|
import org.eclipse.cdt.internal.core.XmlUtil;
|
||||||
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
|
||||||
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
|
import org.eclipse.core.filesystem.EFS;
|
||||||
|
import org.eclipse.core.resources.IContainer;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
|
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 {
|
||||||
|
|
||||||
|
protected static final String ATTR_KEEP_RELATIVE_PATHS = "keep-relative-paths"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
protected ICConfigurationDescription currentCfgDescription = null;
|
||||||
|
protected IProject currentProject = null;
|
||||||
|
protected IResource currentResource = null;
|
||||||
|
protected String currentLanguageId = null;
|
||||||
|
|
||||||
|
protected ErrorParserManager errorParserManager = null;
|
||||||
|
protected String parsedResourceName = null;
|
||||||
|
protected boolean isResolvingPaths = true;
|
||||||
|
|
||||||
|
protected static abstract class AbstractOptionParser {
|
||||||
|
protected final Pattern pattern;
|
||||||
|
protected final String patternStr;
|
||||||
|
protected String nameExpression;
|
||||||
|
protected String valueExpression;
|
||||||
|
protected int extraFlag = 0;
|
||||||
|
protected int kind = 0;
|
||||||
|
private String parsedName;
|
||||||
|
private String parsedValue;
|
||||||
|
|
||||||
|
public AbstractOptionParser(int kind, String pattern, String nameExpression, String valueExpression, int extraFlag) {
|
||||||
|
this.kind = kind;
|
||||||
|
this.patternStr = pattern;
|
||||||
|
this.nameExpression = nameExpression;
|
||||||
|
this.valueExpression = valueExpression;
|
||||||
|
this.extraFlag = extraFlag;
|
||||||
|
|
||||||
|
this.pattern = Pattern.compile(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICLanguageSettingEntry createEntry(String name, String value, int flag) {
|
||||||
|
return (ICLanguageSettingEntry) CDataUtil.createEntry(kind, name, value, null, flag | extraFlag);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: explain
|
||||||
|
*/
|
||||||
|
protected String extractOption(String input) {
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
String option = input.replaceFirst("(" + patternStr + ").*", "$1");
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String parseStr(Matcher matcher, String str) {
|
||||||
|
if (str != null)
|
||||||
|
return matcher.replaceAll(str);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isPathKind() {
|
||||||
|
return kind == ICSettingEntry.INCLUDE_PATH || kind == ICSettingEntry.INCLUDE_FILE
|
||||||
|
|| kind == ICSettingEntry.MACRO_FILE || kind == ICSettingEntry.LIBRARY_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean parseOption(String option) {
|
||||||
|
String opt = extractOption(option);
|
||||||
|
Matcher matcher = pattern.matcher(opt);
|
||||||
|
boolean isMatch = matcher.matches();
|
||||||
|
if (isMatch) {
|
||||||
|
parsedName = parseStr(matcher, nameExpression);
|
||||||
|
parsedValue = parseStr(matcher, valueExpression);
|
||||||
|
}
|
||||||
|
return isMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class IncludePathOptionParser extends AbstractOptionParser {
|
||||||
|
public IncludePathOptionParser(String pattern, String nameExpression) {
|
||||||
|
super(ICLanguageSettingEntry.INCLUDE_PATH, pattern, nameExpression, nameExpression, 0);
|
||||||
|
}
|
||||||
|
public IncludePathOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
|
super(ICLanguageSettingEntry.INCLUDE_PATH, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class IncludeFileOptionParser extends AbstractOptionParser {
|
||||||
|
public IncludeFileOptionParser(String pattern, String nameExpression) {
|
||||||
|
super(ICLanguageSettingEntry.INCLUDE_FILE, pattern, nameExpression, nameExpression, 0);
|
||||||
|
}
|
||||||
|
public IncludeFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
|
super(ICLanguageSettingEntry.INCLUDE_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class MacroOptionParser extends AbstractOptionParser {
|
||||||
|
public MacroOptionParser(String pattern, String nameExpression, String valueExpression) {
|
||||||
|
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, valueExpression, 0);
|
||||||
|
}
|
||||||
|
public MacroOptionParser(String pattern, String nameExpression, String valueExpression, int extraFlag) {
|
||||||
|
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, valueExpression, extraFlag);
|
||||||
|
}
|
||||||
|
public MacroOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
|
super(ICLanguageSettingEntry.MACRO, pattern, nameExpression, null, extraFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class MacroFileOptionParser extends AbstractOptionParser {
|
||||||
|
public MacroFileOptionParser(String pattern, String nameExpression) {
|
||||||
|
super(ICLanguageSettingEntry.MACRO_FILE, pattern, nameExpression, nameExpression, 0);
|
||||||
|
}
|
||||||
|
public MacroFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
|
super(ICLanguageSettingEntry.MACRO_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class LibraryPathOptionParser extends AbstractOptionParser {
|
||||||
|
public LibraryPathOptionParser(String pattern, String nameExpression) {
|
||||||
|
super(ICLanguageSettingEntry.LIBRARY_PATH, pattern, nameExpression, nameExpression, 0);
|
||||||
|
}
|
||||||
|
public LibraryPathOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
|
super(ICLanguageSettingEntry.LIBRARY_PATH, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static class LibraryFileOptionParser extends AbstractOptionParser {
|
||||||
|
public LibraryFileOptionParser(String pattern, String nameExpression) {
|
||||||
|
super(ICLanguageSettingEntry.LIBRARY_FILE, pattern, nameExpression, nameExpression, 0);
|
||||||
|
}
|
||||||
|
public LibraryFileOptionParser(String pattern, String nameExpression, int extraFlag) {
|
||||||
|
super(ICLanguageSettingEntry.LIBRARY_FILE, pattern, nameExpression, nameExpression, extraFlag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the line returning the resource name as appears in the output.
|
||||||
|
* This is the resource where {@link ICLanguageSettingEntry} list is being added.
|
||||||
|
*
|
||||||
|
* @param line - one input line from the output stripped from end of line characters.
|
||||||
|
* @return the resource name as appears in the output or {@code null}.
|
||||||
|
* Note that {@code null} can have different semantics and can mean "no resource found"
|
||||||
|
* or "applicable to any resource". By default "no resource found" is used in this
|
||||||
|
* abstract class but extenders can handle otherwise.
|
||||||
|
*/
|
||||||
|
protected abstract String parseForResourceName(String line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the line returning the list of substrings to be treated each as input to
|
||||||
|
* the option parsers. It is assumed that each substring presents one
|
||||||
|
* {@link ICLanguageSettingEntry} (for example compiler options {@code -I/path} or
|
||||||
|
* {@code -DMACRO=1}.
|
||||||
|
*
|
||||||
|
* @param line - one input line from the output stripped from end of line characters.
|
||||||
|
* @return list of substrings representing language settings entries.
|
||||||
|
*/
|
||||||
|
protected abstract List<String> parseForOptions(String line);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array of option parsers defining how to parse a string to
|
||||||
|
* {@link ICLanguageSettingEntry}.
|
||||||
|
* See {@link AbstractOptionParser} and its specific extenders.
|
||||||
|
*/
|
||||||
|
protected abstract AbstractOptionParser[] getOptionParsers();
|
||||||
|
|
||||||
|
public boolean isResolvingPaths() {
|
||||||
|
return isResolvingPaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResolvingPaths(boolean resolvePaths) {
|
||||||
|
this.isResolvingPaths = resolvePaths;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void startup(ICConfigurationDescription cfgDescription) throws CoreException {
|
||||||
|
currentCfgDescription = cfgDescription;
|
||||||
|
currentProject = cfgDescription != null ? cfgDescription.getProjectDescription().getProject() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void shutdown() {
|
||||||
|
// release resources for garbage collector
|
||||||
|
currentCfgDescription = null;
|
||||||
|
currentProject = null;
|
||||||
|
currentResource = null;
|
||||||
|
currentLanguageId = null;
|
||||||
|
|
||||||
|
errorParserManager = null;
|
||||||
|
parsedResourceName = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean processLine(String line, ErrorParserManager epm) {
|
||||||
|
errorParserManager = epm;
|
||||||
|
parsedResourceName = parseForResourceName(line);
|
||||||
|
currentResource = findResource(parsedResourceName);
|
||||||
|
|
||||||
|
currentLanguageId = determineLanguage();
|
||||||
|
if (!isLanguageInScope(currentLanguageId))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URI of directory where the build is happening. This URI could point to a remote filesystem
|
||||||
|
* for remote builds. Most often it is the same filesystem as for currentResource but
|
||||||
|
* it can be different filesystem (and different URI schema).
|
||||||
|
*/
|
||||||
|
URI buildDirURI = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where source tree starts if mapped. This kind of mapping is useful for example in cases when
|
||||||
|
* the absolute path to the source file on the remote system is simulated inside a project in the
|
||||||
|
* workspace.
|
||||||
|
* This URI is rooted on the same filesystem where currentResource resides. In general this filesystem
|
||||||
|
* (or even URI schema) does not have to match that of buildDirURI.
|
||||||
|
*/
|
||||||
|
URI mappedRootURI = null;
|
||||||
|
|
||||||
|
if (isResolvingPaths) {
|
||||||
|
mappedRootURI = getMappedRootURI(currentResource, parsedResourceName);
|
||||||
|
buildDirURI = getBuildDirURI(mappedRootURI);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
|
||||||
|
List<String> options = parseForOptions(line);
|
||||||
|
if (options!=null) {
|
||||||
|
for (String option : options) {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
int i =0;
|
||||||
|
for (AbstractOptionParser optionParser : getOptionParsers()) {
|
||||||
|
try {
|
||||||
|
if (optionParser.parseOption(option)) {
|
||||||
|
ICLanguageSettingEntry entry = null;
|
||||||
|
if (isResolvingPaths && optionParser.isPathKind()) {
|
||||||
|
URI baseURI = new Path(optionParser.parsedName).isAbsolute() ? mappedRootURI : buildDirURI;
|
||||||
|
entry = createResolvedPathEntry(optionParser, optionParser.parsedName, 0, baseURI);
|
||||||
|
} else {
|
||||||
|
entry = optionParser.createEntry(optionParser.parsedName, optionParser.parsedValue, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry != null && !entries.contains(entry)) {
|
||||||
|
entries.add(entry);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
// protect from rogue parsers extending this class
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (entries.size() > 0) {
|
||||||
|
setSettingEntries(entries);
|
||||||
|
} else {
|
||||||
|
setSettingEntries(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO - remove me
|
||||||
|
@Deprecated
|
||||||
|
protected String getPrefixForLog() {
|
||||||
|
String str;
|
||||||
|
if (currentCfgDescription!= null) {
|
||||||
|
IProject ownerProject = currentCfgDescription.getProjectDescription().getProject();
|
||||||
|
str = ownerProject + ":" + currentCfgDescription.getName();
|
||||||
|
} else {
|
||||||
|
str = "[global]";
|
||||||
|
}
|
||||||
|
return str + ": ";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSettingEntries(List<ICLanguageSettingEntry> entries) {
|
||||||
|
setSettingEntries(currentCfgDescription, currentResource, currentLanguageId, entries);
|
||||||
|
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logInfo(getPrefixForLog()
|
||||||
|
+ getClass().getSimpleName() + " collected " + (entries!=null ? ("" + entries.size()) : "null") + " entries for " + currentResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String determineLanguage() {
|
||||||
|
IResource rc = currentResource;
|
||||||
|
if (rc == null && currentProject != null && parsedResourceName != null) {
|
||||||
|
String fileName = new Path(parsedResourceName).lastSegment().toString();
|
||||||
|
// use handle; resource does not need to exist
|
||||||
|
rc = currentProject.getFile("__" + fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<String> languageIds = LanguageSettingsManager.getLanguages(rc, currentCfgDescription);
|
||||||
|
if (languageIds.isEmpty())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return languageIds.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isLanguageInScope(String languageId) {
|
||||||
|
List<String> languageIds = getLanguageScope();
|
||||||
|
return languageIds == null || languageIds.contains(languageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getPatternFileExtensions() {
|
||||||
|
IContentTypeManager manager = Platform.getContentTypeManager();
|
||||||
|
|
||||||
|
Set<String> fileExts = new HashSet<String>();
|
||||||
|
|
||||||
|
IContentType contentTypeCpp = manager.getContentType("org.eclipse.cdt.core.cxxSource"); //$NON-NLS-1$
|
||||||
|
fileExts.addAll(Arrays.asList(contentTypeCpp.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
|
||||||
|
|
||||||
|
IContentType contentTypeC = manager.getContentType("org.eclipse.cdt.core.cSource"); //$NON-NLS-1$
|
||||||
|
fileExts.addAll(Arrays.asList(contentTypeC.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
|
||||||
|
|
||||||
|
String pattern = expressionLogicalOr(fileExts);
|
||||||
|
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICLanguageSettingEntry createResolvedPathEntry(AbstractOptionParser optionParser,
|
||||||
|
String parsedPath, int flag, URI baseURI) {
|
||||||
|
|
||||||
|
ICLanguageSettingEntry entry;
|
||||||
|
String resolvedPath = null;
|
||||||
|
|
||||||
|
URI uri = determineMappedURI(parsedPath, baseURI);
|
||||||
|
IResource rc = null;
|
||||||
|
if (uri != null && uri.isAbsolute()) {
|
||||||
|
rc = findResourceForLocationURI(uri, optionParser.kind, currentProject);
|
||||||
|
}
|
||||||
|
if (rc != null) {
|
||||||
|
IPath path = rc.getFullPath();
|
||||||
|
resolvedPath = path.toString();
|
||||||
|
flag = flag | ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED;
|
||||||
|
} else {
|
||||||
|
IPath path = getFilesystemLocation(uri);
|
||||||
|
if (path != null && new File(path.toString()).exists()) {
|
||||||
|
resolvedPath = path.toString();
|
||||||
|
}
|
||||||
|
if (resolvedPath == null) {
|
||||||
|
Set<String> referencedProjectsNames = new LinkedHashSet<String>();
|
||||||
|
if (currentCfgDescription!=null) {
|
||||||
|
Map<String,String> refs = currentCfgDescription.getReferenceInfo();
|
||||||
|
referencedProjectsNames.addAll(refs.keySet());
|
||||||
|
}
|
||||||
|
IResource resource = resolveResourceInWorkspace(parsedPath, currentProject, referencedProjectsNames);
|
||||||
|
if (resource != null) {
|
||||||
|
path = resource.getFullPath();
|
||||||
|
resolvedPath = path.toString();
|
||||||
|
flag = flag | ICSettingEntry.VALUE_WORKSPACE_PATH | ICSettingEntry.RESOLVED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (resolvedPath==null && path!=null) {
|
||||||
|
resolvedPath = path.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolvedPath==null) {
|
||||||
|
resolvedPath = parsedPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry = optionParser.createEntry(resolvedPath, resolvedPath, flag);
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IResource findResource(String parsedResourceName) {
|
||||||
|
if (parsedResourceName==null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IResource sourceFile = null;
|
||||||
|
|
||||||
|
// try ErrorParserManager
|
||||||
|
if (errorParserManager != null) {
|
||||||
|
sourceFile = errorParserManager.findFileName(parsedResourceName);
|
||||||
|
}
|
||||||
|
// try to find absolute path in the workspace
|
||||||
|
if (sourceFile == null && new Path(parsedResourceName).isAbsolute()) {
|
||||||
|
URI uri = org.eclipse.core.filesystem.URIUtil.toURI(parsedResourceName);
|
||||||
|
sourceFile = findFileForLocationURI(uri, currentProject);
|
||||||
|
}
|
||||||
|
// try path relative to build dir from configuration
|
||||||
|
if (sourceFile == null && currentCfgDescription != null) {
|
||||||
|
IPath builderCWD = currentCfgDescription.getBuildSetting().getBuilderCWD();
|
||||||
|
if (builderCWD!=null) {
|
||||||
|
IPath path = builderCWD.append(parsedResourceName);
|
||||||
|
URI uri = org.eclipse.core.filesystem.URIUtil.toURI(path);
|
||||||
|
sourceFile = findFileForLocationURI(uri, currentProject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// try path relative to the project
|
||||||
|
if (sourceFile == null && currentProject != null) {
|
||||||
|
sourceFile = currentProject.findMember(parsedResourceName);
|
||||||
|
}
|
||||||
|
return sourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected URI getBuildDirURI(URI mappedRootURI) {
|
||||||
|
URI buildDirURI = null;
|
||||||
|
|
||||||
|
URI cwdURI = null;
|
||||||
|
if (currentResource!=null && parsedResourceName!=null && !new Path(parsedResourceName).isAbsolute()) {
|
||||||
|
cwdURI = findBaseLocationURI(currentResource.getLocationURI(), parsedResourceName);
|
||||||
|
}
|
||||||
|
if (cwdURI == null && errorParserManager != null) {
|
||||||
|
cwdURI = errorParserManager.getWorkingDirectoryURI();
|
||||||
|
}
|
||||||
|
|
||||||
|
String cwdPath = cwdURI != null ? EFSExtensionManager.getDefault().getPathFromURI(cwdURI) : null;
|
||||||
|
if (cwdPath != null && mappedRootURI != null) {
|
||||||
|
buildDirURI = EFSExtensionManager.getDefault().append(mappedRootURI, cwdPath);
|
||||||
|
} else {
|
||||||
|
buildDirURI = cwdURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildDirURI == null && currentCfgDescription != null) {
|
||||||
|
IPath pathBuilderCWD = currentCfgDescription.getBuildSetting().getBuilderCWD();
|
||||||
|
if (pathBuilderCWD != null) {
|
||||||
|
String builderCWD = pathBuilderCWD.toString();
|
||||||
|
try {
|
||||||
|
// TODO - here is a hack to overcome ${workspace_loc:/prj-name} returned by builder
|
||||||
|
ICdtVariableManager vmanager = CCorePlugin.getDefault().getCdtVariableManager();
|
||||||
|
builderCWD = vmanager.resolveValue(builderCWD, "", null, currentCfgDescription);
|
||||||
|
} catch (CdtVariableException e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
buildDirURI = org.eclipse.core.filesystem.URIUtil.toURI(builderCWD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildDirURI == null && currentProject != null) {
|
||||||
|
buildDirURI = currentProject.getLocationURI();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildDirURI == null && currentResource != null) {
|
||||||
|
IContainer container;
|
||||||
|
if (currentResource instanceof IContainer) {
|
||||||
|
container = (IContainer) currentResource;
|
||||||
|
} else {
|
||||||
|
container = currentResource.getParent();
|
||||||
|
}
|
||||||
|
buildDirURI = container.getLocationURI();
|
||||||
|
}
|
||||||
|
return buildDirURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine URI on the local filesystem considering possible mapping.
|
||||||
|
*
|
||||||
|
* @param pathStr - path to the resource, can be absolute or relative
|
||||||
|
* @param baseURI - base {@link URI} where path to the resource is rooted
|
||||||
|
* @return {@link URI} of the resource
|
||||||
|
*/
|
||||||
|
private static URI determineMappedURI(String pathStr, URI baseURI) {
|
||||||
|
URI uri = null;
|
||||||
|
|
||||||
|
if (baseURI==null) {
|
||||||
|
if (new Path(pathStr).isAbsolute()) {
|
||||||
|
uri = resolvePathFromBaseLocation(pathStr, Path.ROOT);
|
||||||
|
}
|
||||||
|
} else if (baseURI.getScheme().equals(EFS.SCHEME_FILE)) {
|
||||||
|
// location on the local filesystem
|
||||||
|
IPath baseLocation = org.eclipse.core.filesystem.URIUtil.toPath(baseURI);
|
||||||
|
// careful not to use Path here but 'pathStr' as String as we want to properly navigate symlinks
|
||||||
|
uri = resolvePathFromBaseLocation(pathStr, baseLocation);
|
||||||
|
} else {
|
||||||
|
// location on a remote filesystem
|
||||||
|
IPath path = new Path(pathStr); // use canonicalized path here, in particular replace all '\' with '/' for Windows paths
|
||||||
|
URI remoteUri = EFSExtensionManager.getDefault().append(baseURI, path.toString());
|
||||||
|
if (remoteUri!=null) {
|
||||||
|
String localPath = EFSExtensionManager.getDefault().getMappedPath(remoteUri);
|
||||||
|
if (localPath!=null) {
|
||||||
|
uri = org.eclipse.core.filesystem.URIUtil.toURI(localPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri == null) {
|
||||||
|
// if everything fails just wrap string to URI
|
||||||
|
uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
|
||||||
|
}
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IResource resolveResourceInWorkspace(String parsedName, IProject preferredProject, Set<String> referencedProjectsNames) {
|
||||||
|
IPath path = new Path(parsedName);
|
||||||
|
if (path.equals(new Path(".")) || path.equals(new Path(".."))) { //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prefer current project
|
||||||
|
if (preferredProject!=null) {
|
||||||
|
List<IResource> result = findPathInFolder(path, preferredProject);
|
||||||
|
int size = result.size();
|
||||||
|
if (size==1) { // found the one
|
||||||
|
return result.get(0);
|
||||||
|
} else if (size>1) { // ambiguous
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
|
// then prefer referenced projects
|
||||||
|
if (referencedProjectsNames.size() > 0) {
|
||||||
|
IResource rc = null;
|
||||||
|
for (String prjName : referencedProjectsNames) {
|
||||||
|
IProject prj = root.getProject(prjName);
|
||||||
|
if (prj.isOpen()) {
|
||||||
|
List<IResource> result = findPathInFolder(path, prj);
|
||||||
|
int size = result.size();
|
||||||
|
if (size==1 && rc==null) {
|
||||||
|
rc = result.get(0);
|
||||||
|
} else if (size > 0) {
|
||||||
|
// ambiguous
|
||||||
|
rc = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rc!=null) {
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// then check all other projects in workspace
|
||||||
|
IProject[] projects = root.getProjects();
|
||||||
|
if (projects.length > 0) {
|
||||||
|
IResource rc = null;
|
||||||
|
for (IProject prj : projects) {
|
||||||
|
if (!prj.equals(preferredProject) && !referencedProjectsNames.contains(prj.getName()) && prj.isOpen()) {
|
||||||
|
List<IResource> result = findPathInFolder(path, prj);
|
||||||
|
int size = result.size();
|
||||||
|
if (size==1 && rc==null) {
|
||||||
|
rc = result.get(0);
|
||||||
|
} else if (size > 0) {
|
||||||
|
// ambiguous
|
||||||
|
rc = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rc!=null) {
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found or ambiguous
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<IResource> findPathInFolder(IPath path, IContainer folder) {
|
||||||
|
List<IResource> paths = new ArrayList<IResource>();
|
||||||
|
IResource resource = folder.findMember(path);
|
||||||
|
if (resource != null) {
|
||||||
|
paths.add(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
for (IResource res : folder.members()) {
|
||||||
|
if (res instanceof IContainer) {
|
||||||
|
paths.addAll(findPathInFolder(path, (IContainer) res));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IResource findFileForLocationURI(URI uri, IProject preferredProject) {
|
||||||
|
IResource sourceFile;
|
||||||
|
IResource result = null;
|
||||||
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
IResource[] resources = root.findFilesForLocationURI(uri);
|
||||||
|
if (resources.length > 0) {
|
||||||
|
result = resources[0];
|
||||||
|
if (preferredProject!=null) {
|
||||||
|
for (IResource rc : resources) {
|
||||||
|
if (rc.getProject().equals(preferredProject)) {
|
||||||
|
result = rc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sourceFile = result;
|
||||||
|
return sourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static URI findBaseLocationURI(URI fileURI, String relativeFileName) {
|
||||||
|
URI cwdURI = null;
|
||||||
|
String path = fileURI.getPath();
|
||||||
|
|
||||||
|
String[] segments = relativeFileName.split("[/\\\\]"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// start removing segments from the end of the path
|
||||||
|
for (int i = segments.length - 1; i >= 0; i--) {
|
||||||
|
String lastSegment = segments[i];
|
||||||
|
if (lastSegment.length() > 0 && !lastSegment.equals(".")) { //$NON-NLS-1$
|
||||||
|
if (lastSegment.equals("..")) { //$NON-NLS-1$
|
||||||
|
// navigating ".." in the other direction is ambiguous, bailing out
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
if (path.endsWith("/" + lastSegment)) { //$NON-NLS-1$
|
||||||
|
int pos = path.lastIndexOf("/" + lastSegment); //$NON-NLS-1$
|
||||||
|
path = path.substring(0, pos);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
// ouch, relativeFileName does not match fileURI, bailing out
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
cwdURI = new URI(fileURI.getScheme(), fileURI.getUserInfo(), fileURI.getHost(),
|
||||||
|
fileURI.getPort(), path + '/', fileURI.getQuery(), fileURI.getFragment());
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
// It should be valid URI here or something is wrong
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cwdURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In case when absolute path is mapped to the source tree in a project
|
||||||
|
* this function will try to figure mapping and return "mapped root",
|
||||||
|
* i.e URI where the root path would be mapped. The mapped root will be
|
||||||
|
* used to prepend to other "absolute" paths where appropriate.
|
||||||
|
*
|
||||||
|
* @param sourceFile - a resource referred by parsed path
|
||||||
|
* @param parsedResourceName - path as appears in the output
|
||||||
|
* @return mapped path as URI
|
||||||
|
*/
|
||||||
|
protected URI getMappedRootURI(IResource sourceFile, String parsedResourceName) {
|
||||||
|
if (currentResource==null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
URI fileURI = sourceFile.getLocationURI();
|
||||||
|
String mappedRoot = "/"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (parsedResourceName!=null) {
|
||||||
|
IPath parsedSrcPath = new Path(parsedResourceName);
|
||||||
|
if (parsedSrcPath.isAbsolute()) {
|
||||||
|
IPath absPath = sourceFile.getLocation();
|
||||||
|
int absSegmentsCount = absPath.segmentCount();
|
||||||
|
int relSegmentsCount = parsedSrcPath.segmentCount();
|
||||||
|
if (absSegmentsCount >= relSegmentsCount) {
|
||||||
|
IPath ending = absPath.removeFirstSegments(absSegmentsCount - relSegmentsCount);
|
||||||
|
ending = ending.setDevice(parsedSrcPath.getDevice()).makeAbsolute();
|
||||||
|
if (ending.equals(parsedSrcPath.makeAbsolute())) {
|
||||||
|
mappedRoot = absPath.removeLastSegments(relSegmentsCount).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
URI uri = EFSExtensionManager.getDefault().createNewURIFromPath(fileURI, mappedRoot);
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The manipulations here are done to resolve "../" navigation for symbolic links where "link/.." cannot
|
||||||
|
* be collapsed as it must follow the real filesystem path. {@link java.io.File#getCanonicalPath()} deals
|
||||||
|
* with that correctly but {@link Path} or {@link URI} try to normalize the path which would be incorrect
|
||||||
|
* here.
|
||||||
|
*/
|
||||||
|
private static URI resolvePathFromBaseLocation(String name, IPath baseLocation) {
|
||||||
|
String pathName = name;
|
||||||
|
if (baseLocation != null && !baseLocation.isEmpty()) {
|
||||||
|
pathName = pathName.replace(File.separatorChar, '/');
|
||||||
|
String device = new Path(pathName).getDevice();
|
||||||
|
if (device==null || device.equals(baseLocation.getDevice())) {
|
||||||
|
if (device != null && device.length() > 0) {
|
||||||
|
pathName = pathName.substring(device.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
baseLocation = baseLocation.addTrailingSeparator();
|
||||||
|
if (pathName.startsWith("/")) { //$NON-NLS-1$
|
||||||
|
pathName = pathName.substring(1);
|
||||||
|
}
|
||||||
|
pathName = baseLocation.toString() + pathName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
File file = new File(pathName);
|
||||||
|
file = file.getCanonicalFile();
|
||||||
|
return file.toURI();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// if error just leave it as is
|
||||||
|
}
|
||||||
|
|
||||||
|
URI uri = org.eclipse.core.filesystem.URIUtil.toURI(pathName);
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IResource findResourceForLocationURI(URI uri, int kind, IProject preferredProject) {
|
||||||
|
if (uri==null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IResource resource = null;
|
||||||
|
|
||||||
|
switch (kind) {
|
||||||
|
case ICSettingEntry.INCLUDE_PATH:
|
||||||
|
case ICSettingEntry.LIBRARY_PATH:
|
||||||
|
resource = findContainerForLocationURI(uri, preferredProject);
|
||||||
|
break;
|
||||||
|
case ICSettingEntry.INCLUDE_FILE:
|
||||||
|
case ICSettingEntry.MACRO_FILE:
|
||||||
|
resource = findFileForLocationURI(uri, preferredProject);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IResource findContainerForLocationURI(URI uri, IProject preferredProject) {
|
||||||
|
IResource resource = null;
|
||||||
|
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
IResource[] resources = root.findContainersForLocationURI(uri);
|
||||||
|
if (resources.length > 0) {
|
||||||
|
for (IResource rc : resources) {
|
||||||
|
if ((rc instanceof IProject || rc instanceof IFolder)) { // treat IWorkspaceRoot as non-workspace path
|
||||||
|
IProject prj = rc instanceof IProject ? (IProject)rc : rc.getProject();
|
||||||
|
if (prj.equals(preferredProject)) {
|
||||||
|
resource = rc;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (resource==null) {
|
||||||
|
resource=rc; // to be deterministic the first qualified resource has preference
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IPath getFilesystemLocation(URI uri) {
|
||||||
|
if (uri==null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// EFSExtensionManager mapping
|
||||||
|
String pathStr = EFSExtensionManager.getDefault().getMappedPath(uri);
|
||||||
|
uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
|
||||||
|
|
||||||
|
try {
|
||||||
|
File file = new java.io.File(uri);
|
||||||
|
String canonicalPathStr = file.getCanonicalPath();
|
||||||
|
return new Path(canonicalPathStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
MakeCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
private static String expressionLogicalOr(Set<String> fileExts) {
|
||||||
|
String pattern = "(";
|
||||||
|
for (String ext : fileExts) {
|
||||||
|
if (pattern.length() != 1)
|
||||||
|
pattern += "|";
|
||||||
|
pattern += "(" + Pattern.quote(ext) + ")";
|
||||||
|
ext = ext.toUpperCase();
|
||||||
|
if (!fileExts.contains(ext)) {
|
||||||
|
pattern += "|(" + Pattern.quote(ext) + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pattern += ")";
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static int countGroups(String str) {
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
int count = str.replaceAll("[^\\(]", "").length();
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element serializeAttributes(Element parentElement) {
|
||||||
|
Element elementProvider = super.serializeAttributes(parentElement);
|
||||||
|
elementProvider.setAttribute(ATTR_KEEP_RELATIVE_PATHS, Boolean.toString( ! isResolvingPaths ));
|
||||||
|
return elementProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadAttributes(Element providerNode) {
|
||||||
|
super.loadAttributes(providerNode);
|
||||||
|
|
||||||
|
String expandRelativePathsValue = XmlUtil.determineAttributeValue(providerNode, ATTR_KEEP_RELATIVE_PATHS);
|
||||||
|
if (expandRelativePathsValue!=null)
|
||||||
|
isResolvingPaths = ! Boolean.parseBoolean(expandRelativePathsValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + (isResolvingPaths ? 1231 : 1237);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (!super.equals(obj))
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
AbstractLanguageSettingsOutputScanner other = (AbstractLanguageSettingsOutputScanner) obj;
|
||||||
|
if (isResolvingPaths != other.isResolvingPaths)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ package org.eclipse.cdt.make.core.scannerconfig;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
@ -75,6 +77,11 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
|
|
||||||
buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
|
buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
|
||||||
autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
||||||
|
if (autodiscoveryEnabled2) {
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(getProject());
|
||||||
|
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
||||||
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
|
}
|
||||||
|
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
||||||
|
@ -129,6 +136,11 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
|
|
||||||
protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){
|
protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){
|
||||||
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
||||||
|
if (autodiscoveryEnabled2) {
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(getProject());
|
||||||
|
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
|
||||||
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
|
}
|
||||||
|
|
||||||
if (autodiscoveryEnabled2) {
|
if (autodiscoveryEnabled2) {
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.internal.core.scannerconfig;
|
||||||
|
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.errorparsers.RegexErrorPattern;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsEditableProvider;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser;
|
||||||
|
|
||||||
|
public class GCCBuildCommandParser extends AbstractBuildCommandParser implements ILanguageSettingsEditableProvider {
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
static final AbstractOptionParser[] optionParsers = {
|
||||||
|
new IncludePathOptionParser("-I\\s*([\"'])(.*)\\1", "$2"),
|
||||||
|
new IncludePathOptionParser("-I\\s*([^\\s\"']*)", "$1"),
|
||||||
|
new IncludeFileOptionParser("-include\\s*([\"'])(.*)\\1", "$2"),
|
||||||
|
new IncludeFileOptionParser("-include\\s*([^\\s\"']*)", "$1"),
|
||||||
|
new MacroOptionParser("-D\\s*([\"'])([^=]*)(=(.*))?\\1", "$2", "$4"),
|
||||||
|
new MacroOptionParser("-D\\s*([^\\s=\"']*)=(\\\\([\"']))(.*?)\\2", "$1", "$3$4$3"),
|
||||||
|
new MacroOptionParser("-D\\s*([^\\s=\"']*)=([\"'])(.*?)\\2", "$1", "$3"),
|
||||||
|
new MacroOptionParser("-D\\s*([^\\s=\"']*)(=([^\\s\"']*))?", "$1", "$3"),
|
||||||
|
new MacroOptionParser("-U\\s*([^\\s=\"']*)", "$1", ICSettingEntry.UNDEFINED),
|
||||||
|
new MacroFileOptionParser("-macros\\s*([\"'])(.*)\\1", "$2"),
|
||||||
|
new MacroFileOptionParser("-macros\\s*([^\\s\"']*)", "$1"),
|
||||||
|
new LibraryPathOptionParser("-L\\s*([\"'])(.*)\\1", "$2"),
|
||||||
|
new LibraryPathOptionParser("-L\\s*([^\\s\"']*)", "$1"),
|
||||||
|
new LibraryFileOptionParser("-l\\s*([^\\s\"']*)", "lib$1.a"), };
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
|
return optionParsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuildCommandParser cloneShallow() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuildCommandParser) super.cloneShallow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuildCommandParser clone() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuildCommandParser) super.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class GCCBuildCommandPatternHighlighter extends AbstractBuildCommandParser.AbstractBuildCommandPatternHighlighter {
|
||||||
|
// ID of the parser taken from the existing extension point
|
||||||
|
private static final String GCC_BUILD_COMMAND_PARSER_EXT = "org.eclipse.cdt.make.core.GCCBuildCommandParser"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
public GCCBuildCommandPatternHighlighter() {
|
||||||
|
super(GCC_BUILD_COMMAND_PARSER_EXT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() throws CloneNotSupportedException {
|
||||||
|
GCCBuildCommandPatternHighlighter that = new GCCBuildCommandPatternHighlighter();
|
||||||
|
that.setId(getId());
|
||||||
|
that.setName(getName());
|
||||||
|
for (RegexErrorPattern pattern : getPatterns()) {
|
||||||
|
that.addPattern((RegexErrorPattern)pattern.clone());
|
||||||
|
}
|
||||||
|
return that;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -14,6 +14,10 @@ package org.eclipse.cdt.make.internal.core.scannerconfig;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
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.ConsoleOutputSniffer;
|
||||||
import org.eclipse.cdt.make.core.MakeBuilder;
|
import org.eclipse.cdt.make.core.MakeBuilder;
|
||||||
import org.eclipse.cdt.make.core.MakeBuilderUtil;
|
import org.eclipse.cdt.make.core.MakeBuilderUtil;
|
||||||
|
@ -118,23 +122,29 @@ public class ScannerInfoConsoleParserFactory {
|
||||||
// builder not installed or disabled
|
// builder not installed or disabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scBuildInfo != null &&
|
if (scBuildInfo != null) {
|
||||||
scBuildInfo.isAutoDiscoveryEnabled() &&
|
boolean autodiscoveryEnabled2 = scBuildInfo.isAutoDiscoveryEnabled();
|
||||||
scBuildInfo.isBuildOutputParserEnabled()) {
|
if (autodiscoveryEnabled2) {
|
||||||
// get the make builder console parser
|
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(currentProject);
|
||||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
||||||
getSCProfileInstance(currentProject, context, scBuildInfo.getSelectedProfileId());
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
IScannerInfoConsoleParser clParser = profileInstance.createBuildOutputParser();
|
}
|
||||||
if (collector == null) {
|
if (autodiscoveryEnabled2 && scBuildInfo.isBuildOutputParserEnabled()) {
|
||||||
collector = profileInstance.getScannerInfoCollector();
|
// get the make builder console parser
|
||||||
}
|
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||||
if(clParser != null){
|
getSCProfileInstance(currentProject, context, scBuildInfo.getSelectedProfileId());
|
||||||
clParser.startup(currentProject, workingDirectory, collector,
|
IScannerInfoConsoleParser clParser = profileInstance.createBuildOutputParser();
|
||||||
scBuildInfo.isProblemReportingEnabled() ? markerGenerator : null);
|
if (collector == null) {
|
||||||
// create an output stream sniffer
|
collector = profileInstance.getScannerInfoCollector();
|
||||||
return new ConsoleOutputSniffer(outputStream, errorStream, new
|
}
|
||||||
IScannerInfoConsoleParser[] {clParser});
|
if(clParser != null){
|
||||||
}
|
clParser.startup(currentProject, workingDirectory, collector,
|
||||||
|
scBuildInfo.isProblemReportingEnabled() ? markerGenerator : null);
|
||||||
|
// create an output stream sniffer
|
||||||
|
return new ConsoleOutputSniffer(outputStream, errorStream, new
|
||||||
|
IScannerInfoConsoleParser[] {clParser});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -35,7 +35,8 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)",
|
||||||
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
|
org.eclipse.ui.navigator;bundle-version="[3.2.0,4.0.0)";resolution:=optional,
|
||||||
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
org.eclipse.compare;bundle-version="[3.3.0,4.0.0)",
|
||||||
org.eclipse.core.filesystem;bundle-version="1.2.0"
|
org.eclipse.core.filesystem;bundle-version="1.2.0",
|
||||||
|
org.eclipse.ui.console;bundle-version="3.5.100"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||||
Import-Package: com.ibm.icu.text
|
Import-Package: com.ibm.icu.text
|
||||||
|
|
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/inspect_system.gif
Normal file
After Width: | Height: | Size: 553 B |
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/log_obj.gif
Normal file
After Width: | Height: | Size: 335 B |
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/search.gif
Normal file
After Width: | Height: | Size: 347 B |
|
@ -44,6 +44,9 @@ PreferenceBuildSettings.name=Settings
|
||||||
ErrorParsersTab.name=Error Parsers
|
ErrorParsersTab.name=Error Parsers
|
||||||
ErrorParsersTab.tooltip=Error Parsers scan build output and report errors in Problems view
|
ErrorParsersTab.tooltip=Error Parsers scan build output and report errors in Problems view
|
||||||
|
|
||||||
|
LanguageSettingsProvidersTab.name=Discovery
|
||||||
|
LanguageSettingsProvidersTab.tooltip=Language settings providers
|
||||||
|
|
||||||
PreferenceMakeProject.name=New Make Projects
|
PreferenceMakeProject.name=New Make Projects
|
||||||
PreferenceMake.name=Make Targets
|
PreferenceMake.name=Make Targets
|
||||||
PreferenceMakefileEditor.name=Makefile Editor
|
PreferenceMakefileEditor.name=Makefile Editor
|
||||||
|
|
|
@ -470,6 +470,14 @@
|
||||||
tooltip="%ErrorParsersTab.tooltip"
|
tooltip="%ErrorParsersTab.tooltip"
|
||||||
weight="020">
|
weight="020">
|
||||||
</tab>
|
</tab>
|
||||||
|
<tab
|
||||||
|
class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderTab"
|
||||||
|
icon="icons/obj16/search.gif"
|
||||||
|
name="%LanguageSettingsProvidersTab.name"
|
||||||
|
parent="org.eclipse.cdt.make.internal.ui.preferences.BuildSettingsPreferencePage"
|
||||||
|
tooltip="%LanguageSettingsProvidersTab.tooltip"
|
||||||
|
weight="000">
|
||||||
|
</tab>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
|
@ -532,4 +540,35 @@
|
||||||
</description>
|
</description>
|
||||||
</fontDefinition>
|
</fontDefinition>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.ui.LanguageSettingsProviderAssociation">
|
||||||
|
<class-association
|
||||||
|
class="org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser"
|
||||||
|
icon="icons/obj16/log_obj.gif"
|
||||||
|
page="org.eclipse.cdt.make.internal.ui.preferences.GCCBuildCommandParserOptionPage"
|
||||||
|
ui-clear-entries="true"
|
||||||
|
ui-edit-entries="false">
|
||||||
|
</class-association>
|
||||||
|
<class-association
|
||||||
|
class="org.eclipse.cdt.make.core.scannerconfig.AbstractBuiltinSpecsDetector"
|
||||||
|
icon="icons/obj16/inspect_system.gif"
|
||||||
|
page="org.eclipse.cdt.make.internal.ui.scannerconfig.BuiltinSpecsDetectorOptionPage"
|
||||||
|
ui-clear-entries="true"
|
||||||
|
ui-edit-entries="false">
|
||||||
|
</class-association>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.CBuildConsole">
|
||||||
|
<CBuildConsole
|
||||||
|
id="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryConsole"
|
||||||
|
class="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryConsole">
|
||||||
|
</CBuildConsole>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.CBuildConsole">
|
||||||
|
<CBuildConsole
|
||||||
|
id="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryGlobalConsole"
|
||||||
|
class="org.eclipse.cdt.make.internal.ui.scannerconfig.ScannerDiscoveryGlobalConsole">
|
||||||
|
</CBuildConsole>
|
||||||
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,224 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2010 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.internal.ui.preferences;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.internal.ui.language.settings.providers.AbstractLanguageSettingProviderOptionPage;
|
||||||
|
import org.eclipse.cdt.internal.ui.newui.StatusMessageLine;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
import org.eclipse.core.runtime.Assert;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options page for TODO
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class GCCBuildCommandParserOptionPage extends AbstractLanguageSettingProviderOptionPage {
|
||||||
|
private boolean fEditable;
|
||||||
|
|
||||||
|
private Text inputCommand;
|
||||||
|
|
||||||
|
private StatusMessageLine fStatusLine;
|
||||||
|
private Button runOnceRadioButton;
|
||||||
|
private Button runEveryBuildRadioButton;
|
||||||
|
private Button expandRelativePathCheckBox;
|
||||||
|
private Button applyToProjectCheckBox;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void createControl(Composite parent) {
|
||||||
|
// Composite optionsPageComposite = new Composite(composite, SWT.NULL);
|
||||||
|
fEditable = parent.isEnabled();
|
||||||
|
|
||||||
|
final Composite composite = new Composite(parent, SWT.NONE);
|
||||||
|
{
|
||||||
|
GridLayout layout = new GridLayout();
|
||||||
|
layout.numColumns = 2;
|
||||||
|
layout.marginWidth = 1;
|
||||||
|
layout.marginHeight = 1;
|
||||||
|
layout.marginRight = 1;
|
||||||
|
composite.setLayout(layout);
|
||||||
|
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
Dialog.applyDialogFont(composite);
|
||||||
|
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
composite.setLayoutData(gd);
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractBuildCommandParser provider = getRawProvider();
|
||||||
|
|
||||||
|
// Compiler specs command
|
||||||
|
{
|
||||||
|
Label label = ControlFactory.createLabel(composite, "Compiler command pattern:");
|
||||||
|
GridData gd = new GridData();
|
||||||
|
gd.horizontalSpan = 1;
|
||||||
|
label.setLayoutData(gd);
|
||||||
|
label.setEnabled(fEditable);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
inputCommand = ControlFactory.createTextField(composite, SWT.SINGLE | SWT.BORDER);
|
||||||
|
String compilerPattern = provider.getCompilerPattern();
|
||||||
|
inputCommand.setText(compilerPattern!=null ? compilerPattern : "");
|
||||||
|
|
||||||
|
GridData gd = new GridData();
|
||||||
|
gd.horizontalSpan = 1;
|
||||||
|
gd.grabExcessHorizontalSpace = true;
|
||||||
|
gd.horizontalAlignment = SWT.FILL;
|
||||||
|
inputCommand.setLayoutData(gd);
|
||||||
|
inputCommand.setEnabled(fEditable);
|
||||||
|
|
||||||
|
inputCommand.addModifyListener(new ModifyListener() {
|
||||||
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
String text = inputCommand.getText();
|
||||||
|
AbstractBuildCommandParser provider = getRawProvider();
|
||||||
|
if (!text.equals(provider.getCompilerPattern())) {
|
||||||
|
AbstractBuildCommandParser selectedProvider = getWorkingCopy(providerId);
|
||||||
|
selectedProvider.setCompilerPattern(text);
|
||||||
|
providerTab.refreshItem(selectedProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// {
|
||||||
|
// Button button = ControlFactory.createPushButton(composite, "Browse...");
|
||||||
|
// button.setEnabled(fEditable);
|
||||||
|
// button.addSelectionListener(new SelectionAdapter() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void widgetSelected(SelectionEvent evt) {
|
||||||
|
//// handleAddr2LineButtonSelected();
|
||||||
|
// //updateLaunchConfigurationDialog();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
{
|
||||||
|
expandRelativePathCheckBox = new Button(composite, SWT.CHECK);
|
||||||
|
expandRelativePathCheckBox.setText("Use heuristics to resolve paths");
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
expandRelativePathCheckBox.setLayoutData(gd);
|
||||||
|
|
||||||
|
expandRelativePathCheckBox.setSelection(provider.isResolvingPaths());
|
||||||
|
expandRelativePathCheckBox.setEnabled(fEditable);
|
||||||
|
expandRelativePathCheckBox.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
boolean enabled = expandRelativePathCheckBox.getSelection();
|
||||||
|
AbstractBuildCommandParser provider = getRawProvider();
|
||||||
|
if (enabled != provider.isResolvingPaths()) {
|
||||||
|
AbstractBuildCommandParser selectedProvider = getWorkingCopy(providerId);
|
||||||
|
selectedProvider.setResolvingPaths(enabled);
|
||||||
|
providerTab.refreshItem(selectedProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
widgetSelected(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
applyToProjectCheckBox = new Button(composite, SWT.CHECK);
|
||||||
|
applyToProjectCheckBox.setText("Apply discovered settings on project level");
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
applyToProjectCheckBox.setLayoutData(gd);
|
||||||
|
|
||||||
|
// applyToProjectCheckBox.setSelection(provider.isExpandRelativePaths());
|
||||||
|
// applyToProjectCheckBox.setEnabled(fEditable);
|
||||||
|
applyToProjectCheckBox.setSelection(false);
|
||||||
|
applyToProjectCheckBox.setEnabled(false);
|
||||||
|
applyToProjectCheckBox.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
boolean enabled = applyToProjectCheckBox.getSelection();
|
||||||
|
AbstractBuildCommandParser provider = getRawProvider();
|
||||||
|
if (enabled != provider.isResolvingPaths()) {
|
||||||
|
AbstractBuildCommandParser selectedProvider = getWorkingCopy(providerId);
|
||||||
|
selectedProvider.setResolvingPaths(enabled);
|
||||||
|
providerTab.refreshItem(selectedProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
widgetSelected(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Status line
|
||||||
|
// if (fEditable) {
|
||||||
|
// fStatusLine = new StatusMessageLine(composite, SWT.LEFT, 2);
|
||||||
|
// IStatus status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, "Note that currently not all options are persisted (FIXME)");
|
||||||
|
// fStatusLine.setErrorStatus(status);
|
||||||
|
// }
|
||||||
|
|
||||||
|
setControl(composite);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AbstractBuildCommandParser getRawProvider() {
|
||||||
|
ILanguageSettingsProvider provider = LanguageSettingsManager.getRawProvider(providerTab.getProvider(providerId));
|
||||||
|
Assert.isTrue(provider instanceof AbstractBuildCommandParser);
|
||||||
|
return (AbstractBuildCommandParser) provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AbstractBuildCommandParser getWorkingCopy(String providerId) {
|
||||||
|
ILanguageSettingsProvider provider = providerTab.getWorkingCopy(providerId);
|
||||||
|
Assert.isTrue(provider instanceof AbstractBuildCommandParser);
|
||||||
|
return (AbstractBuildCommandParser) provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||||
|
// handled by LanguageSettingsProviderTab
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performDefaults() {
|
||||||
|
// handled by LanguageSettingsProviderTab
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,261 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2010 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.internal.ui.scannerconfig;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.internal.ui.language.settings.providers.AbstractLanguageSettingProviderOptionPage;
|
||||||
|
import org.eclipse.cdt.internal.ui.newui.StatusMessageLine;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuiltinSpecsDetector;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
|
import org.eclipse.core.runtime.Assert;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options page for TODO
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettingProviderOptionPage {
|
||||||
|
private boolean fEditable;
|
||||||
|
|
||||||
|
private Text inputCommand;
|
||||||
|
|
||||||
|
private StatusMessageLine fStatusLine;
|
||||||
|
private Button allocateConsoleCheckBox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void createControl(Composite parent) {
|
||||||
|
// Composite optionsPageComposite = new Composite(composite, SWT.NULL);
|
||||||
|
fEditable = parent.isEnabled();
|
||||||
|
|
||||||
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
|
{
|
||||||
|
GridLayout layout = new GridLayout();
|
||||||
|
layout.numColumns = 2;
|
||||||
|
layout.marginWidth = 1;
|
||||||
|
layout.marginHeight = 1;
|
||||||
|
layout.marginRight = 1;
|
||||||
|
composite.setLayout(layout);
|
||||||
|
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
Dialog.applyDialogFont(composite);
|
||||||
|
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
composite.setLayoutData(gd);
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractBuiltinSpecsDetector provider = getRawProvider();
|
||||||
|
|
||||||
|
// Compiler specs command
|
||||||
|
{
|
||||||
|
Label label = ControlFactory.createLabel(composite, "Command to get compiler specs:");
|
||||||
|
GridData gd = new GridData();
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
label.setLayoutData(gd);
|
||||||
|
label.setEnabled(fEditable);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
inputCommand = ControlFactory.createTextField(composite, SWT.SINGLE | SWT.BORDER);
|
||||||
|
String command = provider.getCommand();
|
||||||
|
inputCommand.setText(command!=null ? command : "");
|
||||||
|
inputCommand.setEnabled(fEditable);
|
||||||
|
inputCommand.addModifyListener(new ModifyListener() {
|
||||||
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
|
String text = inputCommand.getText();
|
||||||
|
AbstractBuiltinSpecsDetector provider = getRawProvider();
|
||||||
|
if (!text.equals(provider.getCommand())) {
|
||||||
|
AbstractBuiltinSpecsDetector selectedProvider = getWorkingCopy(providerId);
|
||||||
|
selectedProvider.setCommand(text);
|
||||||
|
providerTab.refreshItem(selectedProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Button button = ControlFactory.createPushButton(composite, "Browse...");
|
||||||
|
button.setEnabled(fEditable);
|
||||||
|
button.addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
|
// handleAddr2LineButtonSelected();
|
||||||
|
//updateLaunchConfigurationDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// {
|
||||||
|
// final Button button = new Button(composite, SWT.PUSH);
|
||||||
|
// button.setFont(parent.getFont());
|
||||||
|
// String text = fProvider.isEmpty() ? "Run Now (TODO)" : "Clear";
|
||||||
|
// button.setText(text);
|
||||||
|
//// button.addSelectionListener(this);
|
||||||
|
// GridData data = new GridData();
|
||||||
|
// data.horizontalSpan = 2;
|
||||||
|
//// data.horizontalAlignment = GridData.BEGINNING;
|
||||||
|
//// data.widthHint = 60;
|
||||||
|
// button.setLayoutData(data);
|
||||||
|
// // TODO
|
||||||
|
// button.setEnabled(fEditable && !fProvider.isEmpty());
|
||||||
|
//
|
||||||
|
// button.addSelectionListener(new SelectionAdapter() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void widgetSelected(SelectionEvent evt) {
|
||||||
|
// if (fProvider.isEmpty()) {
|
||||||
|
// // TODO
|
||||||
|
// } else {
|
||||||
|
// fProvider.clear();
|
||||||
|
// }
|
||||||
|
// // TODO
|
||||||
|
// button.setEnabled(fEditable && !fProvider.isEmpty());
|
||||||
|
// String text = fProvider.isEmpty() ? "Run Now (TODO)" : "Clear";
|
||||||
|
// button.setText(text);
|
||||||
|
// button.pack();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Compiler specs command
|
||||||
|
// {
|
||||||
|
// Label label = ControlFactory.createLabel(composite, "Parsing rules:");
|
||||||
|
// GridData gd = new GridData();
|
||||||
|
// gd.horizontalSpan = 2;
|
||||||
|
// label.setLayoutData(gd);
|
||||||
|
//// Label newLabel = new Label(composite, SWT.NONE);
|
||||||
|
////// ((GridData) newLabel.getLayoutData()).horizontalSpan = 1;
|
||||||
|
//// newLabel.setText("Command to get compiler specs:");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// createPatternsTable(group, composite);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
|
||||||
|
// group.setText(DialogsMessages.RegexErrorParserOptionPage_Title);
|
||||||
|
//
|
||||||
|
// GridLayout gridLayout = new GridLayout(2, true);
|
||||||
|
// gridLayout.makeColumnsEqualWidth = false;
|
||||||
|
// gridLayout.marginRight = -10;
|
||||||
|
// gridLayout.marginLeft = -4;
|
||||||
|
// group.setLayout(gridLayout);
|
||||||
|
// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
//
|
||||||
|
// Composite composite = new Composite(group, SWT.NONE);
|
||||||
|
// GridLayout layout = new GridLayout();
|
||||||
|
// layout.numColumns = 2;
|
||||||
|
// layout.marginWidth = 1;
|
||||||
|
// layout.marginHeight = 1;
|
||||||
|
// layout.marginRight = 1;
|
||||||
|
// composite.setLayout(layout);
|
||||||
|
// composite.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
|
// Dialog.applyDialogFont(composite);
|
||||||
|
//
|
||||||
|
// if (!fEditable)
|
||||||
|
// createLinkToPreferences(composite);
|
||||||
|
//
|
||||||
|
// createPatternsTable(group, composite);
|
||||||
|
//
|
||||||
|
// if (fEditable) {
|
||||||
|
// createButtons(composite);
|
||||||
|
// }
|
||||||
|
|
||||||
|
{
|
||||||
|
allocateConsoleCheckBox = new Button(composite, SWT.CHECK);
|
||||||
|
allocateConsoleCheckBox.setText("Allocate console in the Console View");
|
||||||
|
allocateConsoleCheckBox.setSelection(provider.isConsoleEnabled());
|
||||||
|
allocateConsoleCheckBox.setEnabled(fEditable);
|
||||||
|
allocateConsoleCheckBox.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
boolean enabled = allocateConsoleCheckBox.getSelection();
|
||||||
|
AbstractBuiltinSpecsDetector provider = getRawProvider();
|
||||||
|
if (enabled != provider.isConsoleEnabled()) {
|
||||||
|
AbstractBuiltinSpecsDetector selectedProvider = getWorkingCopy(providerId);
|
||||||
|
selectedProvider.setConsoleEnabled(enabled);
|
||||||
|
providerTab.refreshItem(selectedProvider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
|
widgetSelected(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// // Status line
|
||||||
|
// if (fEditable) {
|
||||||
|
// fStatusLine = new StatusMessageLine(composite, SWT.LEFT, 2);
|
||||||
|
// IStatus status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, "Note that currently not all options are persisted (FIXME)");
|
||||||
|
// fStatusLine.setErrorStatus(status);
|
||||||
|
// }
|
||||||
|
|
||||||
|
setControl(composite);
|
||||||
|
}
|
||||||
|
|
||||||
|
private AbstractBuiltinSpecsDetector getRawProvider() {
|
||||||
|
ILanguageSettingsProvider provider = LanguageSettingsManager.getRawProvider(providerTab.getProvider(providerId));
|
||||||
|
Assert.isTrue(provider instanceof AbstractBuiltinSpecsDetector);
|
||||||
|
return (AbstractBuiltinSpecsDetector) provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AbstractBuiltinSpecsDetector getWorkingCopy(String providerId) {
|
||||||
|
ILanguageSettingsProvider provider = providerTab.getWorkingCopy(providerId);
|
||||||
|
Assert.isTrue(provider instanceof AbstractBuiltinSpecsDetector);
|
||||||
|
return (AbstractBuiltinSpecsDetector) provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||||
|
// handled by LanguageSettingsProviderTab
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performDefaults() {
|
||||||
|
// handled by LanguageSettingsProviderTab
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 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.internal.ui.scannerconfig;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.internal.ui.buildconsole.CBuildConsole;
|
||||||
|
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderAssociationManager;
|
||||||
|
|
||||||
|
public class ScannerDiscoveryConsole extends CBuildConsole {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
* @param consoleId - a console ID is expected here which then is used as menu context ID.
|
||||||
|
* @param defaultIconUrl - if {@code LanguageSettingsProviderAssociation} extension point
|
||||||
|
* defines URL by provider id, {@code defaultIconUrl} will be ignored and the URL from the extension
|
||||||
|
* point will be used. If not, supplied {@code defaultIconUrl} will be used.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void init(String consoleId, String name, URL defaultIconUrl) {
|
||||||
|
URL iconUrl = LanguageSettingsProviderAssociationManager.getImageUrl(consoleId);
|
||||||
|
if (iconUrl==null) {
|
||||||
|
iconUrl = defaultIconUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
super.init(consoleId, name, iconUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.internal.ui.scannerconfig;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||||
|
import org.eclipse.cdt.internal.core.ICConsole;
|
||||||
|
import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderAssociationManager;
|
||||||
|
import org.eclipse.cdt.ui.CDTSharedImages;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.Assert;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.ui.console.ConsolePlugin;
|
||||||
|
import org.eclipse.ui.console.IConsole;
|
||||||
|
import org.eclipse.ui.console.IConsoleManager;
|
||||||
|
import org.eclipse.ui.console.MessageConsole;
|
||||||
|
import org.eclipse.ui.console.MessageConsoleStream;
|
||||||
|
|
||||||
|
public class ScannerDiscoveryGlobalConsole implements ICConsole {
|
||||||
|
private MessageConsole console;
|
||||||
|
private ConsoleOutputStreamAdapter stream;
|
||||||
|
|
||||||
|
private class ConsoleOutputStreamAdapter extends ConsoleOutputStream {
|
||||||
|
private MessageConsoleStream fConsoleStream;
|
||||||
|
public ConsoleOutputStreamAdapter(MessageConsoleStream stream) {
|
||||||
|
fConsoleStream = stream;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void write(int arg0) throws IOException {
|
||||||
|
fConsoleStream.write(arg0);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public synchronized void write(byte[] b, int off, int len) throws IOException {
|
||||||
|
fConsoleStream.write(b, off, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flush() throws IOException {
|
||||||
|
fConsoleStream.flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() throws IOException {
|
||||||
|
fConsoleStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(IProject project) {
|
||||||
|
Assert.isTrue(project == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsoleOutputStream getOutputStream() throws CoreException {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsoleOutputStream getInfoStream() throws CoreException {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ConsoleOutputStream getErrorStream() throws CoreException {
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(String consoleId, String name, URL defaultIconUrl) {
|
||||||
|
console = null;
|
||||||
|
|
||||||
|
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
|
||||||
|
IConsole[] allConsoles = consoleManager.getConsoles();
|
||||||
|
for (IConsole con : allConsoles) {
|
||||||
|
if (name.equals(con.getName()) && con instanceof MessageConsole) {
|
||||||
|
console = (MessageConsole) con;
|
||||||
|
console.clearConsole();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (console==null) {
|
||||||
|
URL iconUrl = LanguageSettingsProviderAssociationManager.getImageUrl(consoleId);
|
||||||
|
if (iconUrl==null) {
|
||||||
|
iconUrl = defaultIconUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
console = new MessageConsole(name, CDTSharedImages.getImageDescriptor(iconUrl.toString()));
|
||||||
|
console.activate();
|
||||||
|
consoleManager.addConsoles(new IConsole[]{ console });
|
||||||
|
}
|
||||||
|
|
||||||
|
stream = new ConsoleOutputStreamAdapter(console.newMessageStream());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,10 +15,13 @@ import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
import org.eclipse.cdt.core.model.IPathEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.MakeProjectNature;
|
import org.eclipse.cdt.make.core.MakeProjectNature;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
|
@ -180,8 +183,14 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
|
||||||
((GridData)scEnabledButton.getLayoutData()).horizontalSpan = numColumns;
|
((GridData)scEnabledButton.getLayoutData()).horizontalSpan = numColumns;
|
||||||
((GridData)scEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
|
((GridData)scEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
|
||||||
// VMIR* old projects will have discovery disabled by default
|
// VMIR* old projects will have discovery disabled by default
|
||||||
scEnabledButton.setSelection(needsSCNature ? false
|
boolean autodiscoveryEnabled2 = getBuildInfo().isAutoDiscoveryEnabled();
|
||||||
: (getBuildInfo().isAutoDiscoveryEnabled()
|
if (autodiscoveryEnabled2) {
|
||||||
|
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(getProject());
|
||||||
|
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
|
||||||
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
|
}
|
||||||
|
scEnabledButton.setSelection(needsSCNature ? false
|
||||||
|
: (autodiscoveryEnabled2
|
||||||
&& !getBuildInfo().getSelectedProfileId().equals(ScannerConfigProfileManager.NULL_PROFILE_ID)));
|
&& !getBuildInfo().getSelectedProfileId().equals(ScannerConfigProfileManager.NULL_PROFILE_ID)));
|
||||||
scEnabledButton.addSelectionListener(new SelectionAdapter() {
|
scEnabledButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,7 +6,8 @@ Bundle-Version: 8.1.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin
|
Bundle-Activator: org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin
|
||||||
Bundle-Vendor: Eclipse CDT
|
Bundle-Vendor: Eclipse CDT
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Export-Package: org.eclipse.cdt.managedbuilder.core.tests,
|
Export-Package: org.eclipse.cdt.build.core.scannerconfig.tests;x-internal:=true,
|
||||||
|
org.eclipse.cdt.managedbuilder.core.tests,
|
||||||
org.eclipse.cdt.managedbuilder.templateengine.tests,
|
org.eclipse.cdt.managedbuilder.templateengine.tests,
|
||||||
org.eclipse.cdt.managedbuilder.testplugin,
|
org.eclipse.cdt.managedbuilder.testplugin,
|
||||||
org.eclipse.cdt.managedbuilder.tests.suite,
|
org.eclipse.cdt.managedbuilder.tests.suite,
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.eclipse.cdt.managedbuilder.tests.suite;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.build.core.scannerconfig.tests.AllLanguageSettingsProvidersMBSTests;
|
||||||
import org.eclipse.cdt.build.core.scannerconfig.tests.CfgScannerConfigProfileManagerTests;
|
import org.eclipse.cdt.build.core.scannerconfig.tests.CfgScannerConfigProfileManagerTests;
|
||||||
import org.eclipse.cdt.build.core.scannerconfig.tests.GCCSpecsConsoleParserTest;
|
import org.eclipse.cdt.build.core.scannerconfig.tests.GCCSpecsConsoleParserTest;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -61,6 +62,9 @@ public class AllManagedBuildTests {
|
||||||
suite.addTest(CfgScannerConfigProfileManagerTests.suite());
|
suite.addTest(CfgScannerConfigProfileManagerTests.suite());
|
||||||
suite.addTestSuite(GCCSpecsConsoleParserTest.class);
|
suite.addTestSuite(GCCSpecsConsoleParserTest.class);
|
||||||
|
|
||||||
|
// language settings providers tests
|
||||||
|
suite.addTest(AllLanguageSettingsProvidersMBSTests.suite());
|
||||||
|
|
||||||
// managedbuilder.core.tests
|
// managedbuilder.core.tests
|
||||||
suite.addTest(ManagedBuildDependencyLibsTests.suite());
|
suite.addTest(ManagedBuildDependencyLibsTests.suite());
|
||||||
suite.addTest(ManagedBuildCoreTests20.suite());
|
suite.addTest(ManagedBuildCoreTests20.suite());
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 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.build.core.scannerconfig.tests;
|
||||||
|
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
public class AllLanguageSettingsProvidersMBSTests extends TestSuite {
|
||||||
|
|
||||||
|
public static TestSuite suite() {
|
||||||
|
return new AllLanguageSettingsProvidersMBSTests();
|
||||||
|
}
|
||||||
|
|
||||||
|
public AllLanguageSettingsProvidersMBSTests() {
|
||||||
|
super(AllLanguageSettingsProvidersMBSTests.class.getName());
|
||||||
|
|
||||||
|
addTestSuite(LanguageSettingsProvidersMBSTest.class);
|
||||||
|
addTestSuite(GCCBuiltinSpecsDetectorTest.class);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,410 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 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.build.core.scannerconfig.tests;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.CMacroEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.GCCBuiltinSpecsDetector;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.GCCBuiltinSpecsDetectorCygwin;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
|
public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
private static final String LANGUAGE_ID_C = GCCLanguage.ID;
|
||||||
|
|
||||||
|
class MockGCCBuiltinSpecsDetector extends GCCBuiltinSpecsDetector {
|
||||||
|
@Override
|
||||||
|
public void startupForLanguage(String languageId) throws CoreException {
|
||||||
|
super.startupForLanguage(languageId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void shutdownForLanguage() {
|
||||||
|
super.shutdownForLanguage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MockGCCBuiltinSpecsDetectorCygwin extends GCCBuiltinSpecsDetectorCygwin {
|
||||||
|
@Override
|
||||||
|
public void startupForLanguage(String languageId) throws CoreException {
|
||||||
|
super.startupForLanguage(languageId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void shutdownForLanguage() {
|
||||||
|
super.shutdownForLanguage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
|
||||||
|
CoreModel coreModel = CoreModel.getDefault();
|
||||||
|
ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
|
||||||
|
// project description
|
||||||
|
ICProjectDescription projectDescription = mngr.getProjectDescription(project);
|
||||||
|
assertNotNull(projectDescription);
|
||||||
|
assertEquals(1, projectDescription.getConfigurations().length);
|
||||||
|
// configuration description
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
|
||||||
|
return cfgDescriptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_ResolvedCommand() throws Exception {
|
||||||
|
class MockGCCBuiltinSpecsDetectorLocal extends GCCBuiltinSpecsDetector {
|
||||||
|
@Override
|
||||||
|
public String resolveCommand(String languageId) throws CoreException {
|
||||||
|
return super.resolveCommand(languageId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
MockGCCBuiltinSpecsDetectorLocal detector = new MockGCCBuiltinSpecsDetectorLocal();
|
||||||
|
detector.setLanguageScope(new ArrayList<String>() {{add(LANGUAGE_ID_C);}});
|
||||||
|
detector.setCommand("${COMMAND} -E -P -v -dD ${INPUTS}");
|
||||||
|
|
||||||
|
String resolvedCommand = detector.resolveCommand(LANGUAGE_ID_C);
|
||||||
|
assertTrue(resolvedCommand.startsWith("gcc -E -P -v -dD "));
|
||||||
|
assertTrue(resolvedCommand.endsWith("spec.c"));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
MockGCCBuiltinSpecsDetectorLocal detector = new MockGCCBuiltinSpecsDetectorLocal();
|
||||||
|
detector.setLanguageScope(new ArrayList<String>() {{add(LANGUAGE_ID_C);}});
|
||||||
|
detector.setCommand("${COMMAND} -E -P -v -dD file.${EXT}");
|
||||||
|
|
||||||
|
String resolvedCommand = detector.resolveCommand(LANGUAGE_ID_C);
|
||||||
|
assertTrue(resolvedCommand.startsWith("gcc -E -P -v -dD "));
|
||||||
|
assertTrue(resolvedCommand.endsWith("file.c"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_NoValue() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define MACRO", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CMacroEntry("MACRO", null, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_Simple() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define MACRO VALUE", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CMacroEntry("MACRO", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_Const() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define MACRO (3)", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CMacroEntry("MACRO", "(3)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_WhiteSpaces() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define \t MACRO_1 VALUE", null);
|
||||||
|
detector.processLine("#define MACRO_2 \t VALUE", null);
|
||||||
|
detector.processLine("#define MACRO_3 VALUE \t", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
int index = 0;
|
||||||
|
assertEquals(new CMacroEntry("MACRO_1", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CMacroEntry("MACRO_2", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CMacroEntry("MACRO_3", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(index, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_EmptyArgList() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define MACRO() VALUE", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CMacroEntry("MACRO()", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_ParamUnused() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define MACRO(X) VALUE", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CMacroEntry("MACRO(X)", "VALUE", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_ParamSpace() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define MACRO(P1, P2) VALUE(P1, P2)", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CMacroEntry("MACRO(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_ArgsNoValue() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define MACRO(P1, P2) ", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CMacroEntry("MACRO(P1, P2)", null, ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Macro_Args_WhiteSpaces() throws Exception {
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#define \t MACRO_1(P1, P2) VALUE(P1, P2)", null);
|
||||||
|
detector.processLine("#define MACRO_2(P1, P2) \t VALUE(P1, P2)", null);
|
||||||
|
detector.processLine("#define MACRO_3(P1, P2) VALUE(P1, P2) \t", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
int index = 0;
|
||||||
|
assertEquals(new CMacroEntry("MACRO_1(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CMacroEntry("MACRO_2(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CMacroEntry("MACRO_3(P1, P2)", "VALUE(P1, P2)", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(index, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Includes() throws Exception {
|
||||||
|
// Create model project and folders to test
|
||||||
|
String projectName = getName();
|
||||||
|
IProject project = ResourceHelper.createCDTProject(projectName);
|
||||||
|
IPath tmpPath = ResourceHelper.createTemporaryFolder();
|
||||||
|
ResourceHelper.createFolder(project, "/misplaced/include1");
|
||||||
|
ResourceHelper.createFolder(project, "/local/include");
|
||||||
|
ResourceHelper.createFolder(project, "/usr/include");
|
||||||
|
ResourceHelper.createFolder(project, "/usr/include2");
|
||||||
|
ResourceHelper.createFolder(project, "/misplaced/include2");
|
||||||
|
ResourceHelper.createFolder(project, "/System/Library/Frameworks");
|
||||||
|
ResourceHelper.createFolder(project, "/Library/Frameworks");
|
||||||
|
ResourceHelper.createFolder(project, "/misplaced/include3");
|
||||||
|
String loc = tmpPath.toString();
|
||||||
|
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
|
||||||
|
detector.processLine(" "+loc+"/misplaced/include1", null);
|
||||||
|
detector.processLine("#include \"...\" search starts here:", null);
|
||||||
|
detector.processLine(" "+loc+"/local/include", null);
|
||||||
|
detector.processLine("#include <...> search starts here:", null);
|
||||||
|
detector.processLine(" "+loc+"/usr/include", null);
|
||||||
|
detector.processLine(" "+loc+"/usr/include/../include2", null);
|
||||||
|
detector.processLine(" "+loc+"/missing/folder", null);
|
||||||
|
detector.processLine(" "+loc+"/Library/Frameworks (framework directory)", null);
|
||||||
|
detector.processLine("End of search list.", null);
|
||||||
|
detector.processLine(" "+loc+"/misplaced/include2", null);
|
||||||
|
detector.processLine("Framework search starts here:", null);
|
||||||
|
detector.processLine(" "+loc+"/System/Library/Frameworks", null);
|
||||||
|
detector.processLine("End of framework search list.", null);
|
||||||
|
detector.processLine(" "+loc+"/misplaced/include3", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
int index = 0;
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/local/include", ICSettingEntry.LOCAL | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/usr/include2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/missing/folder", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/Library/Frameworks", ICSettingEntry.FRAMEWORKS_MAC | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/System/Library/Frameworks", ICSettingEntry.FRAMEWORKS_MAC | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(index, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Includes_WhiteSpaces() throws Exception {
|
||||||
|
String loc = ResourceHelper.createTemporaryFolder().toString();
|
||||||
|
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
|
||||||
|
detector.processLine("#include \"...\" search starts here:", null);
|
||||||
|
detector.processLine(" \t "+loc+"/local/include", null);
|
||||||
|
detector.processLine("#include <...> search starts here:", null);
|
||||||
|
detector.processLine(loc+"/usr/include", null);
|
||||||
|
detector.processLine(" "+loc+"/Library/Frameworks \t (framework directory)", null);
|
||||||
|
detector.processLine("End of search list.", null);
|
||||||
|
detector.processLine("Framework search starts here:", null);
|
||||||
|
detector.processLine(" "+loc+"/System/Library/Frameworks \t ", null);
|
||||||
|
detector.processLine("End of framework search list.", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
int index = 0;
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/local/include", ICSettingEntry.LOCAL | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/usr/include", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/Library/Frameworks", ICSettingEntry.FRAMEWORKS_MAC | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(new CIncludePathEntry(loc+"/System/Library/Frameworks", ICSettingEntry.FRAMEWORKS_MAC | ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(index++));
|
||||||
|
assertEquals(index, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Includes_SymbolicLinkUp() throws Exception {
|
||||||
|
// do not test on systems where symbolic links are not supported
|
||||||
|
if (!ResourceHelper.isSymbolicLinkSupported())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Create model project and folders to test
|
||||||
|
String projectName = getName();
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
IProject project = ResourceHelper.createCDTProject(projectName);
|
||||||
|
// create link on the filesystem
|
||||||
|
IPath dir1 = ResourceHelper.createTemporaryFolder();
|
||||||
|
IPath dir2 = dir1.removeLastSegments(1);
|
||||||
|
IPath linkPath = dir1.append("linked");
|
||||||
|
ResourceHelper.createSymbolicLink(linkPath, dir2);
|
||||||
|
|
||||||
|
MockGCCBuiltinSpecsDetector detector = new MockGCCBuiltinSpecsDetector();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#include <...> search starts here:", null);
|
||||||
|
detector.processLine(" "+linkPath.toString()+"/..", null);
|
||||||
|
detector.processLine("End of search list.", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
// check populated entries
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CIncludePathEntry(dir2.removeLastSegments(1), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Cygwin_NoProject() throws Exception {
|
||||||
|
String windowsLocation;
|
||||||
|
String cygwinLocation = "/usr/include";
|
||||||
|
try {
|
||||||
|
windowsLocation = ResourceHelper.cygwinToWindowsPath(cygwinLocation);
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// Skip the test if Cygwin is not available.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assertTrue("windowsLocation=["+windowsLocation+"]", new Path(windowsLocation).getDevice()!=null);
|
||||||
|
|
||||||
|
MockGCCBuiltinSpecsDetectorCygwin detector = new MockGCCBuiltinSpecsDetectorCygwin();
|
||||||
|
|
||||||
|
detector.startup(null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#include <...> search starts here:", null);
|
||||||
|
detector.processLine(" /usr/include", null);
|
||||||
|
detector.processLine("End of search list.", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
// check populated entries
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CIncludePathEntry(new Path(windowsLocation), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGCCBuiltinSpecsDetector_Cygwin_Configuration() throws Exception {
|
||||||
|
String windowsLocation;
|
||||||
|
String cygwinLocation = "/usr/include";
|
||||||
|
try {
|
||||||
|
windowsLocation = ResourceHelper.cygwinToWindowsPath(cygwinLocation);
|
||||||
|
} catch (UnsupportedOperationException e) {
|
||||||
|
// Skip the test if Cygwin is not available.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assertTrue("windowsLocation=["+windowsLocation+"]", new Path(windowsLocation).getDevice()!=null);
|
||||||
|
|
||||||
|
// Create model project and folders to test
|
||||||
|
String projectName = getName();
|
||||||
|
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
||||||
|
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||||
|
|
||||||
|
MockGCCBuiltinSpecsDetectorCygwin detector = new MockGCCBuiltinSpecsDetectorCygwin();
|
||||||
|
|
||||||
|
detector.startup(cfgDescription);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#include <...> search starts here:", null);
|
||||||
|
detector.processLine(" /usr/include", null);
|
||||||
|
detector.processLine("End of search list.", null);
|
||||||
|
detector.shutdownForLanguage();
|
||||||
|
detector.shutdown();
|
||||||
|
|
||||||
|
// check populated entries
|
||||||
|
List<ICLanguageSettingEntry> entries = detector.getSettingEntries(null, null, null);
|
||||||
|
assertEquals(new CIncludePathEntry(new Path(windowsLocation), ICSettingEntry.BUILTIN | ICSettingEntry.READONLY), entries.get(0));
|
||||||
|
assertEquals(1, entries.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,173 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 2012 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.build.core.scannerconfig.tests;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsPersistenceProjectTests;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
||||||
|
import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
public class LanguageSettingsProvidersMBSTest extends BaseTestCase {
|
||||||
|
private static final String MBS_LANGUAGE_SETTINGS_PROVIDER_ID = ScannerDiscoveryLegacySupport.MBS_LANGUAGE_SETTINGS_PROVIDER_ID;
|
||||||
|
private static final String USER_LANGUAGE_SETTINGS_PROVIDER_ID = ScannerDiscoveryLegacySupport.USER_LANGUAGE_SETTINGS_PROVIDER_ID;
|
||||||
|
private static final String GCC_SPECS_DETECTOR_ID = "org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector";
|
||||||
|
private static final String PROJECT_TYPE_EXECUTABLE_GNU = "cdt.managedbuild.target.gnu.exe";
|
||||||
|
private static final String LANGUAGE_SETTINGS_PROJECT_XML = LanguageSettingsPersistenceProjectTests.LANGUAGE_SETTINGS_PROJECT_XML;
|
||||||
|
private static final String LANGUAGE_SETTINGS_WORKSPACE_XML = LanguageSettingsPersistenceProjectTests.LANGUAGE_SETTINGS_WORKSPACE_XML;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tearDown() throws Exception {
|
||||||
|
ManagedBuildTestHelper.removeProject(this.getName());
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New Project Wizards do all these things
|
||||||
|
*/
|
||||||
|
private static IProject imitateNewProjectWizard(String name, String projectTypeId) throws CoreException {
|
||||||
|
IProject project = ManagedBuildTestHelper.createProject(name, projectTypeId);
|
||||||
|
ManagedBuildTestHelper.addManagedBuildNature(project);
|
||||||
|
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
|
assertNotNull(prjDescription);
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
||||||
|
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
||||||
|
assertNotNull(cfgDescription);
|
||||||
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
|
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, true);
|
||||||
|
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(cfgDescription);
|
||||||
|
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(cfg, cfgDescription);
|
||||||
|
|
||||||
|
assertTrue(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders().size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoreModel.getDefault().setProjectDescription(project, prjDescription);
|
||||||
|
|
||||||
|
return project;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public void testGnuToolchainProviders() throws Exception {
|
||||||
|
IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
||||||
|
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
|
assertNotNull(prjDescription);
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
||||||
|
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
||||||
|
assertNotNull(cfgDescription);
|
||||||
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
|
|
||||||
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
|
{
|
||||||
|
ILanguageSettingsProvider provider = providers.get(0);
|
||||||
|
String id = provider.getId();
|
||||||
|
assertEquals(USER_LANGUAGE_SETTINGS_PROVIDER_ID, id);
|
||||||
|
assertEquals(false, LanguageSettingsManager.isPreferShared(id));
|
||||||
|
assertEquals(false, LanguageSettingsManager.isWorkspaceProvider(provider));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ILanguageSettingsProvider provider = providers.get(1);
|
||||||
|
String id = provider.getId();
|
||||||
|
assertEquals(MBS_LANGUAGE_SETTINGS_PROVIDER_ID, id);
|
||||||
|
assertEquals(true, LanguageSettingsManager.isPreferShared(id));
|
||||||
|
assertEquals(true, LanguageSettingsManager.isWorkspaceProvider(provider));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
ILanguageSettingsProvider provider = providers.get(2);
|
||||||
|
String id = provider.getId();
|
||||||
|
assertEquals(GCC_SPECS_DETECTOR_ID, id);
|
||||||
|
assertEquals(true, LanguageSettingsManager.isPreferShared(id));
|
||||||
|
assertEquals(true, LanguageSettingsManager.isWorkspaceProvider(provider));
|
||||||
|
}
|
||||||
|
assertEquals(3, providers.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public void testProjectPersistence_NoProviders() throws Exception {
|
||||||
|
IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
||||||
|
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, true);
|
||||||
|
assertNotNull(prjDescription);
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
||||||
|
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
||||||
|
assertNotNull(cfgDescription);
|
||||||
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
|
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(new ArrayList<ILanguageSettingsProvider>());
|
||||||
|
assertTrue(((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders().size() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoreModel.getDefault().setProjectDescription(project, prjDescription);
|
||||||
|
|
||||||
|
IFile xmlStorageFile = project.getFile(LANGUAGE_SETTINGS_PROJECT_XML);
|
||||||
|
assertEquals(true, xmlStorageFile.exists());
|
||||||
|
|
||||||
|
String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests.getStoreLocationInWorkspaceArea(project.getName()+'.'+LANGUAGE_SETTINGS_WORKSPACE_XML);
|
||||||
|
java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation);
|
||||||
|
assertEquals(false, xmlStorageFilePrjWsp.exists());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public void testProjectPersistence_Defaults() throws Exception {
|
||||||
|
IProject project = imitateNewProjectWizard(this.getName(), PROJECT_TYPE_EXECUTABLE_GNU);
|
||||||
|
|
||||||
|
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
|
assertNotNull(prjDescription);
|
||||||
|
ICConfigurationDescription[] cfgDescriptions = prjDescription.getConfigurations();
|
||||||
|
for (ICConfigurationDescription cfgDescription : cfgDescriptions) {
|
||||||
|
assertNotNull(cfgDescription);
|
||||||
|
assertTrue(cfgDescription instanceof ILanguageSettingsProvidersKeeper);
|
||||||
|
|
||||||
|
String[] defaultIds = ((ILanguageSettingsProvidersKeeper) cfgDescription).getDefaultLanguageSettingsProvidersIds();
|
||||||
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
|
assertEquals(defaultIds.length, providers.size());
|
||||||
|
for (int i = 0; i < defaultIds.length; i++) {
|
||||||
|
assertEquals(providers.get(i).getId(), defaultIds[i]);
|
||||||
|
}
|
||||||
|
assertTrue(defaultIds.length > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
IFile xmlStorageFile = project.getFile(LANGUAGE_SETTINGS_PROJECT_XML);
|
||||||
|
assertEquals(false, xmlStorageFile.exists());
|
||||||
|
assertEquals(false, xmlStorageFile.getParent().exists()); // .settings folder
|
||||||
|
|
||||||
|
String xmlPrjWspStorageFileLocation = LanguageSettingsPersistenceProjectTests.getStoreLocationInWorkspaceArea(project.getName()+'.'+LANGUAGE_SETTINGS_WORKSPACE_XML);
|
||||||
|
java.io.File xmlStorageFilePrjWsp = new java.io.File(xmlPrjWspStorageFileLocation);
|
||||||
|
assertEquals(false, xmlStorageFilePrjWsp.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ Export-Package: org.eclipse.cdt.build.core.scannerconfig,
|
||||||
org.eclipse.cdt.managedbuilder.envvar,
|
org.eclipse.cdt.managedbuilder.envvar,
|
||||||
org.eclipse.cdt.managedbuilder.internal.buildmodel;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
org.eclipse.cdt.managedbuilder.internal.buildmodel;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
org.eclipse.cdt.managedbuilder.internal.core;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
org.eclipse.cdt.managedbuilder.internal.core;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
|
org.eclipse.cdt.managedbuilder.internal.dataprovider;x-internal:=true,
|
||||||
org.eclipse.cdt.managedbuilder.internal.envvar;x-internal:=true,
|
org.eclipse.cdt.managedbuilder.internal.envvar;x-internal:=true,
|
||||||
org.eclipse.cdt.managedbuilder.internal.macros;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
org.eclipse.cdt.managedbuilder.internal.macros;x-friends:="org.eclipse.cdt.managedbuilder.ui",
|
||||||
org.eclipse.cdt.managedbuilder.internal.scannerconfig;x-internal:=true,
|
org.eclipse.cdt.managedbuilder.internal.scannerconfig;x-internal:=true,
|
||||||
|
|
|
@ -308,13 +308,14 @@
|
||||||
</managedBuildRevision>
|
</managedBuildRevision>
|
||||||
<configuration
|
<configuration
|
||||||
id="org.eclipse.cdt.build.core.emptycfg"
|
id="org.eclipse.cdt.build.core.emptycfg"
|
||||||
|
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;${Toolchain}"
|
||||||
name="%cfg1_empty">
|
name="%cfg1_empty">
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
<configuration
|
<configuration
|
||||||
id="org.eclipse.cdt.build.core.prefbase.cfg"
|
id="org.eclipse.cdt.build.core.prefbase.cfg"
|
||||||
name="%cfg1_base"
|
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;${Toolchain}"
|
||||||
>
|
name="%cfg1_base">
|
||||||
<toolChain
|
<toolChain
|
||||||
id="org.eclipse.cdt.build.core.prefbase.toolchain"
|
id="org.eclipse.cdt.build.core.prefbase.toolchain"
|
||||||
name="%toolChain.name"
|
name="%toolChain.name"
|
||||||
|
@ -597,6 +598,41 @@
|
||||||
</run>
|
</run>
|
||||||
</application>
|
</application>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.MBSLanguageSettingsProvider"
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider"
|
||||||
|
name="CDT Managed Build Setting Entries">
|
||||||
|
</provider>
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.GCCBuiltinSpecsDetector"
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
|
||||||
|
name="CDT GCC Builtin Compiler Settings"
|
||||||
|
parameter="${COMMAND} -E -P -v -dD ${INPUTS}">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.managedbuilder.internal.scannerconfig.GCCBuiltinSpecsDetectorCygwin"
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorCygwin"
|
||||||
|
name="CDT GCC Builtin Compiler Settings Cygwin"
|
||||||
|
parameter="sh -c "${COMMAND} -E -P -v -dD ${INPUTS}"">
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
<extension
|
||||||
|
id="scanner.discovery.problem"
|
||||||
|
name="C/C++ Scanner Discovery Problem"
|
||||||
|
point="org.eclipse.core.resources.markers">
|
||||||
|
<super
|
||||||
|
type="org.eclipse.core.resources.problemmarker">
|
||||||
|
</super>
|
||||||
|
<persistent
|
||||||
|
value="true">
|
||||||
|
</persistent>
|
||||||
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="headlessSettings"
|
id="headlessSettings"
|
||||||
name="HeadlessBuilder Additional Settings"
|
name="HeadlessBuilder Additional Settings"
|
||||||
|
|
|
@ -263,7 +263,16 @@ Specifying this attribute is fully equivalent to specifying the "org.eclips
|
||||||
<attribute name="errorParsers" type="string">
|
<attribute name="errorParsers" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
The semi-colon separated list of the default error parsers to be used with this configuration. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. The list of error parsers to be used may be changed by the user on a per-configuration basis. When specified, this overrides the tool-chain errorParsers attribute.
|
The semi-colon separated list of the default error parsers to be used with this configuration. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. The list of error parsers to be used may be changed by the user on a per-configuration basis. When specified, this overrides the tool-chain errorParsers attribute.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="languageSettingsProviders" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Semicolon-separated list of providers ID implementing ILanguageSettingProvider interface.
|
||||||
|
This field could be amended with toolchain-level providers list by using ${Toolchain} keyword. Provider ID can be prefixed with "*", in this case shared instance of the provider defined on workspace level is used. Also provider ID can be prefixed with "-" which will cause id to be removed from the preceeding list including providers defined with ${Toolchain} keyword.
|
||||||
|
If this field is not specified, "*org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" (MBS Language Settings Provider) is used by default.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -405,7 +414,15 @@ Specifying this attribute is fully equivalent to specifying the "org.eclips
|
||||||
<attribute name="errorParsers" type="string">
|
<attribute name="errorParsers" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
The semi-colon separated list of the default error parsers to be used with this tool-chain. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. When specified, this overrides the tool errorParsers attributes of the tool children of the tool-chain and the builder child of the tool-chain.
|
The semi-colon separated list of the default error parsers to be used with this tool-chain. The list is ordered with the first error parser on the list invoked first, the second error parser second, and so on. The list may contain the error parsers defined by CDT and/or other installed error parser extensions. When specified, this overrides the tool errorParsers attributes of the tool children of the tool-chain and the builder child of the tool-chain.
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="languageSettingsProviders" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
Semicolon-separated list of providers ID implementing ILanguageSettingProvider interface. Provider ID can be prefixed with "*", in this case shared instance of the provider defined on workspace level is used.
|
||||||
|
This list could be adjusted on configuration level in the corresponding attribute.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -732,14 +749,14 @@ The pathConverter of a toolchain applies for all tools of the toolchain except i
|
||||||
<attribute name="customBuildStep" type="boolean">
|
<attribute name="customBuildStep" type="boolean">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Specifies whether this Tool represents a user-define custom build step. The default is false. When True, the default value of the commandLinePattern attribute changes to “$(command)”.
|
Specifies whether this Tool represents a user-define custom build step. The default is false. When True, the default value of the commandLinePattern attribute changes to “$(command)�.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="announcement" type="string">
|
<attribute name="announcement" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Specifies a string that is written to the build output prior to each invocation of the tool. The default value is “Invoking tool-name (tool-id)…”
|
Specifies a string that is written to the build output prior to each invocation of the tool. The default value is “Invoking tool-name (tool-id)…�
|
||||||
</documentation>
|
</documentation>
|
||||||
<appInfo>
|
<appInfo>
|
||||||
<meta.attribute translatable="true"/>
|
<meta.attribute translatable="true"/>
|
||||||
|
@ -1066,7 +1083,7 @@ Overrides language id specified with the languageId attribute.
|
||||||
<attribute name="primaryInputType" type="string">
|
<attribute name="primaryInputType" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
The id of the input type that is used in determining the build “rules” for the output type and for the default name of the output file. The default is the input type with primaryInput == true.
|
The id of the input type that is used in determining the build “rules� for the output type and for the default name of the output file. The default is the input type with primaryInput == true.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -1080,7 +1097,7 @@ Overrides language id specified with the languageId attribute.
|
||||||
<attribute name="outputPrefix" type="string">
|
<attribute name="outputPrefix" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be libtarget.a, so 'lib' would be the prefix. The default is to use the Tool “outputPrefix” attribute if primaryOutput is True, otherwise the default is an empty string. This attribute supports MBS configuration context macros.
|
Some tools produce files with a special prefix that must be specified. For example, a librarian on POSIX systems expects the output to be libtarget.a, so 'lib' would be the prefix. The default is to use the Tool “outputPrefix� attribute if primaryOutput is True, otherwise the default is an empty string. This attribute supports MBS configuration context macros.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -2035,11 +2052,11 @@ If the "buildPathResolver" attribute is specified, the "pathDelim
|
||||||
<documentation>
|
<documentation>
|
||||||
Represents the applicability type for this enablement.
|
Represents the applicability type for this enablement.
|
||||||
Can contain the following values:
|
Can contain the following values:
|
||||||
UI_VISIBILITY – the given enablement expression specifies whether the option is to be visible in UI,
|
UI_VISIBILITY – the given enablement expression specifies whether the option is to be visible in UI,
|
||||||
UI_ENABLEMENT – the given enablement expression specifies the enable state of the controls that represent the option in UI,
|
UI_ENABLEMENT – the given enablement expression specifies the enable state of the controls that represent the option in UI,
|
||||||
CMD_USAGE – the given enablement expression specifies whether the option is to be used in command line
|
CMD_USAGE – the given enablement expression specifies whether the option is to be used in command line
|
||||||
CONTAINER_ATTRIBUTE - the given enablement expressions specifies thecontainer attribute value
|
CONTAINER_ATTRIBUTE - the given enablement expressions specifies thecontainer attribute value
|
||||||
ALL – this value means the combination of all the above values.
|
ALL – this value means the combination of all the above values.
|
||||||
|
|
||||||
Several types could be specified simultaneously using the "|" as a delimiter, e.g.:
|
Several types could be specified simultaneously using the "|" as a delimiter, e.g.:
|
||||||
type="UI_VISIBILITY|CMD_USAGE"
|
type="UI_VISIBILITY|CMD_USAGE"
|
||||||
|
@ -2173,7 +2190,7 @@ Default value is true.
|
||||||
<attribute name="value" type="string">
|
<attribute name="value" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Specifies the expected value. If the current option value matches the value specified in this attribute, the checkOption element is treated as true, otherwise – as false.
|
Specifies the expected value. If the current option value matches the value specified in this attribute, the checkOption element is treated as true, otherwise – as false.
|
||||||
The expected value could be specified either as a string that may contain build macros or as a regular expression. During the comparison, the build macros are resolved and the option value is checked to match the resulting string or regular expression. The way the expected value is specified and treated depends on the value of the isRegex attribute
|
The expected value could be specified either as a string that may contain build macros or as a regular expression. During the comparison, the build macros are resolved and the option value is checked to match the resulting string or regular expression. The way the expected value is specified and treated depends on the value of the isRegex attribute
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
|
@ -2188,14 +2205,14 @@ The expected value could be specified either as a string that may contain build
|
||||||
<attribute name="otherOptionId" type="string">
|
<attribute name="otherOptionId" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
The id of the option which is to be compared with the option specified with the “optionId” attribute. The default is the id of the option that holds this expression. If the “value” attribute is specified, both the “otherOptionId” and the “otherHolderId” attributes are ignored. When searching for the option to be checked, MBS will examine all the options the holder contains along with all superclasses of each option to find the option with the specified id.
|
The id of the option which is to be compared with the option specified with the “optionId� attribute. The default is the id of the option that holds this expression. If the “value� attribute is specified, both the “otherOptionId� and the “otherHolderId� attributes are ignored. When searching for the option to be checked, MBS will examine all the options the holder contains along with all superclasses of each option to find the option with the specified id.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
<attribute name="otherHolderId" type="string">
|
<attribute name="otherHolderId" type="string">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
The option holder id that holds the option specified with the “otherOptionId” attribute. The default is the id of the holder that holds the container of this expression. If the “value” attribute is specified, both the “otherOptionId” and the “otherHolderId” attributes are ingnored. When searching for the needed holder, MBS will examine all the holders the current configuration contains along with all superclasses of each holder in order to find the holder with the specified id.
|
The option holder id that holds the option specified with the “otherOptionId� attribute. The default is the id of the holder that holds the container of this expression. If the “value� attribute is specified, both the “otherOptionId� and the “otherHolderId� attributes are ingnored. When searching for the needed holder, MBS will examine all the holders the current configuration contains along with all superclasses of each holder in order to find the holder with the specified id.
|
||||||
</documentation>
|
</documentation>
|
||||||
</annotation>
|
</annotation>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@ -2219,7 +2236,7 @@ The expected value could be specified either as a string that may contain build
|
||||||
<attribute name="value" type="string" use="required">
|
<attribute name="value" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
<documentation>
|
<documentation>
|
||||||
Specifies the expected value. If the current string specified in the “string” attribute matches the value specified in this attribute, the checkString element is treated as true, otherwise – as false.
|
Specifies the expected value. If the current string specified in the “string� attribute matches the value specified in this attribute, the checkString element is treated as true, otherwise – as false.
|
||||||
The expected value could be specified either as a string that might contain the build macros or as a regular expression.
|
The expected value could be specified either as a string that might contain the build macros or as a regular expression.
|
||||||
The way the value is specified and treated depends on the value of the isRegex attribute.
|
The way the value is specified and treated depends on the value of the isRegex attribute.
|
||||||
</documentation>
|
</documentation>
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfil
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -180,7 +181,8 @@ public class ScannerConfigBuilder extends ACBuilder {
|
||||||
public static SCProfileInstance build(CfgInfoContext context, IScannerConfigBuilderInfo2 buildInfo2, int flags, Properties env, IProgressMonitor monitor) throws CoreException{
|
public static SCProfileInstance build(CfgInfoContext context, IScannerConfigBuilderInfo2 buildInfo2, int flags, Properties env, IProgressMonitor monitor) throws CoreException{
|
||||||
IConfiguration cfg = context.getConfiguration();
|
IConfiguration cfg = context.getConfiguration();
|
||||||
IProject project = cfg.getOwner().getProject();
|
IProject project = cfg.getOwner().getProject();
|
||||||
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
|
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled() &&
|
||||||
|
ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(ManagedBuildManager.getDescriptionForConfiguration(cfg));
|
||||||
|
|
||||||
if (autodiscoveryEnabled2 || ((flags & FORCE_DISCOVERY) != 0)) {
|
if (autodiscoveryEnabled2 || ((flags & FORCE_DISCOVERY) != 0)) {
|
||||||
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
|
||||||
|
|
|
@ -159,7 +159,12 @@ public class CfgScannerConfigUtil {
|
||||||
Set<String> profiles = new TreeSet<String>();
|
Set<String> profiles = new TreeSet<String>();
|
||||||
|
|
||||||
if (toolchain!=null) {
|
if (toolchain!=null) {
|
||||||
String toolchainProfileId = toolchain.getScannerConfigDiscoveryProfileId();
|
String toolchainProfileId = null;
|
||||||
|
if (toolchain instanceof ToolChain) {
|
||||||
|
toolchainProfileId = ((ToolChain) toolchain).getLegacyScannerConfigDiscoveryProfileId();
|
||||||
|
} else {
|
||||||
|
toolchainProfileId = toolchain.getScannerConfigDiscoveryProfileId();
|
||||||
|
}
|
||||||
if (toolchainProfileId!=null && toolchainProfileId.length()>0) {
|
if (toolchainProfileId!=null && toolchainProfileId.length()>0) {
|
||||||
profiles.add(toolchainProfileId);
|
profiles.add(toolchainProfileId);
|
||||||
}
|
}
|
||||||
|
@ -227,7 +232,7 @@ public class CfgScannerConfigUtil {
|
||||||
|
|
||||||
Set<String> profiles = new TreeSet<String>();
|
Set<String> profiles = new TreeSet<String>();
|
||||||
|
|
||||||
String attribute = ((InputType) inputType).getDiscoveryProfileIdAttribute();
|
String attribute = ((InputType) inputType).getLegacyDiscoveryProfileIdAttribute();
|
||||||
if (attribute!=null) {
|
if (attribute!=null) {
|
||||||
// FIXME: temporary; we should add new method to IInputType instead of that
|
// FIXME: temporary; we should add new method to IInputType instead of that
|
||||||
for (String profileId : attribute.split("\\|")) { //$NON-NLS-1$
|
for (String profileId : attribute.split("\\|")) { //$NON-NLS-1$
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.util.Map.Entry;
|
||||||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgScannerConfigUtil;
|
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgScannerConfigUtil;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
@ -36,6 +37,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.core.runtime.QualifiedName;
|
import org.eclipse.core.runtime.QualifiedName;
|
||||||
|
@ -213,7 +215,12 @@ public class CfgScannerConfigInfoFactory2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
id = CfgScannerConfigUtil.getDefaultProfileId(context, true);
|
// Language Settings Providers are meant to replace legacy scanner discovery
|
||||||
|
// so do not try to find default profile
|
||||||
|
IProject project = cfg.getOwner().getProject();
|
||||||
|
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project)) {
|
||||||
|
id = CfgScannerConfigUtil.getDefaultProfileId(context, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoContext baseContext = context.toInfoContext();
|
InfoContext baseContext = context.toInfoContext();
|
||||||
|
|
|
@ -25,10 +25,16 @@ import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ErrorParserManager;
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
|
import org.eclipse.cdt.core.ICConsoleParser;
|
||||||
import org.eclipse.cdt.core.ICommandLauncher;
|
import org.eclipse.cdt.core.ICommandLauncher;
|
||||||
|
import org.eclipse.cdt.core.IConsoleParser;
|
||||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.core.resources.IConsole;
|
import org.eclipse.cdt.core.resources.IConsole;
|
||||||
import org.eclipse.cdt.core.resources.RefreshScopeManager;
|
import org.eclipse.cdt.core.resources.RefreshScopeManager;
|
||||||
|
@ -114,6 +120,18 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
URI workingDirectoryURI = ManagedBuildManager.getBuildLocationURI(configuration, builder);
|
||||||
|
final String pathFromURI = EFSExtensionManager.getDefault().getPathFromURI(workingDirectoryURI);
|
||||||
|
if(pathFromURI == null) {
|
||||||
|
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, ManagedMakeMessages.getString("ManagedMakeBuilder.message.error"), null)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
IPath workingDirectory = new Path(pathFromURI);
|
||||||
|
|
||||||
|
// Set the environment
|
||||||
|
Map<String, String> envMap = getEnvironment(builder);
|
||||||
|
String[] env = getEnvStrings(envMap);
|
||||||
|
|
||||||
consoleHeader[1] = configuration.getName();
|
consoleHeader[1] = configuration.getName();
|
||||||
consoleHeader[2] = project.getName();
|
consoleHeader[2] = project.getName();
|
||||||
buf.append(NEWLINE);
|
buf.append(NEWLINE);
|
||||||
|
@ -135,14 +153,6 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
if (markers != null)
|
if (markers != null)
|
||||||
workspace.deleteMarkers(markers);
|
workspace.deleteMarkers(markers);
|
||||||
|
|
||||||
URI workingDirectoryURI = ManagedBuildManager.getBuildLocationURI(configuration, builder);
|
|
||||||
final String pathFromURI = EFSExtensionManager.getDefault().getPathFromURI(workingDirectoryURI);
|
|
||||||
if(pathFromURI == null) {
|
|
||||||
throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, ManagedMakeMessages.getString("ManagedMakeBuilder.message.error"), null)); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
IPath workingDirectory = new Path(pathFromURI);
|
|
||||||
|
|
||||||
String[] targets = getTargets(kind, builder);
|
String[] targets = getTargets(kind, builder);
|
||||||
if (targets.length != 0 && targets[targets.length - 1].equals(builder.getCleanBuildTarget()))
|
if (targets.length != 0 && targets[targets.length - 1].equals(builder.getCleanBuildTarget()))
|
||||||
isClean = true;
|
isClean = true;
|
||||||
|
@ -153,9 +163,6 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
// Print the command for visual interaction.
|
// Print the command for visual interaction.
|
||||||
launcher.showCommand(true);
|
launcher.showCommand(true);
|
||||||
|
|
||||||
// Set the environment
|
|
||||||
Map<String, String> envMap = getEnvironment(builder);
|
|
||||||
String[] env = getEnvStrings(envMap);
|
|
||||||
String[] buildArguments = targets;
|
String[] buildArguments = targets;
|
||||||
|
|
||||||
String[] newArgs = CommandLineUtil.argumentsToArray(builder.getBuildArguments());
|
String[] newArgs = CommandLineUtil.argumentsToArray(builder.getBuildArguments());
|
||||||
|
@ -175,9 +182,15 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
OutputStream stderr = streamMon;
|
OutputStream stderr = streamMon;
|
||||||
|
|
||||||
// Sniff console output for scanner info
|
// Sniff console output for scanner info
|
||||||
ConsoleOutputSniffer sniffer = createBuildOutputSniffer(stdout, stderr, project, configuration, workingDirectory, markerGenerator, null);
|
OutputStream consoleOut = stdout;
|
||||||
OutputStream consoleOut = (sniffer == null ? stdout : sniffer.getOutputStream());
|
OutputStream consoleErr = stderr;
|
||||||
OutputStream consoleErr = (sniffer == null ? stderr : sniffer.getErrorStream());
|
if (kind!=IncrementalProjectBuilder.CLEAN_BUILD) {
|
||||||
|
ConsoleOutputSniffer sniffer = createBuildOutputSniffer(stdout, stderr, project, configuration, workingDirectory, markerGenerator, null, epm);
|
||||||
|
if (sniffer!=null) {
|
||||||
|
consoleOut = sniffer.getOutputStream();
|
||||||
|
consoleErr = sniffer.getErrorStream();
|
||||||
|
}
|
||||||
|
}
|
||||||
Process p = launcher.execute(buildCommand, buildArguments, env, workingDirectory, monitor);
|
Process p = launcher.execute(buildCommand, buildArguments, env, workingDirectory, monitor);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -337,10 +350,11 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
IConfiguration cfg,
|
IConfiguration cfg,
|
||||||
IPath workingDirectory,
|
IPath workingDirectory,
|
||||||
IMarkerGenerator markerGenerator,
|
IMarkerGenerator markerGenerator,
|
||||||
IScannerInfoCollector collector){
|
IScannerInfoCollector collector,
|
||||||
|
ErrorParserManager epm){
|
||||||
ICfgScannerConfigBuilderInfo2Set container = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
|
ICfgScannerConfigBuilderInfo2Set container = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
|
||||||
Map<CfgInfoContext, IScannerConfigBuilderInfo2> map = container.getInfoMap();
|
Map<CfgInfoContext, IScannerConfigBuilderInfo2> map = container.getInfoMap();
|
||||||
List<IScannerInfoConsoleParser> clParserList = new ArrayList<IScannerInfoConsoleParser>();
|
List<IConsoleParser> clParserList = new ArrayList<IConsoleParser>();
|
||||||
|
|
||||||
if(container.isPerRcTypeDiscovery()){
|
if(container.isPerRcTypeDiscovery()){
|
||||||
for (IResourceInfo rcInfo : cfg.getResourceInfos()) {
|
for (IResourceInfo rcInfo : cfg.getResourceInfos()) {
|
||||||
|
@ -370,9 +384,27 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
contributeToConsoleParserList(project, map, new CfgInfoContext(cfg), workingDirectory, markerGenerator, collector, clParserList);
|
contributeToConsoleParserList(project, map, new CfgInfoContext(cfg), workingDirectory, markerGenerator, collector, clParserList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
List<ILanguageSettingsProvider> lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
|
for (ILanguageSettingsProvider lsProvider : lsProviders) {
|
||||||
|
ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(lsProvider);
|
||||||
|
if (rawProvider instanceof ICConsoleParser) {
|
||||||
|
ICConsoleParser consoleParser = (ICConsoleParser) rawProvider;
|
||||||
|
try {
|
||||||
|
consoleParser.startup(cfgDescription);
|
||||||
|
clParserList.add(consoleParser);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID,
|
||||||
|
"Language Settings Provider failed to start up", e)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(clParserList.size() != 0){
|
if(clParserList.size() != 0){
|
||||||
return new ConsoleOutputSniffer(outputStream, errorStream,
|
IConsoleParser[] parsers = clParserList.toArray(new IConsoleParser[clParserList.size()]);
|
||||||
clParserList.toArray(new IScannerInfoConsoleParser[clParserList.size()]));
|
return new ConsoleOutputSniffer(outputStream, errorStream, parsers, epm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -385,36 +417,41 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
IPath workingDirectory,
|
IPath workingDirectory,
|
||||||
IMarkerGenerator markerGenerator,
|
IMarkerGenerator markerGenerator,
|
||||||
IScannerInfoCollector collector,
|
IScannerInfoCollector collector,
|
||||||
List<IScannerInfoConsoleParser> parserList){
|
List<IConsoleParser> parserList){
|
||||||
IScannerConfigBuilderInfo2 info = map.get(context);
|
IScannerConfigBuilderInfo2 info = map.get(context);
|
||||||
InfoContext ic = context.toInfoContext();
|
InfoContext ic = context.toInfoContext();
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
if (info != null &&
|
if (info != null) {
|
||||||
info.isAutoDiscoveryEnabled() &&
|
boolean autodiscoveryEnabled2 = info.isAutoDiscoveryEnabled();
|
||||||
info.isBuildOutputParserEnabled()) {
|
if (autodiscoveryEnabled2) {
|
||||||
|
IConfiguration cfg = context.getConfiguration();
|
||||||
|
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||||
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
|
}
|
||||||
|
if (autodiscoveryEnabled2 && info.isBuildOutputParserEnabled()) {
|
||||||
|
|
||||||
String id = info.getSelectedProfileId();
|
String id = info.getSelectedProfileId();
|
||||||
ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(id);
|
ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(id);
|
||||||
if(profile.getBuildOutputProviderElement() != null){
|
if(profile.getBuildOutputProviderElement() != null){
|
||||||
// get the make builder console parser
|
// get the make builder console parser
|
||||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||||
getSCProfileInstance(project, ic, id);
|
getSCProfileInstance(project, ic, id);
|
||||||
|
|
||||||
IScannerInfoConsoleParser clParser = profileInstance.createBuildOutputParser();
|
IScannerInfoConsoleParser clParser = profileInstance.createBuildOutputParser();
|
||||||
if (collector == null) {
|
if (collector == null) {
|
||||||
collector = profileInstance.getScannerInfoCollector();
|
collector = profileInstance.getScannerInfoCollector();
|
||||||
}
|
}
|
||||||
if(clParser != null){
|
if(clParser != null){
|
||||||
clParser.startup(project, workingDirectory, collector,
|
clParser.startup(project, workingDirectory, collector,
|
||||||
info.isProblemReportingEnabled() ? markerGenerator : null);
|
info.isProblemReportingEnabled() ? markerGenerator : null);
|
||||||
parserList.add(clParser);
|
parserList.add(clParser);
|
||||||
added = true;
|
added = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return added;
|
return added;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,8 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
|
||||||
// Schema element names
|
// Schema element names
|
||||||
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
|
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
|
||||||
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
|
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
|
||||||
|
/** @since 8.1 */
|
||||||
|
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders";
|
||||||
public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
|
public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
|
||||||
public static final String PARENT = "parent"; //$NON-NLS-1$
|
public static final String PARENT = "parent"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -170,6 +172,14 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
|
||||||
*/
|
*/
|
||||||
public String[] getErrorParserList();
|
public String[] getErrorParserList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns default language settings providers IDs specified for the configuration.
|
||||||
|
* @return default language settings providers IDs.
|
||||||
|
*
|
||||||
|
* @since 8.1
|
||||||
|
*/
|
||||||
|
public String[] getDefaultLanguageSettingsProvidersIds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Projects have C or CC natures. Tools can specify a filter so they are not
|
* Projects have C or CC natures. Tools can specify a filter so they are not
|
||||||
* misapplied to a project. This method allows the caller to retrieve a list
|
* misapplied to a project. This method allows the caller to retrieve a list
|
||||||
|
|
|
@ -53,6 +53,9 @@ public interface IToolChain extends IBuildObject, IHoldsOptions {
|
||||||
// The attribute name for the scanner info collector
|
// The attribute name for the scanner info collector
|
||||||
public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$
|
public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/** @since 8.1 */
|
||||||
|
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the configuration that is the parent of this tool-chain.
|
* Returns the configuration that is the parent of this tool-chain.
|
||||||
*
|
*
|
||||||
|
@ -261,6 +264,15 @@ public interface IToolChain extends IBuildObject, IHoldsOptions {
|
||||||
*/
|
*/
|
||||||
public void setErrorParserIds(String ids);
|
public void setErrorParserIds(String ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the default language settings providers IDs.
|
||||||
|
*
|
||||||
|
* @return the default language settings providers IDs separated by semicolon or {@code null} if none.
|
||||||
|
*
|
||||||
|
* @since 8.1
|
||||||
|
*/
|
||||||
|
public String getDefaultLanguageSettingsProvidersIds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the scanner config discovery profile id or <code>null</code> if none.
|
* Returns the scanner config discovery profile id or <code>null</code> if none.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,14 +13,23 @@ package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.ConsoleOutputStream;
|
import org.eclipse.cdt.core.ConsoleOutputStream;
|
||||||
import org.eclipse.cdt.core.ErrorParserManager;
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||||
import org.eclipse.cdt.core.resources.IConsole;
|
import org.eclipse.cdt.core.resources.IConsole;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuildCommandParser;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
import org.eclipse.cdt.managedbuilder.buildmodel.BuildDescriptionManager;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildDescription;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildDescription;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildStateManager;
|
import org.eclipse.cdt.managedbuilder.internal.buildmodel.BuildStateManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.buildmodel.DescriptionBuilder;
|
import org.eclipse.cdt.managedbuilder.internal.buildmodel.DescriptionBuilder;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.buildmodel.IBuildModelBuilder;
|
import org.eclipse.cdt.managedbuilder.internal.buildmodel.IBuildModelBuilder;
|
||||||
|
@ -35,6 +44,7 @@ import org.eclipse.core.resources.IResourceDelta;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
@ -61,6 +71,21 @@ public class InternalBuildRunner extends AbstractBuildRunner {
|
||||||
private static final String NOTHING_BUILT = "ManagedMakeBuilder.message.no.build"; //$NON-NLS-1$
|
private static final String NOTHING_BUILT = "ManagedMakeBuilder.message.no.build"; //$NON-NLS-1$
|
||||||
private static final String BUILD_ERROR = "ManagedMakeBuilder.message.error"; //$NON-NLS-1$
|
private static final String BUILD_ERROR = "ManagedMakeBuilder.message.error"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: same function is present in CommandBuilder and BuildProcessManager
|
||||||
|
private String[] mapToStringArray(Map<String, String> map){
|
||||||
|
if(map == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
List<String> list = new ArrayList<String>();
|
||||||
|
|
||||||
|
for (Entry<String, String> entry : map.entrySet()) {
|
||||||
|
list.add(entry.getKey() + '=' + entry.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.toArray(new String[list.size()]);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean invokeBuild(int kind, IProject project, IConfiguration configuration,
|
public boolean invokeBuild(int kind, IProject project, IConfiguration configuration,
|
||||||
IBuilder builder, IConsole console, IMarkerGenerator markerGenerator,
|
IBuilder builder, IConsole console, IMarkerGenerator markerGenerator,
|
||||||
|
@ -96,6 +121,16 @@ public class InternalBuildRunner extends AbstractBuildRunner {
|
||||||
|
|
||||||
// Get a build console for the project
|
// Get a build console for the project
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
|
|
||||||
|
IBuildDescription des = BuildDescriptionManager.createBuildDescription(configuration, cBS, delta, flags);
|
||||||
|
|
||||||
|
IPath workingDirectory = des.getDefaultBuildDirLocation();
|
||||||
|
String[] env = null;
|
||||||
|
if (des instanceof BuildDescription) {
|
||||||
|
Map<String, String> envMap = ((BuildDescription)des).getEnvironment();
|
||||||
|
env = mapToStringArray(envMap);
|
||||||
|
}
|
||||||
|
|
||||||
consoleOutStream = console.getOutputStream();
|
consoleOutStream = console.getOutputStream();
|
||||||
String[] consoleHeader = new String[3];
|
String[] consoleHeader = new String[3];
|
||||||
if(buildIncrementaly)
|
if(buildIncrementaly)
|
||||||
|
@ -119,11 +154,29 @@ public class InternalBuildRunner extends AbstractBuildRunner {
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (kind!=IncrementalProjectBuilder.CLEAN_BUILD) {
|
||||||
|
// TODO - AG - sanity check? elaborate
|
||||||
|
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(configuration);
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
|
for (ILanguageSettingsProvider provider : providers) {
|
||||||
|
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+" ****");
|
||||||
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
|
ManagedBuilderCorePlugin.error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
consoleOutStream.write(buf.toString().getBytes());
|
consoleOutStream.write(buf.toString().getBytes());
|
||||||
consoleOutStream.flush();
|
consoleOutStream.flush();
|
||||||
|
|
||||||
IBuildDescription des = BuildDescriptionManager.createBuildDescription(configuration, cBS, delta, flags);
|
|
||||||
|
|
||||||
DescriptionBuilder dBuilder = null;
|
DescriptionBuilder dBuilder = null;
|
||||||
if (!isParallel)
|
if (!isParallel)
|
||||||
dBuilder = new DescriptionBuilder(des, buildIncrementaly, resumeOnErr, cBS);
|
dBuilder = new DescriptionBuilder(des, buildIncrementaly, resumeOnErr, cBS);
|
||||||
|
@ -192,6 +245,7 @@ public class InternalBuildRunner extends AbstractBuildRunner {
|
||||||
consoleOutStream.flush();
|
consoleOutStream.flush();
|
||||||
epmOutputStream.close();
|
epmOutputStream.close();
|
||||||
epmOutputStream = null;
|
epmOutputStream = null;
|
||||||
|
|
||||||
// Generate any error markers that the build has discovered
|
// Generate any error markers that the build has discovered
|
||||||
monitor.subTask(ManagedMakeMessages.getResourceString(MARKERS));
|
monitor.subTask(ManagedMakeMessages.getResourceString(MARKERS));
|
||||||
|
|
||||||
|
@ -238,5 +292,4 @@ public class InternalBuildRunner extends AbstractBuildRunner {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,6 @@ import org.w3c.dom.ProcessingInstruction;
|
||||||
* @noinstantiate This class is not intended to be instantiated by clients.
|
* @noinstantiate This class is not intended to be instantiated by clients.
|
||||||
*/
|
*/
|
||||||
public class ManagedBuildManager extends AbstractCExtension {
|
public class ManagedBuildManager extends AbstractCExtension {
|
||||||
|
|
||||||
// private static final QualifiedName buildInfoProperty = new QualifiedName(ManagedBuilderCorePlugin.PLUGIN_ID, "managedBuildInfo"); //$NON-NLS-1$
|
// private static final QualifiedName buildInfoProperty = new QualifiedName(ManagedBuilderCorePlugin.PLUGIN_ID, "managedBuildInfo"); //$NON-NLS-1$
|
||||||
private static final String ROOT_NODE_NAME = "ManagedProjectBuildInfo"; //$NON-NLS-1$
|
private static final String ROOT_NODE_NAME = "ManagedProjectBuildInfo"; //$NON-NLS-1$
|
||||||
public static final String SETTINGS_FILE_NAME = ".cdtbuild"; //$NON-NLS-1$
|
public static final String SETTINGS_FILE_NAME = ".cdtbuild"; //$NON-NLS-1$
|
||||||
|
|
|
@ -145,6 +145,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
private final IConfiguration fCfg;
|
private final IConfiguration fCfg;
|
||||||
private final IBuilder fBuilder;
|
private final IBuilder fBuilder;
|
||||||
private IConsole fConsole;
|
private IConsole fConsole;
|
||||||
|
|
||||||
CfgBuildInfo(IBuilder builder, boolean isForegound){
|
CfgBuildInfo(IBuilder builder, boolean isForegound){
|
||||||
this.fBuilder = builder;
|
this.fBuilder = builder;
|
||||||
this.fCfg = builder.getParent().getParent();
|
this.fCfg = builder.getParent().getParent();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2011 IBM Corporation and others.
|
* Copyright (c) 2003, 2012 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -26,6 +26,7 @@ import java.util.Vector;
|
||||||
|
|
||||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
|
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ErrorParserManager;
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
import org.eclipse.cdt.core.settings.model.CSourceEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -83,8 +84,10 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceDelta;
|
import org.eclipse.core.resources.IResourceDelta;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
import org.osgi.framework.Version;
|
import org.osgi.framework.Version;
|
||||||
|
|
||||||
|
@ -92,6 +95,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
|
|
||||||
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
|
||||||
private static final String EMPTY_CFG_ID = "org.eclipse.cdt.build.core.emptycfg"; //$NON-NLS-1$
|
private static final String EMPTY_CFG_ID = "org.eclipse.cdt.build.core.emptycfg"; //$NON-NLS-1$
|
||||||
|
private static final String LANGUAGE_SETTINGS_PROVIDER_DELIMITER = ";"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Parent and children
|
// Parent and children
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
@ -102,6 +106,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
private String cleanCommand;
|
private String cleanCommand;
|
||||||
private String artifactExtension;
|
private String artifactExtension;
|
||||||
private String errorParserIds;
|
private String errorParserIds;
|
||||||
|
private String defaultLanguageSettingsProvidersAttribute;
|
||||||
|
private String[] defaultLanguageSettingsProvidersIds;
|
||||||
private String prebuildStep;
|
private String prebuildStep;
|
||||||
private String postbuildStep;
|
private String postbuildStep;
|
||||||
private String preannouncebuildStep;
|
private String preannouncebuildStep;
|
||||||
|
@ -781,6 +787,9 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
// Get the semicolon separated list of IDs of the error parsers
|
// Get the semicolon separated list of IDs of the error parsers
|
||||||
errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
|
errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
|
||||||
|
|
||||||
|
// Get the initial/default language setttings providers IDs
|
||||||
|
defaultLanguageSettingsProvidersAttribute = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS));
|
||||||
|
|
||||||
// Get the artifact extension
|
// Get the artifact extension
|
||||||
artifactExtension = SafeStringInterner.safeIntern(element.getAttribute(EXTENSION));
|
artifactExtension = SafeStringInterner.safeIntern(element.getAttribute(EXTENSION));
|
||||||
|
|
||||||
|
@ -1453,6 +1462,55 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDefaultLanguageSettingsProvidersAttribute() {
|
||||||
|
if (defaultLanguageSettingsProvidersAttribute == null && parent instanceof Configuration) {
|
||||||
|
defaultLanguageSettingsProvidersAttribute = ((Configuration) parent).getDefaultLanguageSettingsProvidersAttribute();
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultLanguageSettingsProvidersAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||||
|
defaultLanguageSettingsProvidersIds = null;
|
||||||
|
if (defaultLanguageSettingsProvidersIds == null) {
|
||||||
|
getDefaultLanguageSettingsProvidersAttribute();
|
||||||
|
if (defaultLanguageSettingsProvidersAttribute != null) {
|
||||||
|
List<String> ids = new ArrayList<String>();
|
||||||
|
String[] defaultIds = defaultLanguageSettingsProvidersAttribute.split(LANGUAGE_SETTINGS_PROVIDER_DELIMITER);
|
||||||
|
for (String id : defaultIds) {
|
||||||
|
if (id != null && !id.isEmpty()) {
|
||||||
|
if (id.startsWith("-")) {
|
||||||
|
id = id.substring(1);
|
||||||
|
ids.remove(id);
|
||||||
|
} else if (!ids.contains(id)){
|
||||||
|
if (id.contains("${Toolchain}")) {
|
||||||
|
IToolChain toolchain = getToolChain();
|
||||||
|
if (toolchain != null) {
|
||||||
|
String toolchainProvidersIds = toolchain.getDefaultLanguageSettingsProvidersIds();
|
||||||
|
if (toolchainProvidersIds != null) {
|
||||||
|
ids.addAll(Arrays.asList(toolchainProvidersIds.split(LANGUAGE_SETTINGS_PROVIDER_DELIMITER)));
|
||||||
|
} else {
|
||||||
|
String message = "Invalid use of ${Toolchain} tag, toolchain does not specify language settings providers. cfg=" + getId();
|
||||||
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, IStatus.ERROR, message, new Exception()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ids.add(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
defaultLanguageSettingsProvidersIds = ids.toArray(new String[ids.size()]);
|
||||||
|
} else if (parent != null) {
|
||||||
|
defaultLanguageSettingsProvidersIds = parent.getDefaultLanguageSettingsProvidersIds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return defaultLanguageSettingsProvidersIds;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setArtifactExtension(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setArtifactExtension(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.ILanguage;
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
import org.eclipse.cdt.core.model.LanguageManager;
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
|
@ -24,6 +25,7 @@ import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.cdt.internal.core.SafeStringInterner;
|
import org.eclipse.cdt.internal.core.SafeStringInterner;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
|
import org.eclipse.cdt.managedbuilder.core.IAdditionalInput;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
import org.eclipse.cdt.managedbuilder.core.IFileInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IInputOrder;
|
import org.eclipse.cdt.managedbuilder.core.IInputOrder;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
|
@ -37,6 +39,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.enablement.OptionEnablementExpression;
|
import org.eclipse.cdt.managedbuilder.internal.enablement.OptionEnablementExpression;
|
||||||
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
|
import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -1838,9 +1841,56 @@ public class InputType extends BuildObject implements IInputType {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary method to support compatibility during SD transition.
|
||||||
|
*/
|
||||||
|
private boolean isLanguageSettingsProvidersFunctionalityEnabled() {
|
||||||
|
boolean isLanguageSettingsProvidersEnabled = false;
|
||||||
|
ITool tool = getParent();
|
||||||
|
if (tool!=null) {
|
||||||
|
IBuildObject bo = tool.getParent();
|
||||||
|
if (bo instanceof IToolChain) {
|
||||||
|
IConfiguration cfg = ((IToolChain) bo).getParent();
|
||||||
|
if (cfg!=null) {
|
||||||
|
IResource rc = cfg.getOwner();
|
||||||
|
if (rc!=null) {
|
||||||
|
IProject project = rc.getProject();
|
||||||
|
isLanguageSettingsProvidersEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isLanguageSettingsProvidersEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary method to support compatibility during SD transition.
|
||||||
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
public String getLegacyDiscoveryProfileIdAttribute(){
|
||||||
|
String profileId = buildInfoDicsoveryProfileId;
|
||||||
|
if (profileId == null) {
|
||||||
|
profileId = ScannerDiscoveryLegacySupport.getDeprecatedLegacyProfiles(id);
|
||||||
|
if (profileId == null && superClass instanceof InputType) {
|
||||||
|
profileId = ((InputType)superClass).getLegacyDiscoveryProfileIdAttribute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return profileId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDiscoveryProfileIdAttribute(){
|
public String getDiscoveryProfileIdAttribute(){
|
||||||
if(buildInfoDicsoveryProfileId == null && superClass != null)
|
if (!isLanguageSettingsProvidersFunctionalityEnabled())
|
||||||
return ((InputType)superClass).getDiscoveryProfileIdAttribute();
|
return getLegacyDiscoveryProfileIdAttribute();
|
||||||
|
|
||||||
|
return getDiscoveryProfileIdAttributeInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method extracted temporarily to support compatibility during SD transition.
|
||||||
|
*/
|
||||||
|
private String getDiscoveryProfileIdAttributeInternal(){
|
||||||
|
if(buildInfoDicsoveryProfileId == null && superClass instanceof InputType)
|
||||||
|
return ((InputType)superClass).getDiscoveryProfileIdAttributeInternal();
|
||||||
return buildInfoDicsoveryProfileId;
|
return buildInfoDicsoveryProfileId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -440,6 +440,12 @@ public class MultiConfiguration extends MultiItemsHolder implements
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||||
|
ManagedBuilderCorePlugin.error("Default Language Settings Providers are not supported in multiconfiguration mode");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getFilteredTools()
|
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getFilteredTools()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.SortedMap;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
|
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager.PathInfoCache;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
|
import org.eclipse.cdt.core.settings.model.extension.CTargetPlatformData;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
|
@ -50,6 +51,8 @@ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSu
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.enablement.OptionEnablementExpression;
|
import org.eclipse.cdt.managedbuilder.internal.enablement.OptionEnablementExpression;
|
||||||
import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
|
import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IConfigurationElement;
|
import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.IExtension;
|
import org.eclipse.core.runtime.IExtension;
|
||||||
|
@ -85,6 +88,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
||||||
private String targetToolIds;
|
private String targetToolIds;
|
||||||
private String secondaryOutputIds;
|
private String secondaryOutputIds;
|
||||||
private Boolean isAbstract;
|
private Boolean isAbstract;
|
||||||
|
private String defaultLanguageSettingsProvidersIds;
|
||||||
private String scannerConfigDiscoveryProfileId;
|
private String scannerConfigDiscoveryProfileId;
|
||||||
private String versionsSupported;
|
private String versionsSupported;
|
||||||
private String convertToId;
|
private String convertToId;
|
||||||
|
@ -554,6 +558,9 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
||||||
// Get the target tool id
|
// Get the target tool id
|
||||||
targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
|
targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
|
||||||
|
|
||||||
|
// Get the initial/default language setttings providers IDs
|
||||||
|
defaultLanguageSettingsProvidersIds = element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS);
|
||||||
|
|
||||||
// Get the scanner config discovery profile id
|
// Get the scanner config discovery profile id
|
||||||
scannerConfigDiscoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_CONFIG_PROFILE_ID));
|
scannerConfigDiscoveryProfileId = SafeStringInterner.safeIntern(element.getAttribute(SCANNER_CONFIG_PROFILE_ID));
|
||||||
String tmp = element.getAttribute(RESOURCE_TYPE_BASED_DISCOVERY);
|
String tmp = element.getAttribute(RESOURCE_TYPE_BASED_DISCOVERY);
|
||||||
|
@ -1529,18 +1536,72 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
|
||||||
setDirty(true);
|
setDirty(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getScannerConfigDiscoveryProfileId()
|
public String getDefaultLanguageSettingsProvidersIds() {
|
||||||
*/
|
if (defaultLanguageSettingsProvidersIds == null) {
|
||||||
@Override
|
if (superClass instanceof IToolChain) {
|
||||||
|
defaultLanguageSettingsProvidersIds = ((IToolChain) superClass).getDefaultLanguageSettingsProvidersIds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return defaultLanguageSettingsProvidersIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary method to support compatibility during SD transition.
|
||||||
|
*/
|
||||||
|
private boolean isLanguageSettingsProvidersFunctionalityEnabled() {
|
||||||
|
boolean isLanguageSettingsProvidersEnabled = false;
|
||||||
|
IConfiguration cfg = getParent();
|
||||||
|
if (cfg!=null) {
|
||||||
|
IResource rc = cfg.getOwner();
|
||||||
|
if (rc!=null) {
|
||||||
|
IProject project = rc.getProject();
|
||||||
|
isLanguageSettingsProvidersEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return isLanguageSettingsProvidersEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporary method to support compatibility during SD transition.
|
||||||
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
public String getLegacyScannerConfigDiscoveryProfileId() {
|
||||||
|
String profileId = scannerConfigDiscoveryProfileId;
|
||||||
|
if (profileId==null) {
|
||||||
|
profileId = ScannerDiscoveryLegacySupport.getDeprecatedLegacyProfiles(id);
|
||||||
|
if (profileId == null) {
|
||||||
|
IToolChain superClass = getSuperClass();
|
||||||
|
if (superClass instanceof ToolChain) {
|
||||||
|
profileId = ((ToolChain) superClass).getLegacyScannerConfigDiscoveryProfileId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getScannerConfigDiscoveryProfileId()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public String getScannerConfigDiscoveryProfileId() {
|
public String getScannerConfigDiscoveryProfileId() {
|
||||||
if (scannerConfigDiscoveryProfileId == null) {
|
if (!isLanguageSettingsProvidersFunctionalityEnabled())
|
||||||
if (getSuperClass() != null) {
|
return getLegacyScannerConfigDiscoveryProfileId();
|
||||||
return getSuperClass().getScannerConfigDiscoveryProfileId();
|
|
||||||
}
|
return getScannerConfigDiscoveryProfileIdInternal();
|
||||||
}
|
}
|
||||||
return scannerConfigDiscoveryProfileId;
|
|
||||||
}
|
/**
|
||||||
|
* Method extracted temporarily to support compatibility during SD transition.
|
||||||
|
*/
|
||||||
|
private String getScannerConfigDiscoveryProfileIdInternal() {
|
||||||
|
if (scannerConfigDiscoveryProfileId == null && superClass instanceof ToolChain) {
|
||||||
|
return ((ToolChain) getSuperClass()).getScannerConfigDiscoveryProfileIdInternal();
|
||||||
|
}
|
||||||
|
return scannerConfigDiscoveryProfileId;
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#setScannerConfigDiscoveryProfileId(java.lang.String)
|
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#setScannerConfigDiscoveryProfileId(java.lang.String)
|
||||||
|
|
|
@ -19,6 +19,10 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigInfoFactory2;
|
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigInfoFactory2;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
import org.eclipse.cdt.core.model.ILanguageDescriptor;
|
||||||
import org.eclipse.cdt.core.model.LanguageManager;
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -532,9 +536,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription,
|
public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription, IProgressMonitor monitor) throws CoreException {
|
||||||
IProgressMonitor monitor)
|
|
||||||
throws CoreException {
|
|
||||||
if(cfgDescription.isPreferenceConfiguration())
|
if(cfgDescription.isPreferenceConfiguration())
|
||||||
return loadPreferences(cfgDescription);
|
return loadPreferences(cfgDescription);
|
||||||
|
|
||||||
|
@ -549,11 +551,56 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
|
||||||
// Update the ManagedBuildInfo in the ManagedBuildManager map. Doing this creates a barrier for subsequent
|
// Update the ManagedBuildInfo in the ManagedBuildManager map. Doing this creates a barrier for subsequent
|
||||||
// ManagedBuildManager#getBuildInfo(...) see Bug 305146 for more
|
// ManagedBuildManager#getBuildInfo(...) see Bug 305146 for more
|
||||||
ManagedBuildManager.setLoaddedBuildInfo(cfgDescription.getProjectDescription().getProject(), info);
|
ManagedBuildManager.setLoaddedBuildInfo(cfgDescription.getProjectDescription().getProject(), info);
|
||||||
|
setDefaultLanguageSettingsProvidersIds(cfg, cfgDescription);
|
||||||
return cfg.getConfigurationData();
|
return cfg.getConfigurationData();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<ILanguageSettingsProvider> getDefaultLanguageSettingsProviders(IConfiguration cfg) {
|
||||||
|
List<ILanguageSettingsProvider> providers = new ArrayList<ILanguageSettingsProvider>();
|
||||||
|
String[] ids = cfg.getDefaultLanguageSettingsProvidersIds();
|
||||||
|
if (ids != null) {
|
||||||
|
for (String id : ids) {
|
||||||
|
ILanguageSettingsProvider provider = null;
|
||||||
|
if (!LanguageSettingsManager.isPreferShared(id)) {
|
||||||
|
provider = LanguageSettingsManager.getExtensionProviderCopy(id, false);
|
||||||
|
}
|
||||||
|
if (provider == null) {
|
||||||
|
provider = LanguageSettingsManager.getWorkspaceProvider(id);
|
||||||
|
}
|
||||||
|
providers.add(provider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// AG TODO - should it be when empty or when ids==null?
|
||||||
|
if (providers.isEmpty()) {
|
||||||
|
providers = ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy();
|
||||||
|
}
|
||||||
|
|
||||||
|
return providers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setDefaultLanguageSettingsProvidersIds(IConfiguration cfg, ICConfigurationDescription cfgDescription) {
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg);
|
||||||
|
String[] ids = new String[providers.size()];
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
ILanguageSettingsProvider provider = providers.get(i);
|
||||||
|
ids[i] = provider.getId();
|
||||||
|
}
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setDefaultLanguageSettingsProvidersIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDefaultLanguageSettingsProviders(IConfiguration cfg, ICConfigurationDescription cfgDescription) {
|
||||||
|
setDefaultLanguageSettingsProvidersIds(cfg, cfgDescription);
|
||||||
|
List<ILanguageSettingsProvider> providers = getDefaultLanguageSettingsProviders(cfg);
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDescription).setLanguageSettingProviders(providers);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isPersistedCfg(ICConfigurationDescription cfgDescription){
|
private boolean isPersistedCfg(ICConfigurationDescription cfgDescription){
|
||||||
return cfgDescription.getSessionProperty(CFG_PERSISTED_PROPERTY) != null;
|
return cfgDescription.getSessionProperty(CFG_PERSISTED_PROPERTY) != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.managedbuilder.internal.scannerconfig;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsEditableProvider;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.managedbuilder.scannerconfig.ToolchainBuiltinSpecsDetector;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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),
|
||||||
|
new IncludePathOptionParser("#include <(\\S.*)>", "$1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
new IncludePathOptionParser("#framework <(\\S.*)>", "$1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.FRAMEWORKS_MAC),
|
||||||
|
new MacroOptionParser("#define\\s+(\\S*\\(.*?\\))\\s*(.*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
new MacroOptionParser("#define\\s+(\\S*)\\s*(\\S*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getToolchainId() {
|
||||||
|
return GCC_TOOLCHAIN_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
|
return optionParsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> makeList(final String line) {
|
||||||
|
return new ArrayList<String>() {{ add(line); }};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> parseForOptions(String line) {
|
||||||
|
line = line.trim();
|
||||||
|
|
||||||
|
// contribution of -dD option
|
||||||
|
if (line.startsWith("#define")) {
|
||||||
|
return makeList(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// contribution of includes
|
||||||
|
if (line.equals("#include \"...\" search starts here:")) {
|
||||||
|
state = State.EXPECTING_LOCAL_INCLUDE;
|
||||||
|
} else if (line.equals("#include <...> search starts here:")) {
|
||||||
|
state = State.EXPECTING_SYSTEM_INCLUDE;
|
||||||
|
} else if (line.startsWith("End of search list.")) {
|
||||||
|
state = State.NONE;
|
||||||
|
} else if (line.equals("Framework search starts here:")) {
|
||||||
|
state = State.EXPECTING_FRAMEWORKS;
|
||||||
|
} else if (line.startsWith("End of framework search list.")) {
|
||||||
|
state = State.NONE;
|
||||||
|
} else if (state==State.EXPECTING_LOCAL_INCLUDE) {
|
||||||
|
// making that up for the parser to figure out
|
||||||
|
line = "#include \""+line+"\"";
|
||||||
|
return makeList(line);
|
||||||
|
} else {
|
||||||
|
String frameworkIndicator = "(framework directory)";
|
||||||
|
if (state==State.EXPECTING_SYSTEM_INCLUDE) {
|
||||||
|
// making that up for the parser to figure out
|
||||||
|
if (line.contains(frameworkIndicator)) {
|
||||||
|
line = "#framework <"+line.replace(frameworkIndicator, "").trim()+">";
|
||||||
|
} else {
|
||||||
|
line = "#include <"+line+">";
|
||||||
|
}
|
||||||
|
return makeList(line);
|
||||||
|
} else if (state==State.EXPECTING_FRAMEWORKS) {
|
||||||
|
// making that up for the parser to figure out
|
||||||
|
line = "#framework <"+line.replace(frameworkIndicator, "").trim()+">";
|
||||||
|
return makeList(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startup(ICConfigurationDescription cfgDescription) throws CoreException {
|
||||||
|
super.startup(cfgDescription);
|
||||||
|
|
||||||
|
state = State.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() {
|
||||||
|
state = State.NONE;
|
||||||
|
|
||||||
|
super.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetector cloneShallow() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetector) super.cloneShallow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetector clone() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetector) super.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.managedbuilder.internal.scannerconfig;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to detect built-in compiler settings.
|
||||||
|
* The paths are converted to cygwin "filesystem" representation. Then
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GCCBuiltinSpecsDetectorCygwin extends GCCBuiltinSpecsDetector {
|
||||||
|
private static final URI CYGWIN_ROOT;
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
CYGWIN_ROOT = new URI("cygwin:/"); //$NON-NLS-1$
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
// hey we know this works
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
private static final AbstractOptionParser[] optionParsers = {
|
||||||
|
new IncludePathOptionParser("#include \"(\\S.*)\"", "$1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY | ICSettingEntry.LOCAL),
|
||||||
|
new IncludePathOptionParser("#include <(\\S.*)>", "$1", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
new MacroOptionParser("#define (\\S*\\(.*?\\)) *(.*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
new MacroOptionParser("#define (\\S*) *(.*)", "$1", "$2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY),
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractOptionParser[] getOptionParsers() {
|
||||||
|
return optionParsers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected URI getMappedRootURI(IResource sourceFile, String parsedResourceName) {
|
||||||
|
if (mappedRootURI==null) {
|
||||||
|
mappedRootURI = super.getMappedRootURI(sourceFile, parsedResourceName);
|
||||||
|
if (mappedRootURI==null) {
|
||||||
|
mappedRootURI = CYGWIN_ROOT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mappedRootURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected URI getBuildDirURI(URI mappedRootURI) {
|
||||||
|
if (buildDirURI==null) {
|
||||||
|
buildDirURI = super.getBuildDirURI(mappedRootURI);
|
||||||
|
if (buildDirURI==null) {
|
||||||
|
buildDirURI = CYGWIN_ROOT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buildDirURI;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetectorCygwin cloneShallow() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetectorCygwin) super.cloneShallow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetectorCygwin clone() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetectorCygwin) super.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,151 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.managedbuilder.internal.scannerconfig;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsBroadcastingProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICFileDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICFolderDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of language settings provider for CDT Managed Build System.
|
||||||
|
*/
|
||||||
|
public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsBroadcastingProvider {
|
||||||
|
@Override
|
||||||
|
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
|
||||||
|
|
||||||
|
IPath projectPath = rc.getProjectRelativePath();
|
||||||
|
ICLanguageSetting[] languageSettings = null;
|
||||||
|
|
||||||
|
if (rc instanceof IFile) {
|
||||||
|
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(projectPath, true);
|
||||||
|
if (ls != null) {
|
||||||
|
languageSettings = new ICLanguageSetting[] {ls};
|
||||||
|
} else {
|
||||||
|
return getSettingEntries(cfgDescription, rc.getParent(), languageId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(projectPath, false);
|
||||||
|
languageSettings = getLanguageSettings(rcDescription);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
|
||||||
|
if (languageSettings != null) {
|
||||||
|
for (ICLanguageSetting langSetting : languageSettings) {
|
||||||
|
if (langSetting!=null) {
|
||||||
|
String id = langSetting.getLanguageId();
|
||||||
|
if (id!=null && id.equals(languageId)) {
|
||||||
|
int kindsBits = langSetting.getSupportedEntryKinds();
|
||||||
|
for (int kind=1;kind<=kindsBits;kind<<=1) {
|
||||||
|
if ((kindsBits & kind) != 0) {
|
||||||
|
list.addAll(langSetting.getSettingEntriesList(kind));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// System.err.println("languageSetting id=null: name=" + languageSetting.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.err.println("languageSetting=null: rc=" + rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return LanguageSettingsStorage.getPooledList(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICLanguageSetting[] getLanguageSettings(ICResourceDescription rcDescription) {
|
||||||
|
ICLanguageSetting[] array = null;
|
||||||
|
switch (rcDescription.getType()) {
|
||||||
|
case ICSettingBase.SETTING_PROJECT:
|
||||||
|
case ICSettingBase.SETTING_CONFIGURATION:
|
||||||
|
case ICSettingBase.SETTING_FOLDER:
|
||||||
|
ICFolderDescription foDes = (ICFolderDescription)rcDescription;
|
||||||
|
array = foDes.getLanguageSettings();
|
||||||
|
break;
|
||||||
|
case ICSettingBase.SETTING_FILE:
|
||||||
|
ICFileDescription fiDes = (ICFileDescription)rcDescription;
|
||||||
|
ICLanguageSetting ls = fiDes.getLanguageSetting();
|
||||||
|
if (ls!=null) {
|
||||||
|
array = new ICLanguageSetting[] { ls };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (array==null) {
|
||||||
|
array = new ICLanguageSetting[0];
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId,
|
||||||
|
List<ICLanguageSettingEntry> entries) {
|
||||||
|
|
||||||
|
// lang.setSettingEntries(kind, entries);
|
||||||
|
IPath projectPath = rc.getProjectRelativePath();
|
||||||
|
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(projectPath, false);
|
||||||
|
|
||||||
|
for (ICLanguageSetting languageSetting : getLanguageSettings(rcDescription)) {
|
||||||
|
if (languageSetting!=null) {
|
||||||
|
String id = languageSetting.getLanguageId();
|
||||||
|
if (id!=null && id.equals(languageId)) {
|
||||||
|
int kindsBits = languageSetting.getSupportedEntryKinds();
|
||||||
|
for (int kind=1;kind<=kindsBits;kind<<=1) {
|
||||||
|
if ((kindsBits & kind) != 0) {
|
||||||
|
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>(entries.size());
|
||||||
|
for (ICLanguageSettingEntry entry : entries) {
|
||||||
|
if (entry.getKind()==kind) {
|
||||||
|
list.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
languageSetting.setSettingEntries(kind, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// System.err.println("languageSetting id=null: name=" + languageSetting.getName());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.err.println("languageSetting=null: rcDescription=" + rcDescription.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LanguageSettingsStorage copyStorage() {
|
||||||
|
class PretendStorage extends LanguageSettingsStorage {
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public LanguageSettingsStorage clone() throws CloneNotSupportedException {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
// Note that this always triggers change event even if nothing changed in MBS
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new PretendStorage();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.managedbuilder.scannerconfig;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.AbstractBuiltinSpecsDetector;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
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 {
|
||||||
|
private Map<String, ITool> toolMap = new HashMap<String, ITool>();
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*/
|
||||||
|
protected abstract String getToolchainId();
|
||||||
|
|
||||||
|
private ITool getTool(String languageId) {
|
||||||
|
ITool langTool = toolMap.get(languageId);
|
||||||
|
if (langTool != null) {
|
||||||
|
return langTool;
|
||||||
|
}
|
||||||
|
|
||||||
|
String toolchainId = getToolchainId();
|
||||||
|
IToolChain toolchain = ManagedBuildManager.getExtensionToolChain(toolchainId);
|
||||||
|
if (toolchain != null) {
|
||||||
|
ITool[] tools = toolchain.getTools();
|
||||||
|
for (ITool tool : tools) {
|
||||||
|
IInputType[] inputTypes = tool.getInputTypes();
|
||||||
|
for (IInputType inType : inputTypes) {
|
||||||
|
String lang = inType.getLanguageId(tool);
|
||||||
|
if (languageId.equals(lang)) {
|
||||||
|
toolMap.put(languageId, tool);
|
||||||
|
return tool;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ManagedBuilderCorePlugin.error("Unable to find tool in toolchain="+toolchainId+" for language="+languageId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getCompilerCommand(String languageId) {
|
||||||
|
ITool tool = getTool(languageId);
|
||||||
|
String compiler = tool.getToolCommand();
|
||||||
|
if (compiler.length() == 0) {
|
||||||
|
String msg = "Unable to find compiler command in toolchain="+getToolchainId();
|
||||||
|
ManagedBuilderCorePlugin.error(msg);
|
||||||
|
}
|
||||||
|
return compiler;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getSpecFileExtension(String languageId) {
|
||||||
|
String ext = null;
|
||||||
|
ITool tool = getTool(languageId);
|
||||||
|
String[] srcFileExtensions = tool.getAllInputExtensions();
|
||||||
|
if (srcFileExtensions != null && srcFileExtensions.length > 0) {
|
||||||
|
ext = srcFileExtensions[0];
|
||||||
|
}
|
||||||
|
if (ext == null || ext.length() == 0) {
|
||||||
|
ManagedBuilderCorePlugin.error("Unable to find file extension for language "+languageId);
|
||||||
|
}
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1269,7 +1269,6 @@
|
||||||
dependencyExtensions="h"
|
dependencyExtensions="h"
|
||||||
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2"
|
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2"
|
||||||
id="cdt.managedbuild.tool.gnu.c.compiler.input"
|
id="cdt.managedbuild.tool.gnu.c.compiler.input"
|
||||||
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"
|
|
||||||
languageId="org.eclipse.cdt.core.gcc">
|
languageId="org.eclipse.cdt.core.gcc">
|
||||||
</inputType>
|
</inputType>
|
||||||
<outputType
|
<outputType
|
||||||
|
@ -1591,7 +1590,6 @@
|
||||||
dependencyExtensions="h,H,hpp"
|
dependencyExtensions="h,H,hpp"
|
||||||
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2"
|
dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2"
|
||||||
id="cdt.managedbuild.tool.gnu.cpp.compiler.input"
|
id="cdt.managedbuild.tool.gnu.cpp.compiler.input"
|
||||||
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"
|
|
||||||
languageId="org.eclipse.cdt.core.g++">
|
languageId="org.eclipse.cdt.core.g++">
|
||||||
</inputType>
|
</inputType>
|
||||||
<outputType
|
<outputType
|
||||||
|
@ -1658,7 +1656,7 @@
|
||||||
<inputType
|
<inputType
|
||||||
id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"
|
id="cdt.managedbuild.tool.gnu.c.compiler.input.cygwin"
|
||||||
superClass="cdt.managedbuild.tool.gnu.c.compiler.input"
|
superClass="cdt.managedbuild.tool.gnu.c.compiler.input"
|
||||||
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"/>
|
/>
|
||||||
</tool>
|
</tool>
|
||||||
<tool
|
<tool
|
||||||
id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin"
|
id="cdt.managedbuild.tool.gnu.cpp.compiler.cygwin"
|
||||||
|
@ -1672,7 +1670,7 @@
|
||||||
<inputType
|
<inputType
|
||||||
id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"
|
id="cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin"
|
||||||
superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"
|
superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"
|
||||||
scannerConfigDiscoveryProfileId="org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"/>
|
/>
|
||||||
</tool>
|
</tool>
|
||||||
|
|
||||||
<builder
|
<builder
|
||||||
|
@ -1705,10 +1703,11 @@
|
||||||
|
|
||||||
<toolChain
|
<toolChain
|
||||||
archList="all"
|
archList="all"
|
||||||
osList="linux,hpux,aix,qnx"
|
id="cdt.managedbuild.toolchain.gnu.base"
|
||||||
|
languageSettingsProviders="org.eclipse.cdt.make.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
|
||||||
name="%ToolChainName.Linux"
|
name="%ToolChainName.Linux"
|
||||||
targetTool="cdt.managedbuild.tool.gnu.c.linker;cdt.managedbuild.tool.gnu.cpp.linker;cdt.managedbuild.tool.gnu.archiver"
|
osList="linux,hpux,aix,qnx"
|
||||||
id="cdt.managedbuild.toolchain.gnu.base">
|
targetTool="cdt.managedbuild.tool.gnu.c.linker;cdt.managedbuild.tool.gnu.cpp.linker;cdt.managedbuild.tool.gnu.archiver">
|
||||||
<targetPlatform
|
<targetPlatform
|
||||||
id="cdt.managedbuild.target.gnu.platform.base"
|
id="cdt.managedbuild.target.gnu.platform.base"
|
||||||
name="%PlatformName.Dbg"
|
name="%PlatformName.Dbg"
|
||||||
|
@ -1773,6 +1772,7 @@
|
||||||
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
|
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier"
|
||||||
id="cdt.managedbuild.toolchain.gnu.cygwin.base"
|
id="cdt.managedbuild.toolchain.gnu.cygwin.base"
|
||||||
isToolChainSupported="org.eclipse.cdt.managedbuilder.gnu.cygwin.IsGnuCygwinToolChainSupported"
|
isToolChainSupported="org.eclipse.cdt.managedbuilder.gnu.cygwin.IsGnuCygwinToolChainSupported"
|
||||||
|
languageSettingsProviders="org.eclipse.cdt.make.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorCygwin"
|
||||||
name="%ToolChainName.Cygwin"
|
name="%ToolChainName.Cygwin"
|
||||||
osList="win32"
|
osList="win32"
|
||||||
targetTool="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base;cdt.managedbuild.tool.gnu.c.linker.cygwin.base;cdt.managedbuild.tool.gnu.archiver">
|
targetTool="cdt.managedbuild.tool.gnu.cpp.linker.cygwin.base;cdt.managedbuild.tool.gnu.c.linker.cygwin.base;cdt.managedbuild.tool.gnu.archiver">
|
||||||
|
@ -1842,6 +1842,7 @@
|
||||||
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.gnu.mingw.MingwEnvironmentVariableSupplier"
|
configurationEnvironmentSupplier="org.eclipse.cdt.managedbuilder.gnu.mingw.MingwEnvironmentVariableSupplier"
|
||||||
id="cdt.managedbuild.toolchain.gnu.mingw.base"
|
id="cdt.managedbuild.toolchain.gnu.mingw.base"
|
||||||
isToolChainSupported="org.eclipse.cdt.managedbuilder.gnu.mingw.MingwIsToolChainSupported"
|
isToolChainSupported="org.eclipse.cdt.managedbuilder.gnu.mingw.MingwIsToolChainSupported"
|
||||||
|
languageSettingsProviders="org.eclipse.cdt.make.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
|
||||||
name="%ToolChainName.MinGW"
|
name="%ToolChainName.MinGW"
|
||||||
osList="win32"
|
osList="win32"
|
||||||
targetTool="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base;cdt.managedbuild.tool.gnu.c.linker.mingw.base;cdt.managedbuild.tool.gnu.archiver">
|
targetTool="cdt.managedbuild.tool.gnu.cpp.linker.mingw.base;cdt.managedbuild.tool.gnu.c.linker.mingw.base;cdt.managedbuild.tool.gnu.archiver">
|
||||||
|
@ -2083,9 +2084,9 @@
|
||||||
</toolChain>
|
</toolChain>
|
||||||
|
|
||||||
<configuration
|
<configuration
|
||||||
id="cdt.managedbuild.config.gnu.base"
|
|
||||||
cleanCommand="rm -rf"
|
cleanCommand="rm -rf"
|
||||||
>
|
id="cdt.managedbuild.config.gnu.base"
|
||||||
|
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.make.core.GCCBuildCommandParser">
|
||||||
<enablement type="CONTAINER_ATTRIBUTE"
|
<enablement type="CONTAINER_ATTRIBUTE"
|
||||||
attribute="artifactExtension"
|
attribute="artifactExtension"
|
||||||
value="so"
|
value="so"
|
||||||
|
@ -2480,10 +2481,10 @@
|
||||||
</projectType>
|
</projectType>
|
||||||
|
|
||||||
<configuration
|
<configuration
|
||||||
id="cdt.managedbuild.config.gnu.cygwin.base"
|
|
||||||
cleanCommand="rm -rf"
|
|
||||||
artifactExtension="exe"
|
artifactExtension="exe"
|
||||||
>
|
cleanCommand="rm -rf"
|
||||||
|
id="cdt.managedbuild.config.gnu.cygwin.base"
|
||||||
|
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.make.core.GCCBuildCommandParser">
|
||||||
<enablement type="CONTAINER_ATTRIBUTE"
|
<enablement type="CONTAINER_ATTRIBUTE"
|
||||||
attribute="artifactExtension"
|
attribute="artifactExtension"
|
||||||
value="dll"
|
value="dll"
|
||||||
|
@ -2878,10 +2879,10 @@
|
||||||
</projectType>
|
</projectType>
|
||||||
|
|
||||||
<configuration
|
<configuration
|
||||||
id="cdt.managedbuild.config.gnu.mingw.base"
|
|
||||||
cleanCommand="rm -rf"
|
|
||||||
artifactExtension="exe"
|
artifactExtension="exe"
|
||||||
>
|
cleanCommand="rm -rf"
|
||||||
|
id="cdt.managedbuild.config.gnu.mingw.base"
|
||||||
|
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.make.core.GCCBuildCommandParser">
|
||||||
<enablement type="CONTAINER_ATTRIBUTE"
|
<enablement type="CONTAINER_ATTRIBUTE"
|
||||||
attribute="artifactExtension"
|
attribute="artifactExtension"
|
||||||
value="dll"
|
value="dll"
|
||||||
|
|
|
@ -207,6 +207,12 @@ public class TestConfiguration implements IConfiguration {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getDefaultLanguageSettingsProvidersIds() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITool[] getFilteredTools() {
|
public ITool[] getFilteredTools() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
|
@ -364,6 +364,10 @@ public class TestToolchain extends HoldsOptions implements IToolChain {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultLanguageSettingsProvidersIds() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
BIN
build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/mbs.gif
Normal file
After Width: | Height: | Size: 380 B |
BIN
build/org.eclipse.cdt.managedbuilder.ui/icons/obj16/search.gif
Normal file
After Width: | Height: | Size: 347 B |
|
@ -92,6 +92,7 @@ Source.location=Source Location
|
||||||
Output.location=Output Location
|
Output.location=Output Location
|
||||||
Binary.parsers=Binary Parsers
|
Binary.parsers=Binary Parsers
|
||||||
Error.parsers=Error Parsers
|
Error.parsers=Error Parsers
|
||||||
|
Language.settings.providers=Discovery
|
||||||
Data.hierarchy=Data Hierarchy
|
Data.hierarchy=Data Hierarchy
|
||||||
Preferred.toolchains=Preferred Toolchains
|
Preferred.toolchains=Preferred Toolchains
|
||||||
Wizard.defaults=Wizard Defaults
|
Wizard.defaults=Wizard Defaults
|
||||||
|
|
|
@ -648,5 +648,14 @@
|
||||||
</description>
|
</description>
|
||||||
</wizard>
|
</wizard>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.ui.LanguageSettingsProviderAssociation">
|
||||||
|
<id-association
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider"
|
||||||
|
icon="icons/obj16/mbs.gif"
|
||||||
|
ui-clear-entries="false"
|
||||||
|
ui-edit-entries="false">
|
||||||
|
</id-association>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -211,6 +211,7 @@ public class Messages extends NLS {
|
||||||
public static String PropertyPageDefsTab_8;
|
public static String PropertyPageDefsTab_8;
|
||||||
public static String PropertyPageDefsTab_9;
|
public static String PropertyPageDefsTab_9;
|
||||||
public static String PropertyPageDefsTab_showIncludeFileTab;
|
public static String PropertyPageDefsTab_showIncludeFileTab;
|
||||||
|
public static String PropertyPageDefsTab_showProvidersTab;
|
||||||
public static String RefreshPolicyExceptionDialog_addDialogLabel;
|
public static String RefreshPolicyExceptionDialog_addDialogLabel;
|
||||||
public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_message;
|
public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_message;
|
||||||
public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_title;
|
public static String RefreshPolicyExceptionDialog_AddExceptionInfoDialog_title;
|
||||||
|
|
|
@ -273,6 +273,7 @@ PropertyPageDefsTab_7=Show disc. page names if they are unique. Else show profil
|
||||||
PropertyPageDefsTab_8=Always show names + profile IDs
|
PropertyPageDefsTab_8=Always show names + profile IDs
|
||||||
PropertyPageDefsTab_9=Always show profile IDs only
|
PropertyPageDefsTab_9=Always show profile IDs only
|
||||||
PropertyPageDefsTab_showIncludeFileTab=Display "Include Files" tab
|
PropertyPageDefsTab_showIncludeFileTab=Display "Include Files" tab
|
||||||
|
PropertyPageDefsTab_showProvidersTab=Display new experimental Scanner Discovery Providers tabs
|
||||||
ProjectConvert_convertersList=Converters List
|
ProjectConvert_convertersList=Converters List
|
||||||
|
|
||||||
AbstractPrefPage_0=\ Preference settings will be applied to new projects \n only when there were no toolchains selected.
|
AbstractPrefPage_0=\ Preference settings will be applied to new projects \n only when there were no toolchains selected.
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
package org.eclipse.cdt.managedbuilder.ui.preferences;
|
package org.eclipse.cdt.managedbuilder.ui.preferences;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
import org.eclipse.cdt.ui.newui.AbstractCPropertyTab;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.layout.FillLayout;
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
@ -38,6 +38,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
private Button show_mng;
|
private Button show_mng;
|
||||||
private Button show_tool;
|
private Button show_tool;
|
||||||
private Button show_exp;
|
private Button show_exp;
|
||||||
|
private Button show_providers_tab; // temporary checkbox for scanner discovery Providers tab
|
||||||
private Button show_tipbox;
|
private Button show_tipbox;
|
||||||
|
|
||||||
private Button b_0;
|
private Button b_0;
|
||||||
|
@ -74,6 +75,11 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
show_exp.setText(Messages.PropertyPageDefsTab_10);
|
show_exp.setText(Messages.PropertyPageDefsTab_10);
|
||||||
show_exp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
show_exp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
|
show_providers_tab = new Button(usercomp, SWT.CHECK);
|
||||||
|
show_providers_tab.setText(Messages.PropertyPageDefsTab_showProvidersTab + ", " //$NON-NLS-1$
|
||||||
|
+ org.eclipse.cdt.internal.ui.newui.Messages.CDTMainWizardPage_TrySD90);
|
||||||
|
show_providers_tab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
show_tipbox = new Button(usercomp, SWT.CHECK);
|
show_tipbox = new Button(usercomp, SWT.CHECK);
|
||||||
show_tipbox.setText(Messages.PropertyPageDefsTab_16);
|
show_tipbox.setText(Messages.PropertyPageDefsTab_16);
|
||||||
show_tipbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
show_tipbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
@ -117,6 +123,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG));
|
show_mng.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOMNG));
|
||||||
show_tool.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOTOOLM));
|
show_tool.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOTOOLM));
|
||||||
show_exp.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_EXPORT));
|
show_exp.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_EXPORT));
|
||||||
|
show_providers_tab.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NO_SHOW_PROVIDERS));
|
||||||
show_tipbox.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_TIPBOX));
|
show_tipbox.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_TIPBOX));
|
||||||
|
|
||||||
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DISC_NAMES)) {
|
switch (CDTPrefUtil.getInt(CDTPrefUtil.KEY_DISC_NAMES)) {
|
||||||
|
@ -140,6 +147,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOMNG, !show_mng.getSelection());
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOTOOLM, !show_tool.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOTOOLM, !show_tool.getSelection());
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_EXPORT, show_exp.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_EXPORT, show_exp.getSelection());
|
||||||
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NO_SHOW_PROVIDERS, !show_providers_tab.getSelection());
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_TIPBOX, show_tipbox.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_TIPBOX, show_tipbox.getSelection());
|
||||||
int x = 0;
|
int x = 0;
|
||||||
if (b_1.getSelection()) x = 1;
|
if (b_1.getSelection()) x = 1;
|
||||||
|
@ -160,6 +168,7 @@ public class PropertyPageDefsTab extends AbstractCPropertyTab {
|
||||||
show_mng.setSelection(true);
|
show_mng.setSelection(true);
|
||||||
show_tool.setSelection(true);
|
show_tool.setSelection(true);
|
||||||
show_exp.setSelection(false);
|
show_exp.setSelection(false);
|
||||||
|
show_providers_tab.setSelection(false);
|
||||||
show_tipbox.setSelection(false);
|
show_tipbox.setSelection(false);
|
||||||
b_0.setSelection(true);
|
b_0.setSelection(true);
|
||||||
b_1.setSelection(false);
|
b_1.setSelection(false);
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class WizardDefaultsTab extends AbstractCPropertyTab {
|
||||||
|
|
||||||
private Button show_sup;
|
private Button show_sup;
|
||||||
private Button show_oth;
|
private Button show_oth;
|
||||||
|
private Button checkBoxTryNewSD;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControls(Composite parent) {
|
public void createControls(Composite parent) {
|
||||||
|
@ -44,20 +45,27 @@ public class WizardDefaultsTab extends AbstractCPropertyTab {
|
||||||
show_oth.setText(Messages.WizardDefaultsTab_1);
|
show_oth.setText(Messages.WizardDefaultsTab_1);
|
||||||
show_oth.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
show_oth.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
|
checkBoxTryNewSD = new Button(usercomp, SWT.CHECK);
|
||||||
|
checkBoxTryNewSD.setText(org.eclipse.cdt.internal.ui.newui.Messages.CDTMainWizardPage_TrySD90);
|
||||||
|
checkBoxTryNewSD.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
|
|
||||||
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
|
show_sup.setSelection(!CDTPrefUtil.getBool(CDTPrefUtil.KEY_NOSUPP));
|
||||||
show_oth.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS));
|
show_oth.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_OTHERS));
|
||||||
|
checkBoxTryNewSD.setSelection(CDTPrefUtil.getBool(CDTPrefUtil.KEY_NEWSD));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performOK() {
|
protected void performOK() {
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSUPP, !show_sup.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NOSUPP, !show_sup.getSelection());
|
||||||
CDTPrefUtil.setBool(CDTPrefUtil.KEY_OTHERS, show_oth.getSelection());
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_OTHERS, show_oth.getSelection());
|
||||||
|
CDTPrefUtil.setBool(CDTPrefUtil.KEY_NEWSD, checkBoxTryNewSD.getSelection());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performDefaults() {
|
protected void performDefaults() {
|
||||||
show_sup.setSelection(true);
|
show_sup.setSelection(true);
|
||||||
show_oth.setSelection(false);
|
show_oth.setSelection(false);
|
||||||
|
checkBoxTryNewSD.setSelection(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,10 +24,12 @@ import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager;
|
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager;
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgScannerConfigUtil;
|
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgScannerConfigUtil;
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
import org.eclipse.cdt.core.model.util.CDTListComparator;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
|
import org.eclipse.cdt.internal.ui.newui.StatusMessageLine;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2Set;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2Set;
|
||||||
|
@ -46,7 +48,9 @@ import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||||
|
@ -103,6 +107,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
private Button reportProblemsCheckBox;
|
private Button reportProblemsCheckBox;
|
||||||
private Combo profileComboBox;
|
private Combo profileComboBox;
|
||||||
private Composite profileOptionsComposite;
|
private Composite profileOptionsComposite;
|
||||||
|
private Button clearButton;
|
||||||
|
|
||||||
private ICfgScannerConfigBuilderInfo2Set cbi;
|
private ICfgScannerConfigBuilderInfo2Set cbi;
|
||||||
private Map<InfoContext, IScannerConfigBuilderInfo2> baseInfoMap;
|
private Map<InfoContext, IScannerConfigBuilderInfo2> baseInfoMap;
|
||||||
|
@ -116,6 +121,8 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
|
|
||||||
private DiscoveryPageWrapper wrapper = null;
|
private DiscoveryPageWrapper wrapper = null;
|
||||||
|
|
||||||
|
private StatusMessageLine fStatusLine;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -184,6 +191,9 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
profileOptionsComposite.setLayoutData(gd);
|
profileOptionsComposite.setLayoutData(gd);
|
||||||
profileOptionsComposite.setLayout(new TabFolderLayout());
|
profileOptionsComposite.setLayout(new TabFolderLayout());
|
||||||
|
|
||||||
|
fStatusLine = new StatusMessageLine(usercomp, SWT.LEFT, 2);
|
||||||
|
setEnablement();
|
||||||
|
|
||||||
sashForm.setWeights(DEFAULT_SASH_WEIGHTS);
|
sashForm.setWeights(DEFAULT_SASH_WEIGHTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +246,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
Label clearLabel = ControlFactory.createLabel(autoDiscoveryGroup, Messages.DiscoveryTab_ClearDisoveredEntries);
|
Label clearLabel = ControlFactory.createLabel(autoDiscoveryGroup, Messages.DiscoveryTab_ClearDisoveredEntries);
|
||||||
|
|
||||||
// "Clear" button
|
// "Clear" button
|
||||||
Button clearButton = ControlFactory.createPushButton(autoDiscoveryGroup, Messages.DiscoveryTab_Clear);
|
clearButton = ControlFactory.createPushButton(autoDiscoveryGroup, Messages.DiscoveryTab_Clear);
|
||||||
GridData gd = (GridData) clearButton.getLayoutData();
|
GridData gd = (GridData) clearButton.getLayoutData();
|
||||||
gd.grabExcessHorizontalSpace = true;
|
gd.grabExcessHorizontalSpace = true;
|
||||||
//Bug 331783 - NLS: "Clear" button label in Makefile Project preferences truncated
|
//Bug 331783 - NLS: "Clear" button label in Makefile Project preferences truncated
|
||||||
|
@ -334,6 +344,27 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
} else {
|
} else {
|
||||||
setVisibility(Messages.DiscoveryTab_6);
|
setVisibility(Messages.DiscoveryTab_6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setEnablement();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEnablement() {
|
||||||
|
IStatus status = null;
|
||||||
|
ICConfigurationDescription cfgDescription = page.getResDesc().getConfiguration();
|
||||||
|
boolean isEnabled = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
|
if (!isEnabled) {
|
||||||
|
status = new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID, "Managed Build language settings provider is not enabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
scopeComboBox.setEnabled(isEnabled);
|
||||||
|
resTable.setEnabled(isEnabled);
|
||||||
|
boolean isSCDEnabled = autoDiscoveryCheckBox.getSelection();
|
||||||
|
reportProblemsCheckBox.setEnabled(isEnabled && isSCDEnabled);
|
||||||
|
autoDiscoveryCheckBox.setEnabled(isEnabled);
|
||||||
|
autoDiscoveryGroup.setEnabled(isEnabled);
|
||||||
|
clearButton.setEnabled(isEnabled);
|
||||||
|
|
||||||
|
fStatusLine.setErrorStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setVisibility(String errMsg) {
|
private void setVisibility(String errMsg) {
|
||||||
|
@ -372,7 +403,13 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
buildInfo = (IScannerConfigBuilderInfo2) ti.getData("info"); //$NON-NLS-1$
|
buildInfo = (IScannerConfigBuilderInfo2) ti.getData("info"); //$NON-NLS-1$
|
||||||
String selectedProfileId = buildInfo.getSelectedProfileId();
|
String selectedProfileId = buildInfo.getSelectedProfileId();
|
||||||
iContext = (CfgInfoContext) ti.getData("cont"); //$NON-NLS-1$
|
iContext = (CfgInfoContext) ti.getData("cont"); //$NON-NLS-1$
|
||||||
autoDiscoveryCheckBox.setSelection(buildInfo.isAutoDiscoveryEnabled()
|
boolean autodiscoveryEnabled2 = buildInfo.isAutoDiscoveryEnabled();
|
||||||
|
if (autodiscoveryEnabled2) {
|
||||||
|
IConfiguration cfg = iContext.getConfiguration();
|
||||||
|
ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
|
||||||
|
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
|
||||||
|
}
|
||||||
|
autoDiscoveryCheckBox.setSelection(autodiscoveryEnabled2
|
||||||
&& !selectedProfileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID));
|
&& !selectedProfileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID));
|
||||||
reportProblemsCheckBox.setSelection(buildInfo.isProblemReportingEnabled());
|
reportProblemsCheckBox.setSelection(buildInfo.isProblemReportingEnabled());
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ import java.util.SortedMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
@ -41,8 +44,9 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.cdt.ui.templateengine.IWizardDataPage;
|
import org.eclipse.cdt.ui.templateengine.IWizardDataPage;
|
||||||
import org.eclipse.cdt.ui.templateengine.Template;
|
import org.eclipse.cdt.ui.templateengine.Template;
|
||||||
|
@ -87,6 +91,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
|
|
||||||
private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$
|
private static final String PROPERTY = "org.eclipse.cdt.build.core.buildType"; //$NON-NLS-1$
|
||||||
private static final String PROP_VAL = PROPERTY + ".debug"; //$NON-NLS-1$
|
private static final String PROP_VAL = PROPERTY + ".debug"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String tooltip =
|
private static final String tooltip =
|
||||||
Messages.CWizardHandler_1 +
|
Messages.CWizardHandler_1 +
|
||||||
Messages.CWizardHandler_2 +
|
Messages.CWizardHandler_2 +
|
||||||
|
@ -591,6 +596,27 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
cfgDebug = cfgDes;
|
cfgDebug = cfgDes;
|
||||||
if (cfgFirst == null) // select at least first configuration
|
if (cfgFirst == null) // select at least first configuration
|
||||||
cfgFirst = cfgDes;
|
cfgFirst = cfgDes;
|
||||||
|
|
||||||
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
boolean isTryingNewSD = false;
|
||||||
|
IWizardPage page = getStartingPage();
|
||||||
|
if (page instanceof CDTMainWizardPage) {
|
||||||
|
isTryingNewSD = ((CDTMainWizardPage)page).isTryingNewSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isTryingNewSD);
|
||||||
|
List<ILanguageSettingsProvider> providers;
|
||||||
|
if (isTryingNewSD) {
|
||||||
|
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
||||||
|
} else {
|
||||||
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||||
|
}
|
||||||
|
|
||||||
monitor.worked(work);
|
monitor.worked(work);
|
||||||
}
|
}
|
||||||
mngr.setProjectDescription(project, des);
|
mngr.setProjectDescription(project, des);
|
||||||
|
@ -607,7 +633,7 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
|
|
||||||
List<IConfiguration> configs = new ArrayList<IConfiguration>();
|
List<IConfiguration> configs = new ArrayList<IConfiguration>();
|
||||||
for (CfgHolder cfg : cfgs) {
|
for (CfgHolder cfg : cfgs) {
|
||||||
configs.add((IConfiguration)cfg.getConfiguration());
|
configs.add(cfg.getConfiguration());
|
||||||
}
|
}
|
||||||
template.getTemplateInfo().setConfigurations(configs);
|
template.getTemplateInfo().setConfigurations(configs);
|
||||||
|
|
||||||
|
@ -834,5 +860,4 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
return super.canFinish();
|
return super.canFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,10 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
|
@ -25,6 +28,7 @@ import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
@ -69,6 +73,7 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
||||||
final String locationStr = page.getLocation();
|
final String locationStr = page.getLocation();
|
||||||
final boolean isCPP = page.isCPP();
|
final boolean isCPP = page.isCPP();
|
||||||
final IToolChain toolChain = page.getToolChain();
|
final IToolChain toolChain = page.getToolChain();
|
||||||
|
final boolean isTryingNewSD = page.isTryingNewSD();
|
||||||
|
|
||||||
IRunnableWithProgress op = new WorkspaceModifyOperation() {
|
IRunnableWithProgress op = new WorkspaceModifyOperation() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -110,7 +115,21 @@ public class NewMakeProjFromExisting extends Wizard implements IImportWizard, IN
|
||||||
IBuilder builder = config.getEditableBuilder();
|
IBuilder builder = config.getEditableBuilder();
|
||||||
builder.setManagedBuildOn(false);
|
builder.setManagedBuildOn(false);
|
||||||
CConfigurationData data = config.getConfigurationData();
|
CConfigurationData data = config.getConfigurationData();
|
||||||
projDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
ICConfigurationDescription cfgDes = projDesc.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
|
||||||
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isTryingNewSD);
|
||||||
|
if (isTryingNewSD) {
|
||||||
|
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(config, cfgDes);
|
||||||
|
} else {
|
||||||
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||||
|
}
|
||||||
|
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
|
|
||||||
pdMgr.setProjectDescription(project, projDesc);
|
pdMgr.setProjectDescription(project, projDesc);
|
||||||
|
|
|
@ -19,6 +19,8 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
@ -52,6 +54,9 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
||||||
List tcList;
|
List tcList;
|
||||||
Map<String, IToolChain> tcMap = new HashMap<String, IToolChain>();
|
Map<String, IToolChain> tcMap = new HashMap<String, IToolChain>();
|
||||||
|
|
||||||
|
private Button checkBoxTryNewSD;
|
||||||
|
|
||||||
|
|
||||||
protected NewMakeProjFromExistingPage() {
|
protected NewMakeProjFromExistingPage() {
|
||||||
super(Messages.NewMakeProjFromExistingPage_0);
|
super(Messages.NewMakeProjFromExistingPage_0);
|
||||||
setTitle(Messages.NewMakeProjFromExistingPage_1);
|
setTitle(Messages.NewMakeProjFromExistingPage_1);
|
||||||
|
@ -72,6 +77,21 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
||||||
addLanguageSelector(comp);
|
addLanguageSelector(comp);
|
||||||
addToolchainSelector(comp);
|
addToolchainSelector(comp);
|
||||||
|
|
||||||
|
checkBoxTryNewSD = new Button(comp, SWT.CHECK);
|
||||||
|
checkBoxTryNewSD.setText(org.eclipse.cdt.internal.ui.newui.Messages.CDTMainWizardPage_TrySD90);
|
||||||
|
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
checkBoxTryNewSD.setLayoutData(gd);
|
||||||
|
|
||||||
|
|
||||||
|
// restore settings from preferences
|
||||||
|
boolean isTryNewSD = true;
|
||||||
|
boolean contains = CUIPlugin.getDefault().getPreferenceStore().contains(CDTPrefUtil.KEY_NEWSD);
|
||||||
|
if (contains) {
|
||||||
|
isTryNewSD = CDTPrefUtil.getBool(CDTPrefUtil.KEY_NEWSD);
|
||||||
|
}
|
||||||
|
checkBoxTryNewSD.setSelection(isTryNewSD);
|
||||||
|
|
||||||
setControl(comp);
|
setControl(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,4 +233,11 @@ public class NewMakeProjFromExistingPage extends WizardPage {
|
||||||
return selection.length != 0 ? tcMap.get(selection[0]) : null;
|
return selection.length != 0 ? tcMap.get(selection[0]) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AG FIXME temporary method to be removed before CDT Juno release.
|
||||||
|
* @since 8.1
|
||||||
|
*/
|
||||||
|
public boolean isTryingNewSD() {
|
||||||
|
return checkBoxTryNewSD.getSelection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvidersKeeper;
|
||||||
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
import org.eclipse.cdt.core.model.CoreModel;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
|
||||||
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
|
||||||
|
@ -23,11 +26,14 @@ import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.ConfigurationDataProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
import org.eclipse.cdt.managedbuilder.internal.ui.Messages;
|
||||||
|
import org.eclipse.cdt.ui.wizards.CDTMainWizardPage;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -71,6 +77,7 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
|
|
||||||
private void setProjectDescription(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)
|
private void setProjectDescription(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor)
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
|
|
||||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
||||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||||
|
@ -99,12 +106,35 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
}
|
}
|
||||||
cfg.setArtifactName(mProj.getDefaultArtifactName());
|
cfg.setArtifactName(mProj.getDefaultArtifactName());
|
||||||
CConfigurationData data = cfg.getConfigurationData();
|
CConfigurationData data = cfg.getConfigurationData();
|
||||||
des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
|
||||||
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
boolean isTryingNewSD = false;
|
||||||
|
IWizardPage page = getStartingPage();
|
||||||
|
if (page instanceof CDTMainWizardPage) {
|
||||||
|
isTryingNewSD = ((CDTMainWizardPage)page).isTryingNewSD();
|
||||||
|
}
|
||||||
|
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isTryingNewSD);
|
||||||
|
if (isTryingNewSD) {
|
||||||
|
ConfigurationDataProvider.setDefaultLanguageSettingsProviders(cfg, cfgDes);
|
||||||
|
} else {
|
||||||
|
if (cfgDes instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
((ILanguageSettingsProvidersKeeper) cfgDes).setLanguageSettingProviders(ScannerDiscoveryLegacySupport.getDefaultProvidersLegacy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, false);
|
||||||
|
}
|
||||||
|
|
||||||
monitor.worked(work);
|
monitor.worked(work);
|
||||||
}
|
}
|
||||||
mngr.setProjectDescription(project, des);
|
mngr.setProjectDescription(project, des);
|
||||||
}
|
}
|
||||||
public boolean canCreateWithoutToolchain() { return true; }
|
|
||||||
|
public boolean canCreateWithoutToolchain() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {
|
public void convertProject(IProject proj, IProgressMonitor monitor) throws CoreException {
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2010, 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.core.internal.tests.filesystem.ram;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.EFSExtensionProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test stub to test EFSExtensionProvider mappings.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MemoryEFSExtensionProvider extends EFSExtensionProvider {
|
||||||
|
|
||||||
|
public String getMappedPath(URI locationURI) {
|
||||||
|
|
||||||
|
String path = locationURI.getPath();
|
||||||
|
if (path.contains("/BeingMappedFrom/Folder")) {
|
||||||
|
return path.replaceFirst("/BeingMappedFrom/Folder", "/LocallyMappedTo/Folder");
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getMappedPath(locationURI);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage;
|
||||||
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.CMacroEntry;
|
import org.eclipse.cdt.core.settings.model.CMacroEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -55,6 +56,7 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
private static final String PROVIDER_NAME_2 = "test.provider.2.name";
|
private static final String PROVIDER_NAME_2 = "test.provider.2.name";
|
||||||
private static final String CFG_ID = "test.configuration.id";
|
private static final String CFG_ID = "test.configuration.id";
|
||||||
private static final String LANG_ID = "test.lang.id";
|
private static final String LANG_ID = "test.lang.id";
|
||||||
|
private static final String LANG_CPP = GPPLanguage.ID;
|
||||||
private static final IFile FILE_0 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/project/path0"));
|
private static final IFile FILE_0 = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/project/path0"));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -805,4 +807,156 @@ public class LanguageSettingsManagerTests extends BaseTestCase {
|
||||||
assertSame(provider, providers.get(0));
|
assertSame(provider, providers.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO - YAGNI?
|
||||||
|
*/
|
||||||
|
public void testBuildResourceTree_FileInFolder() throws Exception {
|
||||||
|
// sample entries
|
||||||
|
CMacroEntry entry = new CMacroEntry("MACRO", null, 0);
|
||||||
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries.add(entry);
|
||||||
|
|
||||||
|
// create resources
|
||||||
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
IFile file = ResourceHelper.createFile(project, "file.cpp");
|
||||||
|
assertNotNull(file);
|
||||||
|
|
||||||
|
// create a provider and set the entries
|
||||||
|
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
|
||||||
|
provider.setSettingEntries(null, file, null, entries);
|
||||||
|
// build the hierarchy
|
||||||
|
LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
|
||||||
|
|
||||||
|
// check that entries go to highest possible level
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file, null));
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, project, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO - YAGNI?
|
||||||
|
*/
|
||||||
|
public void testBuildResourceTree_FileInSubFolder() throws Exception {
|
||||||
|
// sample entries
|
||||||
|
CMacroEntry entry = new CMacroEntry("MACRO", null, 0);
|
||||||
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries.add(entry);
|
||||||
|
|
||||||
|
// create resources
|
||||||
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
IFolder folder = ResourceHelper.createFolder(project, "Folder");
|
||||||
|
IFile file = ResourceHelper.createFile(project, "Folder/file.cpp");
|
||||||
|
|
||||||
|
// create a provider and set the entries
|
||||||
|
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
|
||||||
|
provider.setSettingEntries(null, file, null, entries);
|
||||||
|
// build the hierarchy
|
||||||
|
LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
|
||||||
|
|
||||||
|
// check that entries go to highest possible level
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file, null));
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, folder, null));
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, project, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO - YAGNI?
|
||||||
|
*/
|
||||||
|
public void testBuildResourceTree_TwoSubFolders() throws Exception {
|
||||||
|
// sample entries
|
||||||
|
List<ICLanguageSettingEntry> entries1 = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries1.add(new CMacroEntry("MACRO_1", null, 0));
|
||||||
|
List<ICLanguageSettingEntry> entries2 = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries2.add(new CMacroEntry("MACRO_2", null, 0));
|
||||||
|
|
||||||
|
// create resources
|
||||||
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
IFolder folder1 = ResourceHelper.createFolder(project, "Folder1");
|
||||||
|
IFolder folder2 = ResourceHelper.createFolder(project, "Folder2");
|
||||||
|
IFile file1 = ResourceHelper.createFile(project, "Folder1/file1.cpp");
|
||||||
|
IFile file2 = ResourceHelper.createFile(project, "Folder2/file2.cpp");
|
||||||
|
|
||||||
|
// create a provider and set the entries
|
||||||
|
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
|
||||||
|
provider.setSettingEntries(null, file1, null, entries1);
|
||||||
|
provider.setSettingEntries(null, file2, null, entries2);
|
||||||
|
// build the hierarchy
|
||||||
|
LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
|
||||||
|
|
||||||
|
// check that entries go to highest possible level
|
||||||
|
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null));
|
||||||
|
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, folder1, null));
|
||||||
|
|
||||||
|
assertEquals(entries2, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file2, null));
|
||||||
|
assertEquals(entries2, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, folder2, null));
|
||||||
|
|
||||||
|
assertEquals(0, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, project, null).size());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO - YAGNI?
|
||||||
|
*/
|
||||||
|
public void testBuildResourceTree_FlippingSettings() throws Exception {
|
||||||
|
// sample entries
|
||||||
|
List<ICLanguageSettingEntry> entries1 = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries1.add(new CMacroEntry("MACRO_1", null, 0));
|
||||||
|
List<ICLanguageSettingEntry> entries2 = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries2.add(new CMacroEntry("MACRO_2", null, 0));
|
||||||
|
|
||||||
|
// create resources
|
||||||
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
IFile file1 = ResourceHelper.createFile(project, "file1.cpp");
|
||||||
|
IFile file2 = ResourceHelper.createFile(project, "file2.cpp");
|
||||||
|
IFile file3 = ResourceHelper.createFile(project, "file3.cpp");
|
||||||
|
|
||||||
|
// create a provider
|
||||||
|
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
|
||||||
|
|
||||||
|
// set the entries for the first 2 files
|
||||||
|
provider.setSettingEntries(null, file1, null, entries1);
|
||||||
|
provider.setSettingEntries(null, file2, null, entries1);
|
||||||
|
// build the hierarchy
|
||||||
|
LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
|
||||||
|
// double-check where the entries go
|
||||||
|
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null));
|
||||||
|
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file2, null));
|
||||||
|
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, project, null));
|
||||||
|
|
||||||
|
// set the entries for the second+third files (second file flips the settings)
|
||||||
|
provider.setSettingEntries(null, file2, null, entries2);
|
||||||
|
provider.setSettingEntries(null, file3, null, entries2);
|
||||||
|
// build the hierarchy
|
||||||
|
LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, null, project);
|
||||||
|
// check where the entries go, it should not lose entries for the first file
|
||||||
|
assertEquals(entries1, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file1, null));
|
||||||
|
assertEquals(entries2, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file2, null));
|
||||||
|
assertEquals(entries2, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file3, null));
|
||||||
|
assertEquals(entries2, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, project, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO - YAGNI?
|
||||||
|
*/
|
||||||
|
public void testBuildResourceTree_WithLanguage() throws Exception {
|
||||||
|
// sample entries
|
||||||
|
CMacroEntry entry = new CMacroEntry("MACRO", null, 0);
|
||||||
|
List<ICLanguageSettingEntry> entries = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries.add(entry);
|
||||||
|
|
||||||
|
// create resources
|
||||||
|
IProject project = ResourceHelper.createCDTProjectWithConfig(this.getName());
|
||||||
|
IFolder folder = ResourceHelper.createFolder(project, "Folder");
|
||||||
|
IFile file = ResourceHelper.createFile(project, "Folder/file.cpp");
|
||||||
|
|
||||||
|
// create a provider and set the entries
|
||||||
|
LanguageSettingsSerializableProvider provider = new LanguageSettingsSerializableProvider(PROVIDER_1, PROVIDER_NAME_1);
|
||||||
|
provider.setSettingEntries(null, file, LANG_CPP, entries);
|
||||||
|
// build the hierarchy
|
||||||
|
LanguageSettingsProvidersSerializer.buildResourceTree(provider, null, LANG_CPP, project);
|
||||||
|
|
||||||
|
// check that entries go to highest possible level
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, file, LANG_CPP));
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, folder, LANG_CPP));
|
||||||
|
assertEquals(entries, LanguageSettingsManager.getSettingEntriesUpResourceTree(provider, null, project, LANG_CPP));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,13 @@
|
||||||
</run>
|
</run>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.EFSExtensionProvider">
|
||||||
|
<EFSExtensionProvider
|
||||||
|
class="org.eclipse.cdt.core.internal.tests.filesystem.ram.MemoryEFSExtensionProvider"
|
||||||
|
scheme="mem">
|
||||||
|
</EFSExtensionProvider>
|
||||||
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
id="RegexErrorParserId"
|
id="RegexErrorParserId"
|
||||||
name="Test Plugin RegexErrorParser"
|
name="Test Plugin RegexErrorParser"
|
||||||
|
|
|
@ -12,9 +12,12 @@
|
||||||
package org.eclipse.cdt.core.language.settings.providers;
|
package org.eclipse.cdt.core.language.settings.providers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.internal.core.LocalProjectScope;
|
import org.eclipse.cdt.internal.core.LocalProjectScope;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsExtensionManager;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||||
|
@ -44,6 +47,9 @@ public class ScannerDiscoveryLegacySupport {
|
||||||
private static final String PREFERENCES_QUALIFIER = CCorePlugin.PLUGIN_ID;
|
private static final String PREFERENCES_QUALIFIER = CCorePlugin.PLUGIN_ID;
|
||||||
private static final String LANGUAGE_SETTINGS_PROVIDERS_NODE = "languageSettingsProviders"; //$NON-NLS-1$
|
private static final String LANGUAGE_SETTINGS_PROVIDERS_NODE = "languageSettingsProviders"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static Map<String, String> legacyProfiles = null;
|
||||||
|
|
||||||
|
|
||||||
private static Preferences getPreferences(IProject project) {
|
private static Preferences getPreferences(IProject project) {
|
||||||
if (project == null)
|
if (project == null)
|
||||||
return InstanceScope.INSTANCE.getNode(PREFERENCES_QUALIFIER).node(LANGUAGE_SETTINGS_PROVIDERS_NODE);
|
return InstanceScope.INSTANCE.getNode(PREFERENCES_QUALIFIER).node(LANGUAGE_SETTINGS_PROVIDERS_NODE);
|
||||||
|
@ -82,6 +88,30 @@ public class ScannerDiscoveryLegacySupport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if legacy Scanner Discovery in MBS should be active.
|
||||||
|
*/
|
||||||
|
private static boolean isMbsLanguageSettingsProviderOn(ICConfigurationDescription cfgDescription) {
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
List<ILanguageSettingsProvider> lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
|
for (ILanguageSettingsProvider lsp : lsProviders) {
|
||||||
|
if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(lsp.getId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @noreference This is internal helper method to support compatibility with previous versions
|
||||||
|
* which is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
public static boolean isLegacyScannerDiscoveryOn(ICConfigurationDescription cfgDescription) {
|
||||||
|
IProject project = cfgDescription != null ? cfgDescription.getProjectDescription().getProject() : null;
|
||||||
|
return isLanguageSettingsProvidersFunctionalityEnabled(project) || isMbsLanguageSettingsProviderOn(cfgDescription);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list containing MBS and User provider. Used to initialize for unaware tool-chains (backward compatibility).
|
* Return list containing MBS and User provider. Used to initialize for unaware tool-chains (backward compatibility).
|
||||||
*/
|
*/
|
||||||
|
@ -95,4 +125,37 @@ public class ScannerDiscoveryLegacySupport {
|
||||||
return providers;
|
return providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the values of scanner discovery profiles (scannerConfigDiscoveryProfileId) which were deprecated
|
||||||
|
* and replaced with language settings providers in plugin.xml.
|
||||||
|
* This (temporary) function serves as fail-safe switch during the transition.
|
||||||
|
*
|
||||||
|
* @param id - can be id of either org.eclipse.cdt.managedbuilder.internal.core.InputType
|
||||||
|
* or org.eclipse.cdt.managedbuilder.internal.core.ToolChain.
|
||||||
|
* @return legacy scannerConfigDiscoveryProfileId.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
public static String getDeprecatedLegacyProfiles(String id) {
|
||||||
|
if (legacyProfiles == null) {
|
||||||
|
legacyProfiles = new HashMap<String, String>();
|
||||||
|
|
||||||
|
// InputTypes
|
||||||
|
// TODO -doublecheck
|
||||||
|
// legacyProfiles.put(inputTypeId, scannerConfigDiscoveryProfileId);
|
||||||
|
legacyProfiles.put("cdt.managedbuild.tool.gnu.c.compiler.input", "org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile");
|
||||||
|
legacyProfiles.put("cdt.managedbuild.tool.gnu.cpp.compiler.input", "org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile");
|
||||||
|
legacyProfiles.put("cdt.managedbuild.tool.gnu.c.compiler.input.cygwin", "org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC");
|
||||||
|
legacyProfiles.put("cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin", "org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP");
|
||||||
|
legacyProfiles.put("cdt.managedbuild.tool.xlc.c.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile");
|
||||||
|
legacyProfiles.put("cdt.managedbuild.tool.xlc.cpp.c.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile");
|
||||||
|
legacyProfiles.put("cdt.managedbuild.tool.xlc.cpp.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP");
|
||||||
|
|
||||||
|
// Toolchains
|
||||||
|
// TODO -doublecheck
|
||||||
|
// legacyProfiles.put(toolchainId, scannerConfigDiscoveryProfileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return legacyProfiles.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,7 @@ import org.eclipse.cdt.internal.core.CharOperation;
|
||||||
import org.eclipse.cdt.internal.core.cdtvariables.CoreVariableSubstitutor;
|
import org.eclipse.cdt.internal.core.cdtvariables.CoreVariableSubstitutor;
|
||||||
import org.eclipse.cdt.internal.core.cdtvariables.DefaultVariableContextInfo;
|
import org.eclipse.cdt.internal.core.cdtvariables.DefaultVariableContextInfo;
|
||||||
import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
|
import org.eclipse.cdt.internal.core.cdtvariables.ICoreVariableContextInfo;
|
||||||
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
|
||||||
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsProvidersSerializer;
|
||||||
import org.eclipse.cdt.internal.core.model.APathEntry;
|
import org.eclipse.cdt.internal.core.model.APathEntry;
|
||||||
import org.eclipse.cdt.internal.core.model.CModelStatus;
|
import org.eclipse.cdt.internal.core.model.CModelStatus;
|
||||||
|
@ -2016,6 +2017,9 @@ public class PathEntryTranslator {
|
||||||
public boolean visit(PathSettingsContainer container) {
|
public boolean visit(PathSettingsContainer container) {
|
||||||
CResourceData rcData = (CResourceData)container.getValue();
|
CResourceData rcData = (CResourceData)container.getValue();
|
||||||
if (rcData != null) {
|
if (rcData != null) {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
temporaryLog(cfgDescription, kinds, rcData);
|
||||||
|
|
||||||
PathEntryCollector child = collector.createChild(container.getPath());
|
PathEntryCollector child = collector.createChild(container.getPath());
|
||||||
for (int kind : kinds) {
|
for (int kind : kinds) {
|
||||||
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
|
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
@ -2027,6 +2031,24 @@ public class PathEntryTranslator {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
@Deprecated
|
||||||
|
private void temporaryLog(final ICConfigurationDescription cfgDescription, final int[] kinds, CResourceData rcData) {
|
||||||
|
String kindsStr="";
|
||||||
|
for (int kind : kinds) {
|
||||||
|
String kstr = LanguageSettingEntriesSerializer.kindToString(kind);
|
||||||
|
if (kindsStr.length()==0) {
|
||||||
|
kindsStr = kstr;
|
||||||
|
} else {
|
||||||
|
kindsStr += "|" + kstr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final IProject prj = cfgDescription.getProjectDescription().getProject();
|
||||||
|
String log_msg = "path="+prj+"/"+rcData.getPath()+", kind=["+kindsStr+"]"+" (PathEntryTranslator.collectEntries())";
|
||||||
|
LanguageSettingsLogger.logInfo(log_msg);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return collector;
|
return collector;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
package org.eclipse.cdt.internal.core.language.settings.providers;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AG FIXME -Temporary class for logging language settings providers development.
|
||||||
|
* To remove before CDT Juno release
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class LanguageSettingsLogger {
|
||||||
|
private static boolean isEnabled() {
|
||||||
|
return false;
|
||||||
|
// return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param msg
|
||||||
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static void logInfo(String msg) {
|
||||||
|
if (isEnabled()) {
|
||||||
|
Exception e = new Exception(msg);
|
||||||
|
IStatus status = new Status(IStatus.INFO, CCorePlugin.PLUGIN_ID, msg, e);
|
||||||
|
CCorePlugin.log(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param msg
|
||||||
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static void logWarning(String msg) {
|
||||||
|
if (isEnabled()) {
|
||||||
|
Exception e = new Exception(msg);
|
||||||
|
IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, msg, e);
|
||||||
|
CCorePlugin.log(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param msg
|
||||||
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static void logError(String msg) {
|
||||||
|
if (isEnabled()) {
|
||||||
|
Exception e = new Exception(msg);
|
||||||
|
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, msg, e);
|
||||||
|
CCorePlugin.log(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rc
|
||||||
|
* @param who - pass "this" (calling class instance) here
|
||||||
|
* @noreference This method is not intended to be referenced by clients.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static void logScannerInfoProvider(IResource rc, Object who) {
|
||||||
|
if (isEnabled()) {
|
||||||
|
String msg = "rc="+rc+" <-- "+who.getClass().getSimpleName(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
if (rc instanceof IFile) {
|
||||||
|
LanguageSettingsLogger.logInfo(msg);
|
||||||
|
} else if (rc instanceof IProject) {
|
||||||
|
LanguageSettingsLogger.logWarning(msg);
|
||||||
|
} else {
|
||||||
|
LanguageSettingsLogger.logError(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,8 @@ import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider;
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsSerializableProvider;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage;
|
import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
import org.eclipse.cdt.core.language.settings.providers.ScannerDiscoveryLegacySupport;
|
||||||
|
import org.eclipse.cdt.core.model.ILanguage;
|
||||||
|
import org.eclipse.cdt.core.model.LanguageManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
|
@ -486,6 +488,9 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static void serializeLanguageSettingsWorkspace() throws CoreException {
|
public static void serializeLanguageSettingsWorkspace() throws CoreException {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logWarning("LanguageSettingsProvidersSerializer.serializeLanguageSettingsWorkspace()");
|
||||||
|
|
||||||
URI uriStoreWsp = getStoreInWorkspaceArea(STORAGE_WORKSPACE_LANGUAGE_SETTINGS);
|
URI uriStoreWsp = getStoreInWorkspaceArea(STORAGE_WORKSPACE_LANGUAGE_SETTINGS);
|
||||||
List<LanguageSettingsSerializableProvider> serializableWorkspaceProviders = new ArrayList<LanguageSettingsSerializableProvider>();
|
List<LanguageSettingsSerializableProvider> serializableWorkspaceProviders = new ArrayList<LanguageSettingsSerializableProvider>();
|
||||||
for (ILanguageSettingsProvider provider : rawGlobalWorkspaceProviders.values()) {
|
for (ILanguageSettingsProvider provider : rawGlobalWorkspaceProviders.values()) {
|
||||||
|
@ -741,6 +746,9 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
*/
|
*/
|
||||||
public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws CoreException {
|
public static void serializeLanguageSettings(ICProjectDescription prjDescription) throws CoreException {
|
||||||
IProject project = prjDescription.getProject();
|
IProject project = prjDescription.getProject();
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logWarning("LanguageSettingsProvidersSerializer.serializeLanguageSettings() for " + project);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Using side effect of adding the module to the storage
|
// Using side effect of adding the module to the storage
|
||||||
prjDescription.getStorage(CPROJECT_STORAGE_MODULE, true);
|
prjDescription.getStorage(CPROJECT_STORAGE_MODULE, true);
|
||||||
|
@ -1125,6 +1133,35 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
return provider instanceof LanguageSettingsWorkspaceProvider;
|
return provider instanceof LanguageSettingsWorkspaceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reports inconsistency in log.
|
||||||
|
* AG FIXME - temporary method to remove before CDT Juno release
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
@Deprecated
|
||||||
|
public static void assertConsistency(ICProjectDescription prjDescription) {
|
||||||
|
if (prjDescription != null) {
|
||||||
|
List<ILanguageSettingsProvider> prjProviders = new ArrayList<ILanguageSettingsProvider>();
|
||||||
|
for (ICConfigurationDescription cfgDescription : prjDescription.getConfigurations()) {
|
||||||
|
if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) {
|
||||||
|
List<ILanguageSettingsProvider> providers = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders();
|
||||||
|
for (ILanguageSettingsProvider provider : providers) {
|
||||||
|
if (!LanguageSettingsManager.isWorkspaceProvider(provider)) {
|
||||||
|
if (isInList(prjProviders, provider)) {
|
||||||
|
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Inconsistent state, duplicate LSP in project description "
|
||||||
|
+ "[" + System.identityHashCode(provider) + "] "
|
||||||
|
+ provider);
|
||||||
|
CoreException e = new CoreException(status);
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
prjProviders.add(provider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that this particular element is in the list.
|
* Check that this particular element is in the list.
|
||||||
*/
|
*/
|
||||||
|
@ -1216,9 +1253,13 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
*/
|
*/
|
||||||
public static void reRegisterListeners(ICProjectDescription oldPrjDescription, ICProjectDescription newPrjDescription) {
|
public static void reRegisterListeners(ICProjectDescription oldPrjDescription, ICProjectDescription newPrjDescription) {
|
||||||
if (oldPrjDescription == newPrjDescription) {
|
if (oldPrjDescription == newPrjDescription) {
|
||||||
|
assertConsistency(oldPrjDescription);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertConsistency(oldPrjDescription);
|
||||||
|
assertConsistency(newPrjDescription);
|
||||||
|
|
||||||
List<ICListenerAgent> oldListeners = getListeners(oldPrjDescription);
|
List<ICListenerAgent> oldListeners = getListeners(oldPrjDescription);
|
||||||
List<ListenerAssociation> newAssociations = getListenersAssociations(newPrjDescription);
|
List<ListenerAssociation> newAssociations = getListenersAssociations(newPrjDescription);
|
||||||
|
|
||||||
|
@ -1285,6 +1326,9 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
* @param event - the {@link ILanguageSettingsChangeEvent} event to be broadcast.
|
* @param event - the {@link ILanguageSettingsChangeEvent} event to be broadcast.
|
||||||
*/
|
*/
|
||||||
private static void notifyLanguageSettingsChangeListeners(ILanguageSettingsChangeEvent event) {
|
private static void notifyLanguageSettingsChangeListeners(ILanguageSettingsChangeEvent event) {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logWarning("Firing " + event);
|
||||||
|
|
||||||
for (Object listener : fLanguageSettingsChangeListeners.getListeners()) {
|
for (Object listener : fLanguageSettingsChangeListeners.getListeners()) {
|
||||||
((ILanguageSettingsChangeListener) listener).handleEvent(event);
|
((ILanguageSettingsChangeListener) listener).handleEvent(event);
|
||||||
}
|
}
|
||||||
|
@ -1488,4 +1532,109 @@ public class LanguageSettingsProvidersSerializer {
|
||||||
return new ArrayList<ILanguageSettingsProvider>(newProviders);
|
return new ArrayList<ILanguageSettingsProvider>(newProviders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the language is applicable for the file.
|
||||||
|
*/
|
||||||
|
private static boolean isLanguageInScope(IResource rc, ICConfigurationDescription cfgDescription, String languageId) {
|
||||||
|
if (rc instanceof IFile) {
|
||||||
|
ILanguage lang = null;
|
||||||
|
try {
|
||||||
|
lang = LanguageManager.getInstance().getLanguageForFile((IFile) rc, cfgDescription);
|
||||||
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log("Error while determining language for a file", e); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (lang == null || (languageId != null && !languageId.equals(lang.getId()))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds for the provider a nicer-looking resource tree to present hierarchical view to the user.
|
||||||
|
*
|
||||||
|
* Note that it is not advisable to "compact" the tree because of potential loss of information
|
||||||
|
* which is especially important during partial or incremental builds.
|
||||||
|
*
|
||||||
|
* Note also that after using this method for a while for BOP parsers it appears that disadvantages
|
||||||
|
* outweigh benefits. In particular, it doesn't result in saving memory as the language settings
|
||||||
|
* (and the lists itself) are not duplicated in memory anyway but optimized with using WeakHashSet
|
||||||
|
* and SafeStringInterner.
|
||||||
|
*
|
||||||
|
* This method is a candidate for removal.
|
||||||
|
*
|
||||||
|
* @param provider - language settings provider to build the tree for.
|
||||||
|
* @param cfgDescription - configuration description.
|
||||||
|
* @param languageId - language ID.
|
||||||
|
* @param folder - container where the tree roots.
|
||||||
|
*/
|
||||||
|
public static void buildResourceTree(LanguageSettingsSerializableProvider provider,
|
||||||
|
ICConfigurationDescription cfgDescription, String languageId, IContainer folder) {
|
||||||
|
IResource[] members = null;
|
||||||
|
try {
|
||||||
|
members = folder.members();
|
||||||
|
} catch (Exception e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
if (members==null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (IResource rc : members) {
|
||||||
|
if (rc instanceof IContainer) {
|
||||||
|
buildResourceTree(provider, cfgDescription, languageId, (IContainer) rc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int rcNumber = members.length;
|
||||||
|
|
||||||
|
Map<List<ICLanguageSettingEntry>, Integer> listMap = new HashMap<List<ICLanguageSettingEntry>, Integer>();
|
||||||
|
|
||||||
|
// on the first pass find majority entry list, i.e. list present most often
|
||||||
|
List<ICLanguageSettingEntry> majorityEntries = null;
|
||||||
|
List<ICLanguageSettingEntry> candidate = null;
|
||||||
|
int candidateCount = 0;
|
||||||
|
for (IResource rc : members) {
|
||||||
|
if (!isLanguageInScope(rc, cfgDescription, languageId)) {
|
||||||
|
rcNumber--;
|
||||||
|
} else {
|
||||||
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, rc, languageId);
|
||||||
|
if (entries==null && rc instanceof IContainer) {
|
||||||
|
rcNumber--;
|
||||||
|
} else {
|
||||||
|
Integer count = listMap.get(entries);
|
||||||
|
if (count==null) {
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (count>candidateCount) {
|
||||||
|
candidateCount = count;
|
||||||
|
candidate = entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
listMap.put(entries, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (candidateCount > rcNumber/2) {
|
||||||
|
majorityEntries = candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (majorityEntries!=null) {
|
||||||
|
provider.setSettingEntries(cfgDescription, folder, languageId, majorityEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
// second pass - assign the entries to the folders
|
||||||
|
for (IResource rc : members) {
|
||||||
|
List<ICLanguageSettingEntry> entries = provider.getSettingEntries(null, rc, languageId);
|
||||||
|
if (entries!=null && entries==majorityEntries) {
|
||||||
|
if (!(rc instanceof IFile)) { // preserve information which files were collected
|
||||||
|
provider.setSettingEntries(cfgDescription, rc, languageId, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,6 +64,9 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ExtendedScannerInfo getScannerInformation(IResource rc) {
|
public ExtendedScannerInfo getScannerInformation(IResource rc) {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logScannerInfoProvider(rc, this);
|
||||||
|
|
||||||
IProject project = rc.getProject();
|
IProject project = rc.getProject();
|
||||||
if (project==null)
|
if (project==null)
|
||||||
return DUMMY_SCANNER_INFO;
|
return DUMMY_SCANNER_INFO;
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescriptionListener;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
import org.eclipse.cdt.core.settings.model.ICSettingBase;
|
||||||
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
|
||||||
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
|
||||||
import org.eclipse.cdt.utils.EFSExtensionManager;
|
import org.eclipse.cdt.utils.EFSExtensionManager;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
@ -77,6 +78,9 @@ public class DescriptionScannerInfoProvider implements IScannerInfoProvider, ICP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IScannerInfo getScannerInformation(IResource resource) {
|
public IScannerInfo getScannerInformation(IResource resource) {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
LanguageSettingsLogger.logScannerInfoProvider(resource, this);
|
||||||
|
|
||||||
if(!fInited)
|
if(!fInited)
|
||||||
updateProjCfgInfo(CProjectDescriptionManager.getInstance().getProjectDescription(fProject, false));
|
updateProjCfgInfo(CProjectDescriptionManager.getInstance().getProjectDescription(fProject, false));
|
||||||
|
|
||||||
|
|
|
@ -766,5 +766,12 @@
|
||||||
factoryClass="org.eclipse.cdt.internal.core.resources.ResourceExclusionFactory">
|
factoryClass="org.eclipse.cdt.internal.core.resources.ResourceExclusionFactory">
|
||||||
</exclusionFactory>
|
</exclusionFactory>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.core.EFSExtensionProvider">
|
||||||
|
<EFSExtensionProvider
|
||||||
|
class="org.eclipse.cdt.internal.core.resources.CygwinEFSExtensionProvider"
|
||||||
|
scheme="cygwin">
|
||||||
|
</EFSExtensionProvider>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -531,8 +531,10 @@ public class CCorePlugin extends Plugin {
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @return CDT console adapter.
|
* @return CDT console adapter.
|
||||||
|
*
|
||||||
|
* @since 5.4
|
||||||
*/
|
*/
|
||||||
private IConsole getConsole(String extConsoleId, String contextId, String name, URL iconUrl) {
|
public IConsole getConsole(String extConsoleId, String contextId, String name, URL iconUrl) {
|
||||||
try {
|
try {
|
||||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "CBuildConsole"); //$NON-NLS-1$
|
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, "CBuildConsole"); //$NON-NLS-1$
|
||||||
if (extensionPoint != null) {
|
if (extensionPoint != null) {
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 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.core;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Console parser interface extended to support configurations.
|
||||||
|
*
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public interface ICConsoleParser extends IConsoleParser {
|
||||||
|
/**
|
||||||
|
* Initialize console parser.
|
||||||
|
*
|
||||||
|
* @param cfgDescription - configuration description for the parser.
|
||||||
|
* @throws CoreException if anything goes wrong.
|
||||||
|
*/
|
||||||
|
public void startup(ICConfigurationDescription cfgDescription) throws CoreException;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean processLine(String line);
|
||||||
|
@Override
|
||||||
|
public void shutdown();
|
||||||
|
|
||||||
|
}
|
|
@ -29,8 +29,10 @@ import org.eclipse.cdt.core.model.IMacroFileEntry;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
|
||||||
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
import org.eclipse.cdt.core.parser.IScannerInfoProvider;
|
||||||
|
import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSettingsLogger;
|
||||||
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
||||||
import org.eclipse.cdt.internal.core.settings.model.ScannerInfoProviderProxy;
|
import org.eclipse.cdt.internal.core.settings.model.ScannerInfoProviderProxy;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
@ -96,6 +98,13 @@ public class ScannerProvider extends AbstractCExtension implements IScannerInfoP
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IScannerInfo getScannerInformation(IResource resource) {
|
public IScannerInfo getScannerInformation(IResource resource) {
|
||||||
|
// AG FIXME - temporary log to remove before CDT Juno release
|
||||||
|
if (resource instanceof IFile) {
|
||||||
|
LanguageSettingsLogger.logInfo("rc="+resource+" (ScannerProvider.getScannerInformation())");
|
||||||
|
} else {
|
||||||
|
LanguageSettingsLogger.logWarning("rc="+resource+" (ScannerProvider.getScannerInformation())");
|
||||||
|
}
|
||||||
|
|
||||||
IPath resPath = resource.getFullPath();
|
IPath resPath = resource.getFullPath();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -13,7 +13,10 @@ package org.eclipse.cdt.internal.core;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
import org.eclipse.cdt.core.IConsoleParser;
|
import org.eclipse.cdt.core.IConsoleParser;
|
||||||
|
import org.eclipse.cdt.core.IErrorParser;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,6 +130,8 @@ public class ConsoleOutputSniffer {
|
||||||
private OutputStream consoleErrorStream;
|
private OutputStream consoleErrorStream;
|
||||||
private IConsoleParser[] parsers;
|
private IConsoleParser[] parsers;
|
||||||
|
|
||||||
|
private ErrorParserManager errorParserManager = null;
|
||||||
|
|
||||||
public ConsoleOutputSniffer(IConsoleParser[] parsers) {
|
public ConsoleOutputSniffer(IConsoleParser[] parsers) {
|
||||||
this.parsers = parsers;
|
this.parsers = parsers;
|
||||||
}
|
}
|
||||||
|
@ -137,6 +142,11 @@ public class ConsoleOutputSniffer {
|
||||||
this.consoleErrorStream = errorStream;
|
this.consoleErrorStream = errorStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConsoleOutputSniffer(OutputStream outputStream, OutputStream errorStream, IConsoleParser[] parsers, ErrorParserManager epm) {
|
||||||
|
this(outputStream, errorStream, parsers);
|
||||||
|
this.errorParserManager = epm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an output stream that will be sniffed.
|
* Returns an output stream that will be sniffed.
|
||||||
* This stream should be hooked up so the command
|
* This stream should be hooked up so the command
|
||||||
|
@ -166,7 +176,13 @@ public class ConsoleOutputSniffer {
|
||||||
public synchronized void closeConsoleOutputStream() throws IOException {
|
public synchronized void closeConsoleOutputStream() throws IOException {
|
||||||
if (nOpens > 0 && --nOpens == 0) {
|
if (nOpens > 0 && --nOpens == 0) {
|
||||||
for (int i = 0; i < parsers.length; ++i) {
|
for (int i = 0; i < parsers.length; ++i) {
|
||||||
parsers[i].shutdown();
|
try {
|
||||||
|
parsers[i].shutdown();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
// Report exception if any but let all the parsers chance to shutdown.
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,8 +193,18 @@ public class ConsoleOutputSniffer {
|
||||||
* @param line
|
* @param line
|
||||||
*/
|
*/
|
||||||
private synchronized void processLine(String line) {
|
private synchronized void processLine(String line) {
|
||||||
for (int i = 0; i < parsers.length; ++i) {
|
for (IConsoleParser parser : parsers) {
|
||||||
parsers[i].processLine(line);
|
try {
|
||||||
|
if (parser instanceof IErrorParser) {
|
||||||
|
// IErrorParser interface is used here only with purpose to pass ErrorParserManager
|
||||||
|
// which keeps track of CWD and provides useful methods for locating files
|
||||||
|
((IErrorParser)parser).processLine(line, errorParserManager);
|
||||||
|
} else {
|
||||||
|
parser.processLine(line);
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.internal.core.resources;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.EFSExtensionProvider;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
|
public class CygwinEFSExtensionProvider extends EFSExtensionProvider {
|
||||||
|
@Override
|
||||||
|
public String getMappedPath(URI locationURI) {
|
||||||
|
String cygwinPath = getPathFromURI(locationURI);
|
||||||
|
String windowsPath = null;
|
||||||
|
try {
|
||||||
|
windowsPath = cygwinToWindowsPath(cygwinPath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
return windowsPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conversion from Windows path to Cygwin path.
|
||||||
|
*
|
||||||
|
* @param windowsPath - Windows path.
|
||||||
|
* @return Cygwin style converted path.
|
||||||
|
* @throws UnsupportedOperationException if Cygwin is unavailable.
|
||||||
|
* @throws IOException on IO problem.
|
||||||
|
*
|
||||||
|
* See ResourceHelper.windowsToCygwinPath(...)
|
||||||
|
*/
|
||||||
|
public static String windowsToCygwinPath(String windowsPath) throws IOException, UnsupportedOperationException {
|
||||||
|
if (!Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||||
|
// Don't run this on non-windows platforms
|
||||||
|
throw new UnsupportedOperationException("Not a Windows system, Cygwin is unavailable.");
|
||||||
|
}
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
String[] args = {"cygpath", "-u", windowsPath};
|
||||||
|
Process cygpath;
|
||||||
|
try {
|
||||||
|
cygpath = Runtime.getRuntime().exec(args);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new UnsupportedOperationException("Cygwin utility cygpath is not in the system search path.");
|
||||||
|
}
|
||||||
|
BufferedReader stdout = new BufferedReader(new InputStreamReader(cygpath.getInputStream()));
|
||||||
|
|
||||||
|
String cygwinPath = stdout.readLine();
|
||||||
|
if (cygwinPath == null) {
|
||||||
|
throw new UnsupportedOperationException("Cygwin utility cygpath is not available.");
|
||||||
|
}
|
||||||
|
return cygwinPath.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conversion from Cygwin path to Windows path.
|
||||||
|
*
|
||||||
|
* @param cygwinPath - Cygwin path.
|
||||||
|
* @return Windows style converted path.
|
||||||
|
* @throws UnsupportedOperationException if Cygwin is unavailable.
|
||||||
|
* @throws IOException on IO problem.
|
||||||
|
*
|
||||||
|
* * See ResourceHelper.cygwinToWindowsPath(...)
|
||||||
|
*/
|
||||||
|
public static String cygwinToWindowsPath(String cygwinPath) throws IOException, UnsupportedOperationException {
|
||||||
|
if (!Platform.getOS().equals(Platform.OS_WIN32)) {
|
||||||
|
// Don't run this on non-windows platforms
|
||||||
|
throw new UnsupportedOperationException("Not a Windows system, Cygwin is unavailable.");
|
||||||
|
}
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
String[] args = {"cygpath", "-w", cygwinPath};
|
||||||
|
Process cygpath;
|
||||||
|
try {
|
||||||
|
cygpath = Runtime.getRuntime().exec(args);
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new UnsupportedOperationException("Cygwin utility cygpath is not in the system search path.");
|
||||||
|
}
|
||||||
|
BufferedReader stdout = new BufferedReader(new InputStreamReader(cygpath.getInputStream()));
|
||||||
|
|
||||||
|
String windowsPath = stdout.readLine();
|
||||||
|
if (windowsPath == null) {
|
||||||
|
throw new UnsupportedOperationException("Cygwin utility cygpath is not available.");
|
||||||
|
}
|
||||||
|
return windowsPath.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ Export-Package: org.eclipse.cdt.internal.corext;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.includebrowser;x-internal:=true,
|
org.eclipse.cdt.internal.ui.includebrowser;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.indexview;x-internal:=true,
|
org.eclipse.cdt.internal.ui.indexview;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.language;x-internal:=true,
|
org.eclipse.cdt.internal.ui.language;x-internal:=true,
|
||||||
|
org.eclipse.cdt.internal.ui.language.settings.providers;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.navigator;x-internal:=true,
|
org.eclipse.cdt.internal.ui.navigator;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.newui;x-internal:=true,
|
org.eclipse.cdt.internal.ui.newui;x-internal:=true,
|
||||||
org.eclipse.cdt.internal.ui.preferences;x-internal:=true,
|
org.eclipse.cdt.internal.ui.preferences;x-internal:=true,
|
||||||
|
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 144 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/ls_entries.gif
Normal file
After Width: | Height: | Size: 386 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/ls_entries_provider.gif
Normal file
After Width: | Height: | Size: 371 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/provider_ls_obj.gif
Normal file
After Width: | Height: | Size: 186 B |
BIN
core/org.eclipse.cdt.ui/icons/obj16/search.gif
Normal file
After Width: | Height: | Size: 347 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/cfg_ovr.gif
Normal file
After Width: | Height: | Size: 155 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/edited_ov.gif
Normal file
After Width: | Height: | Size: 167 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/empty_ovr.png
Normal file
After Width: | Height: | Size: 335 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/global_ovr.gif
Normal file
After Width: | Height: | Size: 271 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/import_co.gif
Normal file
After Width: | Height: | Size: 68 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/link_ovr.gif
Normal file
After Width: | Height: | Size: 169 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/lock_ovr.gif
Normal file
After Width: | Height: | Size: 115 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/overlay-has-context.gif
Normal file
After Width: | Height: | Size: 162 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/person_ovr.gif
Normal file
After Width: | Height: | Size: 165 B |
BIN
core/org.eclipse.cdt.ui/icons/ovr16/project_co.gif
Normal file
After Width: | Height: | Size: 112 B |
|
@ -607,9 +607,11 @@ includeFolderDecorator.description = Decorates missing include folders with erro
|
||||||
|
|
||||||
templatesViewName= Templates
|
templatesViewName= Templates
|
||||||
|
|
||||||
|
AllLanguageSettingEntries.name=Providers
|
||||||
|
AllLanguageSettingEntries.tooltip=Language Setting Entries Providers
|
||||||
|
|
||||||
deleteConfigsCommand.name = Reset to Default
|
deleteConfigsCommand.name = Reset to Default
|
||||||
excludeCommand.name = Exclude from Build
|
excludeCommand.name = Exclude from BuildActionDefinition.selectEnclosing.description = Expand the selection to enclosing C/C++ element
|
||||||
ActionDefinition.selectEnclosing.description = Expand the selection to enclosing C/C++ element
|
|
||||||
ActionDefinition.selectEnclosing.name = Select Enclosing C/C++ Element
|
ActionDefinition.selectEnclosing.name = Select Enclosing C/C++ Element
|
||||||
ActionDefinition.selectNext.description = Expand the selection to next C/C++ element
|
ActionDefinition.selectNext.description = Expand the selection to next C/C++ element
|
||||||
ActionDefinition.selectNext.name = Select Next C/C++ Element
|
ActionDefinition.selectNext.name = Select Next C/C++ Element
|
||||||
|
@ -617,6 +619,8 @@ ActionDefinition.selectPrevious.description = Expand the selection to enclosing
|
||||||
ActionDefinition.selectPrevious.name = Select Previous C/C++ Element
|
ActionDefinition.selectPrevious.name = Select Previous C/C++ Element
|
||||||
ActionDefinition.selectLast.description = Restore last selection in C/C++ editor
|
ActionDefinition.selectLast.description = Restore last selection in C/C++ editor
|
||||||
ActionDefinition.selectLast.name = Restore Last C/C++ Selection
|
ActionDefinition.selectLast.name = Restore Last C/C++ Selection
|
||||||
|
LanguageSettingsProviderUIExtensionPoint=Language Settings Provider UI
|
||||||
|
LanguageSettingsProviderAssociationExtensionPoint=Language Settings Provider UI
|
||||||
overrideAnnotation.label = C/C++ Override indicators
|
overrideAnnotation.label = C/C++ Override indicators
|
||||||
|
|
||||||
transfer.EditorAppearance.name = C/C++ Editor Appearance
|
transfer.EditorAppearance.name = C/C++ Editor Appearance
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<extension-point id="quickAssistProcessors" name="%quickAssistProcessorExtensionPoint" schema="schema/quickAssistProcessors.exsd"/>
|
<extension-point id="quickAssistProcessors" name="%quickAssistProcessorExtensionPoint" schema="schema/quickAssistProcessors.exsd"/>
|
||||||
<extension-point id="DocCommentOwner" name="%DocCommentOwner.name" schema="schema/DocCommentOwner.exsd"/>
|
<extension-point id="DocCommentOwner" name="%DocCommentOwner.name" schema="schema/DocCommentOwner.exsd"/>
|
||||||
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
<extension-point id="workingSetConfigurations" name="%workingSetConfigurationsExtensionPoint" schema="schema/workingSetConfigurations.exsd"/>
|
||||||
|
<extension-point id="LanguageSettingsProviderAssociation" name="%LanguageSettingsProviderAssociationExtensionPoint" schema="schema/LanguageSettingsProviderAssociation.exsd"/>
|
||||||
<extension-point id="RefreshExclusionContributor" name="%extension-point.name" schema="schema/RefreshExclusionContributor.exsd"/>
|
<extension-point id="RefreshExclusionContributor" name="%extension-point.name" schema="schema/RefreshExclusionContributor.exsd"/>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
|
@ -3367,6 +3368,17 @@
|
||||||
</adapt>
|
</adapt>
|
||||||
</enabledWhen>
|
</enabledWhen>
|
||||||
</page>
|
</page>
|
||||||
|
<page
|
||||||
|
name="Preprocessor Include Paths, Macros etc."
|
||||||
|
id="org.eclipse.cdt.ui.language.settings"
|
||||||
|
class="org.eclipse.cdt.internal.ui.language.settings.providers.Page_LanguageSettingsProviders"
|
||||||
|
category="org.eclipse.cdt.ui.newui.Page_head_general">
|
||||||
|
<enabledWhen>
|
||||||
|
<adapt type="org.eclipse.core.resources.IResource">
|
||||||
|
<test property="org.eclipse.core.resources.projectNature" value="org.eclipse.cdt.core.cnature"/>
|
||||||
|
</adapt>
|
||||||
|
</enabledWhen>
|
||||||
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
|
@ -4301,6 +4313,40 @@
|
||||||
</complexArray>
|
</complexArray>
|
||||||
</processType>
|
</processType>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.core.language.settings.providers.LanguageSettingsGenericProvider"
|
||||||
|
id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"
|
||||||
|
name="CDT User Setting Entries"
|
||||||
|
prefer-non-shared="true">
|
||||||
|
</provider>
|
||||||
|
</extension>
|
||||||
|
<extension point="org.eclipse.cdt.ui.LanguageSettingsProviderAssociation">
|
||||||
|
<id-association
|
||||||
|
id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"
|
||||||
|
icon="icons/obj16/person-me.gif"
|
||||||
|
ui-clear-entries="true"
|
||||||
|
ui-edit-entries="true">
|
||||||
|
</id-association>
|
||||||
|
</extension>
|
||||||
|
<extension point="org.eclipse.cdt.ui.cPropertyTab">
|
||||||
|
<tab
|
||||||
|
class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsEntriesTab"
|
||||||
|
icon="icons/obj16/ls_entries.gif"
|
||||||
|
name="Entries"
|
||||||
|
weight="010"
|
||||||
|
helpId="FIXME cdt_u_prop_pns_inc"
|
||||||
|
parent="org.eclipse.cdt.internal.ui.language.settings.providers.Page_LanguageSettingsProviders"
|
||||||
|
tooltip="%AllLanguageSettingEntries.tooltip"/>
|
||||||
|
<tab
|
||||||
|
class="org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderTab"
|
||||||
|
icon="icons/obj16/extension_obj.gif"
|
||||||
|
name="Providers"
|
||||||
|
weight="020"
|
||||||
|
helpId="FIXME cdt_u_prop_pns_inc"
|
||||||
|
parent="org.eclipse.cdt.internal.ui.language.settings.providers.Page_LanguageSettingsProviders"
|
||||||
|
tooltip="%AllLanguageSettingEntries.tooltip"/>
|
||||||
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.commands">
|
point="org.eclipse.ui.commands">
|
||||||
<command
|
<command
|
||||||
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!-- Schema file written by PDE -->
|
||||||
|
<schema targetNamespace="org.eclipse.cdt.make.ui" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.schema plugin="org.eclipse.cdt.make.ui" id="LanguageSettingsProviderAssociation" name="Language Settings Provider UI"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter description of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<element name="extension">
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.element />
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
<complexType>
|
||||||
|
<sequence>
|
||||||
|
<element ref="id-association" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
<element ref="class-association" minOccurs="0" maxOccurs="unbounded"/>
|
||||||
|
</sequence>
|
||||||
|
<attribute name="point" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="id" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="name" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute translatable="true"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="id-association">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="id" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="icon" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="resource"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="page" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.ui.dialogs.ICOptionPage"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="ui-edit-entries" type="boolean">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="ui-clear-entries" type="boolean">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<element name="class-association">
|
||||||
|
<complexType>
|
||||||
|
<attribute name="class" type="string" use="required">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="icon" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="resource"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="page" type="string">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.attribute kind="java" basedOn=":org.eclipse.cdt.ui.dialogs.ICOptionPage"/>
|
||||||
|
</appInfo>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="ui-clear-entries" type="boolean">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="ui-edit-entries" type="boolean">
|
||||||
|
<annotation>
|
||||||
|
<documentation>
|
||||||
|
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
</attribute>
|
||||||
|
</complexType>
|
||||||
|
</element>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="since"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter the first release in which this extension point appears.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="examples"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter extension point usage example here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="apiinfo"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter API information here.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
<annotation>
|
||||||
|
<appInfo>
|
||||||
|
<meta.section type="implementation"/>
|
||||||
|
</appInfo>
|
||||||
|
<documentation>
|
||||||
|
[Enter information about supplied implementation of this extension point.]
|
||||||
|
</documentation>
|
||||||
|
</annotation>
|
||||||
|
|
||||||
|
|
||||||
|
</schema>
|