mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
bug 382422: [sd90] Add MinGW specs detector
This commit is contained in:
parent
3f3026481c
commit
2df46fd99f
11 changed files with 178 additions and 52 deletions
|
@ -621,6 +621,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.GCCBuiltinSpecsDetectorMinGW"
|
||||||
|
id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW"
|
||||||
|
name="CDT GCC Builtin Compiler Settings MinGW"
|
||||||
|
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.language.settings.providers.GCCBuildCommandParser"
|
class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser"
|
||||||
id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"
|
id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"
|
||||||
|
|
|
@ -18,11 +18,13 @@ import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpec
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to detect built-in compiler settings.
|
* Class to detect built-in compiler settings for Cygwin toolchain.
|
||||||
* The paths are converted to cygwin "file-system" representation.
|
* The paths are converted to cygwin "file-system" representation.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class GCCBuiltinSpecsDetectorCygwin extends GCCBuiltinSpecsDetector {
|
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 URI CYGWIN_ROOT;
|
private static final URI CYGWIN_ROOT;
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
|
@ -33,6 +35,11 @@ public class GCCBuiltinSpecsDetectorCygwin extends GCCBuiltinSpecsDetector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToolchainId() {
|
||||||
|
return GCC_TOOLCHAIN_ID_CYGWIN;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected URI getMappedRootURI(IResource sourceFile, String parsedResourceName) {
|
protected URI getMappedRootURI(IResource sourceFile, String parsedResourceName) {
|
||||||
if (mappedRootURI == null) {
|
if (mappedRootURI == null) {
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2012, 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.managedbuilder.internal.language.settings.providers;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to detect built-in compiler settings for MinGW toolchain.
|
||||||
|
*/
|
||||||
|
public class GCCBuiltinSpecsDetectorMinGW 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_MINGW = "cdt.managedbuild.toolchain.gnu.mingw.base"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getToolchainId() {
|
||||||
|
return GCC_TOOLCHAIN_ID_MINGW;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetectorMinGW cloneShallow() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetectorMinGW) super.cloneShallow();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GCCBuiltinSpecsDetectorMinGW clone() throws CloneNotSupportedException {
|
||||||
|
return (GCCBuiltinSpecsDetectorMinGW) super.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -17,8 +17,9 @@ 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.Iterator;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CommandLauncher;
|
import org.eclipse.cdt.core.CommandLauncher;
|
||||||
|
@ -27,6 +28,9 @@ import org.eclipse.cdt.core.ICommandLauncher;
|
||||||
import org.eclipse.cdt.core.IConsoleParser;
|
import org.eclipse.cdt.core.IConsoleParser;
|
||||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||||
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
import org.eclipse.cdt.core.ProblemMarkerInfo;
|
||||||
|
import org.eclipse.cdt.core.envvar.EnvironmentVariable;
|
||||||
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||||
|
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ICBuildOutputParser;
|
import org.eclipse.cdt.core.language.settings.providers.ICBuildOutputParser;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ICListenerAgent;
|
import org.eclipse.cdt.core.language.settings.providers.ICListenerAgent;
|
||||||
import org.eclipse.cdt.core.language.settings.providers.IWorkingDirectoryTracker;
|
import org.eclipse.cdt.core.language.settings.providers.IWorkingDirectoryTracker;
|
||||||
|
@ -43,6 +47,7 @@ import org.eclipse.cdt.internal.core.language.settings.providers.LanguageSetting
|
||||||
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;
|
||||||
|
@ -149,7 +154,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return new Status(Status.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error checking markers.", e); //$NON-NLS-1$
|
return new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error checking markers.", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -166,7 +171,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
marker.setAttribute(IMarker.LOCATION, msgProperties);
|
marker.setAttribute(IMarker.LOCATION, msgProperties);
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return new Status(Status.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error adding markers.", e); //$NON-NLS-1$
|
return new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error adding markers.", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
|
@ -192,7 +197,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
ManagedBuilderCorePlugin.log(new Status(Status.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error deleting markers.", e)); //$NON-NLS-1$
|
ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error deleting markers.", e)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -596,26 +601,39 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get array of environment variables in format "var=value".
|
* Returns list of environment variables to be used during execution of provider's command.
|
||||||
|
* Implementers are expected to add their variables to the end of the list.
|
||||||
|
*
|
||||||
|
* @return list of environment variables.
|
||||||
*/
|
*/
|
||||||
private String[] getEnvp() {
|
protected List<IEnvironmentVariable> getEnvironmentVariables() {
|
||||||
|
IEnvironmentVariableManager mngr = CCorePlugin.getDefault().getBuildEnvironmentManager();
|
||||||
|
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(Arrays.asList(mngr.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.
|
||||||
// Include paths with locale characters will be handled properly regardless
|
// Include paths with locale characters will be handled properly regardless
|
||||||
// of the language as long as the encoding is set to UTF-8.
|
// of the language as long as the encoding is set to UTF-8.
|
||||||
// English language is set for parser because it relies on English messages
|
// English language is set for parser because it relies on English messages
|
||||||
// in the output of the 'gcc -v' command.
|
// in the output of the 'gcc -v' command.
|
||||||
|
vars.add(new EnvironmentVariable(ENV_LANGUAGE, "en")); //$NON-NLS-1$
|
||||||
|
vars.add(new EnvironmentVariable(ENV_LC_ALL, "C.UTF-8")); //$NON-NLS-1$
|
||||||
|
|
||||||
List<String> envp = new ArrayList<String>(Arrays.asList(BuildRunnerHelper.getEnvp(currentCfgDescription)));
|
return vars;
|
||||||
for (Iterator<String> iterator = envp.iterator(); iterator.hasNext();) {
|
}
|
||||||
String var = iterator.next();
|
|
||||||
if (var.startsWith(ENV_LANGUAGE + '=') || var.startsWith(ENV_LC_ALL + '=')) {
|
/**
|
||||||
iterator.remove();
|
* Get array of environment variables in format "var=value".
|
||||||
}
|
*/
|
||||||
|
private String[] getEnvp() {
|
||||||
|
EnvironmentCollector collector = new EnvironmentCollector();
|
||||||
|
List<IEnvironmentVariable> vars = getEnvironmentVariables();
|
||||||
|
collector.addVariables(vars.toArray(new IEnvironmentVariable[vars.size()]));
|
||||||
|
|
||||||
|
Set<String> envp = new HashSet<String>();
|
||||||
|
for (IEnvironmentVariable var : collector.getVariables()) {
|
||||||
|
envp.add(var.getName() + '=' + var.getValue());
|
||||||
}
|
}
|
||||||
envp.add(ENV_LANGUAGE + "=en"); // override for GNU gettext //$NON-NLS-1$
|
|
||||||
envp.add(ENV_LC_ALL + "=C.UTF-8"); // for other parts of the system libraries //$NON-NLS-1$
|
|
||||||
|
|
||||||
return envp.toArray(new String[envp.size()]);
|
return envp.toArray(new String[envp.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class GCCBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getToolchainId() {
|
public String getToolchainId() {
|
||||||
return GCC_TOOLCHAIN_ID;
|
return GCC_TOOLCHAIN_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,22 @@
|
||||||
|
|
||||||
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.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
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.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
|
||||||
|
@ -43,7 +51,7 @@ public abstract class ToolchainBuiltinSpecsDetector extends AbstractBuiltinSpecs
|
||||||
* Tool-chain id must be supplied for global providers where we don't
|
* Tool-chain id must be supplied for global providers where we don't
|
||||||
* have configuration description to figure that out programmatically.
|
* have configuration description to figure that out programmatically.
|
||||||
*/
|
*/
|
||||||
protected abstract String getToolchainId();
|
public abstract String getToolchainId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds a tool handling given language in the tool-chain of the provider.
|
* Finds a tool handling given language in the tool-chain of the provider.
|
||||||
|
@ -109,4 +117,22 @@ public abstract class ToolchainBuiltinSpecsDetector extends AbstractBuiltinSpecs
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<IEnvironmentVariable> getEnvironmentVariables() {
|
||||||
|
List<IEnvironmentVariable> vars = new ArrayList<IEnvironmentVariable>(super.getEnvironmentVariables());
|
||||||
|
|
||||||
|
String toolchainId = getToolchainId();
|
||||||
|
for (IToolChain toolchain = ManagedBuildManager.getExtensionToolChain(toolchainId); toolchain != null; toolchain = toolchain.getSuperClass()) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vars;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1842,7 +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.managedbuilder.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
|
languageSettingsProviders="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW"
|
||||||
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">
|
||||||
|
|
|
@ -11,14 +11,21 @@
|
||||||
package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
|
package org.eclipse.cdt.managedbuilder.internal.ui.language.settings.providers;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
|
||||||
|
import org.eclipse.cdt.internal.ui.newui.StatusMessageLine;
|
||||||
|
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.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.AbstractBuiltinSpecsDetector;
|
||||||
|
import org.eclipse.cdt.managedbuilder.language.settings.providers.ToolchainBuiltinSpecsDetector;
|
||||||
|
import org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin;
|
||||||
import org.eclipse.cdt.ui.language.settings.providers.AbstractLanguageSettingProviderOptionPage;
|
import org.eclipse.cdt.ui.language.settings.providers.AbstractLanguageSettingProviderOptionPage;
|
||||||
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
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.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
|
@ -43,6 +50,8 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
|
||||||
private Text inputCommand;
|
private Text inputCommand;
|
||||||
private Button allocateConsoleCheckBox;
|
private Button allocateConsoleCheckBox;
|
||||||
|
|
||||||
|
private StatusMessageLine fStatusLine;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
fEditable = parent.isEnabled();
|
fEditable = parent.isEnabled();
|
||||||
|
@ -52,6 +61,7 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
|
||||||
createCompilerCommandInputControl(composite, provider);
|
createCompilerCommandInputControl(composite, provider);
|
||||||
createBrowseButton(composite);
|
createBrowseButton(composite);
|
||||||
createConsoleCheckbox(composite, provider);
|
createConsoleCheckbox(composite, provider);
|
||||||
|
createStatusLine(composite, provider);
|
||||||
|
|
||||||
setControl(composite);
|
setControl(composite);
|
||||||
}
|
}
|
||||||
|
@ -157,6 +167,25 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create status line to display messages for user.
|
||||||
|
*/
|
||||||
|
private void createStatusLine(Composite composite, AbstractBuiltinSpecsDetector provider) {
|
||||||
|
fStatusLine = new StatusMessageLine(composite, SWT.LEFT, 2);
|
||||||
|
|
||||||
|
if (provider instanceof ToolchainBuiltinSpecsDetector) {
|
||||||
|
String toolchainId = ((ToolchainBuiltinSpecsDetector) provider).getToolchainId();
|
||||||
|
IToolChain toolchain = ManagedBuildManager.getExtensionToolChain(toolchainId);
|
||||||
|
if (toolchain == null) {
|
||||||
|
fStatusLine.setErrorStatus(new Status(IStatus.ERROR, ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
||||||
|
IStatus.ERROR, "Toolchain support for CDT is not installed. Toolchain id=[" + toolchainId + "].", null));
|
||||||
|
} else if (!toolchain.isSupported()) {
|
||||||
|
fStatusLine.setErrorStatus(new Status(IStatus.INFO, ManagedBuilderUIPlugin.getUniqueIdentifier(), IStatus.INFO,
|
||||||
|
"Toolchain " + toolchain.getName() + " is not detected on this system.", null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performApply(IProgressMonitor monitor) throws CoreException {
|
public void performApply(IProgressMonitor monitor) throws CoreException {
|
||||||
ILanguageSettingsProvider provider = providerTab.getProvider(providerId);
|
ILanguageSettingsProvider provider = providerTab.getProvider(providerId);
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
|
||||||
// super();
|
// super();
|
||||||
plugin = this;
|
plugin = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
|
@ -100,7 +100,7 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
|
||||||
message = null;
|
message = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status = new Status(IStatus.ERROR, ManagedBuilderUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$
|
status = new Status(IStatus.ERROR, ManagedBuilderUIPlugin.getUniqueIdentifier(), -1, "Internal Error: ", t); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
ErrorDialog.openError(shell, title, message, status);
|
ErrorDialog.openError(shell, title, message, status);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answers the <code>Shell</code> associated with the active workbench, or
|
* Answers the <code>Shell</code> associated with the active workbench, or
|
||||||
* one of the windows associated with the workbench.
|
* one of the windows associated with the workbench.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -126,6 +126,6 @@ public class ManagedBuilderUIPlugin extends AbstractUIPlugin {
|
||||||
return windows[0].getShell();
|
return windows[0].getShell();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,21 +20,21 @@ import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is an utility class that implements environment variable operations
|
* This is an utility class that implements environment variable operations
|
||||||
* functionality: append, prepend, replace and remove
|
* functionality: append, prepend, replace and remove
|
||||||
*
|
*
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class EnvVarOperationProcessor {
|
public class EnvVarOperationProcessor {
|
||||||
/**
|
/**
|
||||||
* performs the environment variable operation given an initial variable and
|
* performs the environment variable operation given an initial variable and
|
||||||
* a variable representing an operation to be performed
|
* a variable representing an operation to be performed
|
||||||
* Returns a new variable the represents the result of a performed operation
|
* Returns a new variable the represents the result of a performed operation
|
||||||
*
|
*
|
||||||
* @param initial the initial variable
|
* @param initial the initial variable
|
||||||
* @param added the variable that specifies an operation to be performed on the
|
* @param added the variable that specifies an operation to be performed on the
|
||||||
* initial variable value
|
* initial variable value
|
||||||
* @return the new variable the represents the result of a performed operation
|
* @return the new variable the represents the result of a performed operation
|
||||||
*/
|
*/
|
||||||
static public IEnvironmentVariable performOperation(IEnvironmentVariable initial, IEnvironmentVariable added){
|
static public IEnvironmentVariable performOperation(IEnvironmentVariable initial, IEnvironmentVariable added){
|
||||||
if(initial == null){
|
if(initial == null){
|
||||||
|
@ -42,9 +42,9 @@ public class EnvVarOperationProcessor {
|
||||||
}
|
}
|
||||||
if(added == null)
|
if(added == null)
|
||||||
return initial;
|
return initial;
|
||||||
|
|
||||||
String name = added.getName();
|
String name = added.getName();
|
||||||
|
|
||||||
switch(added.getOperation()){
|
switch(added.getOperation()){
|
||||||
case IEnvironmentVariable.ENVVAR_REMOVE:
|
case IEnvironmentVariable.ENVVAR_REMOVE:
|
||||||
return new EnvironmentVariable(name,null,IEnvironmentVariable.ENVVAR_REMOVE,null);
|
return new EnvironmentVariable(name,null,IEnvironmentVariable.ENVVAR_REMOVE,null);
|
||||||
|
@ -82,24 +82,24 @@ public class EnvVarOperationProcessor {
|
||||||
return addValue;
|
return addValue;
|
||||||
if(addValue == null)
|
if(addValue == null)
|
||||||
return initialValue;
|
return initialValue;
|
||||||
|
|
||||||
if(delimiter == null || "".equals(delimiter)){ //$NON-NLS-1$
|
if(delimiter == null || "".equals(delimiter)){ //$NON-NLS-1$
|
||||||
return prepend ? addValue + initialValue : initialValue + addValue;
|
return prepend ? addValue + initialValue : initialValue + addValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> value = convertToList(initialValue, delimiter);
|
List<String> value = convertToList(initialValue, delimiter);
|
||||||
List<String> added = convertToList(addValue, delimiter);
|
List<String> added = convertToList(addValue, delimiter);
|
||||||
|
|
||||||
value = removeDuplicates(value, added);
|
value = removeDuplicates(value, added);
|
||||||
|
|
||||||
if(prepend)
|
if(prepend)
|
||||||
value.addAll(0,added);
|
value.addAll(0,added);
|
||||||
else
|
else
|
||||||
value.addAll(added);
|
value.addAll(added);
|
||||||
|
|
||||||
return convertToString(value, delimiter);
|
return convertToString(value, delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* performs append given an initial String, a string to be appended and a delimiter
|
* performs append given an initial String, a string to be appended and a delimiter
|
||||||
* Returns a String representing the result of the operation
|
* Returns a String representing the result of the operation
|
||||||
|
@ -111,7 +111,7 @@ public class EnvVarOperationProcessor {
|
||||||
static public String performAppend(String initialValue, String addValue, String delimiter){
|
static public String performAppend(String initialValue, String addValue, String delimiter){
|
||||||
return performAppendPrepend(initialValue,addValue,delimiter,false);
|
return performAppendPrepend(initialValue,addValue,delimiter,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* performs prepend given an initial String, a string to be prepended and a delimiter
|
* performs prepend given an initial String, a string to be prepended and a delimiter
|
||||||
* Returns a String representing the result of the operation
|
* Returns a String representing the result of the operation
|
||||||
|
@ -123,7 +123,7 @@ public class EnvVarOperationProcessor {
|
||||||
static public String performPrepend(String initialValue, String addValue, String delimiter){
|
static public String performPrepend(String initialValue, String addValue, String delimiter){
|
||||||
return performAppendPrepend(initialValue,addValue,delimiter,true);
|
return performAppendPrepend(initialValue,addValue,delimiter,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* performs an environment variable operation
|
* performs an environment variable operation
|
||||||
* Returns String representing the result of the operation
|
* Returns String representing the result of the operation
|
||||||
|
@ -141,7 +141,7 @@ public class EnvVarOperationProcessor {
|
||||||
return performPrepend(initialValue,newValue,delimiter);
|
return performPrepend(initialValue,newValue,delimiter);
|
||||||
case IEnvironmentVariable.ENVVAR_APPEND:
|
case IEnvironmentVariable.ENVVAR_APPEND:
|
||||||
return performAppend(initialValue,newValue,delimiter);
|
return performAppend(initialValue,newValue,delimiter);
|
||||||
case IEnvironmentVariable.ENVVAR_REPLACE:
|
case IEnvironmentVariable.ENVVAR_REPLACE:
|
||||||
default:
|
default:
|
||||||
return initialValue;
|
return initialValue;
|
||||||
}
|
}
|
||||||
|
@ -175,8 +175,8 @@ public class EnvVarOperationProcessor {
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* removes duplicates
|
* removes duplicates
|
||||||
*/
|
*/
|
||||||
static public List<String> removeDuplicates(List<String> value, List<String> duplicates){
|
static public List<String> removeDuplicates(List<String> value, List<String> duplicates){
|
||||||
|
@ -198,7 +198,7 @@ public class EnvVarOperationProcessor {
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts list to a single String using a given delimiter to separate
|
* Converts list to a single String using a given delimiter to separate
|
||||||
* the list value in the resulting String
|
* the list value in the resulting String
|
||||||
|
@ -209,18 +209,18 @@ public class EnvVarOperationProcessor {
|
||||||
static public String convertToString(List<String> list, String delimiter){
|
static public String convertToString(List<String> list, String delimiter){
|
||||||
Iterator<String> iter = list.iterator();
|
Iterator<String> iter = list.iterator();
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
|
||||||
while(iter.hasNext()){
|
while(iter.hasNext()){
|
||||||
buffer.append(iter.next());
|
buffer.append(iter.next());
|
||||||
|
|
||||||
if(iter.hasNext())
|
if(iter.hasNext())
|
||||||
buffer.append(delimiter);
|
buffer.append(delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* normalizes the variable name. That is: removes prepended and appended spaces
|
* normalizes the variable name. That is: removes prepended and appended spaces
|
||||||
* and converts the name to upper-case for Win32 systems
|
* and converts the name to upper-case for Win32 systems
|
||||||
* @return the normalized name or <code>null</code> in case the name is not valid
|
* @return the normalized name or <code>null</code> in case the name is not valid
|
||||||
|
@ -234,12 +234,12 @@ public class EnvVarOperationProcessor {
|
||||||
name = name.toUpperCase();
|
name = name.toUpperCase();
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public IEnvironmentVariable[] filterVariables(IEnvironmentVariable variables[], String remove[]){
|
static public IEnvironmentVariable[] filterVariables(IEnvironmentVariable variables[], String remove[]){
|
||||||
|
|
||||||
if(variables == null || variables.length == 0)
|
if(variables == null || variables.length == 0)
|
||||||
return variables;
|
return variables;
|
||||||
|
|
||||||
IEnvironmentVariable filtered[] = new IEnvironmentVariable[variables.length];
|
IEnvironmentVariable filtered[] = new IEnvironmentVariable[variables.length];
|
||||||
int filteredNum = 0;
|
int filteredNum = 0;
|
||||||
for (IEnvironmentVariable var : variables) {
|
for (IEnvironmentVariable var : variables) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class XlcBuiltinSpecsDetector extends ToolchainBuiltinSpecsDetector imple
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getToolchainId() {
|
public String getToolchainId() {
|
||||||
return XLC_TOOLCHAIN_ID;
|
return XLC_TOOLCHAIN_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue