diff --git a/src/Ryujinx.BuildValidationTasks/LocalesValidationTask.cs b/src/Ryujinx.BuildValidationTasks/LocalesValidationTask.cs index 3c9e5925f..05eaee539 100644 --- a/src/Ryujinx.BuildValidationTasks/LocalesValidationTask.cs +++ b/src/Ryujinx.BuildValidationTasks/LocalesValidationTask.cs @@ -9,7 +9,9 @@ namespace Ryujinx.BuildValidationTasks { public class LocalesValidationTask : ValidationTask { - public static bool Execute(string projectPath) + public LocalesValidationTask() { } + + public bool Execute(string projectPath, bool isGitRunner) { Console.WriteLine("Running Locale Validation Task..."); @@ -23,6 +25,8 @@ namespace Ryujinx.BuildValidationTasks LocalesJson json; + if (isGitRunner && data.Contains("\r\n")) + throw new FormatException("locales.json is using CRLF line endings! It should be using LF line endings, build locally to fix..."); try { @@ -34,12 +38,7 @@ namespace Ryujinx.BuildValidationTasks throw new JsonException(e.Message); //shorter and easier stacktrace } - bool isGitRunner = path.Contains("runner") || path.Contains("D:\\a\\Ryujinx\\Ryujinx"); - if (isGitRunner) - Console.WriteLine("Is Git Runner!"); - if (isGitRunner && data.Contains("\r\n")) - throw new FormatException("locales.json is using CRLF line endings! It should be using LF line endings, build locally to fix..."); bool encounteredIssue = false; diff --git a/src/Ryujinx.BuildValidationTasks/Program.cs b/src/Ryujinx.BuildValidationTasks/Program.cs index 45e700939..5245c1083 100644 --- a/src/Ryujinx.BuildValidationTasks/Program.cs +++ b/src/Ryujinx.BuildValidationTasks/Program.cs @@ -12,28 +12,29 @@ namespace Ryujinx.BuildValidationTasks static void Main(string[] args) { // Display the number of command line arguments. - if (args.Length != 1) - { - if (args.Length == 0) - throw new ArgumentException("Error: too few arguments!"); - else - throw new ArgumentException("Error: too many arguments!"); - } + if (args.Length == 0) + throw new ArgumentException("Error: too few arguments!"); string path = args[0]; if (string.IsNullOrEmpty(path)) throw new ArgumentException("Error: path is null or empty!"); - if (!Path.Exists(args[0])) - throw new ArgumentException($"path {{{path}}} does not exist!"); + if (!Path.Exists(path)) + throw new FileLoadException($"path {{{path}}} does not exist!"); path = Path.GetFullPath(path); if (!Directory.GetDirectories(path).Contains($"{path}src")) - throw new ArgumentException($"path {{{path}}} is not a valid ryujinx project!"); + throw new FileLoadException($"path {{{path}}} is not a valid ryujinx project!"); - LocalesValidationTask.Execute(path); + bool isGitRunner = path.Contains("runner") || path.Contains("D:\\a\\Ryujinx\\Ryujinx"); + if (isGitRunner) + Console.WriteLine("Is Git Runner!"); + + // Run tasks + // Pass extra info needed in the task constructors + new LocalesValidationTask().Execute(path, isGitRunner); } } } diff --git a/src/Ryujinx.BuildValidationTasks/ValidationTask.cs b/src/Ryujinx.BuildValidationTasks/ValidationTask.cs index 9577fa973..091cb6825 100644 --- a/src/Ryujinx.BuildValidationTasks/ValidationTask.cs +++ b/src/Ryujinx.BuildValidationTasks/ValidationTask.cs @@ -8,6 +8,6 @@ namespace Ryujinx.BuildValidationTasks { public interface ValidationTask { - public static bool Execute(string projectPath) { return true; } + public bool Execute(string projectPath, bool isGitRunner); } }