1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 564123 Treat environment and build variable case sensitively

Remove all equalIgnoreCase and equal with uppercasing for environment
variables

Change-Id: Ic15974b5fb62413c7b1826ced544ff6d4a8eba2f
Signed-off-by: jantje <eclipse@baeyens.it>
This commit is contained in:
jantje 2020-06-19 15:35:27 +02:00 committed by Jonah Graham
parent 09582630d7
commit 2a62d58621
30 changed files with 61 additions and 157 deletions

View file

@ -19,7 +19,6 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.core.runtime.Platform;
/**
* Supplies some default environment variables for the Autotools toolchain. For
@ -40,10 +39,7 @@ public class AutotoolsEnvironmentVariableSupplier implements IConfigurationEnvir
}
private static boolean isVar(String name) {
// Windows has case insensitive env var names
return Platform.getOS().equals(Platform.OS_WIN32)
? name.equalsIgnoreCase(VerboseEnvironmentVariable.VERBOSE_VAR_NAME)
: name.equals(VerboseEnvironmentVariable.VERBOSE_VAR_NAME);
return name.equals(VerboseEnvironmentVariable.VERBOSE_VAR_NAME);
}
private static IBuildEnvironmentVariable create() {

View file

@ -122,7 +122,7 @@ public class GCCToolChain extends PlatformObject implements IToolChain {
IEnvironmentVariable pathVar = null;
if (envVars != null) {
for (IEnvironmentVariable envVar : envVars) {
if (envVar.getName().equalsIgnoreCase("PATH")) { //$NON-NLS-1$
if (envVar.getName().equals("PATH")) { //$NON-NLS-1$
pathVar = envVar;
}
}

View file

@ -46,7 +46,6 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.osgi.service.environment.Constants;
public class BuildInfoFactory {
@ -115,14 +114,8 @@ public class BuildInfoFactory {
public Map<String, String> getExpandedEnvironment() {
Map<String, String> env = getEnvironment();
HashMap<String, String> envMap = new HashMap<>(env.entrySet().size());
boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
for (Map.Entry<String, String> entry : env.entrySet()) {
String key = entry.getKey();
if (win32) {
// Win32 vars are case insensitive. Uppercase everything so
// that (for example) "pAtH" will correctly replace "PATH"
key = key.toUpperCase();
}
String value = entry.getValue();
// translate any string substitution variables
String translated = value;

View file

@ -33,11 +33,9 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.osgi.service.environment.Constants;
public class MakeTarget extends PlatformObject implements IMakeTarget {
private final static int USE_PROJECT_ENV_SETTING = 3;
@ -245,14 +243,8 @@ public class MakeTarget extends PlatformObject implements IMakeTarget {
}
HashMap<String, String> envMap = new HashMap<>(env.entrySet().size());
boolean win32 = Platform.getOS().equals(Constants.OS_WIN32);
for (Entry<String, String> entry : env.entrySet()) {
String key = entry.getKey();
if (win32) {
// Win32 vars are case insensitive. Uppercase everything so
// that (for example) "pAtH" will correctly replace "PATH"
key = key.toUpperCase();
}
String value = entry.getValue();
// translate any string substitution variables
String translated = value;

View file

@ -14,11 +14,11 @@
package org.eclipse.cdt.managedbuilder.core.tests;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.testplugin.ResourceHelper;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentBuildPathsChangeListener;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.core.resources.IProject;
@ -85,12 +85,12 @@ public class ManagedBuildEnvironmentTests extends TestCase {
doInit();
IConfiguration cfg = mproj.getConfigurations()[0];
// CWD/PWD vars should NOT be overwritten anywhere
IBuildEnvironmentVariable a = envProvider.getVariable(NAME_CWD, cfg, true, false);
IEnvironmentVariable a = envProvider.getVariable(NAME_CWD, cfg, false);
assertNotNull(a);
if (VAL_CWDPWD.equals(a.getValue()))
fail("CWD should not be rewritten !"); //$NON-NLS-1$
a = envProvider.getVariable(NAME_PWD, cfg, true, false);
a = envProvider.getVariable(NAME_PWD, cfg, false);
assertNotNull(a);
if (VAL_CWDPWD.equals(a.getValue()))
fail("PWD should not be rewritten !"); //$NON-NLS-1$
@ -128,28 +128,20 @@ public class ManagedBuildEnvironmentTests extends TestCase {
public void testEnvGetParams() {
doInit();
IEnvironmentVariableProvider envProvider = ManagedBuildManager.getEnvironmentVariableProvider();
IBuildEnvironmentVariable x = null;
IBuildEnvironmentVariable y = null;
// if "path" and "PATH" exist they should be equal
IEnvironmentVariable x = envProvider.getVariable("PATH", mproj.getConfigurations()[0], false);
IEnvironmentVariable y = envProvider.getVariable("path", mproj.getConfigurations()[0], false);
assertNotNull(x);
if (y != null) {
assertFalse(x.getName().equals(y.getName()));
}
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) { //$NON-NLS-1$ //$NON-NLS-2$
assertEquals(envProvider.getDefaultDelimiter(), DEL_WIN);
assertFalse(envProvider.isVariableCaseSensitive());
// these var instances are different although contents is equal.
x = envProvider.getVariable("PATH", mproj.getConfigurations()[0], true, false);
assertNotNull(x);
y = envProvider.getVariable("path", mproj.getConfigurations()[0], true, false);
assertNotNull(y);
assertEquals(x.getName(), y.getName());
assertEquals(x.getValue(), y.getValue());
} else {
assertEquals(envProvider.getDefaultDelimiter(), DEL_UNIX);
assertTrue(envProvider.isVariableCaseSensitive());
// "path" is different var (may absent);
x = envProvider.getVariable("PATH", mproj.getConfigurations()[0], true, false);
assertNotNull(x);
y = envProvider.getVariable("path", mproj.getConfigurations()[0], true, false);
if (y != null) {
assertFalse(x.getName().equals(y.getName()));
}
}
}
@ -158,18 +150,17 @@ public class ManagedBuildEnvironmentTests extends TestCase {
*/
public void testEnvProvider() {
doInit();
IBuildEnvironmentVariable a = envProvider.getVariable(TestMacro.PRJ_VAR, mproj.getConfigurations()[0], true,
false);
IEnvironmentVariable a = envProvider.getVariable(TestMacro.PRJ_VAR, mproj.getConfigurations()[0], false);
assertNotNull(a);
assertEquals(TestMacro.PRJ_VAR + mproj.getName(), a.getValue());
IConfiguration[] cfgs = mproj.getConfigurations();
a = envProvider.getVariable(TestMacro.CFG_VAR, cfgs[0], true, false);
a = envProvider.getVariable(TestMacro.CFG_VAR, cfgs[0], false);
assertNotNull(a);
assertEquals(TestMacro.CFG_VAR + cfgs[0].getName(), a.getValue());
// no provider for another configurations
a = envProvider.getVariable(TestMacro.CFG_VAR, cfgs[1], true, false);
a = envProvider.getVariable(TestMacro.CFG_VAR, cfgs[1], false);
assertNull(a);
}

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
Bundle-Version: 8.9.0.qualifier
Bundle-Version: 9.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin

