v4 first test, will fail due to new validation step
This commit is contained in:
parent
a317184594
commit
bad1f72918
@ -27,28 +27,57 @@ namespace Ryujinx.BuildValidationTasks
|
||||
json = JsonSerializer.Deserialize<LocalesJson>(data);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (JsonException e)
|
||||
{
|
||||
//Log.LogError($"Json Validation failed! {e.Message}");
|
||||
|
||||
return false;
|
||||
throw new JsonException(e.Message); //shorter and easier stacktrace
|
||||
}
|
||||
|
||||
bool isGitRunner = path.Contains("runner");
|
||||
if (isGitRunner)
|
||||
Console.WriteLine("Is Git Runner!");
|
||||
bool encounteredLanguageIssue = false;
|
||||
|
||||
for (int i = 0; i < json.Locales.Count; i++)
|
||||
{
|
||||
LocalesEntry locale = json.Locales[i];
|
||||
|
||||
foreach (string langCode in json.Languages.Where(it => !locale.Translations.ContainsKey(it)))
|
||||
foreach (string langCode in json.Languages.Where(lang => !locale.Translations.ContainsKey(lang)))
|
||||
{
|
||||
locale.Translations.Add(langCode, string.Empty);
|
||||
//Log.LogMessage(MessageImportance.High, $"Added '{langCode}' to Locale '{locale.ID}'");
|
||||
encounteredLanguageIssue = true;
|
||||
|
||||
if (!isGitRunner)
|
||||
{
|
||||
locale.Translations.Add(langCode, string.Empty);
|
||||
Console.WriteLine($"Added '{langCode}' to Locale '{locale.ID}'");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Missing '{langCode}' in Locale '{locale.ID}'!");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string langCode in json.Languages.Where(lang => locale.Translations.ContainsKey(lang) && lang != "en_US" && locale.Translations[lang] == locale.Translations["en_US"]))
|
||||
{
|
||||
encounteredLanguageIssue = true;
|
||||
|
||||
if (!isGitRunner)
|
||||
{
|
||||
locale.Translations[langCode] = string.Empty;
|
||||
Console.WriteLine($"Lanugage '{langCode}' is a dupelicate of en_US in Locale '{locale.ID}'! Resetting it...");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Lanugage '{langCode}' is a dupelicate of en_US in Locale '{locale.ID}'!");
|
||||
}
|
||||
}
|
||||
|
||||
locale.Translations = locale.Translations.OrderBy(pair => pair.Key).ToDictionary(pair => pair.Key, pair => pair.Value);
|
||||
json.Locales[i] = locale;
|
||||
}
|
||||
|
||||
if (isGitRunner && encounteredLanguageIssue)
|
||||
throw new JsonException("1 or more locales are invalid!");
|
||||
|
||||
JsonSerializerOptions jsonOptions = new JsonSerializerOptions()
|
||||
{
|
||||
WriteIndented = true,
|
||||
|
@ -7,11 +7,10 @@
|
||||
<Target Name="PostBuildTarget" AfterTargets="AfterBuild">
|
||||
<Message Text="Running Validation Project" Importance="high" />
|
||||
|
||||
<!--<Exec WorkingDirectory="$(ProjectDir)bin\Debug\$(TargetFramework)\"
|
||||
Command="Ryujinx.BuildValidationTasks.exe $(ProjectDir)..\..\"
|
||||
<Exec WorkingDirectory="$(ProjectDir)bin\Debug\$(TargetFramework)\"
|
||||
Command="Ryujinx.BuildValidationTasks "$(ProjectDir)..\..\"
|
||||
ConsoleToMsBuild="true"
|
||||
/>-->
|
||||
<Exec WorkingDirectory="$(ProjectDir)bin\Debug\$(TargetFramework)" Command="dir"/>
|
||||
/>
|
||||
</Target>
|
||||
|
||||
</Project>
|
@ -23,11 +23,12 @@ namespace Ryujinx.BuildValidationTasks
|
||||
throw new ArgumentException("Error: path is null or empty!");
|
||||
|
||||
if (!Path.Exists(args[0]))
|
||||
throw new ArgumentException("Error: path does not exist!");
|
||||
throw new ArgumentException($"path {{{args[0]}}} does not exist!");
|
||||
|
||||
Console.WriteLine(args[0]);
|
||||
Console.WriteLine(Path.GetFullPath(args[0]));
|
||||
LocalesValidationTask.Execute(args[0]);
|
||||
if (!Directory.GetDirectories(Path.GetFullPath(args[0])).Contains($"{Path.GetFullPath(args[0])}src"))
|
||||
throw new ArgumentException($"path {{{args[0]}}} is not a valid ryujinx project!");
|
||||
|
||||
LocalesValidationTask.Execute(Path.GetFullPath(args[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user