aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-28 11:42:21 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-28 11:42:21 +0200
commitc726e1f7697d9f0fe8cff387dc64dd00c4980b82 (patch)
tree52d91153ee05a32a8ffcd42c4a9220cb7a517bca /Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
parent2f70caaf340063f90529c3302f2f2a78dda9d40c (diff)
downloadTango-c726e1f7697d9f0fe8cff387dc64dd00c4980b82.tar.gz
Tango-c726e1f7697d9f0fe8cff387dc64dd00c4980b82.zip
Change LogManager to Instance.
Diffstat (limited to 'Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs')
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs33
1 files changed, 17 insertions, 16 deletions
diff --git a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
index d2bfde75c..a9322f495 100644
--- a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
@@ -19,6 +19,7 @@ namespace Tango.Protobuf
{
private const String COMPILERS_FOLDER_NAME = "ProtoCompilers"; //Compilers folder name.
protected String _compilersPath; //Compilers folder path.
+ private LogManager logManager = LogManager.Default;
/// <summary>
/// Gets the compiler language.
@@ -53,33 +54,33 @@ namespace Tango.Protobuf
/// </returns>
public virtual IEnumerable<CompilerFileResult> CompileFile(string inputFile)
{
- LogManager.Log("Compiling file " + inputFile);
+ logManager.Log("Compiling file " + inputFile);
String tmpPath = PathHelper.GetTempFolderPath();
- LogManager.Log("Temp path: " + tmpPath);
+ logManager.Log("Temp path: " + tmpPath);
String importsString = "--proto_path \"" + Path.GetDirectoryName(inputFile) + "\" ";
- LogManager.Log("Added import string: " + importsString);
+ logManager.Log("Added import string: " + importsString);
foreach (var path in ImportsFolders)
{
String importStr = "--proto_path \"" + path + "\" ";
importsString += importStr;
- LogManager.Log("Added import string: " + importStr);
+ logManager.Log("Added import string: " + importStr);
}
Process p = new Process();
- LogManager.Log("Compilers folder path: " + _compilersPath);
+ logManager.Log("Compilers folder path: " + _compilersPath);
p.StartInfo.WorkingDirectory = _compilersPath;
String oldCurrentDirectory = Environment.CurrentDirectory;
Environment.CurrentDirectory = _compilersPath;
p.StartInfo.FileName = GetProtoCompilerName();
- LogManager.Log("Protobuf executable path: " + p.StartInfo.FileName);
+ logManager.Log("Protobuf executable path: " + p.StartInfo.FileName);
p.StartInfo.Arguments = String.Format(
"{0} {1}=\"{2}\" \"{3}\"",
@@ -88,7 +89,7 @@ namespace Tango.Protobuf
tmpPath,
inputFile);
- LogManager.Log("Final arguments:\n" + p.StartInfo.Arguments);
+ logManager.Log("Final arguments:\n" + p.StartInfo.Arguments);
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
@@ -98,7 +99,7 @@ namespace Tango.Protobuf
p.StartInfo.RedirectStandardOutput = true;
- LogManager.Log("Executing compilation...");
+ logManager.Log("Executing compilation...");
p.Start();
p.WaitForExit(5000);
@@ -110,7 +111,7 @@ namespace Tango.Protobuf
if (!String.IsNullOrWhiteSpace(error))
{
var lines = error.Split(new[] { '\r', '\n' });
- throw LogManager.Log(new CompilerException() { Issues = lines.Where(x => x.Length > 0).ToList() });
+ throw logManager.Log(new CompilerException() { Issues = lines.Where(x => x.Length > 0).ToList() });
}
List<CompilerFileResult> results = new List<CompilerFileResult>();
@@ -124,14 +125,14 @@ namespace Tango.Protobuf
if (PathHelper.TryDeleteFolder(tmpPath))
{
- LogManager.Log("Removed temp path: " + tmpPath);
+ logManager.Log("Removed temp path: " + tmpPath);
}
else
{
- LogManager.Log("Could not remove temp path: " + tmpPath);
+ logManager.Log("Could not remove temp path: " + tmpPath);
}
- LogManager.Log(Path.GetFileName(inputFile) + "compiled!");
+ logManager.Log(Path.GetFileName(inputFile) + "compiled!");
return results;
}
@@ -159,13 +160,13 @@ namespace Tango.Protobuf
{
if (!UsesDefaultStructure)
{
- LogManager.Log("Compiling folder: " + sourceFolder);
+ logManager.Log("Compiling folder: " + sourceFolder);
ImportsFolders.Clear();
ImportsFolders.AddRange(Directory.GetDirectories(sourceFolder, "*.*", SearchOption.AllDirectories));
var result = CompileFolder(sourceFolder, sourceFolder);
- LogManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
+ logManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
return OnPostProcessFolderCompilation(result);
}
@@ -223,7 +224,7 @@ namespace Tango.Protobuf
/// </returns>
private CompilerFolderResult CompileFolderDefault(string sourceFolder)
{
- LogManager.Log("Compiling folder: " + sourceFolder);
+ logManager.Log("Compiling folder: " + sourceFolder);
Dictionary<string, CompilerFileResult> fileResults = new Dictionary<string, CompilerFileResult>();
ImportsFolders.Clear();
@@ -248,7 +249,7 @@ namespace Tango.Protobuf
PathHelper.TryDeleteFolder(tempPath);
- LogManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
+ logManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
return OnPostProcessFolderCompilation(result);
}