Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/Scripts/Localisation.Automation.cs
Andrew Grant 69f9d6f648 Copying //UE4/Orion-Staging to //UE4/Main (originated from //Orion/Dev-General @ 2831630)
#lockdown Nick.Penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 2831624 on 2016/01/17 by Marcus.Wassmer

	Merge disable of FCachedReadPlatformData on PS4.  Reduces memory spikes. 2830986
	#rb none
	#test none
	#codereview Michael.Noland,James.Golding

Change 2831402 on 2016/01/17 by Marcus.Wassmer

	HLOD priority and streamout changes.
	Give texture pool an extra 200MB which we can afford thanks to James/Michael
	#rb Chris.Gagnon
	#test run agora, notice nice textures.
	#lockdown Andrew.Grant

Change 2831398 on 2016/01/17 by Marcus.Wassmer

	Fix 3 logic bugs with Relocate
	#rb chris.gagnon
	#test run game, look for corruption.
	#lockdown Andrew.Grant

Change 2831372 on 2016/01/16 by Marcus.Wassmer

	Update param.sfo's and lockdown version in prep for good PS4 playtest build.
	#rb none
	#test build from last night...
	#lockdown Andrew.Grant

Change 2831274 on 2016/01/16 by Graeme.Thornton

	Disable platform file cache wrapper on PS4

	#codereview James.Golding
	#rb none
	#tests ran cooked ps4 build, timed loading (no real change), measured memory used for file handles (small)

Change 2831237 on 2016/01/16 by Sammy.James

	Fix PS4 compile error

	#codereview Andrew.Grant
	#rb none
	#tests none

Change 2831219 on 2016/01/16 by Matt.Kuhlenschmidt

	Fix possible invalid access to shared  movie player resource across threads causing startup crash.

	#codereview marcus.wassmer
	#rb none, #tests initial load

Change 2831218 on 2016/01/16 by Marcus.Wassmer

	Fix bad warning case.
	#codereview Martin.Mittring
	#rb none
	#test none

Change 2831201 on 2016/01/16 by Andrew.Grant

	Added extra info about referencer to missing asset reference message
	#rb none
	#tests cooked, ran editor

Change 2831183 on 2016/01/16 by David.Nikdel

	#OSS #PS4 #Purchasing #StoreV2
	- Force failure if we have no receipts after a "successful" checkout.
	- Report consumed entitlements as well as unconsumed but leave ValidationInfo empty so we can tell the difference at the application level
	- Convert productIds to skuIds at checkout time
	- Added PS4 Implementation of IOnlineStoreV2
	- Bugfix: set bSuccessfullyStartedUp=false when InitNPGameSettings() fails
	- Adjusted FOnlineStoreOffer to use FText::AsCurrencyBase
	#RB: Paul.Moore
	#TESTS: login, purchase redemption, store MTX purchasing on PS4 & PC

Change 2831129 on 2016/01/16 by David.Nikdel

	#MCP
	- Added a ctor to make converting from FOnlineError to FMcpQueryResult easier (for stuff that was already using FMcpQueryResult).
	#RB: none
	#TESTS: frontend

Change 2830986 on 2016/01/15 by Michael.Noland

	PS4: Disabling FCachedReadPlatformFile on PS4 to significantly reduce high watermark memory consumption during blocking loads
	#rb marcus.wassmer
	#tests Ran Paragon PS4 down a bad path that currently does a blocking map and hero load
	#lockdown andrew.grant

Change 2830943 on 2016/01/15 by Max.Chen

	Sequencer: Fix bug introduced with preroll. It was also causing a crash in particle track instance.

	#tests Master sequence trailer plays without crashing
	#rb none

