mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Abstract out the stdout reporter
This commit is contained in:
parent
ad65b0ece4
commit
03510d4a55
@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Build.Reporting;
|
||||||
|
|
||||||
|
namespace UnityBuilderAction.Reporting
|
||||||
|
{
|
||||||
|
public class StdOutReporter
|
||||||
|
{
|
||||||
|
static string EOL = Environment.NewLine;
|
||||||
|
|
||||||
|
public static void ReportSummary(BuildSummary summary)
|
||||||
|
{
|
||||||
|
Console.WriteLine(
|
||||||
|
$"{EOL}" +
|
||||||
|
$"###########################{EOL}" +
|
||||||
|
$"# Build results #{EOL}" +
|
||||||
|
$"###########################{EOL}" +
|
||||||
|
$"{EOL}" +
|
||||||
|
$"Duration: {summary.totalTime.ToString()}{EOL}" +
|
||||||
|
$"Warnings: {summary.totalWarnings.ToString()}{EOL}" +
|
||||||
|
$"Errors: {summary.totalErrors.ToString()}{EOL}" +
|
||||||
|
$"Size: {summary.totalSize.ToString()} bytes{EOL}" +
|
||||||
|
$"{EOL}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ExitWithResult(BuildResult result)
|
||||||
|
{
|
||||||
|
if (result == BuildResult.Succeeded) {
|
||||||
|
Console.WriteLine("Build succeeded!");
|
||||||
|
EditorApplication.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == BuildResult.Failed) {
|
||||||
|
Console.WriteLine("Build failed!");
|
||||||
|
EditorApplication.Exit(101);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == BuildResult.Cancelled) {
|
||||||
|
Console.WriteLine("Build cancelled!");
|
||||||
|
EditorApplication.Exit(102);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == BuildResult.Unknown) {
|
||||||
|
Console.WriteLine("Build result is unknown!");
|
||||||
|
EditorApplication.Exit(103);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e59b491a4124442ea7277f76761cdc8a
|
||||||
|
timeCreated: 1587503545
|
Loading…
Reference in New Issue
Block a user