logic: improved plugin performance
* reduced file open/close events while writing cdb * fixed detection of header paths * refactored Visual Studio extension code * removed very old menu option for converting a solution directly into a Coati project (which would have been performed by Coati itself, not by the plugin).
This commit is contained in:
Binary file not shown.
@@ -9,7 +9,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourcetrailPlugin", "Source
|
||||
{8188D64D-E880-490C-B267-B493A2171BE3} = {8188D64D-E880-490C-B267-B493A2171BE3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourcetrailPlugin.IntegrationTests", "SourcetrailPlugin.IntegrationTests\SourcetrailPlugin.IntegrationTests.csproj", "{9DE8C188-0F0E-4F5D-B3C4-ECF9CFB23E0D}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourcetrailPluginTests", "SourcetrailPluginTests\SourcetrailPluginTests.csproj", "{9DE8C188-0F0E-4F5D-B3C4-ECF9CFB23E0D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VCProjectEngineWrapperInterfaces", "VCProjectEngineWrapperInterfaces\VCProjectEngineWrapperInterfaces.csproj", "{F592DB46-0C77-470B-AAF8-80C51F44380E}"
|
||||
EndProject
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using ComTypes = System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
namespace ComUtils
|
||||
|
||||
-2
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
// PkgCmdID.cs
|
||||
// MUST match PkgCmdID.h
|
||||
using System;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin
|
||||
{
|
||||
static class PkgCmdIDList
|
||||
{
|
||||
public const uint cmdidSourcetrailSetActiveToken = 0x104;
|
||||
public const uint cmdidSourcetrailCreateProject = 0x105;
|
||||
public const uint cmdidSourcetrailCreateCDB = 0x106;
|
||||
public const uint cmdidSourcetrailCreateCdb = 0x106;
|
||||
public const uint cmdidSourcetrailOpenLogFolder = 0x107;
|
||||
|
||||
};
|
||||
|
||||
+62
-309
@@ -1,11 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
{
|
||||
@@ -13,75 +7,72 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
{
|
||||
private List<CompileCommand> _compileCommands = new List<CompileCommand>();
|
||||
|
||||
// meta data
|
||||
private string _name = "";
|
||||
private string _sourceProject = "";
|
||||
private string _directory = "";
|
||||
|
||||
private System.DateTime _lastUpdated = new System.DateTime();
|
||||
|
||||
private List<string> _includedProjects = new List<string>();
|
||||
private string _configurationName = "";
|
||||
private string _platformName = "";
|
||||
|
||||
public string Name
|
||||
private bool TryLoadData(string filePath)
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
if (filePath.Length > 0)
|
||||
{
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
string data = "";
|
||||
|
||||
using (System.IO.StreamReader file = new System.IO.StreamReader(filePath))
|
||||
{
|
||||
string line = "";
|
||||
|
||||
while ((line = file.ReadLine()) != null)
|
||||
{
|
||||
data += line;
|
||||
}
|
||||
}
|
||||
|
||||
DeserializeFromJson(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogError("The cdb file at \"" + filePath + "\" does not exist.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogWarning("Can't load cdb data. Filepath has not been set.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public string SourceProject
|
||||
{
|
||||
get { return _sourceProject; }
|
||||
set { _sourceProject = value; }
|
||||
}
|
||||
|
||||
public string Directory
|
||||
{
|
||||
get { return _directory; }
|
||||
set { _directory = value; }
|
||||
}
|
||||
|
||||
public System.DateTime LastUpdated
|
||||
{
|
||||
get { return _lastUpdated; }
|
||||
set { _lastUpdated = value; }
|
||||
}
|
||||
|
||||
public List<string> IncludedProjects
|
||||
{
|
||||
get { return _includedProjects; }
|
||||
set { _includedProjects = value; }
|
||||
}
|
||||
|
||||
public string ConfigurationName
|
||||
{
|
||||
get { return _configurationName; }
|
||||
set { _configurationName = value; }
|
||||
}
|
||||
|
||||
public string PlatformName
|
||||
{
|
||||
get { return _platformName; }
|
||||
set { _platformName = value; }
|
||||
}
|
||||
|
||||
public int CompileCommandCount
|
||||
{
|
||||
get { return _compileCommands.Count; }
|
||||
}
|
||||
|
||||
public static CompilationDatabase LoadFromFile(string filePath)
|
||||
{
|
||||
CompilationDatabase cdb = new CompilationDatabase();
|
||||
cdb.Name = Path.GetFileNameWithoutExtension(filePath);
|
||||
cdb.Directory = Path.GetDirectoryName(filePath);
|
||||
|
||||
bool success = cdb.TryLoadData();
|
||||
|
||||
bool success = cdb.TryLoadData(filePath);
|
||||
return cdb;
|
||||
}
|
||||
|
||||
|
||||
public string SerializeToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(_compileCommands, Newtonsoft.Json.Formatting.Indented);
|
||||
}
|
||||
|
||||
public void DeserializeFromJson(string serialized)
|
||||
{
|
||||
_compileCommands.Clear();
|
||||
|
||||
if (serialized.Length > 0)
|
||||
{
|
||||
_compileCommands = JsonConvert.DeserializeObject<List<CompileCommand>>(serialized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int CompileCommandCount
|
||||
{
|
||||
get { return _compileCommands.Count; }
|
||||
}
|
||||
|
||||
public static bool operator ==(CompilationDatabase a, CompilationDatabase b)
|
||||
{
|
||||
if (System.Object.ReferenceEquals(a, b))
|
||||
@@ -116,257 +107,19 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
public void AddCommandObject(CompileCommand commandObject)
|
||||
public void AddCompileCommand(CompileCommand commandObject)
|
||||
{
|
||||
_compileCommands.Add(commandObject); // updating is not efficient as it is
|
||||
_compileCommands.Add(commandObject);
|
||||
}
|
||||
|
||||
// remove commandObjects for removed files
|
||||
public void Clean()
|
||||
public void SortAlphabetically()
|
||||
{
|
||||
for (int i = 0; i < _compileCommands.Count; i++)
|
||||
{
|
||||
if (System.IO.File.Exists(_compileCommands[i].File) == false)
|
||||
{
|
||||
_compileCommands.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
_compileCommands.Sort((c1, c2) => c1.File.CompareTo(c2.File));
|
||||
}
|
||||
|
||||
public void ClearCommandObjects()
|
||||
public void Clear()
|
||||
{
|
||||
_compileCommands.Clear();
|
||||
}
|
||||
|
||||
public bool CheckCDBExists()
|
||||
{
|
||||
if (_directory.Length > 0 && _name.Length > 0)
|
||||
{
|
||||
string path = GetFilePath();
|
||||
|
||||
if(System.IO.File.Exists(path) == false)
|
||||
{
|
||||
_lastUpdated = System.DateTime.MinValue; // if file is missing, set date way back so it doesn't interfere with re-building
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogWarning("Can't check cdb data, directory and/or name has not been set: directory - '" + _directory + "', name - '" + _name + "'");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool TryLoadData()
|
||||
{
|
||||
if(_directory.Length > 0 && _name.Length > 0)
|
||||
{
|
||||
string path = GetFilePath();
|
||||
if(System.IO.File.Exists(path))
|
||||
{
|
||||
string data = "";
|
||||
|
||||
using (System.IO.StreamReader file = new System.IO.StreamReader(path))
|
||||
{
|
||||
string line = "";
|
||||
|
||||
while ((line = file.ReadLine()) != null)
|
||||
{
|
||||
data += line;
|
||||
}
|
||||
}
|
||||
|
||||
DeserializeFromJson(data);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_lastUpdated = System.DateTime.MinValue; // if file is missing, set date way back so it doesn't interfere with re-building
|
||||
|
||||
Logging.Logging.LogError("The cdb file '" + path + "' does not exist.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogWarning("Can't load cdb data, directory and/or name has not been set: directory - '" + _directory + "', name - '" + _name + "'");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UnloadData()
|
||||
{
|
||||
_compileCommands.Clear();
|
||||
}
|
||||
|
||||
public string SerializeToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(_compileCommands, Newtonsoft.Json.Formatting.Indented);
|
||||
}
|
||||
|
||||
public void DeserializeFromJson(string serialized)
|
||||
{
|
||||
_compileCommands.Clear();
|
||||
|
||||
if (serialized.Length > 0)
|
||||
{
|
||||
_compileCommands = JsonConvert.DeserializeObject<List<CompileCommand>>(serialized);
|
||||
}
|
||||
}
|
||||
|
||||
public XmlNode GetMetaDataXML(XmlDocument doc)
|
||||
{
|
||||
// XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = doc.CreateElement("cdb");
|
||||
|
||||
XmlElement name = doc.CreateElement("name");
|
||||
name.InnerText = _name;
|
||||
|
||||
XmlElement sourceProject = doc.CreateElement("sourceProject");
|
||||
sourceProject.InnerText = _sourceProject;
|
||||
|
||||
XmlElement directory = doc.CreateElement("directory");
|
||||
directory.InnerText = _directory;
|
||||
|
||||
XmlElement lastUpdated = doc.CreateElement("lastUpdated");
|
||||
lastUpdated.InnerText = _lastUpdated.ToString();
|
||||
|
||||
XmlElement includedProjects = doc.CreateElement("includedProjects");
|
||||
foreach (string project in _includedProjects)
|
||||
{
|
||||
XmlElement includedProject = doc.CreateElement("includedProject");
|
||||
includedProject.InnerText = project;
|
||||
includedProjects.AppendChild(includedProject);
|
||||
}
|
||||
|
||||
XmlElement configuration = doc.CreateElement("configuration");
|
||||
configuration.InnerText = _configurationName;
|
||||
|
||||
XmlElement platform = doc.CreateElement("platform");
|
||||
platform.InnerText = _platformName;
|
||||
|
||||
root.AppendChild(name);
|
||||
root.AppendChild(sourceProject);
|
||||
root.AppendChild(directory);
|
||||
root.AppendChild(lastUpdated);
|
||||
root.AppendChild(includedProjects);
|
||||
root.AppendChild(configuration);
|
||||
root.AppendChild(platform);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
public string SerializeMetaDataXML()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = GetMetaDataXML(doc);
|
||||
|
||||
System.IO.StringWriter writer = new System.IO.StringWriter();
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(XmlElement));
|
||||
serializer.Serialize(writer, root);
|
||||
|
||||
return writer.ToString();
|
||||
}
|
||||
|
||||
public static List<CompilationDatabase> ParseCDBsMetaData(string data)
|
||||
{
|
||||
List<CompilationDatabase> cdbs = new List<CompilationDatabase>();
|
||||
|
||||
if(data.Length > 0)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(data);
|
||||
XmlNode root = doc.SelectSingleNode("cdbs");
|
||||
|
||||
XmlNodeList nodes = root.SelectNodes("cdb");
|
||||
|
||||
foreach (XmlNode node in nodes)
|
||||
{
|
||||
cdbs.Add(ParseCDBMetaData(node));
|
||||
}
|
||||
}
|
||||
|
||||
return cdbs;
|
||||
}
|
||||
|
||||
public static CompilationDatabase ParseCDBMetaData(XmlNode node)
|
||||
{
|
||||
CompilationDatabase cdb = new CompilationDatabase();
|
||||
|
||||
XmlNode nameNode = node.SelectSingleNode("name");
|
||||
string name = nameNode.InnerText;
|
||||
|
||||
XmlNode sourceNode = node.SelectSingleNode("sourceProject");
|
||||
string source = sourceNode.InnerText;
|
||||
|
||||
XmlNode directoryNode = node.SelectSingleNode("directory");
|
||||
string directory = directoryNode.InnerText;
|
||||
|
||||
XmlNode updatedNode = node.SelectSingleNode("lastUpdated");
|
||||
string updated = updatedNode.InnerText;
|
||||
System.DateTime updatedDate;
|
||||
if(System.DateTime.TryParse(updated, out updatedDate) == false)
|
||||
{
|
||||
updatedDate = System.DateTime.MinValue;
|
||||
}
|
||||
|
||||
XmlNode includedProjects = node.SelectSingleNode("includedProjects");
|
||||
XmlNodeList includedProjectNodes = includedProjects.SelectNodes("includedProject");
|
||||
List<string> includedProjectsList = new List<string>();
|
||||
foreach(XmlNode p in includedProjectNodes)
|
||||
{
|
||||
includedProjectsList.Add(p.InnerText);
|
||||
}
|
||||
|
||||
XmlNode configurationNode = node.SelectSingleNode("configuration");
|
||||
string configuration = configurationNode.InnerText;
|
||||
|
||||
XmlNode platformNode = node.SelectSingleNode("platform");
|
||||
string platform = platformNode.InnerText;
|
||||
|
||||
// if cdb file is not there anymore, set the modified date back so that a full update will be performed
|
||||
if(System.IO.File.Exists(directory + "\\" + name + ".json") == false)
|
||||
{
|
||||
updatedDate = System.DateTime.MinValue;
|
||||
}
|
||||
|
||||
cdb.Name = name;
|
||||
cdb.SourceProject = source;
|
||||
cdb.Directory = directory;
|
||||
cdb.LastUpdated = updatedDate;
|
||||
cdb.IncludedProjects = includedProjectsList;
|
||||
cdb.ConfigurationName = configuration;
|
||||
cdb.PlatformName = platform;
|
||||
|
||||
return cdb;
|
||||
}
|
||||
|
||||
private bool TryUpdateCommandObject(CompileCommand co)
|
||||
{
|
||||
CompileCommand old = _compileCommands.Find(x => x.File == co.File);
|
||||
|
||||
if(old != null)
|
||||
{
|
||||
_compileCommands.Remove(old);
|
||||
_compileCommands.Add(co);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private string GetFilePath()
|
||||
{
|
||||
return _directory + "\\" + _name + ".json";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+218
@@ -0,0 +1,218 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
{
|
||||
public class CompilationDatabaseSettings
|
||||
{
|
||||
private string _name = "";
|
||||
private string _sourceProject = "";
|
||||
private string _directory = "";
|
||||
|
||||
private System.DateTime _lastUpdated = new System.DateTime();
|
||||
|
||||
private List<string> _includedProjects = new List<string>();
|
||||
private string _configurationName = "";
|
||||
private string _platformName = "";
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _name; }
|
||||
set { _name = value; }
|
||||
}
|
||||
|
||||
public string SourceProject
|
||||
{
|
||||
get { return _sourceProject; }
|
||||
set { _sourceProject = value; }
|
||||
}
|
||||
|
||||
public string Directory
|
||||
{
|
||||
get { return _directory; }
|
||||
set { _directory = value; }
|
||||
}
|
||||
|
||||
public System.DateTime LastUpdated
|
||||
{
|
||||
get { return _lastUpdated; }
|
||||
set { _lastUpdated = value; }
|
||||
}
|
||||
|
||||
public List<string> IncludedProjects
|
||||
{
|
||||
get { return _includedProjects; }
|
||||
set { _includedProjects = value; }
|
||||
}
|
||||
|
||||
public string ConfigurationName
|
||||
{
|
||||
get { return _configurationName; }
|
||||
set { _configurationName = value; }
|
||||
}
|
||||
|
||||
public string PlatformName
|
||||
{
|
||||
get { return _platformName; }
|
||||
set { _platformName = value; }
|
||||
}
|
||||
|
||||
public bool CheckCdbExists()
|
||||
{
|
||||
if (_directory.Length > 0 && _name.Length > 0)
|
||||
{
|
||||
string path = GetFilePath();
|
||||
|
||||
if(System.IO.File.Exists(path) == false)
|
||||
{
|
||||
_lastUpdated = System.DateTime.MinValue; // if file is missing, set date way back so it doesn't interfere with re-building
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogWarning("Can't check cdb data, directory and/or name has not been set: directory - '" + _directory + "', name - '" + _name + "'");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public XmlNode GetMetaDataXML(XmlDocument doc)
|
||||
{
|
||||
// XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = doc.CreateElement("cdb");
|
||||
|
||||
XmlElement name = doc.CreateElement("name");
|
||||
name.InnerText = _name;
|
||||
|
||||
XmlElement sourceProject = doc.CreateElement("sourceProject");
|
||||
sourceProject.InnerText = _sourceProject;
|
||||
|
||||
XmlElement directory = doc.CreateElement("directory");
|
||||
directory.InnerText = _directory;
|
||||
|
||||
XmlElement lastUpdated = doc.CreateElement("lastUpdated");
|
||||
lastUpdated.InnerText = _lastUpdated.ToString();
|
||||
|
||||
XmlElement includedProjects = doc.CreateElement("includedProjects");
|
||||
foreach (string project in _includedProjects)
|
||||
{
|
||||
XmlElement includedProject = doc.CreateElement("includedProject");
|
||||
includedProject.InnerText = project;
|
||||
includedProjects.AppendChild(includedProject);
|
||||
}
|
||||
|
||||
XmlElement configuration = doc.CreateElement("configuration");
|
||||
configuration.InnerText = _configurationName;
|
||||
|
||||
XmlElement platform = doc.CreateElement("platform");
|
||||
platform.InnerText = _platformName;
|
||||
|
||||
root.AppendChild(name);
|
||||
root.AppendChild(sourceProject);
|
||||
root.AppendChild(directory);
|
||||
root.AppendChild(lastUpdated);
|
||||
root.AppendChild(includedProjects);
|
||||
root.AppendChild(configuration);
|
||||
root.AppendChild(platform);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
public string SerializeMetaDataXML()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = GetMetaDataXML(doc);
|
||||
|
||||
System.IO.StringWriter writer = new System.IO.StringWriter();
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(XmlElement));
|
||||
serializer.Serialize(writer, root);
|
||||
|
||||
return writer.ToString();
|
||||
}
|
||||
|
||||
public static List<CompilationDatabaseSettings> ParseCdbsMetaData(string data)
|
||||
{
|
||||
List<CompilationDatabaseSettings> cdbs = new List<CompilationDatabaseSettings>();
|
||||
|
||||
if(data.Length > 0)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(data);
|
||||
XmlNode root = doc.SelectSingleNode("cdbs");
|
||||
|
||||
XmlNodeList nodes = root.SelectNodes("cdb");
|
||||
|
||||
foreach (XmlNode node in nodes)
|
||||
{
|
||||
cdbs.Add(ParseCdbMetaData(node));
|
||||
}
|
||||
}
|
||||
|
||||
return cdbs;
|
||||
}
|
||||
|
||||
public static CompilationDatabaseSettings ParseCdbMetaData(XmlNode node)
|
||||
{
|
||||
CompilationDatabaseSettings cdb = new CompilationDatabaseSettings();
|
||||
|
||||
XmlNode nameNode = node.SelectSingleNode("name");
|
||||
string name = nameNode.InnerText;
|
||||
|
||||
XmlNode sourceNode = node.SelectSingleNode("sourceProject");
|
||||
string source = sourceNode.InnerText;
|
||||
|
||||
XmlNode directoryNode = node.SelectSingleNode("directory");
|
||||
string directory = directoryNode.InnerText;
|
||||
|
||||
XmlNode updatedNode = node.SelectSingleNode("lastUpdated");
|
||||
string updated = updatedNode.InnerText;
|
||||
System.DateTime updatedDate;
|
||||
if(System.DateTime.TryParse(updated, out updatedDate) == false)
|
||||
{
|
||||
updatedDate = System.DateTime.MinValue;
|
||||
}
|
||||
|
||||
XmlNode includedProjects = node.SelectSingleNode("includedProjects");
|
||||
XmlNodeList includedProjectNodes = includedProjects.SelectNodes("includedProject");
|
||||
List<string> includedProjectsList = new List<string>();
|
||||
foreach(XmlNode p in includedProjectNodes)
|
||||
{
|
||||
includedProjectsList.Add(p.InnerText);
|
||||
}
|
||||
|
||||
XmlNode configurationNode = node.SelectSingleNode("configuration");
|
||||
string configuration = configurationNode.InnerText;
|
||||
|
||||
XmlNode platformNode = node.SelectSingleNode("platform");
|
||||
string platform = platformNode.InnerText;
|
||||
|
||||
// if cdb file is not there anymore, set the modified date back so that a full update will be performed
|
||||
if(System.IO.File.Exists(directory + "\\" + name + ".json") == false)
|
||||
{
|
||||
updatedDate = System.DateTime.MinValue;
|
||||
}
|
||||
|
||||
cdb.Name = name;
|
||||
cdb.SourceProject = source;
|
||||
cdb.Directory = directory;
|
||||
cdb.LastUpdated = updatedDate;
|
||||
cdb.IncludedProjects = includedProjectsList;
|
||||
cdb.ConfigurationName = configuration;
|
||||
cdb.PlatformName = platform;
|
||||
|
||||
return cdb;
|
||||
}
|
||||
|
||||
private string GetFilePath()
|
||||
{
|
||||
return _directory + "\\" + _name + ".json";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
{
|
||||
+42
-58
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CoatiSoftware.SourcetrailPlugin.Utility;
|
||||
using EnvDTE;
|
||||
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using CoatiSoftware.SourcetrailPlugin.Utility;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using VCProjectEngineWrapper;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
@@ -15,7 +14,8 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
static private List<Guid> _reloadedProjectGuids = new List<Guid>();
|
||||
static private List<string> _compatibilityFlags = new List<string>() { "-fms-extensions", "-fms-compatibility" };
|
||||
static private string _compatibilityVersionFlagBase = "-fms-compatibility-version="; // We want to get the exact version at runtime for this flag, therefore keeping it seperate from the others makes things easier
|
||||
static private List<string> _extensionWhiteList = new List<string>() { "c", "cc", "cpp", "cxx", "C", "h", "hpp" };
|
||||
static private List<string> _sourceExtensionWhiteList = new List<string>() { "c", "cc", "cpp", "cxx" };
|
||||
static private List<string> _headerExtensionWhiteList = new List<string>() { "h", "hpp" };
|
||||
|
||||
private string _compatibilityVersionFlag = _compatibilityVersionFlagBase + "19"; // This default version would correspond to VS2015
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
|
||||
public List<CompileCommand> CreateCompileCommands(Project project, string configurationName, string platformName, string cStandard)
|
||||
{
|
||||
Logging.Logging.LogInfo("Creating command objects from project " + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name));
|
||||
Logging.Logging.LogInfo("Creating command objects for project \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name) + "\".");
|
||||
|
||||
List<CompileCommand> result = new List<CompileCommand>();
|
||||
|
||||
@@ -43,13 +43,13 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
Guid projectGuid = Utility.ProjectUtility.ReloadProject(project);
|
||||
|
||||
IVCProjectWrapper vcProject = VCProjectEngineWrapper.VCProjectWrapperFactory.create(project.Object);
|
||||
if (vcProject.isValid())
|
||||
if (vcProject != null && vcProject.isValid())
|
||||
{
|
||||
Logging.Logging.LogInfo("Project '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name) + "' has been converted to VCProject " + vcProject.GetWrappedVersion() + ".");
|
||||
Logging.Logging.LogInfo("Project \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name) + "\" has been converted to VCProject " + vcProject.GetWrappedVersion() + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogWarning("Project '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name) + "' could not be converted to VCProject, skipping.");
|
||||
Logging.Logging.LogWarning("Project \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(project.Name) + "\" could not be converted to VCProject, skipping.");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
|
||||
private CompileCommand CreateCompileCommand(EnvDTE.ProjectItem item, List<string> includeDirectories, List<string> preprocessorDefinitions, string vcStandard, string cStandard, string configurationName, string platformName)
|
||||
{
|
||||
Logging.Logging.LogInfo("Starting to create Command Object from item '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(item.Name) + "'");
|
||||
Logging.Logging.LogInfo("Starting to create Command Object from item \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(item.Name) + "\"");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -116,34 +116,11 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
Logging.Logging.LogInfo("Unable to retrieve build tool. Using extension white-list to determine file type.");
|
||||
}
|
||||
|
||||
if (IsSourceFile(item, compilerTool))
|
||||
if (CheckIsSourceFile(item, compilerTool))
|
||||
{
|
||||
CompileCommand command = new CompileCommand();
|
||||
command.File = item.Name;
|
||||
|
||||
// only write source files to cdb, headers are implicit
|
||||
// however, retreive header directory
|
||||
if (CheckIsHeader(item))
|
||||
{
|
||||
Properties props = item.Properties;
|
||||
foreach (Property prop in props)
|
||||
{
|
||||
string propName = prop.Name;
|
||||
string propValue = prop.Value as String;
|
||||
|
||||
if (propName == "FullPath")
|
||||
{
|
||||
int i = propValue.LastIndexOf('\\');
|
||||
|
||||
propValue = propValue.Substring(0, i);
|
||||
|
||||
_headerDirectories.Add(propValue);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
string additionalOptions = "";
|
||||
if (compilerTool != null && compilerTool.isValid())
|
||||
{
|
||||
@@ -202,6 +179,20 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
|
||||
return command;
|
||||
}
|
||||
else if (CheckIsHeaderFile(item, compilerTool))
|
||||
{
|
||||
if (ProjectUtility.HasProperty(item.Properties, "FullPath"))
|
||||
{
|
||||
string propValue = item.Properties.Item("FullPath").Value.ToString();
|
||||
|
||||
int i = propValue.LastIndexOf('\\');
|
||||
|
||||
propValue = propValue.Substring(0, i);
|
||||
|
||||
_headerDirectories.Add(propValue);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogInfo("Item discarded, wrong code model");
|
||||
@@ -217,7 +208,7 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
return null;
|
||||
}
|
||||
|
||||
static private bool IsSourceFile(ProjectItem item, IVCCLCompilerToolWrapper tool)
|
||||
static private bool CheckIsSourceFile(ProjectItem item, IVCCLCompilerToolWrapper tool)
|
||||
{
|
||||
if (tool != null && tool.isValid()) // if the tool is null it's probably not a normal VC project, indicating that the file code model is unavailable
|
||||
{
|
||||
@@ -244,7 +235,7 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (_extensionWhiteList.Contains(GetFileExtension(item)))
|
||||
else if (_sourceExtensionWhiteList.Contains(GetFileExtension(item).ToLower()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -252,35 +243,28 @@ namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
return false;
|
||||
}
|
||||
|
||||
static private bool CheckIsHeader(EnvDTE.ProjectItem item)
|
||||
static private bool CheckIsHeaderFile(EnvDTE.ProjectItem item, IVCCLCompilerToolWrapper tool)
|
||||
{
|
||||
Properties props = item.Properties;
|
||||
|
||||
string propString = "";
|
||||
|
||||
try
|
||||
if (tool != null && tool.isValid()) // if the tool is null it's probably not a normal VC project, indicating that the file code model is unavailable
|
||||
{
|
||||
foreach (Property prop in props)
|
||||
try
|
||||
{
|
||||
string propName = prop.Name;
|
||||
string propValue = prop.Value as String;
|
||||
|
||||
propString += propName + " - " + propValue + "; ";
|
||||
|
||||
if (propName == "ItemType")
|
||||
if (ProjectUtility.HasProperty(item.Properties, "ItemType") && item.Properties.Item("ItemType").Value.ToString() == "ClInclude")
|
||||
{
|
||||
if (propValue as String == "ClInclude")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Logging.Logging.LogInfo("Accepting item because of its \"ItemType\" property");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Exception: " + e.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
else if (_headerExtensionWhiteList.Contains(GetFileExtension(item).ToLower()))
|
||||
{
|
||||
Logging.Logging.LogError("Exception: " + e.Message);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using CoatiSoftware.SourcetrailPlugin.Utility;
|
||||
using CoatiSoftware.SourcetrailPlugin.Utility;
|
||||
using System;
|
||||
using VCProjectEngineWrapper;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.SolutionParser
|
||||
|
||||
+30
-13
@@ -139,9 +139,10 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="ComUtils.cs" />
|
||||
<Compile Include="Multitasking\LimitedThreadsTaskScheduler.cs" />
|
||||
<Compile Include="SolutionParser\CompilationDatabase.cs" />
|
||||
<Compile Include="Utility\IPathResolver.cs" />
|
||||
<Compile Include="SolutionParser\VsPathResolver.cs" />
|
||||
<Compile Include="Utility\CompilationDatabaseList.cs" />
|
||||
<Compile Include="Utility\CompilationDatabaseSettingsList.cs" />
|
||||
<Compile Include="Utility\DataUtility.cs" />
|
||||
<Compile Include="Utility\FileUtility.cs" />
|
||||
<Compile Include="Guids.cs" />
|
||||
@@ -158,25 +159,25 @@
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="PkgCmdID.cs" />
|
||||
<Compile Include="SolutionParser\CommandObject.cs" />
|
||||
<Compile Include="SolutionParser\CompilationDatabase.cs" />
|
||||
<Compile Include="SolutionParser\CompileCommand.cs" />
|
||||
<Compile Include="SolutionParser\CompilationDatabaseSettings.cs" />
|
||||
<Compile Include="SolutionParser\SolutionParser.cs" />
|
||||
<Compile Include="Utility\ProjectUtility.cs" />
|
||||
<Compile Include="Utility\QueuedFileWriter.cs" />
|
||||
<Compile Include="Utility\SolutionUtility.cs" />
|
||||
<Compile Include="Utility\SystemUtility.cs" />
|
||||
<Compile Include="Utility\StringUtility.cs" />
|
||||
<Compile Include="Wizard\WindowCDBReady.cs">
|
||||
<Compile Include="Wizard\WindowCdbReady.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Wizard\WindowCDBReady.Designer.cs">
|
||||
<DependentUpon>WindowCDBReady.cs</DependentUpon>
|
||||
<Compile Include="Wizard\WindowCdbReady.Designer.cs">
|
||||
<DependentUpon>WindowCdbReady.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Wizard\WindowCreateCDB.cs">
|
||||
<Compile Include="Wizard\WindowCreateCdb.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Wizard\WindowCreateCDB.Designer.cs">
|
||||
<DependentUpon>WindowCreateCDB.cs</DependentUpon>
|
||||
<Compile Include="Wizard\WindowCreateCdb.Designer.cs">
|
||||
<DependentUpon>WindowCreateCdb.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Wizard\ProjectSetupWindow.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -202,11 +203,11 @@
|
||||
<ManifestResourceName>VSPackage</ManifestResourceName>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Wizard\WindowCDBReady.resx">
|
||||
<DependentUpon>WindowCDBReady.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Wizard\WindowCdbReady.resx">
|
||||
<DependentUpon>WindowCdbReady.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Wizard\WindowCreateCDB.resx">
|
||||
<DependentUpon>WindowCreateCDB.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Wizard\WindowCreateCdb.resx">
|
||||
<DependentUpon>WindowCreateCdb.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Wizard\ProjectSetupWindow.resx">
|
||||
<DependentUpon>ProjectSetupWindow.cs</DependentUpon>
|
||||
@@ -257,6 +258,22 @@
|
||||
<Project>{f592db46-0c77-470b-aaf8-80c51f44380e}</Project>
|
||||
<Name>VCProjectEngineWrapperInterfaces</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapper\VCProjectEngineWrapperVs2012.csproj">
|
||||
<Project>{c5439b90-42e7-414d-8c3f-bdcabb0592e2}</Project>
|
||||
<Name>VCProjectEngineWrapperVs2012</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapper\VCProjectEngineWrapperVs2013.csproj">
|
||||
<Project>{8718929c-5270-4e5a-8998-48ac7ce19dc2}</Project>
|
||||
<Name>VCProjectEngineWrapperVs2013</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapper\VCProjectEngineWrapperVs2015.csproj">
|
||||
<Project>{1c139999-9592-4891-aa62-2c8a16430d0a}</Project>
|
||||
<Name>VCProjectEngineWrapperVs2015</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VCProjectEngineWrapper\VCProjectEngineWrapperVs2017.csproj">
|
||||
<Project>{b49207f9-89a3-42d8-bc04-8bf77ed2e295}</Project>
|
||||
<Name>VCProjectEngineWrapperVs2017</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<UseCodebase>true</UseCodebase>
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<StartAction>Program</StartAction>
|
||||
<StartProgram>D:\programme\Microsoft Visual Studio14\Common7\IDE\devenv.exe</StartProgram>
|
||||
<StartProgram>D:\programme\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe</StartProgram>
|
||||
<StartArguments>/rootsuffix Exp</StartArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -62,11 +62,11 @@
|
||||
</Strings>
|
||||
</Button>
|
||||
|
||||
<Button guid="guidSourcetrailPluginCmdSet" id="cmdidSourcetrailCreateCDB" priority="0x0100" type="Button">
|
||||
<Button guid="guidSourcetrailPluginCmdSet" id="cmdidSourcetrailCreateCdb" priority="0x0100" type="Button">
|
||||
<Parent guid="guidSourcetrailPluginCmdSet" id="SubMenu" />
|
||||
<Icon guid="icon" id="icon0" />
|
||||
<Strings>
|
||||
<ButtonText>Create CDB</ButtonText>
|
||||
<ButtonText>Create Compilation Database</ButtonText>
|
||||
</Strings>
|
||||
</Button>
|
||||
|
||||
@@ -129,8 +129,7 @@
|
||||
<IDSymbol name="cmdidSourcetrailGetActiveFileName" value="0x0102"/>
|
||||
<IDSymbol name="cmdidSourcetrailGetActiveLineNumber" value="0x0103"/>
|
||||
<IDSymbol name="cmdidSourcetrailSetActiveToken" value="0x0104"/>
|
||||
<IDSymbol name="cmdidSourcetrailCreateProject" value="0x0105"/>
|
||||
<IDSymbol name="cmdidSourcetrailCreateCDB" value="0x0106"/>
|
||||
<IDSymbol name="cmdidSourcetrailCreateCdb" value="0x0106"/>
|
||||
<IDSymbol name="cmdidSourcetrailOpenLogFolder" value="0x0107"/>
|
||||
<IDSymbol name="TopLevelMenu" value="0x1021"/>
|
||||
<IDSymbol name="SubMenu" value="0x1022"/>
|
||||
|
||||
+51
-98
@@ -1,14 +1,12 @@
|
||||
using System;
|
||||
using EnvDTE;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using EnvDTE;
|
||||
using System.IO;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin
|
||||
{
|
||||
@@ -122,15 +120,14 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
public sealed class SourcetrailPluginPackage : Package
|
||||
{
|
||||
private MenuCommand _menuItemSetActiveToken = null;
|
||||
private MenuCommand _menuItemCreateProject = null;
|
||||
private MenuCommand _menuItemCreateCDB = null;
|
||||
private MenuCommand _menuItemCreateCdb = null;
|
||||
private MenuCommand _menuItemOpenLogDir = null;
|
||||
|
||||
private SolutionEvents _solutionEvents = null;
|
||||
|
||||
private bool _validSolutionLoaded = false;
|
||||
|
||||
Utility.CompilationDatabaseList _cdbList = new Utility.CompilationDatabaseList();
|
||||
Utility.CompilationDatabaseSettingsList _recentSettingsList = new Utility.CompilationDatabaseSettingsList();
|
||||
|
||||
public uint ServerPort
|
||||
{
|
||||
@@ -201,26 +198,22 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
|
||||
// register the plugin UI elements
|
||||
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
|
||||
if ( null != mcs )
|
||||
if (null != mcs)
|
||||
{
|
||||
CommandID setActiveTokenCommandID = new CommandID(GuidList.guidSourcetrailPluginCmdSet, (int)PkgCmdIDList.cmdidSourcetrailSetActiveToken);
|
||||
CommandID createProjectID = new CommandID(GuidList.guidSourcetrailPluginCmdSet, (int)PkgCmdIDList.cmdidSourcetrailCreateProject);
|
||||
CommandID createCDBID = new CommandID(GuidList.guidSourcetrailPluginCmdSet, (int)PkgCmdIDList.cmdidSourcetrailCreateCDB);
|
||||
CommandID createCdbID = new CommandID(GuidList.guidSourcetrailPluginCmdSet, (int)PkgCmdIDList.cmdidSourcetrailCreateCdb);
|
||||
CommandID openLogDirID = new CommandID(GuidList.guidSourcetrailPluginCmdSet, (int)PkgCmdIDList.cmdidSourcetrailOpenLogFolder);
|
||||
|
||||
_menuItemSetActiveToken = new MenuCommand(MenuItemCallback, setActiveTokenCommandID);
|
||||
_menuItemCreateProject = new MenuCommand(MenuItemCallback, createProjectID);
|
||||
_menuItemCreateCDB = new MenuCommand(MenuItemCallback, createCDBID);
|
||||
_menuItemCreateCdb = new MenuCommand(MenuItemCallback, createCdbID);
|
||||
_menuItemOpenLogDir = new MenuCommand(MenuItemCallback, openLogDirID);
|
||||
|
||||
_menuItemCreateProject.Enabled = false;
|
||||
|
||||
_menuItemSetActiveToken.Enabled = false;
|
||||
_menuItemCreateCDB.Enabled = false;
|
||||
_menuItemCreateCdb.Enabled = false;
|
||||
_menuItemOpenLogDir.Enabled = true;
|
||||
|
||||
mcs.AddCommand(_menuItemSetActiveToken);
|
||||
mcs.AddCommand(_menuItemCreateProject);
|
||||
mcs.AddCommand(_menuItemCreateCDB);
|
||||
mcs.AddCommand(_menuItemCreateCdb);
|
||||
mcs.AddCommand(_menuItemOpenLogDir);
|
||||
}
|
||||
|
||||
@@ -248,9 +241,9 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
|
||||
string solutionPath = Utility.SolutionUtility.GetSolutionPath(dte);
|
||||
|
||||
if(_cdbList.CheckCDBForSolutionExists(solutionPath))
|
||||
if(_recentSettingsList.CheckCdbForSolutionExists(solutionPath))
|
||||
{
|
||||
Logging.Logging.LogInfo("A CDB for the loaded solution already exists.");
|
||||
Logging.Logging.LogInfo("A Cdb for the loaded solution already exists.");
|
||||
}
|
||||
|
||||
bool enable = false;
|
||||
@@ -268,8 +261,7 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
{
|
||||
Logging.Logging.LogInfo("Enabling plugin UI");
|
||||
_menuItemSetActiveToken.Enabled = true;
|
||||
_menuItemCreateProject.Enabled = true;
|
||||
_menuItemCreateCDB.Enabled = true;
|
||||
_menuItemCreateCdb.Enabled = true;
|
||||
|
||||
_validSolutionLoaded = true;
|
||||
}
|
||||
@@ -292,8 +284,7 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
Logging.Logging.LogInfo("Solution closed, disabling plugin UI");
|
||||
|
||||
_menuItemSetActiveToken.Enabled = false;
|
||||
_menuItemCreateProject.Enabled = false;
|
||||
_menuItemCreateCDB.Enabled = false;
|
||||
_menuItemCreateCdb.Enabled = false;
|
||||
|
||||
_validSolutionLoaded = false;
|
||||
}
|
||||
@@ -340,36 +331,36 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
{
|
||||
DTE dte = (DTE)GetService(typeof(DTE));
|
||||
|
||||
Wizard.WindowCreateCDB createCDB = new Wizard.WindowCreateCDB();
|
||||
createCDB.Projects = projects;
|
||||
createCDB.ConfigurationName = configurationName;
|
||||
createCDB.PlatformName = platformName;
|
||||
createCDB.TargetDir = targetDir;
|
||||
createCDB.FileName = fileName;
|
||||
createCDB.CStandard = cStandard;
|
||||
createCDB.ThreadCount = (int)ThreadCount;
|
||||
createCDB.SolutionDir = Utility.SolutionUtility.GetSolutionPath(dte);
|
||||
Wizard.WindowCreateCdb createCdbWindow = new Wizard.WindowCreateCdb();
|
||||
createCdbWindow.Projects = projects;
|
||||
createCdbWindow.ConfigurationName = configurationName;
|
||||
createCdbWindow.PlatformName = platformName;
|
||||
createCdbWindow.TargetDir = targetDir;
|
||||
createCdbWindow.FileName = fileName;
|
||||
createCdbWindow.CStandard = cStandard;
|
||||
createCdbWindow.ThreadCount = (int)ThreadCount;
|
||||
createCdbWindow.SolutionDir = Utility.SolutionUtility.GetSolutionPath(dte);
|
||||
|
||||
createCDB.CDB = _cdbList.GetCDBForSolution(createCDB.SolutionDir, targetDir + "\\" + fileName + ".json");
|
||||
createCdbWindow.Cdb = _recentSettingsList.GetCdbForSolution(createCdbWindow.SolutionDir, targetDir + "\\" + fileName + ".json");
|
||||
|
||||
createCDB.CallbackOnFinishedCreatingCDB = HandleFinishedCDB;
|
||||
createCdbWindow.CallbackOnFinishedCreatingCdb = HandleFinishedCdb;
|
||||
|
||||
createCDB.StartWorking();
|
||||
createCDB.ShowDialog();
|
||||
createCdbWindow.StartWorking();
|
||||
createCdbWindow.ShowDialog();
|
||||
}
|
||||
|
||||
private void HandleFinishedCDB(Wizard.WindowCreateCDB.CreationResult creationResult)
|
||||
private void HandleFinishedCdb(Wizard.WindowCreateCdb.CreationResult creationResult)
|
||||
{
|
||||
if(creationResult._cdb != null && creationResult._cdbDirectory.Length > 0 && creationResult._cdbName.Length > 0)
|
||||
if(creationResult._cdbSettings != null && creationResult._cdbDirectory.Length > 0 && creationResult._cdbName.Length > 0)
|
||||
{
|
||||
_cdbList.AppendOrUpdate(creationResult._cdb);
|
||||
_cdbList.SaveMetaData();
|
||||
_recentSettingsList.AppendOrUpdate(creationResult._cdbSettings);
|
||||
_recentSettingsList.SaveMetaData();
|
||||
|
||||
Wizard.WindowCDBReady dialog = new Wizard.WindowCDBReady();
|
||||
Wizard.WindowCdbReady dialog = new Wizard.WindowCdbReady();
|
||||
dialog.setData(creationResult);
|
||||
dialog.ShowDialog();
|
||||
|
||||
_cdbList.Refresh();
|
||||
_recentSettingsList.Refresh();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -397,20 +388,10 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
|
||||
Utility.AsynchronousClient.Send(message);
|
||||
}
|
||||
else if(menuCommand.CommandID.ID == (int)PkgCmdIDList.cmdidSourcetrailCreateCDB)
|
||||
else if(menuCommand.CommandID.ID == (int)PkgCmdIDList.cmdidSourcetrailCreateCdb)
|
||||
{
|
||||
CreateCompilationDatabase(dte);
|
||||
}
|
||||
else if(menuCommand.CommandID.ID == (int)PkgCmdIDList.cmdidSourcetrailCreateProject)
|
||||
{
|
||||
// show hint to use CDB methad (only for CDB beta) and create project on ok
|
||||
Wizard.WindowMessage windowMessage = new Wizard.WindowMessage();
|
||||
windowMessage.Title = "Hint";
|
||||
windowMessage.Message = "Consider using 'Create CDB' if errors arise during Sourcetrail's indexing. This will become standard in the future.";
|
||||
windowMessage.OnOK = CreateSourcetrailProjectOld;
|
||||
windowMessage.RefreshWindow();
|
||||
windowMessage.ShowDialog();
|
||||
}
|
||||
else if(menuCommand.CommandID.ID == (int)PkgCmdIDList.cmdidSourcetrailOpenLogFolder)
|
||||
{
|
||||
Utility.SystemUtility.OpenWindowsExplorerAtDirectory(Utility.DataUtility.GetStandardFolderDirectory());
|
||||
@@ -418,35 +399,6 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
}
|
||||
}
|
||||
|
||||
// will be removed once the CDB project creation is fully integrated
|
||||
private void CreateSourcetrailProjectOld()
|
||||
{
|
||||
DTE dte = (DTE)GetService(typeof(DTE));
|
||||
|
||||
string solutionName = Utility.SolutionUtility.GetSolutionPath(dte);
|
||||
|
||||
if (solutionName == "") // TODO: make a better fallback for non-existant solution
|
||||
{
|
||||
List<string> items = Utility.SolutionUtility.GetSolutionProjectsFullNames(dte);
|
||||
|
||||
if (items.Count > 0)
|
||||
{
|
||||
solutionName = items[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (solutionName.Length > 0)
|
||||
{
|
||||
string message = Utility.NetworkProtocolUtility.CreateCreateProjectMessage(solutionName);
|
||||
|
||||
Utility.AsynchronousClient.Send(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayMessage("Sourcetrail", "Can not create a Sourcetrail Project. Please check whether your VS solution is a valid C or C++ solution and is saved.");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNetworkReadCallback(string message)
|
||||
{
|
||||
Utility.NetworkProtocolUtility.MESSAGE_TYPE messageType = Utility.NetworkProtocolUtility.GetMessageType(message);
|
||||
@@ -542,17 +494,18 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
Guid clsid = Guid.Empty;
|
||||
int result;
|
||||
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(uiShell.ShowMessageBox(
|
||||
0,
|
||||
ref clsid,
|
||||
title,
|
||||
message,
|
||||
string.Empty,
|
||||
0,
|
||||
OLEMSGBUTTON.OLEMSGBUTTON_OK,
|
||||
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
|
||||
OLEMSGICON.OLEMSGICON_INFO,
|
||||
0, // false
|
||||
out result));
|
||||
0,
|
||||
ref clsid,
|
||||
title,
|
||||
message,
|
||||
string.Empty,
|
||||
0,
|
||||
OLEMSGBUTTON.OLEMSGBUTTON_OK,
|
||||
OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST,
|
||||
OLEMSGICON.OLEMSGICON_INFO,
|
||||
0, // false
|
||||
out result
|
||||
));
|
||||
}
|
||||
|
||||
private void CreateCompilationDatabase(DTE dte)
|
||||
@@ -570,7 +523,7 @@ namespace CoatiSoftware.SourcetrailPlugin
|
||||
bool containsCFiles = true; // Utility.SolutionUtility.ContainsCFiles(dte); // takes ridiculously long, I'd rather just display the option by default
|
||||
window._containsCFiles = containsCFiles;
|
||||
|
||||
window._cdb = _cdbList.GetMostCurrentCDBForSolution(Utility.SolutionUtility.GetSolutionPath(dte));
|
||||
window._cdb = _recentSettingsList.GetMostCurrentCdbForSolution(Utility.SolutionUtility.GetSolutionPath(dte));
|
||||
|
||||
window.UpdateGUI();
|
||||
window._onCreateProject = OnCreateProject;
|
||||
|
||||
-159
@@ -1,159 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
{
|
||||
class CompilationDatabaseList
|
||||
{
|
||||
private List<SolutionParser.CompilationDatabase> _cdbs = new List<SolutionParser.CompilationDatabase>();
|
||||
|
||||
public List<SolutionParser.CompilationDatabase> CDBs
|
||||
{
|
||||
get { return _cdbs; }
|
||||
// set { _cdbs = value; }
|
||||
}
|
||||
|
||||
public CompilationDatabaseList()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void AppendOrUpdate(SolutionParser.CompilationDatabase cdb)
|
||||
{
|
||||
if(_cdbs.Exists(item => item.Name == cdb.Name && item.Directory == cdb.Directory) == false)
|
||||
{
|
||||
_cdbs.Add(cdb);
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = _cdbs.FindIndex(item => item.Name == cdb.Name && item.Directory == cdb.Directory);
|
||||
_cdbs[idx] = cdb;
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
List<SolutionParser.CompilationDatabase> cdbs = new List<SolutionParser.CompilationDatabase>();
|
||||
|
||||
try
|
||||
{
|
||||
string data = Utility.DataUtility.GetInstance().GetData();
|
||||
cdbs = SolutionParser.CompilationDatabase.ParseCDBsMetaData(data);
|
||||
|
||||
foreach (SolutionParser.CompilationDatabase cdb in cdbs)
|
||||
{
|
||||
cdb.CheckCDBExists();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to aquire data: " + e.Message);
|
||||
}
|
||||
|
||||
_cdbs = cdbs;
|
||||
}
|
||||
|
||||
public List<SolutionParser.CompilationDatabase> GetCDBsForSolution(string solutionPath)
|
||||
{
|
||||
return _cdbs.FindAll(item => item.SourceProject == solutionPath);
|
||||
}
|
||||
|
||||
public SolutionParser.CompilationDatabase GetCDBForSolution(string solutionPath)
|
||||
{
|
||||
return _cdbs.Find(item => item.SourceProject == solutionPath);
|
||||
}
|
||||
|
||||
public SolutionParser.CompilationDatabase GetMostCurrentCDBForSolution(string solutionPath)
|
||||
{
|
||||
SolutionParser.CompilationDatabase result = null;
|
||||
|
||||
try
|
||||
{
|
||||
List<SolutionParser.CompilationDatabase> candidates = GetCDBsForSolution(solutionPath);
|
||||
|
||||
System.DateTime youngest = System.DateTime.MinValue;
|
||||
foreach (SolutionParser.CompilationDatabase cdb in candidates)
|
||||
{
|
||||
if (cdb.LastUpdated >= youngest)
|
||||
{
|
||||
youngest = cdb.LastUpdated;
|
||||
result = cdb;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to find cdb: " + e.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public SolutionParser.CompilationDatabase GetCDBForSolution(string solutionPath, string cdbPath)
|
||||
{
|
||||
return _cdbs.Find(item => item.SourceProject == solutionPath && (item.Directory + "\\" + item.Name + ".json") == cdbPath);
|
||||
}
|
||||
|
||||
public bool CheckCDBForSolutionExists(string solutionPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
SolutionParser.CompilationDatabase cdb = GetCDBForSolution(solutionPath);
|
||||
if (cdb != null && System.IO.File.Exists(cdb.Directory + "\\" + cdb.Name + ".json"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to check cdb: " + e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SaveMetaData()
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = doc.CreateElement("cdbs");
|
||||
|
||||
foreach (SolutionParser.CompilationDatabase cdb in _cdbs)
|
||||
{
|
||||
XmlNode metaData = cdb.GetMetaDataXML(doc);
|
||||
|
||||
root.AppendChild(metaData);
|
||||
}
|
||||
|
||||
System.IO.StringWriter writer = new System.IO.StringWriter();
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(XmlElement));
|
||||
serializer.Serialize(writer, root);
|
||||
|
||||
DataUtility.GetInstance().ClearData();
|
||||
DataUtility.GetInstance().AppendData(writer.ToString());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to save meta data: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public void UnloadCDBs()
|
||||
{
|
||||
if(_cdbs == null)
|
||||
{
|
||||
Logging.Logging.LogWarning("Member '_cdbs' is null, aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(SolutionParser.CompilationDatabase cdb in _cdbs)
|
||||
{
|
||||
cdb.ClearCommandObjects();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
{
|
||||
class CompilationDatabaseSettingsList
|
||||
{
|
||||
private List<CompilationDatabaseSettings> _settings = new List<CompilationDatabaseSettings>();
|
||||
|
||||
public List<CompilationDatabaseSettings> Settings
|
||||
{
|
||||
get { return _settings; }
|
||||
}
|
||||
|
||||
public CompilationDatabaseSettingsList()
|
||||
{
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void AppendOrUpdate(CompilationDatabaseSettings cdb)
|
||||
{
|
||||
if(_settings.Exists(item => item.Name == cdb.Name && item.Directory == cdb.Directory) == false)
|
||||
{
|
||||
_settings.Add(cdb);
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = _settings.FindIndex(item => item.Name == cdb.Name && item.Directory == cdb.Directory);
|
||||
_settings[idx] = cdb;
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
List<CompilationDatabaseSettings> cdbs = new List<CompilationDatabaseSettings>();
|
||||
|
||||
try
|
||||
{
|
||||
string data = Utility.DataUtility.GetInstance().GetData();
|
||||
cdbs = CompilationDatabaseSettings.ParseCdbsMetaData(data);
|
||||
|
||||
foreach (CompilationDatabaseSettings cdb in cdbs)
|
||||
{
|
||||
cdb.CheckCdbExists();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to aquire data: " + e.Message);
|
||||
}
|
||||
|
||||
_settings = cdbs;
|
||||
}
|
||||
|
||||
public List<CompilationDatabaseSettings> GetCdbsForSolution(string solutionPath)
|
||||
{
|
||||
return _settings.FindAll(item => item.SourceProject == solutionPath);
|
||||
}
|
||||
|
||||
public CompilationDatabaseSettings GetCdbForSolution(string solutionPath)
|
||||
{
|
||||
return _settings.Find(item => item.SourceProject == solutionPath);
|
||||
}
|
||||
|
||||
public CompilationDatabaseSettings GetMostCurrentCdbForSolution(string solutionPath)
|
||||
{
|
||||
CompilationDatabaseSettings result = null;
|
||||
|
||||
try
|
||||
{
|
||||
List<CompilationDatabaseSettings> candidates = GetCdbsForSolution(solutionPath);
|
||||
|
||||
System.DateTime youngest = System.DateTime.MinValue;
|
||||
foreach (CompilationDatabaseSettings cdb in candidates)
|
||||
{
|
||||
if (cdb.LastUpdated >= youngest)
|
||||
{
|
||||
youngest = cdb.LastUpdated;
|
||||
result = cdb;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to find cdb: " + e.Message);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public CompilationDatabaseSettings GetCdbForSolution(string solutionPath, string cdbPath)
|
||||
{
|
||||
return _settings.Find(item => item.SourceProject == solutionPath && (item.Directory + "\\" + item.Name + ".json") == cdbPath);
|
||||
}
|
||||
|
||||
public bool CheckCdbForSolutionExists(string solutionPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
CompilationDatabaseSettings cdb = GetCdbForSolution(solutionPath);
|
||||
if (cdb != null && System.IO.File.Exists(cdb.Directory + "\\" + cdb.Name + ".json"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to check cdb: " + e.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SaveMetaData()
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
XmlNode root = doc.CreateElement("cdbs");
|
||||
|
||||
foreach (CompilationDatabaseSettings cdb in _settings)
|
||||
{
|
||||
XmlNode metaData = cdb.GetMetaDataXML(doc);
|
||||
|
||||
root.AppendChild(metaData);
|
||||
}
|
||||
|
||||
System.IO.StringWriter writer = new System.IO.StringWriter();
|
||||
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(XmlElement));
|
||||
serializer.Serialize(writer, root);
|
||||
|
||||
DataUtility.GetInstance().ClearData();
|
||||
DataUtility.GetInstance().AppendData(writer.ToString());
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to save meta data: " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using EnvDTE;
|
||||
using EnvDTE;
|
||||
using System;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using VCProjectEngineWrapper;
|
||||
using VCProjectEngineWrapper;
|
||||
using System;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
{
|
||||
|
||||
+6
-27
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
{
|
||||
@@ -12,12 +9,11 @@ namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
private static string s_setActiveTokenPrefix = "setActiveToken";
|
||||
private static string s_moveCursorPrefix = "moveCursor";
|
||||
private static string s_endOfMessageToken = "<EOM>";
|
||||
|
||||
private static string s_createProjectPrefix = "createProject"; // deprecate
|
||||
private static string s_createCDBProjectPrefix = "createCDBProject";
|
||||
|
||||
private static string s_createCdbProjectPrefix = "createCDBProject";
|
||||
private static string s_ideId = "vs";
|
||||
|
||||
private static string s_createCDBPrefix = "createCDB";
|
||||
private static string s_createCdbPrefix = "createCDB";
|
||||
|
||||
private static string s_pingPrefix = "ping";
|
||||
|
||||
@@ -100,26 +96,9 @@ namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string CreateCreateProjectMessage(string solutionPath)
|
||||
{
|
||||
string message = s_createProjectPrefix;
|
||||
|
||||
message += s_divider;
|
||||
|
||||
message += solutionPath;
|
||||
|
||||
message += s_divider;
|
||||
|
||||
message += s_ideId;
|
||||
|
||||
message += s_endOfMessageToken;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
public static string CreateCreateProjectMessage(string cdbPath, List<string> headerPaths)
|
||||
{
|
||||
string message = s_createCDBProjectPrefix;
|
||||
string message = s_createCdbProjectPrefix;
|
||||
|
||||
message += s_divider;
|
||||
|
||||
@@ -160,7 +139,7 @@ namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
|
||||
if (tokens.Count > 0)
|
||||
{
|
||||
if (tokens[0] == s_createCDBPrefix)
|
||||
if (tokens[0] == s_createCdbPrefix)
|
||||
{
|
||||
return MESSAGE_TYPE.CREATE_CDB;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
using System.Net.Sockets;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
{
|
||||
|
||||
+26
-23
@@ -68,7 +68,6 @@ namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
}
|
||||
_statusLock.ExitReadLock();
|
||||
|
||||
|
||||
_statusLock.EnterWriteLock();
|
||||
_working = true;
|
||||
_workerThread = new Thread(new ThreadStart(Work));
|
||||
@@ -125,39 +124,43 @@ namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
|
||||
private void Commit()
|
||||
{
|
||||
_queueLock.EnterWriteLock();
|
||||
|
||||
Queue<string> tmpQueue = _inputQueue;
|
||||
_inputQueue = _outputQueue;
|
||||
_outputQueue = tmpQueue;
|
||||
|
||||
_queueLock.ExitWriteLock();
|
||||
|
||||
{
|
||||
_queueLock.EnterWriteLock();
|
||||
Queue<string> tmpQueue = _inputQueue;
|
||||
_inputQueue = _outputQueue;
|
||||
_outputQueue = tmpQueue;
|
||||
_queueLock.ExitWriteLock();
|
||||
}
|
||||
|
||||
WriteQueueToFile(ref _outputQueue);
|
||||
}
|
||||
|
||||
private void WriteQueueToFile(ref Queue<string> messageQueue)
|
||||
{
|
||||
_fileLock.EnterWriteLock();
|
||||
try
|
||||
if (messageQueue.Count > 0)
|
||||
{
|
||||
while(messageQueue.Count > 0)
|
||||
_fileLock.EnterWriteLock();
|
||||
|
||||
try
|
||||
{
|
||||
_messageWrittenCount++;
|
||||
StreamWriter writer = System.IO.File.AppendText(_targetDirectory + "\\" + _fileName);
|
||||
|
||||
string message = messageQueue.Dequeue();
|
||||
while (messageQueue.Count > 0)
|
||||
{
|
||||
_messageWrittenCount++;
|
||||
writer.WriteLine(messageQueue.Dequeue());
|
||||
}
|
||||
|
||||
File.AppendAllText(_targetDirectory + "\\" + _fileName, message);
|
||||
writer.Close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Logging.LogError(e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_fileLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logging.Logging.LogError(e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_fileLock.ExitWriteLock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-6
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using EnvDTE;
|
||||
using EnvDTE80;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EnvDTE;
|
||||
using EnvDTE80;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Utility
|
||||
{
|
||||
|
||||
Generated
+237
-233
@@ -17,238 +17,242 @@
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProjectSetupWindow));
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonCreate = new System.Windows.Forms.Button();
|
||||
this.comboBoxConfiguration = new System.Windows.Forms.ComboBox();
|
||||
this.comboBoxPlatform = new System.Windows.Forms.ComboBox();
|
||||
this.labelConfiguration = new System.Windows.Forms.Label();
|
||||
this.labelPlatform = new System.Windows.Forms.Label();
|
||||
this.buttonSelectAll = new System.Windows.Forms.Button();
|
||||
this.labelSelectProject = new System.Windows.Forms.Label();
|
||||
this.folderBrowserTargetDirectory = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.textBoxTargetDirectory = new System.Windows.Forms.TextBox();
|
||||
this.buttonSelect = new System.Windows.Forms.Button();
|
||||
this.textBoxFileName = new System.Windows.Forms.TextBox();
|
||||
this.labelFileName = new System.Windows.Forms.Label();
|
||||
this.labelFileNameEnding = new System.Windows.Forms.Label();
|
||||
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
|
||||
this.comboBoxCStandard = new System.Windows.Forms.ComboBox();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||
this.labelCStandard = new System.Windows.Forms.Label();
|
||||
this.treeViewProjects = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonCancel, "Abort creation of the CDB");
|
||||
this.buttonCancel.Location = new System.Drawing.Point(12, 413);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.helpProvider1.SetShowHelp(this.buttonCancel, true);
|
||||
this.buttonCancel.Size = new System.Drawing.Size(92, 23);
|
||||
this.buttonCancel.TabIndex = 9;
|
||||
this.buttonCancel.Text = "Cancel";
|
||||
this.toolTip1.SetToolTip(this.buttonCancel, "Abort creation of the CDB");
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonCreate, "Start creation of the CDB");
|
||||
this.buttonCreate.Location = new System.Drawing.Point(178, 413);
|
||||
this.buttonCreate.Name = "buttonCreate";
|
||||
this.helpProvider1.SetShowHelp(this.buttonCreate, true);
|
||||
this.buttonCreate.Size = new System.Drawing.Size(92, 23);
|
||||
this.buttonCreate.TabIndex = 8;
|
||||
this.buttonCreate.Text = "Create";
|
||||
this.toolTip1.SetToolTip(this.buttonCreate, "Start creation of the CDB");
|
||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
||||
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
|
||||
//
|
||||
// comboBoxConfiguration
|
||||
//
|
||||
this.comboBoxConfiguration.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxConfiguration.FormattingEnabled = true;
|
||||
this.helpProvider1.SetHelpKeyword(this.comboBoxConfiguration, "Build configuration for CDB");
|
||||
this.helpProvider1.SetHelpString(this.comboBoxConfiguration, "The selected build configuration determines the compile flags for the CDB");
|
||||
this.comboBoxConfiguration.Location = new System.Drawing.Point(87, 277);
|
||||
this.comboBoxConfiguration.Name = "comboBoxConfiguration";
|
||||
this.helpProvider1.SetShowHelp(this.comboBoxConfiguration, true);
|
||||
this.comboBoxConfiguration.Size = new System.Drawing.Size(183, 21);
|
||||
this.comboBoxConfiguration.TabIndex = 3;
|
||||
this.toolTip1.SetToolTip(this.comboBoxConfiguration, "The selected build configuration determines the compile flags for the CDB");
|
||||
//
|
||||
// comboBoxPlatform
|
||||
//
|
||||
this.comboBoxPlatform.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxPlatform.FormattingEnabled = true;
|
||||
this.helpProvider1.SetHelpString(this.comboBoxPlatform, "The target platform determines some compiler flags included in the CDB");
|
||||
this.comboBoxPlatform.Location = new System.Drawing.Point(87, 304);
|
||||
this.comboBoxPlatform.Name = "comboBoxPlatform";
|
||||
this.helpProvider1.SetShowHelp(this.comboBoxPlatform, true);
|
||||
this.comboBoxPlatform.Size = new System.Drawing.Size(183, 21);
|
||||
this.comboBoxPlatform.TabIndex = 4;
|
||||
this.toolTip1.SetToolTip(this.comboBoxPlatform, "The target platform determines some compiler flags included in the CDB");
|
||||
//
|
||||
// labelConfiguration
|
||||
//
|
||||
this.labelConfiguration.AutoSize = true;
|
||||
this.labelConfiguration.Location = new System.Drawing.Point(12, 280);
|
||||
this.labelConfiguration.Name = "labelConfiguration";
|
||||
this.labelConfiguration.Size = new System.Drawing.Size(69, 13);
|
||||
this.labelConfiguration.TabIndex = 6;
|
||||
this.labelConfiguration.Text = "Configuration";
|
||||
//
|
||||
// labelPlatform
|
||||
//
|
||||
this.labelPlatform.AutoSize = true;
|
||||
this.labelPlatform.Location = new System.Drawing.Point(12, 307);
|
||||
this.labelPlatform.Name = "labelPlatform";
|
||||
this.labelPlatform.Size = new System.Drawing.Size(45, 13);
|
||||
this.labelPlatform.TabIndex = 7;
|
||||
this.labelPlatform.Text = "Platform";
|
||||
//
|
||||
// buttonSelectAll
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonSelectAll, "Select all projects if not all are ticked. Deselect all otherwise");
|
||||
this.buttonSelectAll.Location = new System.Drawing.Point(178, 248);
|
||||
this.buttonSelectAll.Name = "buttonSelectAll";
|
||||
this.helpProvider1.SetShowHelp(this.buttonSelectAll, true);
|
||||
this.buttonSelectAll.Size = new System.Drawing.Size(92, 23);
|
||||
this.buttonSelectAll.TabIndex = 2;
|
||||
this.buttonSelectAll.Text = "De/Select All";
|
||||
this.toolTip1.SetToolTip(this.buttonSelectAll, "Select all projects if not all are ticked. Deselect all otherwise");
|
||||
this.buttonSelectAll.UseVisualStyleBackColor = true;
|
||||
this.buttonSelectAll.Click += new System.EventHandler(this.buttonSelectAll_Click);
|
||||
//
|
||||
// labelSelectProject
|
||||
//
|
||||
this.labelSelectProject.AutoSize = true;
|
||||
this.labelSelectProject.Location = new System.Drawing.Point(9, 9);
|
||||
this.labelSelectProject.Name = "labelSelectProject";
|
||||
this.labelSelectProject.Size = new System.Drawing.Size(78, 13);
|
||||
this.labelSelectProject.TabIndex = 9;
|
||||
this.labelSelectProject.Text = "Select Projects";
|
||||
this.labelSelectProject.Click += new System.EventHandler(this.label1_Click);
|
||||
//
|
||||
// textBoxTargetDirectory
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.textBoxTargetDirectory, "Target directory where the CDB will be stored");
|
||||
this.textBoxTargetDirectory.Location = new System.Drawing.Point(12, 333);
|
||||
this.textBoxTargetDirectory.Name = "textBoxTargetDirectory";
|
||||
this.helpProvider1.SetShowHelp(this.textBoxTargetDirectory, true);
|
||||
this.textBoxTargetDirectory.Size = new System.Drawing.Size(177, 20);
|
||||
this.textBoxTargetDirectory.TabIndex = 10;
|
||||
this.toolTip1.SetToolTip(this.textBoxTargetDirectory, "Target directory where the CDB will be stored");
|
||||
//
|
||||
// buttonSelect
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonSelect, "Pick a target directory via folder browser");
|
||||
this.buttonSelect.Location = new System.Drawing.Point(195, 331);
|
||||
this.buttonSelect.Name = "buttonSelect";
|
||||
this.helpProvider1.SetShowHelp(this.buttonSelect, true);
|
||||
this.buttonSelect.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonSelect.TabIndex = 5;
|
||||
this.buttonSelect.Text = "Browse";
|
||||
this.toolTip1.SetToolTip(this.buttonSelect, "Pick a target directory via folder browser");
|
||||
this.buttonSelect.UseVisualStyleBackColor = true;
|
||||
this.buttonSelect.Click += new System.EventHandler(this.buttonSelect_Click);
|
||||
//
|
||||
// textBoxFileName
|
||||
//
|
||||
this.textBoxFileName.Location = new System.Drawing.Point(87, 360);
|
||||
this.textBoxFileName.Name = "textBoxFileName";
|
||||
this.textBoxFileName.Size = new System.Drawing.Size(148, 20);
|
||||
this.textBoxFileName.TabIndex = 6;
|
||||
this.textBoxFileName.TextChanged += new System.EventHandler(this.textBoxFileName_TextChanged);
|
||||
this.textBoxFileName.Leave += new System.EventHandler(this.textBoxFileName_Leave);
|
||||
//
|
||||
// labelFileName
|
||||
//
|
||||
this.labelFileName.AutoSize = true;
|
||||
this.labelFileName.Location = new System.Drawing.Point(12, 363);
|
||||
this.labelFileName.Name = "labelFileName";
|
||||
this.labelFileName.Size = new System.Drawing.Size(60, 13);
|
||||
this.labelFileName.TabIndex = 13;
|
||||
this.labelFileName.Text = "CDB Name";
|
||||
//
|
||||
// labelFileNameEnding
|
||||
//
|
||||
this.labelFileNameEnding.AutoSize = true;
|
||||
this.labelFileNameEnding.Location = new System.Drawing.Point(241, 363);
|
||||
this.labelFileNameEnding.Name = "labelFileNameEnding";
|
||||
this.labelFileNameEnding.Size = new System.Drawing.Size(29, 13);
|
||||
this.labelFileNameEnding.TabIndex = 14;
|
||||
this.labelFileNameEnding.Text = ".json";
|
||||
//
|
||||
// comboBoxCStandard
|
||||
//
|
||||
this.comboBoxCStandard.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxCStandard.FormattingEnabled = true;
|
||||
this.helpProvider1.SetHelpString(this.comboBoxCStandard, "Your Solution contains C Files. Please specify which C standard is to be used for" +
|
||||
" building.");
|
||||
this.comboBoxCStandard.Location = new System.Drawing.Point(87, 386);
|
||||
this.comboBoxCStandard.Name = "comboBoxCStandard";
|
||||
this.helpProvider1.SetShowHelp(this.comboBoxCStandard, true);
|
||||
this.comboBoxCStandard.Size = new System.Drawing.Size(183, 21);
|
||||
this.comboBoxCStandard.TabIndex = 7;
|
||||
this.toolTip1.SetToolTip(this.comboBoxCStandard, "Your Solution contains C Files. Please specify which C standard is to be used for" +
|
||||
" building.");
|
||||
//
|
||||
// labelCStandard
|
||||
//
|
||||
this.labelCStandard.AutoSize = true;
|
||||
this.labelCStandard.Location = new System.Drawing.Point(12, 389);
|
||||
this.labelCStandard.Name = "labelCStandard";
|
||||
this.labelCStandard.Size = new System.Drawing.Size(60, 13);
|
||||
this.labelCStandard.TabIndex = 16;
|
||||
this.labelCStandard.Text = "C Standard";
|
||||
//
|
||||
// treeViewProjects
|
||||
//
|
||||
this.treeViewProjects.CheckBoxes = true;
|
||||
this.treeViewProjects.Location = new System.Drawing.Point(12, 26);
|
||||
this.treeViewProjects.Name = "treeViewProjects";
|
||||
this.treeViewProjects.Size = new System.Drawing.Size(258, 216);
|
||||
this.treeViewProjects.TabIndex = 17;
|
||||
this.treeViewProjects.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ProjectCheckList_MouseUp);
|
||||
this.treeViewProjects.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewProjects_NodeCheckChanged);
|
||||
//
|
||||
// ProjectSetupWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.ClientSize = new System.Drawing.Size(282, 443);
|
||||
this.Controls.Add(this.treeViewProjects);
|
||||
this.Controls.Add(this.labelCStandard);
|
||||
this.Controls.Add(this.comboBoxCStandard);
|
||||
this.Controls.Add(this.labelFileNameEnding);
|
||||
this.Controls.Add(this.labelFileName);
|
||||
this.Controls.Add(this.textBoxFileName);
|
||||
this.Controls.Add(this.buttonSelect);
|
||||
this.Controls.Add(this.textBoxTargetDirectory);
|
||||
this.Controls.Add(this.labelSelectProject);
|
||||
this.Controls.Add(this.buttonSelectAll);
|
||||
this.Controls.Add(this.labelPlatform);
|
||||
this.Controls.Add(this.labelConfiguration);
|
||||
this.Controls.Add(this.comboBoxPlatform);
|
||||
this.Controls.Add(this.comboBoxConfiguration);
|
||||
this.Controls.Add(this.buttonCreate);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.helpProvider1.SetHelpString(this, "Create a CDB from the current C++ solution.");
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ProjectSetupWindow";
|
||||
this.helpProvider1.SetShowHelp(this, true);
|
||||
this.Text = "Create Compilation Database";
|
||||
this.toolTip1.SetToolTip(this, "Create a CDB from the current C++ solution.");
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProjectSetupWindow));
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.buttonCreate = new System.Windows.Forms.Button();
|
||||
this.comboBoxConfiguration = new System.Windows.Forms.ComboBox();
|
||||
this.comboBoxPlatform = new System.Windows.Forms.ComboBox();
|
||||
this.labelConfiguration = new System.Windows.Forms.Label();
|
||||
this.labelPlatform = new System.Windows.Forms.Label();
|
||||
this.buttonSelectAll = new System.Windows.Forms.Button();
|
||||
this.labelSelectProject = new System.Windows.Forms.Label();
|
||||
this.folderBrowserTargetDirectory = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.textBoxTargetDirectory = new System.Windows.Forms.TextBox();
|
||||
this.buttonSelect = new System.Windows.Forms.Button();
|
||||
this.textBoxFileName = new System.Windows.Forms.TextBox();
|
||||
this.labelFileName = new System.Windows.Forms.Label();
|
||||
this.labelFileNameExtension = new System.Windows.Forms.Label();
|
||||
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
|
||||
this.comboBoxCStandard = new System.Windows.Forms.ComboBox();
|
||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||
this.labelCStandard = new System.Windows.Forms.Label();
|
||||
this.treeViewProjects = new System.Windows.Forms.TreeView();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonCancel, "Abort creation of the Compilation Database");
|
||||
this.buttonCancel.Location = new System.Drawing.Point(12, 413);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.helpProvider1.SetShowHelp(this.buttonCancel, true);
|
||||
this.buttonCancel.Size = new System.Drawing.Size(92, 23);
|
||||
this.buttonCancel.TabIndex = 9;
|
||||
this.buttonCancel.Text = "Cancel";
|
||||
this.toolTip1.SetToolTip(this.buttonCancel, "Abort creation of the Compilation Database");
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonCreate, "Start creation of the Compilation Database");
|
||||
this.buttonCreate.Location = new System.Drawing.Point(178, 413);
|
||||
this.buttonCreate.Name = "buttonCreate";
|
||||
this.helpProvider1.SetShowHelp(this.buttonCreate, true);
|
||||
this.buttonCreate.Size = new System.Drawing.Size(92, 23);
|
||||
this.buttonCreate.TabIndex = 8;
|
||||
this.buttonCreate.Text = "Create";
|
||||
this.toolTip1.SetToolTip(this.buttonCreate, "Start creation of the Compilation Database");
|
||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
||||
this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
|
||||
//
|
||||
// comboBoxConfiguration
|
||||
//
|
||||
this.comboBoxConfiguration.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxConfiguration.FormattingEnabled = true;
|
||||
this.helpProvider1.SetHelpKeyword(this.comboBoxConfiguration, "Build configuration for Compilation Database");
|
||||
this.helpProvider1.SetHelpString(this.comboBoxConfiguration, "The selected build configuration determines the compile flags for the Compilation" +
|
||||
" Database");
|
||||
this.comboBoxConfiguration.Location = new System.Drawing.Point(87, 277);
|
||||
this.comboBoxConfiguration.Name = "comboBoxConfiguration";
|
||||
this.helpProvider1.SetShowHelp(this.comboBoxConfiguration, true);
|
||||
this.comboBoxConfiguration.Size = new System.Drawing.Size(183, 21);
|
||||
this.comboBoxConfiguration.TabIndex = 3;
|
||||
this.toolTip1.SetToolTip(this.comboBoxConfiguration, "The selected build configuration determines the compile flags for the Compilation" +
|
||||
" Database");
|
||||
//
|
||||
// comboBoxPlatform
|
||||
//
|
||||
this.comboBoxPlatform.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxPlatform.FormattingEnabled = true;
|
||||
this.helpProvider1.SetHelpString(this.comboBoxPlatform, "The target platform determines some compiler flags included in the Compilation Da" +
|
||||
"tabase");
|
||||
this.comboBoxPlatform.Location = new System.Drawing.Point(87, 304);
|
||||
this.comboBoxPlatform.Name = "comboBoxPlatform";
|
||||
this.helpProvider1.SetShowHelp(this.comboBoxPlatform, true);
|
||||
this.comboBoxPlatform.Size = new System.Drawing.Size(183, 21);
|
||||
this.comboBoxPlatform.TabIndex = 4;
|
||||
this.toolTip1.SetToolTip(this.comboBoxPlatform, "The target platform determines some compiler flags included in the Compilation Da" +
|
||||
"tabase");
|
||||
//
|
||||
// labelConfiguration
|
||||
//
|
||||
this.labelConfiguration.AutoSize = true;
|
||||
this.labelConfiguration.Location = new System.Drawing.Point(12, 280);
|
||||
this.labelConfiguration.Name = "labelConfiguration";
|
||||
this.labelConfiguration.Size = new System.Drawing.Size(69, 13);
|
||||
this.labelConfiguration.TabIndex = 6;
|
||||
this.labelConfiguration.Text = "Configuration";
|
||||
//
|
||||
// labelPlatform
|
||||
//
|
||||
this.labelPlatform.AutoSize = true;
|
||||
this.labelPlatform.Location = new System.Drawing.Point(12, 307);
|
||||
this.labelPlatform.Name = "labelPlatform";
|
||||
this.labelPlatform.Size = new System.Drawing.Size(45, 13);
|
||||
this.labelPlatform.TabIndex = 7;
|
||||
this.labelPlatform.Text = "Platform";
|
||||
//
|
||||
// buttonSelectAll
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonSelectAll, "Select all projects if not all are ticked. Deselect all otherwise");
|
||||
this.buttonSelectAll.Location = new System.Drawing.Point(178, 248);
|
||||
this.buttonSelectAll.Name = "buttonSelectAll";
|
||||
this.helpProvider1.SetShowHelp(this.buttonSelectAll, true);
|
||||
this.buttonSelectAll.Size = new System.Drawing.Size(92, 23);
|
||||
this.buttonSelectAll.TabIndex = 2;
|
||||
this.buttonSelectAll.Text = "De/Select All";
|
||||
this.toolTip1.SetToolTip(this.buttonSelectAll, "Select all projects if not all are ticked. Deselect all otherwise");
|
||||
this.buttonSelectAll.UseVisualStyleBackColor = true;
|
||||
this.buttonSelectAll.Click += new System.EventHandler(this.buttonSelectAll_Click);
|
||||
//
|
||||
// labelSelectProject
|
||||
//
|
||||
this.labelSelectProject.AutoSize = true;
|
||||
this.labelSelectProject.Location = new System.Drawing.Point(9, 9);
|
||||
this.labelSelectProject.Name = "labelSelectProject";
|
||||
this.labelSelectProject.Size = new System.Drawing.Size(78, 13);
|
||||
this.labelSelectProject.TabIndex = 9;
|
||||
this.labelSelectProject.Text = "Select Projects";
|
||||
this.labelSelectProject.Click += new System.EventHandler(this.label1_Click);
|
||||
//
|
||||
// textBoxTargetDirectory
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.textBoxTargetDirectory, "Target directory where the Compilation Database will be stored");
|
||||
this.textBoxTargetDirectory.Location = new System.Drawing.Point(12, 333);
|
||||
this.textBoxTargetDirectory.Name = "textBoxTargetDirectory";
|
||||
this.helpProvider1.SetShowHelp(this.textBoxTargetDirectory, true);
|
||||
this.textBoxTargetDirectory.Size = new System.Drawing.Size(177, 20);
|
||||
this.textBoxTargetDirectory.TabIndex = 10;
|
||||
this.toolTip1.SetToolTip(this.textBoxTargetDirectory, "Target directory where the Compilation Database will be stored");
|
||||
//
|
||||
// buttonSelect
|
||||
//
|
||||
this.helpProvider1.SetHelpString(this.buttonSelect, "Pick a target directory via folder browser");
|
||||
this.buttonSelect.Location = new System.Drawing.Point(195, 331);
|
||||
this.buttonSelect.Name = "buttonSelect";
|
||||
this.helpProvider1.SetShowHelp(this.buttonSelect, true);
|
||||
this.buttonSelect.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonSelect.TabIndex = 5;
|
||||
this.buttonSelect.Text = "Browse";
|
||||
this.toolTip1.SetToolTip(this.buttonSelect, "Pick a target directory via folder browser");
|
||||
this.buttonSelect.UseVisualStyleBackColor = true;
|
||||
this.buttonSelect.Click += new System.EventHandler(this.buttonSelect_Click);
|
||||
//
|
||||
// textBoxFileName
|
||||
//
|
||||
this.textBoxFileName.Location = new System.Drawing.Point(87, 360);
|
||||
this.textBoxFileName.Name = "textBoxFileName";
|
||||
this.textBoxFileName.Size = new System.Drawing.Size(148, 20);
|
||||
this.textBoxFileName.TabIndex = 6;
|
||||
this.textBoxFileName.TextChanged += new System.EventHandler(this.textBoxFileName_TextChanged);
|
||||
this.textBoxFileName.Leave += new System.EventHandler(this.textBoxFileName_Leave);
|
||||
//
|
||||
// labelFileName
|
||||
//
|
||||
this.labelFileName.AutoSize = true;
|
||||
this.labelFileName.Location = new System.Drawing.Point(12, 363);
|
||||
this.labelFileName.Name = "labelFileName";
|
||||
this.labelFileName.Size = new System.Drawing.Size(49, 13);
|
||||
this.labelFileName.TabIndex = 13;
|
||||
this.labelFileName.Text = "Filename";
|
||||
//
|
||||
// labelFileNameExtension
|
||||
//
|
||||
this.labelFileNameExtension.AutoSize = true;
|
||||
this.labelFileNameExtension.Location = new System.Drawing.Point(241, 363);
|
||||
this.labelFileNameExtension.Name = "labelFileNameExtension";
|
||||
this.labelFileNameExtension.Size = new System.Drawing.Size(29, 13);
|
||||
this.labelFileNameExtension.TabIndex = 14;
|
||||
this.labelFileNameExtension.Text = ".json";
|
||||
//
|
||||
// comboBoxCStandard
|
||||
//
|
||||
this.comboBoxCStandard.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxCStandard.FormattingEnabled = true;
|
||||
this.helpProvider1.SetHelpString(this.comboBoxCStandard, "In case your solution contains C files, please specify which C standard is to be " +
|
||||
"used for building.");
|
||||
this.comboBoxCStandard.Location = new System.Drawing.Point(87, 386);
|
||||
this.comboBoxCStandard.Name = "comboBoxCStandard";
|
||||
this.helpProvider1.SetShowHelp(this.comboBoxCStandard, true);
|
||||
this.comboBoxCStandard.Size = new System.Drawing.Size(183, 21);
|
||||
this.comboBoxCStandard.TabIndex = 7;
|
||||
this.toolTip1.SetToolTip(this.comboBoxCStandard, "In case your solution contains C files, please specify which C standard is to be " +
|
||||
"used for building.");
|
||||
//
|
||||
// labelCStandard
|
||||
//
|
||||
this.labelCStandard.AutoSize = true;
|
||||
this.labelCStandard.Location = new System.Drawing.Point(12, 389);
|
||||
this.labelCStandard.Name = "labelCStandard";
|
||||
this.labelCStandard.Size = new System.Drawing.Size(60, 13);
|
||||
this.labelCStandard.TabIndex = 16;
|
||||
this.labelCStandard.Text = "C Standard";
|
||||
//
|
||||
// treeViewProjects
|
||||
//
|
||||
this.treeViewProjects.CheckBoxes = true;
|
||||
this.treeViewProjects.Location = new System.Drawing.Point(12, 26);
|
||||
this.treeViewProjects.Name = "treeViewProjects";
|
||||
this.treeViewProjects.Size = new System.Drawing.Size(258, 216);
|
||||
this.treeViewProjects.TabIndex = 17;
|
||||
this.treeViewProjects.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeViewProjects_NodeCheckChanged);
|
||||
this.treeViewProjects.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ProjectCheckList_MouseUp);
|
||||
//
|
||||
// ProjectSetupWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.ClientSize = new System.Drawing.Size(282, 443);
|
||||
this.Controls.Add(this.treeViewProjects);
|
||||
this.Controls.Add(this.labelCStandard);
|
||||
this.Controls.Add(this.comboBoxCStandard);
|
||||
this.Controls.Add(this.labelFileNameExtension);
|
||||
this.Controls.Add(this.labelFileName);
|
||||
this.Controls.Add(this.textBoxFileName);
|
||||
this.Controls.Add(this.buttonSelect);
|
||||
this.Controls.Add(this.textBoxTargetDirectory);
|
||||
this.Controls.Add(this.labelSelectProject);
|
||||
this.Controls.Add(this.buttonSelectAll);
|
||||
this.Controls.Add(this.labelPlatform);
|
||||
this.Controls.Add(this.labelConfiguration);
|
||||
this.Controls.Add(this.comboBoxPlatform);
|
||||
this.Controls.Add(this.comboBoxConfiguration);
|
||||
this.Controls.Add(this.buttonCreate);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.helpProvider1.SetHelpString(this, "Create a Compilation Database from the current C/C++ solution.");
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ProjectSetupWindow";
|
||||
this.helpProvider1.SetShowHelp(this, true);
|
||||
this.Text = "Create Compilation Database";
|
||||
this.toolTip1.SetToolTip(this, "Create a Compilation Database from the current C/C++ solution.");
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -266,7 +270,7 @@
|
||||
private System.Windows.Forms.Button buttonSelect;
|
||||
private System.Windows.Forms.TextBox textBoxFileName;
|
||||
private System.Windows.Forms.Label labelFileName;
|
||||
private System.Windows.Forms.Label labelFileNameEnding;
|
||||
private System.Windows.Forms.Label labelFileNameExtension;
|
||||
private System.Windows.Forms.HelpProvider helpProvider1;
|
||||
private System.Windows.Forms.ToolTip toolTip1;
|
||||
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
||||
|
||||
+19
-12
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
@@ -39,7 +39,7 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
"c9x", "gnu9x", "iso9899:199x", "c99", "gnu99", "iso9899:1999", "iso9899:199409", "c90", "gnu90", "iso9899:1990",
|
||||
"c89", "gnu89" };
|
||||
|
||||
public SolutionParser.CompilationDatabase _cdb = new SolutionParser.CompilationDatabase();
|
||||
public SolutionParser.CompilationDatabaseSettings _cdb = new SolutionParser.CompilationDatabaseSettings();
|
||||
|
||||
public ProjectSetupWindow()
|
||||
{
|
||||
@@ -168,23 +168,30 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
|
||||
private void InitTextBoxTargetDirectory()
|
||||
{
|
||||
Logging.Logging.LogInfo("Setting default target directory: \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(_solutionDirectory) + "\"");
|
||||
|
||||
folderBrowserTargetDirectory.SelectedPath = _solutionDirectory;
|
||||
string rootDirectory = folderBrowserTargetDirectory.SelectedPath.ToString();
|
||||
textBoxTargetDirectory.Text = rootDirectory;
|
||||
if (_cdb == null)
|
||||
{
|
||||
Logging.Logging.LogInfo("Setting default target directory to default: \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(_solutionDirectory) + "\"");
|
||||
folderBrowserTargetDirectory.SelectedPath = _solutionDirectory;
|
||||
textBoxTargetDirectory.Text = _solutionDirectory;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogInfo("Setting default target directory to recent: \"" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(_cdb.Directory) + "\"");
|
||||
folderBrowserTargetDirectory.SelectedPath = _cdb.Directory;
|
||||
textBoxTargetDirectory.Text = _cdb.Directory;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitTextBoxFileName()
|
||||
{
|
||||
Logging.Logging.LogInfo("Setting default file name: '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(_solutionFileName) + "'");
|
||||
|
||||
if(_cdb == null)
|
||||
{
|
||||
Logging.Logging.LogInfo("Setting file name to default: '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(_solutionFileName) + "'");
|
||||
textBoxFileName.Text = _solutionFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogInfo("Setting file name to recent: '" + Logging.Obfuscation.NameObfuscator.GetObfuscatedName(_cdb.Name) + "'");
|
||||
textBoxFileName.Text = _cdb.Name;
|
||||
}
|
||||
}
|
||||
@@ -252,7 +259,7 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
|
||||
if(result == DialogResult.No)
|
||||
{
|
||||
Logging.Logging.LogInfo("Aborting CDB creation and attempting to make file name unique.");
|
||||
Logging.Logging.LogInfo("Aborting Cdb creation and attempting to make file name unique.");
|
||||
MakeFileNameUnique();
|
||||
return;
|
||||
}
|
||||
@@ -286,7 +293,7 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogError("CDB create callback is not set. Cannot start creating CDB.");
|
||||
Logging.Logging.LogError("Cdb create callback is not set. Cannot start creating Cdb.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +312,7 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
string fileName = textBoxFileName.Text;
|
||||
string path = textBoxTargetDirectory.Text;
|
||||
string extension = labelFileNameEnding.Text;
|
||||
string extension = labelFileNameExtension.Text;
|
||||
|
||||
return File.Exists(path + "\\" + fileName + extension);
|
||||
}
|
||||
|
||||
Generated
+6
-6
@@ -1,6 +1,6 @@
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
partial class WindowCDBReady
|
||||
partial class WindowCdbReady
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -28,7 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WindowCDBReady));
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WindowCdbReady));
|
||||
this.label_message = new System.Windows.Forms.Label();
|
||||
this.button_ok = new System.Windows.Forms.Button();
|
||||
this.button_import = new System.Windows.Forms.Button();
|
||||
@@ -80,7 +80,7 @@
|
||||
this.button_open.UseVisualStyleBackColor = true;
|
||||
this.button_open.Click += new System.EventHandler(this.button_open_Click);
|
||||
//
|
||||
// WindowCDBReady
|
||||
// WindowCdbReady
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -92,9 +92,9 @@
|
||||
this.Controls.Add(this.label_message);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimumSize = new System.Drawing.Size(330, 160);
|
||||
this.Name = "WindowCDBReady";
|
||||
this.Text = "CDB Ready";
|
||||
this.Resize += new System.EventHandler(this.WindowCDBReady_Resize);
|
||||
this.Name = "WindowCdbReady";
|
||||
this.Text = "Cdb Ready";
|
||||
this.Resize += new System.EventHandler(this.WindowCdbReady_Resize);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
public partial class WindowCDBReady : Form
|
||||
public partial class WindowCdbReady : Form
|
||||
{
|
||||
private string _message0 = "The CDB ";
|
||||
private string _message1 = " was created at directory ";
|
||||
private string _message2 = "Do you want to auto-import it in Sourcetrail now?";
|
||||
private WindowCreateCdb.CreationResult _creationResult = new WindowCreateCdb.CreationResult();
|
||||
|
||||
private WindowCreateCDB.CreationResult _creationResult = new WindowCreateCDB.CreationResult();
|
||||
|
||||
public WindowCDBReady()
|
||||
public WindowCdbReady()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -26,12 +16,13 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
label_message.MaximumSize = new Size((int)((float)MaximumSize.Width * 0.8f), 0);
|
||||
}
|
||||
|
||||
public void setData(WindowCreateCDB.CreationResult creationResult)
|
||||
public void setData(WindowCreateCdb.CreationResult creationResult)
|
||||
{
|
||||
_creationResult = creationResult;
|
||||
|
||||
label_message.Text = _message0 + "'" + creationResult._cdbName + "'" + _message1 + "\"" + creationResult._cdbDirectory + "\".";
|
||||
label_message.Text += "\n" + _message2;
|
||||
label_message.Text = "The Compilation Database \"" + creationResult._cdbName +
|
||||
"\" was created at directory \"" + creationResult._cdbDirectory + "\".\n" +
|
||||
"Do you want to auto-import it in Sourcetrail now?";
|
||||
}
|
||||
|
||||
private void button_ok_Click(object sender, EventArgs e)
|
||||
@@ -53,7 +44,7 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
Close();
|
||||
}
|
||||
|
||||
private void WindowCDBReady_Resize(object sender, EventArgs e)
|
||||
private void WindowCdbReady_Resize(object sender, EventArgs e)
|
||||
{
|
||||
label_message.MaximumSize = new Size((int)((float)MaximumSize.Width * 0.8f), 0);
|
||||
}
|
||||
|
||||
Generated
+5
-5
@@ -1,6 +1,6 @@
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
partial class WindowCreateCDB
|
||||
partial class WindowCreateCdb
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -28,7 +28,7 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WindowCreateCDB));
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WindowCreateCdb));
|
||||
this.progressBar = new System.Windows.Forms.ProgressBar();
|
||||
this.labelStatus = new System.Windows.Forms.Label();
|
||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||
@@ -57,7 +57,7 @@
|
||||
this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
|
||||
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
|
||||
//
|
||||
// WindowCreateCDB
|
||||
// WindowCreateCdb
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -67,9 +67,9 @@
|
||||
this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "WindowCreateCDB";
|
||||
this.Name = "WindowCreateCdb";
|
||||
this.Text = "Creating Compilation Data Base";
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.WindowCreateCDB_FormClosed);
|
||||
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.WindowCreateCdb_FormClosed);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
||||
+33
-50
@@ -1,27 +1,27 @@
|
||||
using System;
|
||||
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
public partial class WindowCreateCDB : Form
|
||||
public partial class WindowCreateCdb : Form
|
||||
{
|
||||
public struct CreationResult
|
||||
{
|
||||
public SolutionParser.CompilationDatabase _cdb;
|
||||
public SolutionParser.CompilationDatabaseSettings _cdbSettings;
|
||||
public string _cdbDirectory;
|
||||
public string _cdbName;
|
||||
public List<string> _headerDirectories;
|
||||
}
|
||||
|
||||
public delegate void OnFinishedCreatingCDB(CreationResult result);
|
||||
public delegate void OnFinishedCreatingCdb(CreationResult result);
|
||||
|
||||
private OnFinishedCreatingCDB _onFinishedCreateCDB = null;
|
||||
private OnFinishedCreatingCdb _onFinishedCreateCdb = null;
|
||||
|
||||
private List<EnvDTE.Project> _projects = new List<EnvDTE.Project>();
|
||||
|
||||
@@ -33,19 +33,19 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
private string _solutionDir = "";
|
||||
private List<string> _headerDirectories;
|
||||
|
||||
private SolutionParser.CompilationDatabase _cdb = null;
|
||||
private SolutionParser.CompilationDatabaseSettings _cdb = null;
|
||||
|
||||
CreationResult _result = new CreationResult();
|
||||
private CreationResult _result = new CreationResult();
|
||||
|
||||
private int _threadCount = 1;
|
||||
|
||||
private static object _lockObject = new object();
|
||||
private static ReaderWriterLockSlim _readWriteLock = new ReaderWriterLockSlim();
|
||||
|
||||
public OnFinishedCreatingCDB CallbackOnFinishedCreatingCDB
|
||||
public OnFinishedCreatingCdb CallbackOnFinishedCreatingCdb
|
||||
{
|
||||
get { return _onFinishedCreateCDB; }
|
||||
set { _onFinishedCreateCDB = value; }
|
||||
get { return _onFinishedCreateCdb; }
|
||||
set { _onFinishedCreateCdb = value; }
|
||||
}
|
||||
|
||||
public List<EnvDTE.Project> Projects
|
||||
@@ -96,14 +96,14 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
set { _solutionDir = value; }
|
||||
}
|
||||
|
||||
public SolutionParser.CompilationDatabase CDB
|
||||
public SolutionParser.CompilationDatabaseSettings Cdb
|
||||
{
|
||||
get { return _cdb; }
|
||||
set { _cdb = value; }
|
||||
}
|
||||
|
||||
|
||||
public WindowCreateCDB()
|
||||
public WindowCreateCdb()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -116,57 +116,51 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
|
||||
public void StartWorking()
|
||||
{
|
||||
// Show();
|
||||
|
||||
backgroundWorker1.RunWorkerAsync();
|
||||
}
|
||||
|
||||
private CreationResult CreateCDB()
|
||||
private CreationResult CreateCdb()
|
||||
{
|
||||
CreationResult result = new CreationResult();
|
||||
result._cdb = null;
|
||||
result._cdbSettings = null;
|
||||
result._cdbDirectory = "";
|
||||
result._cdbName = "";
|
||||
result._headerDirectories = new List<string>();
|
||||
|
||||
Logging.Logging.LogInfo("Starting to create CDB");
|
||||
|
||||
SolutionParser.CompilationDatabase cdb = null;
|
||||
SolutionParser.CompilationDatabaseSettings cdbSettings = null;
|
||||
_headerDirectories = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
|
||||
|
||||
watch.Start();
|
||||
|
||||
cdb = CreateCommandObjects();
|
||||
|
||||
CreateCompilationDatabase();
|
||||
watch.Stop();
|
||||
|
||||
Logging.Logging.LogInfo("Finished, elapsed time: " + watch.ElapsedMilliseconds.ToString() + " ms");
|
||||
Logging.Logging.LogInfo("Finished creating CDB, elapsed time: " + watch.ElapsedMilliseconds.ToString() + " ms");
|
||||
|
||||
cdb.Name = _fileName;
|
||||
cdb.Directory = _targetDir;
|
||||
cdb.SourceProject = _solutionDir;
|
||||
cdb.LastUpdated = DateTime.Now;
|
||||
cdb.ConfigurationName = _configurationName;
|
||||
cdb.PlatformName = _platformName;
|
||||
cdbSettings = new CompilationDatabaseSettings();
|
||||
cdbSettings.Name = _fileName;
|
||||
cdbSettings.Directory = _targetDir;
|
||||
cdbSettings.SourceProject = _solutionDir;
|
||||
cdbSettings.LastUpdated = DateTime.Now;
|
||||
cdbSettings.ConfigurationName = _configurationName;
|
||||
cdbSettings.PlatformName = _platformName;
|
||||
|
||||
cdb.IncludedProjects = new List<string>();
|
||||
cdbSettings.IncludedProjects = new List<string>();
|
||||
foreach (EnvDTE.Project p in _projects)
|
||||
{
|
||||
cdb.IncludedProjects.Add(p.Name);
|
||||
cdbSettings.IncludedProjects.Add(p.Name);
|
||||
}
|
||||
|
||||
cdb.Clean();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logging.Logging.LogError("Failed to create CDB: " + e.Message);
|
||||
}
|
||||
|
||||
result._cdb = cdb;
|
||||
result._cdbSettings = cdbSettings;
|
||||
result._cdbDirectory = _targetDir;
|
||||
result._cdbName = _fileName;
|
||||
result._headerDirectories = _headerDirectories;
|
||||
@@ -176,17 +170,11 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
return result;
|
||||
}
|
||||
|
||||
private SolutionParser.CompilationDatabase CreateCommandObjects()
|
||||
private void CreateCompilationDatabase()
|
||||
{
|
||||
SolutionParser.CompilationDatabase cdb = new SolutionParser.CompilationDatabase();
|
||||
cdb.Directory = _targetDir;
|
||||
cdb.Name = _fileName;
|
||||
|
||||
File.WriteAllText(_targetDir + "\\" + _fileName + ".json", "");
|
||||
File.AppendAllText(_targetDir + "\\" + _fileName + ".json", "[\n");
|
||||
|
||||
// Mutex commandObjectMutex = new Mutex();
|
||||
|
||||
Utility.QueuedFileWriter fileWriter = new Utility.QueuedFileWriter(_fileName + ".json", _targetDir);
|
||||
fileWriter.StartWorking();
|
||||
|
||||
@@ -221,9 +209,6 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
|
||||
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'))
|
||||
{
|
||||
@@ -262,13 +247,11 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
File.AppendAllText(_targetDir + "\\" + _fileName + ".json", "\n]");
|
||||
}
|
||||
|
||||
return cdb;
|
||||
}
|
||||
|
||||
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
_result = CreateCDB();
|
||||
_result = CreateCdb();
|
||||
}
|
||||
|
||||
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
|
||||
@@ -291,17 +274,17 @@ namespace CoatiSoftware.SourcetrailPlugin.Wizard
|
||||
{
|
||||
if(e.Cancelled == false && e.Error == null /*&& progressBar.Value >= 100*/)
|
||||
{
|
||||
_onFinishedCreateCDB?.Invoke(_result);
|
||||
_onFinishedCreateCdb?.Invoke(_result);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logging.Logging.LogWarning("CDB creation was aborted by user");
|
||||
Logging.Logging.LogWarning("Cdb creation was aborted by user");
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
private void WindowCreateCDB_FormClosed(object sender, FormClosedEventArgs e)
|
||||
private void WindowCreateCdb_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
backgroundWorker1.CancelAsync();
|
||||
}
|
||||
|
||||
+1
-1
@@ -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.82" Language="en-US" Publisher="Coati Software OG" />
|
||||
<Identity Id="acf15780-03b5-440e-a41e-db79b7043fc2" Version="0.9.83" 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>
|
||||
|
||||
+9
-8
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using CoatiSoftware.SourcetrailPlugin.IntegrationTests.Helpers;
|
||||
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
|
||||
using EnvDTE;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using EnvDTE;
|
||||
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
|
||||
using System.IO;
|
||||
using CoatiSoftware.SourcetrailPlugin.IntegrationTests.Helpers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests
|
||||
{
|
||||
@@ -44,7 +44,7 @@ namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests
|
||||
UIThreadInvoker.Initialize();
|
||||
UIThreadInvoker.Invoke(new Action(() =>
|
||||
{
|
||||
TestCompilationDatabaseForSolution("../../../SourcetrailPlugin.IntegrationTests/bin/data/cinder/cinder.sln");
|
||||
TestCompilationDatabaseForSolution("../../../SourcetrailPluginTests/bin/data/cinder/cinder.sln");
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests
|
||||
UIThreadInvoker.Initialize();
|
||||
UIThreadInvoker.Invoke(new Action(() =>
|
||||
{
|
||||
TestCompilationDatabaseForSolution("../../../SourcetrailPlugin.IntegrationTests/bin/data/all_in_same_folder/test.sln");
|
||||
TestCompilationDatabaseForSolution("../../../SourcetrailPluginTests/bin/data/all_in_same_folder/test.sln");
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests
|
||||
string cdbPath = Path.ChangeExtension(solutionPath, "json");
|
||||
if (_updateExpectedOutput)
|
||||
{
|
||||
output.SortAlphabetically();
|
||||
Console.WriteLine("writing compilation database to file: " + cdbPath);
|
||||
File.WriteAllText(cdbPath, output.SerializeToJson());
|
||||
Assert.IsTrue(File.Exists(cdbPath));
|
||||
@@ -120,7 +121,7 @@ namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests
|
||||
project, configurationNames[0], platformNames[0], "c11"
|
||||
))
|
||||
{
|
||||
cdb.AddCommandObject(command);
|
||||
cdb.AddCompileCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
|
||||
using CoatiSoftware.SourcetrailPlugin.SolutionParser;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests.UnitTests
|
||||
{
|
||||
@@ -31,10 +31,10 @@ namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests.UnitTests
|
||||
command.Command = "D test test.cpp";
|
||||
|
||||
CompilationDatabase cdb1 = new CompilationDatabase();
|
||||
cdb1.AddCommandObject(command);
|
||||
cdb1.AddCompileCommand(command);
|
||||
|
||||
CompilationDatabase cdb2 = new CompilationDatabase();
|
||||
cdb2.AddCommandObject(command);
|
||||
cdb2.AddCompileCommand(command);
|
||||
|
||||
Assert.IsTrue(cdb1 == cdb2);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace CoatiSoftware.SourcetrailPlugin.IntegrationTests.UnitTests
|
||||
command.Command = "D DEFINE=\"value\" test.cpp";
|
||||
|
||||
CompilationDatabase originalCompilationDatabase = new CompilationDatabase();
|
||||
originalCompilationDatabase.AddCommandObject(command);
|
||||
originalCompilationDatabase.AddCompileCommand(command);
|
||||
string serialized = originalCompilationDatabase.SerializeToJson();
|
||||
|
||||
CompilationDatabase deserializedCompilationDatabase = new CompilationDatabase();
|
||||
+528
-528
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user