mirror of
https://github.com/GreemDev/Ryujinx
synced 2025-01-20 09:42:27 +01:00
slight refactor
isGitRunner is now a variable passed to all tasks. Validation project can now accept more arguments, only the first argument is used at the moment. Execute is no longer static, and you can now pass extra data to the task constructor if needed.
This commit is contained in:
parent
4e56b1493f
commit
8efefeaaca
3 changed files with 18 additions and 18 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue