Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions UnityProxy/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;

namespace UnityProxy
Expand All @@ -16,7 +17,22 @@ static void Main(string[] args)
{
string unityPath, artifactsPath;
int startingArgumentIndex = ParseArguments(args, out unityPath, out artifactsPath);

string logPath = Path.GetTempFileName();
bool hasLogFileArgument = false;
for (int i = startingArgumentIndex; i < args.Length; i++)
{
if (args[i] == "-logFile")
{
logPath = args[i + 1];
hasLogFileArgument = true;
if (File.Exists(logPath))
{
File.Delete(logPath);
}
break;
}
}

Watcher watcher = new Watcher(logPath);
Thread watcherThread = new Thread(watcher.Run);
Expand All @@ -25,7 +41,10 @@ static void Main(string[] args)
Process unity = new Process();
unity.StartInfo = new ProcessStartInfo(unityPath);

unity.StartInfo.Arguments = "-logFile \"" + logPath + "\"";
if (!hasLogFileArgument)
{
unity.StartInfo.Arguments = "-logFile \"" + logPath + "\"";
}

for (int i = startingArgumentIndex; i < args.Length; i++)
{
Expand All @@ -47,15 +66,24 @@ static void Main(string[] args)
SaveArtifacts(artifactsPath, watcher.FullLog);
}

if (watcher.FullLog.Contains(SuccessMagicString))
bool isBuilding = args.Contains("-executeMethod");
if (isBuilding)
{
Console.WriteLine("Success.");
Environment.Exit(0);
if (watcher.FullLog.Contains(SuccessMagicString))
{
Console.WriteLine("Success.");
Environment.Exit(0);
}
else
{
Console.WriteLine("Failure.");
Environment.Exit(1);
}
}
else
{
Console.WriteLine("Failure.");
Environment.Exit(1);
// just reimporting, not building
Environment.Exit(unity.ExitCode);
}
}

Expand Down