View file

@ -46,7 +46,6 @@ public interface IBuilder extends IHoldsOptions, IMakeBuilderInfo {
public static final String CONVERT_TO_ID = "convertToId"; //$NON-NLS-1$
public static final String VARIABLE_FORMAT = "variableFormat"; //$NON-NLS-1$
public static final String IS_VARIABLE_CASE_SENSITIVE = "isVariableCaseSensitive"; //$NON-NLS-1$
public static final String RESERVED_MACRO_NAMES = "reservedMacroNames"; //$NON-NLS-1$
public static final String RESERVED_MACRO_NAME_SUPPLIER = "reservedMacroNameSupplier"; //$NON-NLS-1$
public static final String IS_SYSTEM = "isSystem"; //$NON-NLS-1$
@ -273,13 +272,6 @@ public interface IBuilder extends IHoldsOptions, IMakeBuilderInfo {
*/
public String getBuilderVariablePattern();
/**
* Returns whether the builder supports case sensitive variables or not
*
* @return boolean
*/
public boolean isVariableCaseSensitive();
/**
* Returns an array of Strings representing the patterns of the builder/buildfile-generator
* reserved variables

View file

@ -101,12 +101,6 @@ public interface IEnvironmentVariableProvider {
*/
public String getDefaultDelimiter();
/**
* @return true if the OS supports case sensitive variables (Unix-like systems) or false
* if it does not (Win32 systems)
*/
public boolean isVariableCaseSensitive();
/**
* This method is defined to be used basically by the UI classes and should not be used by the
* tool-integrator

View file

@ -26,6 +26,7 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.Vector;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.settings.model.CSourceEntry;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
@ -56,7 +57,6 @@ 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;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.macros.FileContextData;
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
@ -1498,11 +1498,11 @@ public class BuildDescription implements IBuildDescription {
}
protected Map<String, String> calculateEnvironment() {
IBuildEnvironmentVariable variables[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(fCfg,
true, true);
IEnvironmentVariable[] variables = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(fCfg,
true);
Map<String, String> map = new HashMap<>();
for (IBuildEnvironmentVariable var : variables) {
for (IEnvironmentVariable var : variables) {
map.put(var.getName(), var.getValue());
}
return map;

View file

@ -101,7 +101,6 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
private String convertToId;
private FileContextBuildMacroValues fileContextBuildMacroValues;
private String builderVariablePattern;
private Boolean isVariableCaseSensitive;
private String[] reservedMacroNames;
private IReservedMacroNameSupplier reservedMacroNameSupplier;
private IConfigurationElement reservedMacroNameSupplierElement;
@ -315,9 +314,6 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
builderVariablePattern = builder.builderVariablePattern;
if (builder.isVariableCaseSensitive != null)
isVariableCaseSensitive = builder.isVariableCaseSensitive;
if (builder.reservedMacroNames != null)
reservedMacroNames = builder.reservedMacroNames.clone();
@ -473,11 +469,6 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
// get the 'variableFormat' attribute
builderVariablePattern = SafeStringInterner.safeIntern(element.getAttribute(VARIABLE_FORMAT));
// get the 'isVariableCaseSensitive' attribute
String isCS = element.getAttribute(IS_VARIABLE_CASE_SENSITIVE);
if (isCS != null)
isVariableCaseSensitive = Boolean.parseBoolean(isCS);
// get the reserved macro names
String reservedNames = element.getAttribute(RESERVED_MACRO_NAMES);
if (reservedNames != null)
@ -1484,16 +1475,6 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return builderVariablePattern;
}
@Override
public boolean isVariableCaseSensitive() {
if (isVariableCaseSensitive == null) {
if (superClass != null)
return getSuperClass().isVariableCaseSensitive();
return true;
}
return isVariableCaseSensitive.booleanValue();
}
@Override
public String[] getReservedMacroNames() {
if (reservedMacroNames == null && superClass != null)

View file

@ -31,6 +31,7 @@ import org.eclipse.cdt.core.ConsoleOutputStream;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.ICommandLauncher;
import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.resources.ACBuilder;
import org.eclipse.cdt.core.resources.IConsole;
@ -47,7 +48,6 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.DescriptionBuilder;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.IBuildModelBuilder;
import org.eclipse.cdt.managedbuilder.internal.buildmodel.ParallelBuilder;
@ -978,8 +978,8 @@ public class GeneratedMakefileBuilder extends ACBuilder {
launcher.showCommand(true);
// Set the environmennt
IBuildEnvironmentVariable variables[] = ManagedBuildManager.getEnvironmentVariableProvider()
.getVariables(cfg, true, true);
IEnvironmentVariable[] variables = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(cfg,
true);
String[] envp = null;
ArrayList<String> envList = new ArrayList<>();
if (variables != null) {

View file

@ -19,6 +19,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
@ -50,7 +51,6 @@ 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;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
import org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedBuildCPathEntryContainer;
@ -993,8 +993,8 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
private String getCWD() {
String cwd = ""; //$NON-NLS-1$
IBuildEnvironmentVariable cwdvar = ManagedBuildManager.getEnvironmentVariableProvider().getVariable("CWD", //$NON-NLS-1$
getDefaultConfiguration(), false, true);
IEnvironmentVariable cwdvar = ManagedBuildManager.getEnvironmentVariableProvider().getVariable("CWD", //$NON-NLS-1$
getDefaultConfiguration(), true);
if (cwdvar != null) {
cwd = cwdvar.getValue().replace('\\', '/');
}

View file

@ -179,11 +179,6 @@ public class EnvironmentVariableProvider implements IEnvironmentVariableProvider
return fMngr.getDefaultDelimiter();
}
@Override
public boolean isVariableCaseSensitive() {
return fMngr.isVariableCaseSensitive();
}
@Override
public IEnvironmentVariableSupplier[] getSuppliers(Object level) {
return null;

View file

@ -23,7 +23,6 @@ import org.eclipse.cdt.internal.core.envvar.EnvVarDescriptor;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IEnvVarBuildPath;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.utils.envvar.StorableEnvironment;
@ -49,8 +48,6 @@ public class StoredBuildPathEnvironmentContainer extends StorableEnvironmentLoad
private IConfiguration fConfiguration;
private StorableEnvironment fEnvironment;
private int fPathType;
private boolean fIsVariableCaseSensitive = ManagedBuildManager.getEnvironmentVariableProvider()
.isVariableCaseSensitive();
public StoredBuildPathEnvironmentContainer(int pathType) {
fPathType = pathType == IEnvVarBuildPath.BUILDPATH_LIBRARY ? IEnvVarBuildPath.BUILDPATH_LIBRARY
@ -190,7 +187,7 @@ public class StoredBuildPathEnvironmentContainer extends StorableEnvironmentLoad
* returns true if the variable names are equal and false otherwise
*/
private boolean varNamesEqual(String name1, String name2) {
return fIsVariableCaseSensitive ? name1.equals(name2) : name1.equalsIgnoreCase(name2);
return name1.equals(name2);
}
/* (non-Javadoc)

View file

@ -53,7 +53,6 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
private static final String PATTERN_MACRO_NAME = "="; //$NON-NLS-1$
private IConfiguration fConfiguration;
private IBuilder fBuilder;
private HashSet<String> fCaseInsensitiveReferencedNames;
private ICdtVariableManager fVarMngr;
private ICConfigurationDescription fCfgDes;
@ -257,26 +256,16 @@ public class BuildfileMacroSubstitutor extends SupplierBasedCdtVariableSubstitut
String macroName = macro.getName();
String ref = null;
IReservedMacroNameSupplier supplier = getReservedMacroNameSupplier();
//on win32 all environment variable names are converted to upper case
macroName = EnvVarOperationProcessor.normalizeName(macroName);
if (supplier == null || !supplier.isReservedName(macroName, fConfiguration)) {
String pattern = fBuilder.getBuilderVariablePattern();
if (pattern != null && pattern.indexOf(PATTERN_MACRO_NAME) != -1) {
if (fBuilder.isVariableCaseSensitive()
|| getCaseInsensitiveReferencedNames().add(macroName.toUpperCase())) {
ref = pattern.replaceAll(PATTERN_MACRO_NAME, macroName);
}
ref = pattern.replaceAll(PATTERN_MACRO_NAME, macroName);
}
}
return ref;
}
protected Set<String> getCaseInsensitiveReferencedNames() {
if (fCaseInsensitiveReferencedNames == null)
fCaseInsensitiveReferencedNames = new HashSet<>();
return fCaseInsensitiveReferencedNames;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.internal.macros.DefaultMacroSubstitutor#setMacroContextInfo(org.eclipse.cdt.managedbuilder.internal.macros.IMacroContextInfo)
*/

View file

@ -21,6 +21,7 @@ import java.util.Set;
import java.util.Vector;
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IMacroEntry;
import org.eclipse.cdt.core.model.IPathEntry;
@ -36,7 +37,6 @@ import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ITarget;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
import org.eclipse.core.resources.IProject;
@ -147,8 +147,8 @@ public class ManagedBuildCPathEntryContainer implements IPathEntryContainer {
IProgressMonitor monitor = new NullProgressMonitor();
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
IConfiguration config = info.getDefaultConfiguration();
IBuildEnvironmentVariable[] vars = ManagedBuildManager.getEnvironmentVariableProvider()
.getVariables(config, true, true);
IEnvironmentVariable[] vars = ManagedBuildManager.getEnvironmentVariableProvider()
.getVariables(config, true);
Properties env = new Properties();
if (vars != null)
for (int i = 0; i < vars.length; ++i)

View file

@ -777,9 +777,6 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
Map<String, String> envMap = new HashMap<>();
for (IEnvironmentVariable var : getEnvironmentVariables()) {
String name = var.getName();
if (!envMngr.isVariableCaseSensitive()) {
name = name.toUpperCase();
}
envMap.put(name, var.getValue());
}
return envMap;
@ -920,7 +917,7 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
* Return the best extension to use for calculating spec file from a list of extensions.
* @param extensions list of possible extensions to choose from
* @return one of the extensions deemed the best one to use from the list
* @since 8.9
* @since 9.0
*/
protected Optional<String> selectBestSpecFileExtension(List<String> extensions) {
return extensions.stream().filter(s -> s != null && !s.isEmpty()).findFirst().map(ext -> {

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.gnu.ui; singleton:=true
Bundle-Version: 8.3.300.qualifier
Bundle-Version: 8.3.400.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.gnu.ui.GnuUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@ -11,7 +11,7 @@ Export-Package: org.eclipse.cdt.managedbuilder.gnu.cygwin,
org.eclipse.cdt.managedbuilder.gnu.templates;x-internal:=true,
org.eclipse.cdt.managedbuilder.gnu.ui
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.managedbuilder.core;bundle-version="[8.1.0,9.0.0)",
org.eclipse.cdt.managedbuilder.core;bundle-version="[9.0.0,10.0.0]",
org.eclipse.cdt.core;bundle-version="[7.0.0,8.0.0)",
org.eclipse.core.resources
Bundle-ActivationPolicy: lazy

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.ui; singleton:=true
Bundle-Version: 9.1.600.qualifier
Bundle-Version: 9.1.700.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.ui.properties.ManagedBuilderUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.cdt.core;bundle-version="[7.0.0,8.0.0)",
org.eclipse.cdt.make.core,
org.eclipse.cdt.make.ui,
org.eclipse.cdt.managedbuilder.core;bundle-version="[8.7.0,9.0.0)",
org.eclipse.cdt.managedbuilder.core;bundle-version="[9.0.0,10.0.0]",
org.eclipse.cdt.ui;bundle-version="[7.0.0,8.0.0)",
org.eclipse.ui;bundle-version="[3.2.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.5.100,4.0.0)",

View file

@ -383,7 +383,7 @@ public class NewVarDialog extends Dialog {
private boolean macroNamesEqual(String name1, String name2) {
name1 = name1.trim();
name2 = name2.trim();
return name1.equalsIgnoreCase(name2);
return name1.equals(name2);
}
/*

View file

@ -28,7 +28,8 @@ import org.eclipse.core.runtime.Platform;
*/
public class EnvironmentReader {
private static Properties envVars;
private static List<String> toUppercaseEnvironmentVars = Arrays.asList("PATH"); //$NON-NLS-1$
@SuppressWarnings("nls")
private static List<String> toUppercaseEnvironmentVars = Arrays.asList("PATH", "CYGWIN_HOME", "LANG");
static {
boolean isWindows = Platform.OS_WIN32.equals(Platform.getOS());

View file

@ -134,9 +134,6 @@ public class CommandLauncher implements ICommandLauncher {
if (pos < 0)
pos = envStr.length();
String key = envStr.substring(0, pos);
if (Platform.getOS().equals(Platform.OS_WIN32)) {
key = key.toUpperCase();
}
String value = envStr.substring(pos + 1);
fEnvironment.put(key, value);
}

View file

@ -101,11 +101,5 @@ public interface IEnvironmentVariableManager {
*/
public String getDefaultDelimiter();
/**
* @return true if the OS supports case sensitive variables (Unix-like systems) or false
* if it does not (Win32 systems)
*/
public boolean isVariableCaseSensitive();
public IContributedEnvironment getContributedEnvironment();
}

View file

@ -51,13 +51,10 @@ public class EnvVarCollector {
ICoreEnvironmentVariableSupplier supplier) {
if (vars == null)
return;
boolean isCaseInsensitive = !EnvironmentVariableManager.getDefault().isVariableCaseSensitive();
for (int i = 0; i < vars.length; i++) {
IEnvironmentVariable var = vars[i];
if (var != null) {
String name = var.getName();
if (isCaseInsensitive)
name = name.toUpperCase();
boolean noCheck = false;
@ -108,10 +105,6 @@ public class EnvVarCollector {
public EnvVarDescriptor getVariable(String name) {
if (fMap == null)
return null;
if (!EnvironmentVariableManager.getDefault().isVariableCaseSensitive())
name = name.toUpperCase();
return fMap.get(name);
}

View file

@ -365,11 +365,6 @@ public class EnvironmentVariableManager implements IEnvironmentVariableManager {
return isWin32() ? DELIMITER_WIN32 : DELIMITER_UNIX;
}
@Override
public boolean isVariableCaseSensitive() {
return !isWin32();
}
public ICoreEnvironmentVariableSupplier[] getSuppliers(Object level) {
IEnvironmentContextInfo info = getContextInfo(level);
if (info != null)

View file

@ -19,7 +19,6 @@ import java.util.List;
import org.eclipse.cdt.core.envvar.EnvironmentVariable;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
/**
* This is an utility class that implements environment variable operations
@ -225,7 +224,6 @@ public class EnvVarOperationProcessor {
/**
* normalizes the variable name. That is: removes prepended and appended spaces
* 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
*/
static public String normalizeName(String name) {
@ -233,8 +231,6 @@ public class EnvVarOperationProcessor {
return null;
if ("".equals(name = name.trim())) //$NON-NLS-1$
return null;
if (!EnvironmentVariableManager.getDefault().isVariableCaseSensitive())
name = name.toUpperCase();
return name;
}

View file

@ -20,7 +20,6 @@ import java.util.Map;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.internal.core.envvar.EnvironmentVariableManager;
import org.eclipse.cdt.internal.core.settings.model.ExceptionFactory;
import org.eclipse.cdt.utils.envvar.StorableEnvironmentLoader.ISerializeInfo;
@ -315,8 +314,6 @@ public class StorableEnvironment {
String getNameForMap(String name) {
if (name == null || (name = name.trim()).length() == 0)
return null;
if (!EnvironmentVariableManager.getDefault().isVariableCaseSensitive())
return name.toUpperCase();
return name;
}

View file

@ -63,9 +63,7 @@ public class CrossEnvironmentVariableSupplier implements IConfigurationEnvironme
}
public static boolean isVar(String name) {
// Windows has case insensitive env var names
return Platform.getOS().equals(Platform.OS_WIN32) ? name.equalsIgnoreCase(PathEnvironmentVariable.name)
: name.equals(PathEnvironmentVariable.name);
return name.equals(PathEnvironmentVariable.name);
}
@Override

View file

@ -45,6 +45,7 @@
<li><a href="#optionsAPI">Removal of CDT Core Options API.</a></li>
<li><a href="#terminal">TM Terminal has major changes to support new color and preference functionality.</a></li>
<li><a href="#pathutil">Remove org.eclipse.cdt.core.browser.PathUtil.</a></li>
<li><a href="#casesensitive">Environment Variables are always case sensitive in CDT.</a></li>
</ol>
<p>
Planned Removals after June 2022
@ -260,9 +261,23 @@
<h3>13. <a name="pathutil">Remove org.eclipse.cdt.core.browser.PathUtil.</a></h3>
<p>
The deprecated class org.eclipse.cdt.core.browser.PathUtil has been removed. Use
org.eclipse.cdt.utils.PathUtil instead.
org.eclipse.cdt.utils.PathUtil instead. See <a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=564123" target="_blank">Bug 564123</a>.
</p>
<h3>14. <a name="casesensitive">Environment Variables are always case sensitive in CDT.</a></h3>
<p>
The handling of environment and build variables in CDT has changed to being case sensitive. This means
some API changes to remove methods such as isVariableCaseSensitive (see full list below). The PATH and
dome other special environment variables in CDT are always uppercased, such as Path. See <a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=564123" target="_blank">Bug 564123</a>.
</p>
<ul>
<li>org.eclipse.cdt.managedbuilder.core.IBuilder.isVariableCaseSensitive() removed.</li>
<li>org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider.isVariableCaseSensitive() removed.</li>
<li>org.eclipse.cdt.core.envvar.IEnvironmentVariableManager.isVariableCaseSensitive() removed.</li></li>
</ul>
<hr>
<h2>Future Deletions</h2>

View file

@ -85,7 +85,8 @@ public class Env {
//This is supposed to be a straight copy (no modifications)
//except for making getEnvVars private to avoid errors/warnings
private static Properties envVars;
private static List<String> toUppercaseEnvironmentVars = Arrays.asList("PATH"); //$NON-NLS-1$
@SuppressWarnings("nls")
private static List<String> toUppercaseEnvironmentVars = Arrays.asList("PATH", "CYGWIN_HOME", "LANG");
static {
boolean isWindows = Platform.OS_WIN32.equals(Platform.getOS());