Change 2830912 on 2016/01/15 by Michael.Noland

	Rendering: Exposed GRHIDeviceId (only filled in on D3D11 and D3D12 RHI's under the same circumstances as GRHIAdapterName, etc..., 0 otherwise)
	#rb mieszko.zielinski
	#tests Tested printing the value out
	#codereview martin.mittring

Change 2830910 on 2016/01/15 by Michael.Noland

	Rendering: Improved GPU driver detection logic to handle more cases
	#codereview martin.mittring
	#rb mieszko.zielinski
	#tests Tested on my machine which was previous reporting Unknown for the values as some entries contained the key in the Settings subfolder

Change 2830776 on 2016/01/15 by Martin.Mittring

	from Dev-Rendering
	added ensure to track down multiple issues like
	OR-11771 CRASH: User Crashed when pressing the Play button
	OR-12430 CRASH: OT2 user crashed with FRHIResource::AddRef()
	#rb:Gil.Gribb
	#code_review:Gil.Gribb,Mark.Satterthwaite,Marcus.Wassmer
2016-01-20 11:32:08 -05:00

245 lines
9.6 KiB
C#

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.IO;
using AutomationTool;
using UnrealBuildTool;
using EpicGames.Localization;
[Help("Updates the OneSky localization data using the arguments provided.")]
[Help("UEProjectDirectory", "Sub-path to the project we're gathering for (relative to CmdEnv.LocalRoot).")]
[Help("UEProjectName", "Optional name of the project we're gathering for (should match its .uproject file, eg QAGame).")]
[Help("LocalizationProjectNames", "Comma separated list of the projects to gather text from.")]
[Help("LocalizationBranch", "Optional suffix to use when uploading the new data to the localization provider.")]
[Help("LocalizationProvider", "Optional localization provide override (default is OneSky).")]
[Help("AdditionalCommandletArguments", "Optional arguments to pass to the gather process.")]
class Localise : BuildCommand
{
public override void ExecuteBuild()
{
var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe");
// Parse out the required command line arguments
var UEProjectDirectory = ParseParamValue("UEProjectDirectory");
if (UEProjectDirectory == null)
{
throw new AutomationException("Missing required command line argument: 'UEProjectDirectory'");
}
var UEProjectName = ParseParamValue("UEProjectName");
if (UEProjectName == null)
{
UEProjectName = "";
}
var LocalizationProjectNames = new List<string>();
{
var LocalizationProjectNamesStr = ParseParamValue("LocalizationProjectNames");
if (LocalizationProjectNamesStr == null)
{
throw new AutomationException("Missing required command line argument: 'LocalizationProjectNames'");
}
foreach (var ProjectName in LocalizationProjectNamesStr.Split(','))
{
LocalizationProjectNames.Add(ProjectName.Trim());
}
}
var LocalizationProviderName = ParseParamValue("LocalizationProvider");
if (LocalizationProviderName == null)
{
LocalizationProviderName = "OneSky";
}
var AdditionalCommandletArguments = ParseParamValue("AdditionalCommandletArguments");
if (AdditionalCommandletArguments == null)
{
AdditionalCommandletArguments = "";
}
var RootWorkingDirectory = CombinePaths(CmdEnv.LocalRoot, UEProjectDirectory);
// Try and find our localization provider
LocalizationProvider LocProvider = null;
{
LocalizationProvider.LocalizationProviderArgs LocProviderArgs;
LocProviderArgs.RootWorkingDirectory = RootWorkingDirectory;
LocProviderArgs.CommandUtils = this;
LocProvider = LocalizationProvider.GetLocalizationProvider(LocalizationProviderName, LocProviderArgs);
}
// Make sure the Localization configs and content is up-to-date to ensure we don't get errors later on
if (P4Enabled)
{
Log("Sync necessary content to head revision");
P4.Sync(P4Env.BuildRootP4 + "/" + UEProjectDirectory + "/Config/Localization/...");
P4.Sync(P4Env.BuildRootP4 + "/" + UEProjectDirectory + "/Content/Localization/...");
}
// Generate the info we need to gather for each project
var ProjectInfos = new List<ProjectInfo>();
foreach (var ProjectName in LocalizationProjectNames)
{
ProjectInfos.Add(GenerateProjectInfo(RootWorkingDirectory, ProjectName));
}
// Export all text from OneSky
foreach (var ProjectInfo in ProjectInfos)
{
LocProvider.DownloadProjectFromLocalizationProvider(ProjectInfo.ProjectName, ProjectInfo.ImportInfo);
}
// Setup editor arguments for SCC.
string EditorArguments = String.Empty;
if (P4Enabled)
{
EditorArguments = String.Format("-SCCProvider={0} -P4Port={1} -P4User={2} -P4Client={3} -P4Passwd={4}", "Perforce", P4Env.P4Port, P4Env.User, P4Env.Client, P4.GetAuthenticationToken());
}
else
{
EditorArguments = String.Format("-SCCProvider={0}", "None");
}
// Setup commandlet arguments for SCC.
string CommandletSCCArguments = String.Empty;
if (P4Enabled) { CommandletSCCArguments += (String.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-EnableSCC"; }
if (!AllowSubmit) { CommandletSCCArguments += (String.IsNullOrEmpty(CommandletSCCArguments) ? "" : " ") + "-DisableSCCSubmit"; }
// Execute commandlet for each config in each project.
foreach (var ProjectInfo in ProjectInfos)
{
foreach (var LocalizationConfigFile in ProjectInfo.LocalizationConfigFiles)
{
var CommandletArguments = String.Format("-config={0}", LocalizationConfigFile) + (String.IsNullOrEmpty(CommandletSCCArguments) ? "" : " " + CommandletSCCArguments);
if (!String.IsNullOrEmpty(AdditionalCommandletArguments))
{
CommandletArguments += " " + AdditionalCommandletArguments;
}
Log("Localization for {0} {1}", EditorArguments, CommandletArguments);
Log("Running UE4Editor to generate localization data");
string Arguments = String.Format("{0} -run=GatherText {1} {2}", UEProjectName, EditorArguments, CommandletArguments);
var RunResult = Run(EditorExe, Arguments);
if (RunResult.ExitCode != 0)
{
Console.WriteLine("[ERROR] Error while executing localization commandlet '{0}'", Arguments);
}
}
}
// Upload all text to OneSky
foreach (var ProjectInfo in ProjectInfos)
{
LocProvider.UploadProjectToLocalizationProvider(ProjectInfo.ProjectName, ProjectInfo.ExportInfo);
}
}
private ProjectInfo GenerateProjectInfo(string RootWorkingDirectory, string ProjectName)
{
var ProjectInfo = new ProjectInfo();
ProjectInfo.ProjectName = ProjectName;
ProjectInfo.LocalizationConfigFiles = new List<string>();
// Projects generated by the localization dashboard will use multiple config files that must be run in a specific order
// Older projects (such as the Engine) would use a single config file containing all the steps
// Work out which kind of project we're dealing with...
var MonolithicConfigFile = String.Format(@"Config/Localization/{0}.ini", ProjectName);
var IsMonolithicConfig = File.Exists(CombinePaths(RootWorkingDirectory, MonolithicConfigFile));
if (IsMonolithicConfig)
{
ProjectInfo.LocalizationConfigFiles.Add(MonolithicConfigFile);
ProjectInfo.ImportInfo = GenerateProjectImportExportInfo(RootWorkingDirectory, MonolithicConfigFile);
ProjectInfo.ExportInfo = ProjectInfo.ImportInfo;
}
else
{
var FileSuffixes = new[] {
new { Suffix = "Gather", Required = true },
new { Suffix = "Import", Required = true },
new { Suffix = "Export", Required = true },
new { Suffix = "Compile", Required = true },
new { Suffix = "GenerateReports", Required = false }
};
foreach (var FileSuffix in FileSuffixes)
{
var ModularConfigFile = String.Format(@"Config/Localization/{0}_{1}.ini", ProjectName, FileSuffix.Suffix);
if (File.Exists(CombinePaths(RootWorkingDirectory, ModularConfigFile)))
{
ProjectInfo.LocalizationConfigFiles.Add(ModularConfigFile);
if (FileSuffix.Suffix == "Import")
{
ProjectInfo.ImportInfo = GenerateProjectImportExportInfo(RootWorkingDirectory, ModularConfigFile);
}
else if (FileSuffix.Suffix == "Export")
{
ProjectInfo.ExportInfo = GenerateProjectImportExportInfo(RootWorkingDirectory, ModularConfigFile);
}
}
else if (FileSuffix.Required)
{
throw new AutomationException("Failed to find a required config file! '{0}'", ModularConfigFile);
}
}
}
return ProjectInfo;
}
private ProjectImportExportInfo GenerateProjectImportExportInfo(string RootWorkingDirectory, string LocalizationConfigFile)
{
var ProjectImportExportInfo = new ProjectImportExportInfo();
var LocalizationConfig = new ConfigCacheIni(new FileReference(CombinePaths(RootWorkingDirectory, LocalizationConfigFile)));
if (!LocalizationConfig.GetString("CommonSettings", "DestinationPath", out ProjectImportExportInfo.DestinationPath))
{
throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'DestinationPath', File: '{0}'", LocalizationConfigFile);
}
if (!LocalizationConfig.GetString("CommonSettings", "ManifestName", out ProjectImportExportInfo.ManifestName))
{
throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ManifestName', File: '{0}'", LocalizationConfigFile);
}
if (!LocalizationConfig.GetString("CommonSettings", "ArchiveName", out ProjectImportExportInfo.ArchiveName))
{
throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ArchiveName', File: '{0}'", LocalizationConfigFile);
}
if (!LocalizationConfig.GetString("CommonSettings", "PortableObjectName", out ProjectImportExportInfo.PortableObjectName))
{
throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'PortableObjectName', File: '{0}'", LocalizationConfigFile);
}
if (!LocalizationConfig.GetString("CommonSettings", "NativeCulture", out ProjectImportExportInfo.NativeCulture))
{
throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'NativeCulture', File: '{0}'", LocalizationConfigFile);
}
if (!LocalizationConfig.GetArray("CommonSettings", "CulturesToGenerate", out ProjectImportExportInfo.CulturesToGenerate))
{
throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'CulturesToGenerate', File: '{0}'", LocalizationConfigFile);
}
if (!LocalizationConfig.GetBool("CommonSettings", "bUseCultureDirectory", out ProjectImportExportInfo.bUseCultureDirectory))
{
// bUseCultureDirectory is optional, default is true
ProjectImportExportInfo.bUseCultureDirectory = true;
}
return ProjectImportExportInfo;
}
}