mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 15:35:24 +02:00
bug 382423: Add Builtin Compiler Settings LSP provider for Cygwin toolchain
This commit is contained in:
parent
bbea2db0b4
commit
62eeab5ef6
8 changed files with 343 additions and 47 deletions
|
@ -225,6 +225,7 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
|
|
||||||
provider.execute();
|
provider.execute();
|
||||||
assertEquals(true, provider.isExecuted());
|
assertEquals(true, provider.isExecuted());
|
||||||
|
assertEquals(null, provider.getSettingEntries(null, null, null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +308,9 @@ public class BuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
// check entries
|
// check entries
|
||||||
{
|
{
|
||||||
MockDetectorCloneable clone = provider.clone();
|
MockDetectorCloneable clone = provider.clone();
|
||||||
clone.setSettingEntries(null, null, null, null);
|
List<ICLanguageSettingEntry> entries2 = new ArrayList<ICLanguageSettingEntry>();
|
||||||
|
entries2.add(new CMacroEntry("MACRO2", "VALUE2", ICSettingEntry.BUILTIN | ICSettingEntry.READONLY));
|
||||||
|
clone.setSettingEntries(null, null, null, entries2);
|
||||||
assertFalse(provider.equals(clone));
|
assertFalse(provider.equals(clone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,16 +14,23 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.dom.ast.gnu.c.GCCLanguage;
|
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.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.ICLanguageSettingEntry;
|
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.settings.model.ICSettingEntry;
|
||||||
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
import org.eclipse.cdt.core.testplugin.ResourceHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
import org.eclipse.cdt.internal.core.Cygwin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorCygwin;
|
||||||
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector;
|
||||||
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.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test cases to test GCC built-in specs detector.
|
* Test cases to test GCC built-in specs detector.
|
||||||
|
@ -45,6 +52,20 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mock GCCBuiltinSpecsDetectorCygwin to gain access to protected methods.
|
||||||
|
*/
|
||||||
|
class MockGCCBuiltinSpecsDetectorCygwin extends GCCBuiltinSpecsDetectorCygwin {
|
||||||
|
@Override
|
||||||
|
public void startupForLanguage(String languageId) throws CoreException {
|
||||||
|
super.startupForLanguage(languageId);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void shutdownForLanguage() {
|
||||||
|
super.shutdownForLanguage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
@ -55,6 +76,21 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to fetch configuration descriptions.
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test expansion of variables in build command.
|
* Test expansion of variables in build command.
|
||||||
*/
|
*/
|
||||||
|
@ -365,4 +401,68 @@ public class GCCBuiltinSpecsDetectorTest extends BaseTestCase {
|
||||||
assertEquals(1, entries.size());
|
assertEquals(1, entries.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test parsing of include directives for Cygwin for global provider.
|
||||||
|
*/
|
||||||
|
public void testGCCBuiltinSpecsDetector_Cygwin_NoProject() throws Exception {
|
||||||
|
if (!Cygwin.isAvailable()) {
|
||||||
|
// Skip the test if Cygwin is not available.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String cygwinLocation = "/usr/include";
|
||||||
|
String windowsLocation = ResourceHelper.cygwinToWindowsPath(cygwinLocation);
|
||||||
|
assertTrue("windowsLocation=["+windowsLocation+"]", new Path(windowsLocation).getDevice()!=null);
|
||||||
|
|
||||||
|
MockGCCBuiltinSpecsDetectorCygwin detector = new MockGCCBuiltinSpecsDetectorCygwin();
|
||||||
|
|
||||||
|
detector.startup(null, null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#include <...> search starts here:");
|
||||||
|
detector.processLine(" /usr/include");
|
||||||
|
detector.processLine("End of search list.");
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test parsing of include directives for Cygwin for provider running for a configuration.
|
||||||
|
*/
|
||||||
|
public void testGCCBuiltinSpecsDetector_Cygwin_Configuration() throws Exception {
|
||||||
|
if (!Cygwin.isAvailable()) {
|
||||||
|
// Skip the test if Cygwin is not available.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String cygwinLocation = "/usr/include";
|
||||||
|
String windowsLocation = ResourceHelper.cygwinToWindowsPath(cygwinLocation);
|
||||||
|
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, null);
|
||||||
|
detector.startupForLanguage(null);
|
||||||
|
detector.processLine("#include <...> search starts here:");
|
||||||
|
detector.processLine(" /usr/include");
|
||||||
|
detector.processLine("End of search list.");
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -613,6 +613,14 @@
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
</provider>
|
</provider>
|
||||||
|
<provider
|
||||||
|
class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorCygwin"
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorCygwin"
|
||||||
|
name="CDT GCC Builtin Compiler Settings Cygwin"
|
||||||
|
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
|
<provider
|
||||||
class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW"
|
class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW"
|
||||||
id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW"
|
id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW"
|
||||||
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2009, 2013 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.language.settings.providers;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.EFSExtensionProvider;
|
||||||
|
import org.eclipse.cdt.internal.core.Cygwin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to detect built-in compiler settings for Cygwin toolchain.
|
||||||
|
* The paths are converted to cygwin "file-system" representation.
|
||||||
|
*/
|
||||||
|
public class GCCBuiltinSpecsDetectorCygwin extends GCCBuiltinSpecsDetector {
|
||||||
|
// ID must match the tool-chain definition in org.eclipse.cdt.managedbuilder.core.buildDefinitions extension point
|
||||||
|
private static final String GCC_TOOLCHAIN_ID_CYGWIN = "cdt.managedbuild.toolchain.gnu.cygwin.base"; //$NON-NLS-1$
|
||||||
|
private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EFSExtensionProvider for Cygwin translations
|
||||||
|
*/
|
||||||
|
private class CygwinEFSExtensionProvider extends EFSExtensionProvider {
|
||||||
|
private String envPathValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
* @param envPathValue - Value of environment variable $PATH.
|
||||||
|
*/
|
||||||
|
public CygwinEFSExtensionProvider(String envPathValue) {
|
||||||
|
this.envPathValue = envPathValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMappedPath(URI locationURI) {
|
||||||
|
String windowsPath = null;
|
||||||
|
try {
|
||||||
|
String cygwinPath = getPathFromURI(locationURI);
|
||||||
|
windowsPath = Cygwin.cygwinToWindowsPath(cygwinPath, envPathValue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ManagedBuilderCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
if (windowsPath != null) {
|
||||||
|
return windowsPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getMappedPath(locationURI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToolchainId() {
|
||||||
|
return GCC_TOOLCHAIN_ID_CYGWIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected EFSExtensionProvider getEFSProvider() {
|
||||||
|
String envPathValue = environmentMap != null ? environmentMap.get(ENV_PATH) : null;
|
||||||
|
return new CygwinEFSExtensionProvider(envPathValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetectorCygwin cloneShallow() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetectorCygwin) super.cloneShallow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetectorCygwin clone() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetectorCygwin) super.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2011 Andrew Gvozdev and others.
|
* Copyright (c) 2009, 2013 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
|
||||||
|
@ -17,8 +17,11 @@ import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -46,7 +49,6 @@ import org.eclipse.cdt.internal.core.XmlUtil;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
||||||
import org.eclipse.cdt.utils.CommandLineUtil;
|
import org.eclipse.cdt.utils.CommandLineUtil;
|
||||||
import org.eclipse.cdt.utils.envvar.EnvironmentCollector;
|
|
||||||
import org.eclipse.core.resources.IMarker;
|
import org.eclipse.core.resources.IMarker;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
@ -97,9 +99,11 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
private static final String ATTR_PARAMETER = "parameter"; //$NON-NLS-1$
|
private static final String ATTR_PARAMETER = "parameter"; //$NON-NLS-1$
|
||||||
private static final String ATTR_CONSOLE = "console"; //$NON-NLS-1$
|
private static final String ATTR_CONSOLE = "console"; //$NON-NLS-1$
|
||||||
|
private static final String ATTR_ENV_HASH = "env-hash"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final String ENV_LANGUAGE = "LANGUAGE"; //$NON-NLS-1$
|
private static final String ENV_LANGUAGE = "LANGUAGE"; //$NON-NLS-1$
|
||||||
private static final String ENV_LC_ALL = "LC_ALL"; //$NON-NLS-1$
|
private static final String ENV_LC_ALL = "LC_ALL"; //$NON-NLS-1$
|
||||||
|
private static final String ENV_PATH = "PATH"; //$NON-NLS-1$
|
||||||
|
|
||||||
private static final int MONITOR_SCALE = 100;
|
private static final int MONITOR_SCALE = 100;
|
||||||
private static final int TICKS_REMOVE_MARKERS = 1 * MONITOR_SCALE;
|
private static final int TICKS_REMOVE_MARKERS = 1 * MONITOR_SCALE;
|
||||||
|
@ -112,9 +116,15 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
protected URI buildDirURI = null;
|
protected URI buildDirURI = null;
|
||||||
protected java.io.File specFile = null;
|
protected java.io.File specFile = null;
|
||||||
protected boolean preserveSpecFile = false;
|
protected boolean preserveSpecFile = false;
|
||||||
|
/** @since 8.2 */
|
||||||
|
protected IEnvironmentVariableManager envMngr = null;
|
||||||
|
/** @since 8.2 */
|
||||||
|
protected volatile Map<String, String> environmentMap = null;
|
||||||
|
|
||||||
protected List<ICLanguageSettingEntry> detectedSettingEntries = null;
|
protected List<ICLanguageSettingEntry> detectedSettingEntries = null;
|
||||||
protected int collected = 0;
|
protected int collected = 0;
|
||||||
protected boolean isExecuted = false;
|
protected volatile boolean isExecuted = false;
|
||||||
|
private int envPathHash = 0;
|
||||||
|
|
||||||
private BuildRunnerHelper buildRunnerHelper;
|
private BuildRunnerHelper buildRunnerHelper;
|
||||||
private SDMarkerGenerator markerGenerator = new SDMarkerGenerator();
|
private SDMarkerGenerator markerGenerator = new SDMarkerGenerator();
|
||||||
|
@ -348,6 +358,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
|
|
||||||
mappedRootURI = null;
|
mappedRootURI = null;
|
||||||
buildDirURI = getBuildDirURI(mappedRootURI);
|
buildDirURI = getBuildDirURI(mappedRootURI);
|
||||||
|
environmentMap = createEnvironmentMap(currentCfgDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -358,18 +369,46 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
super.shutdown();
|
super.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method does 2 related things:
|
||||||
|
* <br>
|
||||||
|
* 1. Validate environment, i.e. check that environment for running the command has not changed.
|
||||||
|
* If environment changed {@link #execute()} will rerun the command even if flag {@link #isExecuted}
|
||||||
|
* suggests that it was run already.
|
||||||
|
* <br>
|
||||||
|
* 2. The relevant environment is cached here so the new one is validated against it at the next call.
|
||||||
|
* {@link #validateEnvironment()} will be called right before running the job to execute the command.
|
||||||
|
*
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
protected boolean validateEnvironment() {
|
||||||
|
String envPathValue = environmentMap.get(ENV_PATH);
|
||||||
|
int envPathValueHash = envPathValue != null ? envPathValue.hashCode() : 0;
|
||||||
|
if (envPathValueHash != envPathHash || envPathValueHash == 0) {
|
||||||
|
envPathHash = envPathValueHash;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute provider's command which is expected to print built-in compiler options (specs) to build output.
|
* Execute provider's command which is expected to print built-in compiler options (specs) to build output.
|
||||||
* The parser will parse output and generate language settings for corresponding resources.
|
* The parser will parse output and generate language settings for corresponding resources.
|
||||||
*/
|
*/
|
||||||
protected void execute() {
|
protected void execute() {
|
||||||
if (isExecuted) {
|
environmentMap = createEnvironmentMap(currentCfgDescription);
|
||||||
|
if (validateEnvironment() && isExecuted) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkspaceJob job = new WorkspaceJob(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.DiscoverBuiltInSettingsJobName")) { //$NON-NLS-1$
|
WorkspaceJob job = new WorkspaceJob(ManagedMakeMessages.getResourceString("AbstractBuiltinSpecsDetector.DiscoverBuiltInSettingsJobName")) { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
|
isExecuted = false;
|
||||||
|
if (!isEmpty()) {
|
||||||
|
clear();
|
||||||
|
serializeLanguageSettings(currentCfgDescription);
|
||||||
|
}
|
||||||
IStatus status;
|
IStatus status;
|
||||||
try {
|
try {
|
||||||
startup(currentCfgDescription, null);
|
startup(currentCfgDescription, null);
|
||||||
|
@ -550,7 +589,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] envp = getEnvp();
|
String[] envp = toEnvp(environmentMap);
|
||||||
|
|
||||||
// Using GMAKE_ERROR_PARSER_ID as it can handle generated error messages
|
// Using GMAKE_ERROR_PARSER_ID as it can handle generated error messages
|
||||||
ErrorParserManager epm = new ErrorParserManager(currentProject, buildDirURI, markerGenerator, new String[] {GMAKE_ERROR_PARSER_ID});
|
ErrorParserManager epm = new ErrorParserManager(currentProject, buildDirURI, markerGenerator, new String[] {GMAKE_ERROR_PARSER_ID});
|
||||||
|
@ -592,8 +631,10 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
* @since 8.2
|
* @since 8.2
|
||||||
*/
|
*/
|
||||||
protected List<IEnvironmentVariable> getEnvironmentVariables() {
|
protected List<IEnvironmentVariable> getEnvironmentVariables() {
|
||||||
IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
if (envMngr == null) {
|
||||||
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(Arrays.asList(mngr.getVariables(currentCfgDescription, true)));
|
envMngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
|
}
|
||||||
|
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(Arrays.asList(envMngr.getVariables(currentCfgDescription, true)));
|
||||||
|
|
||||||
// On POSIX (Linux, UNIX) systems reset language variables to default (English)
|
// On POSIX (Linux, UNIX) systems reset language variables to default (English)
|
||||||
// with UTF-8 encoding since GNU compilers can handle only UTF-8 characters.
|
// with UTF-8 encoding since GNU compilers can handle only UTF-8 characters.
|
||||||
|
@ -608,16 +649,23 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get array of environment variables in format "var=value".
|
* Create a handy map of environment variables.
|
||||||
*/
|
*/
|
||||||
private String[] getEnvp() {
|
private Map<String, String> createEnvironmentMap(ICConfigurationDescription cfgDescription) {
|
||||||
EnvironmentCollector collector = new EnvironmentCollector();
|
Map<String, String> envMap = new HashMap<String, String>();
|
||||||
List<IEnvironmentVariable> vars = getEnvironmentVariables();
|
for (IEnvironmentVariable var : getEnvironmentVariables()) {
|
||||||
collector.addVariables(vars.toArray(new IEnvironmentVariable[vars.size()]));
|
envMap.put(var.getName(), var.getValue());
|
||||||
|
}
|
||||||
|
return envMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert map of environment variables to array in format "var=value".
|
||||||
|
*/
|
||||||
|
private String[] toEnvp(Map<String, String> environmentMap) {
|
||||||
Set<String> envp = new HashSet<String>();
|
Set<String> envp = new HashSet<String>();
|
||||||
for (IEnvironmentVariable var : collector.getVariables()) {
|
for (Entry<String, String> var: environmentMap.entrySet()) {
|
||||||
envp.add(var.getName() + '=' + var.getValue());
|
envp.add(var.getKey() + '=' + var.getValue());
|
||||||
}
|
}
|
||||||
return envp.toArray(new String[envp.size()]);
|
return envp.toArray(new String[envp.size()]);
|
||||||
}
|
}
|
||||||
|
@ -736,6 +784,9 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
public Element serializeAttributes(Element parentElement) {
|
public Element serializeAttributes(Element parentElement) {
|
||||||
Element elementProvider = super.serializeAttributes(parentElement);
|
Element elementProvider = super.serializeAttributes(parentElement);
|
||||||
elementProvider.setAttribute(ATTR_CONSOLE, Boolean.toString(isConsoleEnabled));
|
elementProvider.setAttribute(ATTR_CONSOLE, Boolean.toString(isConsoleEnabled));
|
||||||
|
if (envPathHash != 0) {
|
||||||
|
elementProvider.setAttribute(ATTR_ENV_HASH, Integer.toString(envPathHash));
|
||||||
|
}
|
||||||
return elementProvider;
|
return elementProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -747,6 +798,16 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
if (consoleValue != null) {
|
if (consoleValue != null) {
|
||||||
isConsoleEnabled = Boolean.parseBoolean(consoleValue);
|
isConsoleEnabled = Boolean.parseBoolean(consoleValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
envPathHash = 0;
|
||||||
|
String envPathHashStr = XmlUtil.determineAttributeValue(providerNode, ATTR_ENV_HASH);
|
||||||
|
if (envPathHashStr != null) {
|
||||||
|
try {
|
||||||
|
envPathHash = Integer.parseInt(envPathHashStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Wrong integer format [" + envPathHashStr + "]", e)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -774,6 +835,9 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
protected AbstractBuiltinSpecsDetector cloneShallow() throws CloneNotSupportedException {
|
protected AbstractBuiltinSpecsDetector cloneShallow() throws CloneNotSupportedException {
|
||||||
AbstractBuiltinSpecsDetector clone = (AbstractBuiltinSpecsDetector) super.cloneShallow();
|
AbstractBuiltinSpecsDetector clone = (AbstractBuiltinSpecsDetector) super.cloneShallow();
|
||||||
clone.isExecuted = false;
|
clone.isExecuted = false;
|
||||||
|
clone.envMngr = null;
|
||||||
|
clone.environmentMap = null;
|
||||||
|
clone.envPathHash = 0;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,6 +847,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
int result = super.hashCode();
|
int result = super.hashCode();
|
||||||
result = prime * result + (isConsoleEnabled ? 1231 : 1237);
|
result = prime * result + (isConsoleEnabled ? 1231 : 1237);
|
||||||
result = prime * result + (isExecuted ? 1231 : 1237);
|
result = prime * result + (isExecuted ? 1231 : 1237);
|
||||||
|
result = prime * result + envPathHash;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,13 +857,15 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
return true;
|
return true;
|
||||||
if (!super.equals(obj))
|
if (!super.equals(obj))
|
||||||
return false;
|
return false;
|
||||||
if (!(obj instanceof AbstractBuiltinSpecsDetector))
|
if (getClass() != obj.getClass())
|
||||||
return false;
|
return false;
|
||||||
AbstractBuiltinSpecsDetector other = (AbstractBuiltinSpecsDetector) obj;
|
AbstractBuiltinSpecsDetector other = (AbstractBuiltinSpecsDetector) obj;
|
||||||
if (isConsoleEnabled != other.isConsoleEnabled)
|
if (isConsoleEnabled != other.isConsoleEnabled)
|
||||||
return false;
|
return false;
|
||||||
if (isExecuted != other.isExecuted)
|
if (isExecuted != other.isExecuted)
|
||||||
return false;
|
return false;
|
||||||
|
if (envPathHash != other.envPathHash)
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2012 Andrew Gvozdev and others.
|
* Copyright (c) 2009, 2013 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
|
||||||
|
@ -25,6 +25,7 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.EFSExtensionProvider;
|
||||||
import org.eclipse.cdt.core.ErrorParserManager;
|
import org.eclipse.cdt.core.ErrorParserManager;
|
||||||
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
import org.eclipse.cdt.core.cdtvariables.CdtVariableException;
|
||||||
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
|
import org.eclipse.cdt.core.cdtvariables.ICdtVariableManager;
|
||||||
|
@ -80,6 +81,37 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
protected String parsedResourceName = null;
|
protected String parsedResourceName = null;
|
||||||
protected boolean isResolvingPaths = true;
|
protected boolean isResolvingPaths = true;
|
||||||
|
|
||||||
|
/** @since 8.2 */
|
||||||
|
protected EFSExtensionProvider efsProvider = null;
|
||||||
|
|
||||||
|
private static final EFSExtensionProvider efsProviderDefault = new EFSExtensionProvider() {
|
||||||
|
final EFSExtensionManager efsManager = EFSExtensionManager.getDefault();
|
||||||
|
@Override
|
||||||
|
public String getPathFromURI(URI locationURI) {
|
||||||
|
return efsManager.getPathFromURI(locationURI);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public URI getLinkedURI(URI locationURI) {
|
||||||
|
return efsManager.getLinkedURI(locationURI);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public URI createNewURIFromPath(URI locationOnSameFilesystem, String path) {
|
||||||
|
return efsManager.createNewURIFromPath(locationOnSameFilesystem, path);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getMappedPath(URI locationURI) {
|
||||||
|
return efsManager.getMappedPath(locationURI);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isVirtual(URI locationURI) {
|
||||||
|
return efsManager.isVirtual(locationURI);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public URI append(URI baseURI, String extension) {
|
||||||
|
return efsManager.append(baseURI, extension);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class defining common functionality for option parsers.
|
* Abstract class defining common functionality for option parsers.
|
||||||
* The purpose of this parser is to parse a portion of string representing
|
* The purpose of this parser is to parse a portion of string representing
|
||||||
|
@ -373,6 +405,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
this.currentCfgDescription = cfgDescription;
|
this.currentCfgDescription = cfgDescription;
|
||||||
this.currentProject = cfgDescription != null ? cfgDescription.getProjectDescription().getProject() : null;
|
this.currentProject = cfgDescription != null ? cfgDescription.getProjectDescription().getProject() : null;
|
||||||
this.cwdTracker = cwdTracker;
|
this.cwdTracker = cwdTracker;
|
||||||
|
this.efsProvider = getEFSProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -429,7 +462,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
if (isResolvingPaths && (optionParser.isForFile() || optionParser.isForFolder())) {
|
if (isResolvingPaths && (optionParser.isForFile() || optionParser.isForFolder())) {
|
||||||
URI baseURI = mappedRootURI;
|
URI baseURI = mappedRootURI;
|
||||||
if (buildDirURI != null && !new Path(optionParser.parsedName).isAbsolute()) {
|
if (buildDirURI != null && !new Path(optionParser.parsedName).isAbsolute()) {
|
||||||
baseURI = EFSExtensionManager.getDefault().append(mappedRootURI, buildDirURI.getPath());
|
baseURI = efsProvider.append(mappedRootURI, buildDirURI.getPath());
|
||||||
}
|
}
|
||||||
entry = createResolvedPathEntry(optionParser, optionParser.parsedName, 0, baseURI);
|
entry = createResolvedPathEntry(optionParser, optionParser.parsedName, 0, baseURI);
|
||||||
} else {
|
} else {
|
||||||
|
@ -494,7 +527,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this creates URI with schema and other components from resourceURI but path as mappedRoot
|
// this creates URI with schema and other components from resourceURI but path as mappedRoot
|
||||||
URI uri = EFSExtensionManager.getDefault().createNewURIFromPath(resourceURI, mappedRoot);
|
URI uri = efsProvider.createNewURIFromPath(resourceURI, mappedRoot);
|
||||||
return uri;
|
return uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,9 +546,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
if (currentResource != null && parsedResourceName != null && !new Path(parsedResourceName).isAbsolute()) {
|
if (currentResource != null && parsedResourceName != null && !new Path(parsedResourceName).isAbsolute()) {
|
||||||
cwdURI = findBaseLocationURI(currentResource.getLocationURI(), parsedResourceName);
|
cwdURI = findBaseLocationURI(currentResource.getLocationURI(), parsedResourceName);
|
||||||
}
|
}
|
||||||
String cwdPath = cwdURI != null ? EFSExtensionManager.getDefault().getPathFromURI(cwdURI) : null;
|
String cwdPath = cwdURI != null ? efsProvider.getPathFromURI(cwdURI) : null;
|
||||||
if (cwdPath != null && mappedRootURI != null) {
|
if (cwdPath != null && mappedRootURI != null) {
|
||||||
buildDirURI = EFSExtensionManager.getDefault().append(mappedRootURI, cwdPath);
|
buildDirURI = efsProvider.append(mappedRootURI, cwdPath);
|
||||||
} else {
|
} else {
|
||||||
buildDirURI = cwdURI;
|
buildDirURI = cwdURI;
|
||||||
}
|
}
|
||||||
|
@ -674,7 +707,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
if (sourceFile == null && cwdTracker != null) {
|
if (sourceFile == null && cwdTracker != null) {
|
||||||
URI cwdURI = cwdTracker.getWorkingDirectoryURI();
|
URI cwdURI = cwdTracker.getWorkingDirectoryURI();
|
||||||
if (cwdURI != null) {
|
if (cwdURI != null) {
|
||||||
URI uri = EFSExtensionManager.getDefault().append(cwdURI, parsedResourceName);
|
URI uri = efsProvider.append(cwdURI, parsedResourceName);
|
||||||
sourceFile = findFileForLocationURI(uri, currentProject);
|
sourceFile = findFileForLocationURI(uri, currentProject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -804,7 +837,7 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
* @param baseURI - base {@link URI} where path to the resource is rooted
|
* @param baseURI - base {@link URI} where path to the resource is rooted
|
||||||
* @return {@link URI} of the resource
|
* @return {@link URI} of the resource
|
||||||
*/
|
*/
|
||||||
private static URI determineMappedURI(String pathStr, URI baseURI) {
|
private URI determineMappedURI(String pathStr, URI baseURI) {
|
||||||
URI uri = null;
|
URI uri = null;
|
||||||
|
|
||||||
if (baseURI == null) {
|
if (baseURI == null) {
|
||||||
|
@ -819,9 +852,9 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
} else {
|
} else {
|
||||||
// location on a remote file-system
|
// location on a remote file-system
|
||||||
IPath path = new Path(pathStr); // use canonicalized path here, in particular replace all '\' with '/' for Windows paths
|
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());
|
URI remoteUri = efsProvider.append(baseURI, path.toString());
|
||||||
if (remoteUri != null) {
|
if (remoteUri != null) {
|
||||||
String localPath = EFSExtensionManager.getDefault().getMappedPath(remoteUri);
|
String localPath = efsProvider.getMappedPath(remoteUri);
|
||||||
if (localPath != null) {
|
if (localPath != null) {
|
||||||
uri = org.eclipse.core.filesystem.URIUtil.toURI(localPath);
|
uri = org.eclipse.core.filesystem.URIUtil.toURI(localPath);
|
||||||
}
|
}
|
||||||
|
@ -929,13 +962,13 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get location on the local file-system considering possible mapping by {@link EFSExtensionManager}.
|
* Get location on the local file-system considering possible mapping by EFS provider. See {@link EFSExtensionManager}.
|
||||||
*/
|
*/
|
||||||
private static IPath getFilesystemLocation(URI uri) {
|
private IPath getFilesystemLocation(URI uri) {
|
||||||
if (uri == null)
|
if (uri == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
String pathStr = EFSExtensionManager.getDefault().getMappedPath(uri);
|
String pathStr = efsProvider.getMappedPath(uri);
|
||||||
uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
|
uri = org.eclipse.core.filesystem.URIUtil.toURI(pathStr);
|
||||||
|
|
||||||
if (uri != null && uri.isAbsolute()) {
|
if (uri != null && uri.isAbsolute()) {
|
||||||
|
@ -1066,6 +1099,20 @@ public abstract class AbstractLanguageSettingsOutputScanner extends LanguageSett
|
||||||
return pattern;
|
return pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This {@link EFSExtensionProvider} is capable to translate EFS paths to and from local
|
||||||
|
* file-system. Added mostly for Cygwin translations.
|
||||||
|
*
|
||||||
|
* This usage of {@link EFSExtensionProvider} is somewhat a misnomer. This provider is not
|
||||||
|
* an "extension" provider but rather a wrapper on {@link EFSExtensionManager} which in fact
|
||||||
|
* will use genuine {@link EFSExtensionProvider}s defined as extensions.
|
||||||
|
*
|
||||||
|
* @since 8.2
|
||||||
|
*/
|
||||||
|
protected EFSExtensionProvider getEFSProvider() {
|
||||||
|
return efsProviderDefault;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Element serializeAttributes(Element parentElement) {
|
public Element serializeAttributes(Element parentElement) {
|
||||||
Element elementProvider = super.serializeAttributes(parentElement);
|
Element elementProvider = super.serializeAttributes(parentElement);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009, 2012 Andrew Gvozdev and others.
|
* Copyright (c) 2009, 2013 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
|
||||||
|
@ -11,22 +11,17 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.managedbuilder.language.settings.providers;
|
package org.eclipse.cdt.managedbuilder.language.settings.providers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
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.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
|
import org.eclipse.cdt.managedbuilder.internal.envvar.EnvironmentVariableManagerToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
|
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract parser capable to execute compiler command printing built-in compiler
|
* Abstract parser capable to execute compiler command printing built-in compiler
|
||||||
|
@ -120,19 +115,12 @@ public abstract class ToolchainBuiltinSpecsDetector extends AbstractBuiltinSpecs
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<IEnvironmentVariable> getEnvironmentVariables() {
|
protected List<IEnvironmentVariable> getEnvironmentVariables() {
|
||||||
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(super.getEnvironmentVariables());
|
if (envMngr == null && currentCfgDescription == null) {
|
||||||
|
// For global provider need to include toolchain in the equation
|
||||||
String toolchainId = getToolchainId();
|
IToolChain toolchain = ManagedBuildManager.getExtensionToolChain(getToolchainId());
|
||||||
for (IToolChain toolchain = ManagedBuildManager.getExtensionToolChain(toolchainId); toolchain != null; toolchain = toolchain.getSuperClass()) {
|
envMngr = new EnvironmentVariableManagerToolChain(toolchain);
|
||||||
IConfigurationEnvironmentVariableSupplier envSupplier = toolchain.getEnvironmentVariableSupplier();
|
|
||||||
if (envSupplier != null) {
|
|
||||||
IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(currentCfgDescription);
|
|
||||||
IEnvironmentVariableProvider provider = ManagedBuildManager.getEnvironmentVariableProvider();
|
|
||||||
IBuildEnvironmentVariable[] added = envSupplier.getVariables(cfg, provider);
|
|
||||||
vars.addAll(Arrays.asList(added));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
List<IEnvironmentVariable> vars = super.getEnvironmentVariables();
|
||||||
|
|
||||||
return vars;
|
return vars;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1772,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.managedbuilder.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">
|
||||||
|
|
Loading…
Add table
Reference in a new issue