Change Globals.BuildErrors into BuildException #1673

This commit is contained in:
Wojtek Figat
2023-11-15 11:57:53 +01:00
parent 385693afff
commit 3a59cfcf20
5 changed files with 18 additions and 15 deletions

View File

@@ -628,10 +628,7 @@ namespace Flax.Build
}
}
if (failed)
{
Globals.BuildErrors = true;
throw new Exception($"Failed to build target {target.Name}. See log.");
}
throw new BuildException($"Failed to build target {target.Name}. See log.");
}
else
{
@@ -692,10 +689,7 @@ namespace Flax.Build
}
}
if (failed)
{
Globals.BuildErrors = true;
throw new Exception($"Failed to build target {target.Name}. See log.");
}
throw new BuildException($"Failed to build target {target.Name}. See log.");
}
else
{

View File

@@ -22,11 +22,6 @@ namespace Flax.Build
/// </summary>
public static ProjectInfo Project;
/// <summary>
/// Set when any build related errors were raised.
/// </summary>
public static bool BuildErrors = false;
/// <summary>
/// All platforms array.
/// </summary>

View File

@@ -172,7 +172,7 @@ namespace Flax.Build
catch (Exception ex)
{
// Ignore exception logging for build errors
if (!Globals.BuildErrors)
if (!(ex is BuildException))
Log.Exception(ex);
failed = true;
}

View File

@@ -525,7 +525,7 @@ namespace Flax.Build.Projects.VisualStudio
// Build C# projects (needed for Rider solution wide analysis)
build |= project.Type == TargetType.DotNetCore;
//
// Always build the project named after solution if main project was not set
build |= solution.MainProject == null && project.Name == solution.Name;
}
else if (firstPlatformMatch != -1 && !configuration.Name.StartsWith("Editor."))

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System;
namespace Flax.Build
{
internal class BuildException : Exception
{
public BuildException(string message)
: base(message)
{
}
}
}