Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonah Graham2018-11-20 11:20:42 -0500
committerJonah Graham2018-11-22 16:47:02 -0500
commit170e654b4796bad1453ae85a427b97317d67a69a (patch)
tree6ca9b8a8fedd5fd25f97eb79c408312e256ff981 /windows/org.eclipse.cdt.msw.build
parent35996a5c5ca5c254959ba48241eaada6dbf8628d (diff)
downloadorg.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.gz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.tar.xz
org.eclipse.cdt-170e654b4796bad1453ae85a427b97317d67a69a.zip
Bug 540373: Cleanup: Format & Remove trailing whitespace
This was done by selecting all projects in Eclipse then Source -> Clean Up... -> choosing: - Format source code - Remove trailing white spaces on all lines and completing the wizard Change-Id: I63685372c6bcc67719bcf145123bcb72e5b00394
Diffstat (limited to 'windows/org.eclipse.cdt.msw.build')
-rw-r--r--windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/Activator.java2
-rw-r--r--windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinDiscoveredPathInfo.java11
-rw-r--r--windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinEnvironmentVariableSupplier.java69
-rw-r--r--windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinScannerInfoCollector.java9
-rw-r--r--windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java30
-rw-r--r--windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java8
6 files changed, 62 insertions, 67 deletions
diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/Activator.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/Activator.java
index 20d7227b8f..67dc194923 100644
--- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/Activator.java
+++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/Activator.java
@@ -23,7 +23,7 @@ public class Activator extends Plugin {
// The shared instance
private static Activator plugin;
-
+
/**
* The constructor
*/
diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinDiscoveredPathInfo.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinDiscoveredPathInfo.java
index 47f753d408..91eff6d1e5 100644
--- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinDiscoveredPathInfo.java
+++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinDiscoveredPathInfo.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.msw.build;
-
import java.util.HashMap;
import java.util.Map;
@@ -27,15 +26,15 @@ public class WinDiscoveredPathInfo implements IDiscoveredPathInfo {
private final IPath[] paths;
private final Map<String, String> symbols = new HashMap<String, String>();
-
+
public WinDiscoveredPathInfo() {
// Include paths
paths = WinEnvironmentVariableSupplier.getIncludePath();
-
+
symbols.put("_M_IX86", "600");
symbols.put("_WIN32", "1");
symbols.put("_MSC_VER", "1400");
-
+
// Microsoft specific modifiers that can be ignored
symbols.put("__cdecl", "");
symbols.put("__fastcall", "");
@@ -45,7 +44,7 @@ public class WinDiscoveredPathInfo implements IDiscoveredPathInfo {
symbols.put("__unaligned", "");
symbols.put("__uptr", "");
symbols.put("__w64", "");
-
+
// Redefine some things so that the CDT parser can handle them, until there is a VC specific parser
symbols.put("__forceinline", "__inline");
symbols.put("__int8", "char");
@@ -53,7 +52,7 @@ public class WinDiscoveredPathInfo implements IDiscoveredPathInfo {
symbols.put("__int32", "int");
symbols.put("__int64", "long long");
}
-
+
public IPath[] getIncludePaths() {
return paths;
}
diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinEnvironmentVariableSupplier.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinEnvironmentVariableSupplier.java
index 7009c67c61..551d886620 100644
--- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinEnvironmentVariableSupplier.java
+++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinEnvironmentVariableSupplier.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.msw.build;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -31,32 +30,32 @@ import org.eclipse.core.runtime.Path;
*
*/
public class WinEnvironmentVariableSupplier
- implements IConfigurationEnvironmentVariableSupplier, IProjectEnvironmentVariableSupplier {
-
+ implements IConfigurationEnvironmentVariableSupplier, IProjectEnvironmentVariableSupplier {
+
private static Map<String, IBuildEnvironmentVariable> envvars;
private static String sdkDir;
private static String vcDir;
-
+
private static class WindowsBuildEnvironmentVariable implements IBuildEnvironmentVariable {
-
+
private final String name;
private final String value;
private final int operation;
-
+
public WindowsBuildEnvironmentVariable(String name, String value, int operation) {
this.name = name;
this.value = value;
this.operation = operation;
}
-
+
public String getDelimiter() {
return ";";
}
-
+
public String getName() {
return name;
}
-
+
public String getValue() {
return value;
}
@@ -70,39 +69,38 @@ public class WinEnvironmentVariableSupplier
public WinEnvironmentVariableSupplier() {
initvars();
}
-
- public IBuildEnvironmentVariable getVariable(String variableName,
- IManagedProject project, IEnvironmentVariableProvider provider) {
+
+ public IBuildEnvironmentVariable getVariable(String variableName, IManagedProject project,
+ IEnvironmentVariableProvider provider) {
return envvars.get(variableName);
}
-
- public IBuildEnvironmentVariable getVariable(String variableName,
- IConfiguration configuration, IEnvironmentVariableProvider provider) {
+
+ public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
+ IEnvironmentVariableProvider provider) {
return envvars.get(variableName);
}
- public IBuildEnvironmentVariable[] getVariables(IManagedProject project,
- IEnvironmentVariableProvider provider) {
+ public IBuildEnvironmentVariable[] getVariables(IManagedProject project, IEnvironmentVariableProvider provider) {
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
}
-
- public IBuildEnvironmentVariable[] getVariables(
- IConfiguration configuration, IEnvironmentVariableProvider provider) {
+
+ public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration,
+ IEnvironmentVariableProvider provider) {
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
}
-
+
private static String getSoftwareKey(WindowsRegistry reg, String subkey, String name) {
String value = reg.getLocalMachineValue("SOFTWARE\\" + subkey, name);
- // Visual Studio is a 32 bit application so on Windows 64 the keys will be in Wow6432Node
+ // Visual Studio is a 32 bit application so on Windows 64 the keys will be in Wow6432Node
if (value == null) {
value = reg.getLocalMachineValue("SOFTWARE\\Wow6432Node\\" + subkey, name);
}
return value;
}
-
+
// Current support is for Windows SDK 8.0 with Visual C++ 11.0
// or Windows SDK 7.1 with Visual C++ 10.0
- // or Windows SDK 7.0 with Visual C++ 9.0
+ // or Windows SDK 7.0 with Visual C++ 9.0
private static String getSDKDir() {
WindowsRegistry reg = WindowsRegistry.getRegistry();
String sdkDir = getSoftwareKey(reg, "Microsoft\\Microsoft SDKs\\Windows\\v8.0", "InstallationFolder");
@@ -113,7 +111,7 @@ public class WinEnvironmentVariableSupplier
return sdkDir;
return getSoftwareKey(reg, "Microsoft SDKs\\Windows\\v7.0", "InstallationFolder");
}
-
+
private static String getVCDir() {
WindowsRegistry reg = WindowsRegistry.getRegistry();
String vcDir = getSoftwareKey(reg, "Microsoft\\VisualStudio\\SxS\\VC7", "11.0");
@@ -124,7 +122,7 @@ public class WinEnvironmentVariableSupplier
return vcDir;
return getSoftwareKey(reg, "Microsoft\\VisualStudio\\SxS\\VC7", "9.0");
}
-
+
public static IPath[] getIncludePath() {
// Include paths
List<IPath> includePaths = new ArrayList<IPath>();
@@ -132,37 +130,38 @@ public class WinEnvironmentVariableSupplier
includePaths.add(new Path(sdkDir.concat("Include")));
includePaths.add(new Path(sdkDir.concat("Include\\gl")));
}
-
+
if (vcDir != null) {
includePaths.add(new Path(vcDir.concat("Include")));
}
return includePaths.toArray(new IPath[0]);
}
-
+
private static void addvar(IBuildEnvironmentVariable var) {
envvars.put(var.getName(), var);
}
-
+
private static synchronized void initvars() {
if (envvars != null)
return;
envvars = new HashMap<String, IBuildEnvironmentVariable>();
-
+
// The SDK Location
sdkDir = getSDKDir();
vcDir = getVCDir();
-
+
if (sdkDir == null && vcDir == null) {
return;
}
-
+
// INCLUDE
StringBuilder buff = new StringBuilder();
IPath includePaths[] = getIncludePath();
for (IPath path : includePaths) {
buff.append(path.toOSString()).append(';');
}
- addvar(new WindowsBuildEnvironmentVariable("INCLUDE", buff.toString(), IBuildEnvironmentVariable.ENVVAR_PREPEND));
+ addvar(new WindowsBuildEnvironmentVariable("INCLUDE", buff.toString(),
+ IBuildEnvironmentVariable.ENVVAR_PREPEND));
// LIB
buff = new StringBuilder();
@@ -172,9 +171,9 @@ public class WinEnvironmentVariableSupplier
buff.append(sdkDir).append("Lib;");
buff.append(sdkDir).append("Lib\\win8\\um\\x86;");
}
-
+
addvar(new WindowsBuildEnvironmentVariable("LIB", buff.toString(), IBuildEnvironmentVariable.ENVVAR_PREPEND));
-
+
// PATH
buff = new StringBuilder();
if (vcDir != null) {
diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinScannerInfoCollector.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinScannerInfoCollector.java
index 9936d70879..1f3271036e 100644
--- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinScannerInfoCollector.java
+++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/WinScannerInfoCollector.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.msw.build;
-
import java.util.List;
import java.util.Map;
@@ -38,14 +37,14 @@ public class WinScannerInfoCollector implements IScannerInfoCollector3 {
public IDiscoveredPathInfo createPathInfoObject() {
return new WinDiscoveredPathInfo();
}
-
+
public void setInfoContext(InfoContext context) {
}
-
+
public void setProject(IProject project) {
}
-
+
public void updateScannerConfiguration(IProgressMonitor monitor) throws CoreException {
}
-
+
}
diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java
index 95da127bd6..e912a90528 100644
--- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java
+++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java
@@ -55,13 +55,13 @@ public class MSVCToolChain extends PlatformObject implements IToolChain {
public MSVCToolChain(IToolChainProvider provider, Path path) {
this.provider = provider;
this.path = path;
-
+
// path = <version>/bin/<hostArch>/<targetArch>
String targetArch = path.getFileName().toString();
this.arch = targetArch.equalsIgnoreCase("x86") ? Platform.ARCH_X86 : Platform.ARCH_X86_64; //$NON-NLS-1$
this.id = "msvc." + arch; //$NON-NLS-1$
this.version = path.getParent().getParent().getParent().getFileName().toString();
-
+
Path kitRoot = Paths.get("C:", "Program Files (x86)", "Windows Kits", "10"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
List<String> versions = Arrays.asList(kitRoot.resolve("lib").toFile().list()); //$NON-NLS-1$
Collections.sort(versions, (v1, v2) -> {
@@ -71,25 +71,23 @@ public class MSVCToolChain extends PlatformObject implements IToolChain {
} catch (IllegalArgumentException e) {
return 1;
}
-
+
Version ver2;
try {
ver2 = new Version(v2);
} catch (IllegalArgumentException e) {
return -1;
}
-
+
return ver2.compareTo(ver1);
});
String sdkVersion = versions.iterator().next();
-
+
pathVar = new EnvironmentVariable("Path", String.join(File.pathSeparator, //$NON-NLS-1$
- path.toString(),
- kitRoot.resolve("bin").resolve(sdkVersion).resolve(targetArch).toString() //$NON-NLS-1$
- ), IEnvironmentVariable.ENVVAR_PREPEND, File.pathSeparator);
+ path.toString(), kitRoot.resolve("bin").resolve(sdkVersion).resolve(targetArch).toString() //$NON-NLS-1$
+ ), IEnvironmentVariable.ENVVAR_PREPEND, File.pathSeparator);
- this.includeDirs = new String[] {
- path.getParent().getParent().getParent().resolve("include").toString(), //$NON-NLS-1$
+ this.includeDirs = new String[] { path.getParent().getParent().getParent().resolve("include").toString(), //$NON-NLS-1$
kitRoot.resolve("include").resolve(sdkVersion).resolve("ucrt").toString(), //$NON-NLS-1$ //$NON-NLS-2$
kitRoot.resolve("include").resolve(sdkVersion).resolve("shared").toString(), //$NON-NLS-1$ //$NON-NLS-2$
kitRoot.resolve("include").resolve(sdkVersion).resolve("um").toString(), //$NON-NLS-1$ //$NON-NLS-2$
@@ -98,13 +96,13 @@ public class MSVCToolChain extends PlatformObject implements IToolChain {
includeVar = new EnvironmentVariable("INCLUDE", String.join(File.pathSeparator, this.includeDirs), //$NON-NLS-1$
IEnvironmentVariable.ENVVAR_REPLACE, File.pathSeparator);
-
+
libVar = new EnvironmentVariable("LIB", String.join(File.pathSeparator, //$NON-NLS-1$
path.getParent().getParent().getParent().resolve("lib").resolve(targetArch).toString(), //$NON-NLS-1$
kitRoot.resolve("lib").resolve(sdkVersion).resolve("ucrt").resolve(targetArch).toString(), //$NON-NLS-1$ //$NON-NLS-2$
kitRoot.resolve("lib").resolve(sdkVersion).resolve("um").resolve(targetArch).toString() //$NON-NLS-1$ //$NON-NLS-2$
- ), IEnvironmentVariable.ENVVAR_REPLACE, File.pathSeparator);
-
+ ), IEnvironmentVariable.ENVVAR_REPLACE, File.pathSeparator);
+
symbols = new HashMap<>();
symbols.put("_WIN32", "1"); //$NON-NLS-1$ //$NON-NLS-2$
if (this.arch.equals(Platform.ARCH_X86)) {
@@ -115,7 +113,7 @@ public class MSVCToolChain extends PlatformObject implements IToolChain {
}
// TODO make this more dynamic to actual version
symbols.put("_MSC_VER", "1900"); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// Microsoft specific modifiers that can be ignored
symbols.put("__cdecl", ""); //$NON-NLS-1$ //$NON-NLS-2$
symbols.put("__fastcall", ""); //$NON-NLS-1$ //$NON-NLS-2$
@@ -125,7 +123,7 @@ public class MSVCToolChain extends PlatformObject implements IToolChain {
symbols.put("__unaligned", ""); //$NON-NLS-1$ //$NON-NLS-2$
symbols.put("__uptr", ""); //$NON-NLS-1$ //$NON-NLS-2$
symbols.put("__w64", ""); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// Redefine some things so that the CDT parser can handle them, until there is a VC specific parser
symbols.put("__forceinline", "__inline"); //$NON-NLS-1$ //$NON-NLS-2$
symbols.put("__int8", "char"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -230,7 +228,7 @@ public class MSVCToolChain extends PlatformObject implements IToolChain {
IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) {
Map<String, String> symbols = new HashMap<>(this.symbols);
List<String> includeDirs = new ArrayList<>(Arrays.asList(this.includeDirs));
-
+
for (String arg : command) {
if (arg.startsWith("-") || arg.startsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$
if (arg.charAt(1) == 'I') {
diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java
index 293de6fdc7..1aa3c4651c 100644
--- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java
+++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java
@@ -25,7 +25,7 @@ import org.eclipse.core.runtime.Status;
/**
* Toolchain provider for Microsoft's Visual C++ Compiler (MSVC).
- *
+ *
* This implementation only supports Microsoft Build Tools 2017 and
* the Windows 10 SDK (Kit).
*/
@@ -47,12 +47,12 @@ public class MSVCToolChainProvider implements IToolChainProvider {
if (!Files.exists(vsPath)) {
return;
}
-
+
Path vs2017Path = vsPath.resolve("2017"); //$NON-NLS-1$
if (!Files.exists(vs2017Path)) {
return;
}
-
+
Path msvcPath = vs2017Path.resolve("BuildTools").resolve("VC").resolve("Tools").resolve("MSVC"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
if (!Files.exists(msvcPath)) {
return;
@@ -60,7 +60,7 @@ public class MSVCToolChainProvider implements IToolChainProvider {
String hostPath = Platform.getOSArch().equals(Platform.ARCH_X86) ? "HostX86" : "HostX64"; //$NON-NLS-1$ //$NON-NLS-2$
String archPath = Platform.getOSArch().equals(Platform.ARCH_X86) ? "x86" : "x64"; //$NON-NLS-1$ //$NON-NLS-2$
-
+
try {
Files.find(msvcPath, 6, (path, attr) -> {
return path.getFileName().toString().equalsIgnoreCase("cl.exe") //$NON-NLS-1$

Back to the top