logic: Visual Studio plugin improvements

* changed dll version handling to be automated
* added some additional logging
* improved VCProjectWrapperFactory
This commit is contained in:
malte_langkabel
2017-06-05 15:14:55 +02:00
parent de645be37a
commit f31c0ae3ba
12 changed files with 92 additions and 48 deletions
Binary file not shown.
@@ -15,6 +15,5 @@ using System.Runtime.InteropServices;
[assembly: Guid("9de8c188-0f0e-4f5d-b3c4-ecf9cfb23e0d")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -29,8 +29,8 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -203,33 +203,42 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
Task task = factory.StartNew(() =>
{
SolutionParser.SolutionParser solutionParser = new SolutionParser.SolutionParser(new VsPathResolver(_targetDir));
List<SolutionParser.CompileCommand> commands = solutionParser.CreateCompileCommands(project, _configurationName, _platformName, _cStandard);
lock (_lockObject)
try
{
projectsProcessed++;
_headerDirectories.AddRange(solutionParser.HeaderDirectories);
}
SolutionParser.SolutionParser solutionParser = new SolutionParser.SolutionParser(new VsPathResolver(_targetDir));
float relativProgress = (float)projectsProcessed / (float)_projects.Count;
Logging.Logging.LogInfo("Processing project \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name) + "\"");
backgroundWorker1.ReportProgress((int)(relativProgress * 100), "Processing project \"" + project.Name + "\"");
List<CompileCommand> commands = solutionParser.CreateCompileCommands(project, _configurationName, _platformName, _cStandard);
foreach (SolutionParser.CompileCommand command in commands)
{
// cdb.AddOrUpdateCommandObject(obj, false); // since the data is written to file right away now, no need to store it
// the cdb is however still needed to store some meta data later
string serializedCommand = "";
foreach (string line in command.SerializeToJson().Split('\n'))
lock (_lockObject)
{
serializedCommand += " " + line + "\n";
projectsProcessed++;
_headerDirectories.AddRange(solutionParser.HeaderDirectories);
}
serializedCommand = serializedCommand.TrimEnd('\n');
fileWriter.PushMessage(serializedCommand + ",\n");
float relativProgress = (float)projectsProcessed / (float)_projects.Count;
Logging.Logging.LogInfo("Processing project \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name) + "\"");
backgroundWorker1.ReportProgress((int)(relativProgress * 100), "Processing project \"" + project.Name + "\"");
foreach (CompileCommand command in commands)
{
// cdb.AddOrUpdateCommandObject(obj, false); // since the data is written to file right away now, no need to store it
// the cdb is however still needed to store some meta data later
string serializedCommand = "";
foreach (string line in command.SerializeToJson().Split('\n'))
{
serializedCommand += " " + line + "\n";
}
serializedCommand = serializedCommand.TrimEnd('\n');
fileWriter.PushMessage(serializedCommand + ",\n");
}
}
catch (Exception e)
{
Logging.Logging.LogError("Failed to create CDB for project with exception: " + e.Message);
Logging.Logging.LogError("Stack Trace: " + e.StackTrace);
throw (e);
}
});
@@ -246,7 +255,8 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
}
catch(Exception e)
{
Logging.Logging.LogError("Failed to create CDB: " + e.Message);
Logging.Logging.LogError("Failed to create CDB for solution with exception: " + e.Message);
Logging.Logging.LogError("Stack Trace: " + e.StackTrace);
}
finally
{
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="acf15780-03b5-440e-a41e-db79b7043fc2" Version="0.9.81" Language="en-US" Publisher="Coati Software OG" />
<Identity Id="acf15780-03b5-440e-a41e-db79b7043fc2" Version="0.9.82" Language="en-US" Publisher="Coati Software OG" />
<DisplayName>SourcetrailPlugin</DisplayName>
<Description xml:space="preserve">The Sourcetrail Plugin allows Visual Studio to communicate with Sourcetrail - an external source code exploration tool. It also enables Visual Studio to generate a Clang Compilation Database from any Visual Studio Solution which can be used to automate the Sourcetrail project setup and to run other Clang based tools.</Description>
<MoreInfo>https://www.sourcetrail.com/</MoreInfo>
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,4 +1,6 @@
namespace VCProjectEngineWrapper
using System;
namespace VCProjectEngineWrapper
{
public static class VCProjectWrapperFactory
{
@@ -6,19 +8,52 @@
{
IVCProjectWrapper wrapper = null;
wrapper = new VCProjectWrapperVs2017(wrapped);
try
{
if (wrapper == null || !wrapper.isValid())
{
wrapper = new VCProjectWrapperVs2017(wrapped);
}
}
catch (Exception e)
{
wrapper = null;
}
if (wrapper == null || !wrapper.isValid())
try
{
wrapper = new VCProjectWrapperVs2015(wrapped);
if (wrapper == null || !wrapper.isValid())
{
wrapper = new VCProjectWrapperVs2015(wrapped);
}
}
if (wrapper == null || !wrapper.isValid())
catch (Exception e)
{
wrapper = new VCProjectWrapperVs2013(wrapped);
wrapper = null;
}
if (wrapper == null || !wrapper.isValid())
try
{
wrapper = new VCProjectWrapperVs2012(wrapped);
if (wrapper == null || !wrapper.isValid())
{
wrapper = new VCProjectWrapperVs2013(wrapped);
}
}
catch (Exception e)
{
wrapper = null;
}
try
{
if (wrapper == null || !wrapper.isValid())
{
wrapper = new VCProjectWrapperVs2012(wrapped);
}
}
catch (Exception e)
{
wrapper = null;
}
return wrapper;
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.9.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]