Files
Sourcetrail/ide_plugins/vs/vs2015/SourcetrailPlugin/VCProjectEngineWrapper/VCConfigurationWrapper.cs
T
malte_langkabel 7010b9a6fb logic: update Visual Studio plugin to support Visual Studio 2017
* changed description text of Visual Studio plugin
* changed plugin install targets to include VS 2017
* add license file with MIT license
* updated vsix for deployment

* implement wrapper for all used classes of VCProjectEngine.dll since you cannot just use the oldest version of this
  assembly (see https://stackoverflow.com/questions/44288050/typecast-fails-when-visual-studio-extension-uses-reference-to-older-assembly).
* improved serialization and deserialization of compile commands and compilation databases.
* updated used JSON package
* rename CommandObject to CompileCommand
* changed implementation to keep non-existent file paths in cdb
* made methods of SolutionParser non-static
* replace spaces with tabs

* added IntegrationTests project
* configured tests to simulate a new instance of VisualStudio
* added cinder as test project for integration tests
* remove all absolute paths from expected output of integration tests

fortune cookie message = A stranger will bring great meaning to your life.
2017-06-02 14:48:29 +02:00

109 lines
2.0 KiB
C#

using Microsoft.VisualStudio.VCProjectEngine;
using System;
using System.Collections;
namespace VCProjectEngineWrapper
{
public class
#if (VS2012)
VCConfigurationWrapperVs2012
#elif (VS2013)
VCConfigurationWrapperVs2013
#elif (VS2015)
VCConfigurationWrapperVs2015
#elif (VS2017)
VCConfigurationWrapperVs2017
#endif
: IVCConfigurationWrapper
{
private VCConfiguration _wrapped = null;
public
#if (VS2012)
VCConfigurationWrapperVs2012
#elif (VS2013)
VCConfigurationWrapperVs2013
#elif (VS2015)
VCConfigurationWrapperVs2015
#elif (VS2017)
VCConfigurationWrapperVs2017
#endif
(object wrapped)
{
_wrapped = wrapped as VCConfiguration;
}
public bool isValid()
{
return (_wrapped != null);
}
public string GetWrappedVersion()
{
return Utility.GetWrappedVersion();
}
public string EvaluateMacro(string macro)
{
return _wrapped.Evaluate(macro);
}
public IVCCLCompilerToolWrapper GetCompilerTool()
{
try
{
IEnumerable tools = _wrapped.Tools as IEnumerable;
foreach (Object tool in tools)
{
VCCLCompilerTool compilerTool = tool as VCCLCompilerTool;
if (compilerTool != null)
{
return new
#if (VS2012)
VCCLCompilerToolWrapperVs2012
#elif (VS2013)
VCCLCompilerToolWrapperVs2013
#elif (VS2015)
VCCLCompilerToolWrapperVs2015
#elif (VS2017)
VCCLCompilerToolWrapperVs2017
#endif
(compilerTool);
}
}
}
catch (Exception e)
{
// Logging.Logging.LogError("Failed to retreive compiler tool: " + e.Message);
}
return new
#if (VS2012)
VCCLCompilerToolWrapperVs2012
#elif (VS2013)
VCCLCompilerToolWrapperVs2013
#elif (VS2015)
VCCLCompilerToolWrapperVs2015
#elif (VS2017)
VCCLCompilerToolWrapperVs2017
#endif
(null);
}
public IVCPlatformWrapper GetPlatform()
{
return new
#if (VS2012)
VCPlatformWrapperVs2012
#elif (VS2013)
VCPlatformWrapperVs2013
#elif (VS2015)
VCPlatformWrapperVs2015
#elif (VS2017)
VCPlatformWrapperVs2017
#endif
(_wrapped.Platform);
}
}
}