internal static PluginAccount CreatePluginAccount(PluginName pluginName, AccountName accountName, PluginProfile[] pluginProfiles) { return(new PluginAccount { PluginName = pluginName, Name = accountName, PluginProfiles = pluginProfiles }); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (DisplayName.Length != 0) { hash ^= DisplayName.GetHashCode(); } if (Description.Length != 0) { hash ^= Description.GetHashCode(); } if (ValueType != global::Google.Cloud.AIPlatform.V1.TensorboardTimeSeries.Types.ValueType.Unspecified) { hash ^= ValueType.GetHashCode(); } if (createTime_ != null) { hash ^= CreateTime.GetHashCode(); } if (updateTime_ != null) { hash ^= UpdateTime.GetHashCode(); } if (Etag.Length != 0) { hash ^= Etag.GetHashCode(); } if (PluginName.Length != 0) { hash ^= PluginName.GetHashCode(); } if (PluginData.Length != 0) { hash ^= PluginData.GetHashCode(); } if (metadata_ != null) { hash ^= Metadata.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// </summary> private UserPreferences(IDictionary <string, string> replacementsDictionary) { _replacements = replacementsDictionary.Clone(); ProjectType = (ProjectType)Enum.Parse(typeof(ProjectType), _replacements[@"$wizarddata$"]); _solutionProjectSameDirectory = string.IsNullOrWhiteSpace(SolutionDirectory) || SolutionDirectory.Equals(DestinationDirectory, StringComparison.OrdinalIgnoreCase) || !SolutionDirectory.Equals(Path.GetDirectoryName(DestinationDirectory), StringComparison.OrdinalIgnoreCase); if (_solutionProjectSameDirectory) { SolutionDirectory = DestinationDirectory; } // Add replacements keys _replacements.AddKey(@"$targetname$"); _replacements.AddKey(@"$exportsdef$"); _replacements.AddKey(@"$msvcdirectory$"); _replacements.AddKey(@"$cmakeprojectname$"); _replacements.AddKey(@"$cmakepluginprojectdirname$"); _replacements.AddKey(@"$pluginname$"); _replacements.AddKey(@"$pluginversion$"); _replacements.AddKey(@"$pluginauthor$"); _replacements.AddKey(@"$pluginlogtag$"); _replacements.AddKey(@"$pluginurl$"); _replacements.AddKey(@"$pluginlibrary$"); _replacements.AddKey(@"$pluginlibclass$"); _replacements.AddKey(@"$pluginloadable$"); _replacements.AddKey(@"$pluginunloadable$"); _replacements.AddKey(@"$pluginprojectdirname$"); // Initialize replacements TargetName = SafeProjectName.Replace("_", string.Empty).ToLower() + ProjectType.Suffix(); ExportsDef = SafeProjectName.Replace("_", string.Empty).ToUpper() + @"_EXPORTS"; MsvcDirectory = Path.Combine(DestinationDirectory, @"msvc"); CMakeProjectName = SafeProjectName.Replace("_", string.Empty).ToLower(); PluginName = ProjectName; PluginVersion = @"1.0.0"; PluginAuthor = Environment.UserName; PluginLogTag = PluginName.ToUpper(); PluginUrl = "https://dev-cs.ru"; PluginLibrary = SafeProjectName.ToLower(); PluginLibClass = SafeProjectName.ToLower(); PluginLoadable = MetaPluginLoadTime.AnyTime.ToCppCode(); PluginUnloadable = MetaPluginLoadTime.AnyTime.ToCppCode(); PluginProjectDirName = SafeProjectName.ToLower(); }
public override int GetHashCode() { int hash = 1; if (PluginName.Length != 0) { hash ^= PluginName.GetHashCode(); } if (PluginPort != 0) { hash ^= PluginPort.GetHashCode(); } return(hash); }
/** * Gets Main calss associated with Command */ public void ReloadPlugin() { //Console Commands skip this part becuase Plugins Are not loaded yet if (ServerInstance.Instance.PluginManager != null) { //Search for Plugin foreach (PluginInfo pi in ServerInstance.Instance.PluginManager.LoadedPlugins) { //Console.WriteLine(pi.MainClass.GetName.ToLower() + "-----" + PluginName.ToLower()); if (pi.MainClass.GetName.ToLower() == PluginName.ToLower()) { GetPlugin = pi.MainClass; break; } } } }
public FMODStudio(TargetInfo Target) #endif { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PrivatePCHHeaderFile = "Private/FMODStudioPrivatePCH.h"; bFasterWithoutUnity = true; PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public/FMOD")); PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Classes")); PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "Media", "Projects" } ); PrivateDependencyModuleNames.AddRange( new string[] { "MovieScene", "MovieSceneTracks" } ); if (Target.bBuildEditor == true) { PrivateDependencyModuleNames.Add("AssetRegistry"); PrivateDependencyModuleNames.Add("UnrealEd"); } DynamicallyLoadedModuleNames.AddRange( new string[] { } ); string configName = ""; if (Target.Configuration != UnrealTargetConfiguration.Shipping) { configName = "L"; PublicDefinitions.Add("FMODSTUDIO_LINK_LOGGING=1"); } else { configName = ""; PublicDefinitions.Add("FMODSTUDIO_LINK_RELEASE=1"); } string platformName = Target.Platform.ToString(); string linkExtension = ""; string dllExtension = ""; string libPrefix = ""; // ModuleDirectory points to FMODStudio\source\FMODStudio, need to get back to binaries directory for our libs string BasePath = System.IO.Path.Combine(ModuleDirectory, "../../Binaries", platformName); // Collapse the directory path, otherwise OSX is having issues with plugin paths. BasePath = Utils.CleanDirectorySeparators(BasePath); string copyThirdPartyPath = ""; bool bAddRuntimeDependencies = true; bool bAddDelayLoad = false; bool bShortLinkNames = false; bool bLinkFromBinaries = true; // Minimum UE version for Switch 4.15 System.Console.WriteLine("Target Platform -- " + Target.Platform.ToString()); if (Target.Platform.ToString() == "Switch") { linkExtension = ".a"; dllExtension = ".a"; libPrefix = "lib"; bAddRuntimeDependencies = false; } else if (Target.Platform.ToString() == "UWP64") { linkExtension = ".lib"; dllExtension = ".dll"; bAddDelayLoad = true; } else { switch (Target.Platform) { case UnrealTargetPlatform.Win32: linkExtension = "_vc.lib"; dllExtension = ".dll"; bAddDelayLoad = true; break; case UnrealTargetPlatform.Win64: linkExtension = "_vc.lib"; dllExtension = ".dll"; bAddDelayLoad = true; break; case UnrealTargetPlatform.Mac: linkExtension = dllExtension = ".dylib"; libPrefix = "lib"; bLinkFromBinaries = false; break; case UnrealTargetPlatform.XboxOne: linkExtension = "_vc.lib"; dllExtension = ".dll"; copyThirdPartyPath = "../XBoxOne"; // XBoxOne still doesn't seem to support plugins with .dlls bAddDelayLoad = false; break; case UnrealTargetPlatform.PS4: linkExtension = "_stub.a"; dllExtension = ".prx"; libPrefix = "lib"; bAddDelayLoad = true; break; case UnrealTargetPlatform.Android: // Don't use an explicit path with the .so, let the architecture dirs be filtered by UBT PublicLibraryPaths.Add(System.IO.Path.Combine(BasePath, "armeabi-v7a")); PublicLibraryPaths.Add(System.IO.Path.Combine(BasePath, "arm64-v8a")); PublicLibraryPaths.Add(System.IO.Path.Combine(BasePath, "x86")); bAddRuntimeDependencies = false; // Don't use this system bShortLinkNames = true; // strip off lib and .so linkExtension = dllExtension = ".so"; libPrefix = "lib"; break; case UnrealTargetPlatform.IOS: linkExtension = "_iphoneos.a"; libPrefix = "lib"; bAddRuntimeDependencies = false; break; case UnrealTargetPlatform.TVOS: linkExtension = "_appletvos.a"; libPrefix = "lib"; bAddRuntimeDependencies = false; break; case UnrealTargetPlatform.Linux: BasePath = System.IO.Path.Combine(BasePath, "x86_64"); linkExtension = ".so"; dllExtension = ".so"; libPrefix = "lib"; break; default: //extName = ".a"; throw new System.Exception(System.String.Format("Unsupported platform {0}", Target.Platform.ToString())); //break; } } //System.Console.WriteLine("FMOD Current path: " + System.IO.Path.GetFullPath(".")); //System.Console.WriteLine("FMOD Base path: " + BasePath); PublicLibraryPaths.Add(BasePath); string fmodLibName = System.String.Format("{0}fmod{1}{2}", libPrefix, configName, linkExtension); string fmodStudioLibName = System.String.Format("{0}fmodstudio{1}{2}", libPrefix, configName, linkExtension); string fmodDllName = System.String.Format("{0}fmod{1}{2}", libPrefix, configName, dllExtension); string fmodStudioDllName = System.String.Format("{0}fmodstudio{1}{2}", libPrefix, configName, dllExtension); string fmodLibPath = System.IO.Path.Combine(BasePath, fmodLibName); string fmodStudioLibPath = System.IO.Path.Combine(BasePath, fmodStudioLibName); string fmodDllPath = System.IO.Path.Combine(BasePath, fmodDllName); string fmodStudioDllPath = System.IO.Path.Combine(BasePath, fmodStudioDllName); System.Collections.Generic.List <string> plugins = GetPlugins(BasePath); if (bShortLinkNames) { // For android we have provided the paths to all architectures above // Just provide the name without "lib" and without extension PublicAdditionalLibraries.Add(System.String.Format("fmod{0}", configName)); PublicAdditionalLibraries.Add(System.String.Format("fmodstudio{0}", configName)); } else if (bLinkFromBinaries) { PublicAdditionalLibraries.Add(fmodLibPath); PublicAdditionalLibraries.Add(fmodStudioLibPath); } else { string LibPath = System.IO.Path.Combine(ModuleDirectory, "../../Libs/Mac/"); PublicAdditionalLibraries.Add(System.String.Format("{0}libfmod{1}.dylib", LibPath, configName)); PublicAdditionalLibraries.Add(System.String.Format("{0}libfmodStudio{1}.dylib", LibPath, configName)); } if (bAddRuntimeDependencies) { RuntimeDependencies.Add(fmodDllPath); RuntimeDependencies.Add(fmodStudioDllPath); foreach (string plugin in plugins) { string pluginPath = System.IO.Path.Combine(BasePath, plugin + dllExtension); System.Console.WriteLine("Adding reference to FMOD plugin: " + pluginPath); RuntimeDependencies.Add(pluginPath); } } if (copyThirdPartyPath.Length != 0) { string destPath = System.IO.Path.Combine(Target.UEThirdPartyBinariesDirectory, copyThirdPartyPath); System.IO.Directory.CreateDirectory(destPath); string fmodDllDest = System.IO.Path.Combine(destPath, fmodDllName); string fmodStudioDllDest = System.IO.Path.Combine(destPath, fmodStudioDllName); CopyFile(fmodDllPath, fmodDllDest); CopyFile(fmodStudioDllPath, fmodStudioDllDest); } if (bAddDelayLoad) { PublicDelayLoadDLLs.AddRange( new string[] { fmodDllName, fmodStudioDllName } ); } if (Target.Platform == UnrealTargetPlatform.Android) { string APLName = System.String.Format("FMODStudio{0}_APL.xml", configName); string RelAPLPath = Utils.MakePathRelativeTo(System.IO.Path.Combine(ModuleDirectory, APLName), Target.RelativeEnginePath); System.Console.WriteLine("Adding {0}", RelAPLPath); AdditionalPropertiesForReceipt.Add("AndroidPlugin", RelAPLPath); foreach (string PluginName in System.IO.Directory.GetFiles(BasePath)) { if (PluginName.EndsWith("_APL.xml", System.StringComparison.OrdinalIgnoreCase)) { string RelPluginPath = Utils.MakePathRelativeTo(PluginName, Target.RelativeEnginePath); System.Console.WriteLine("Adding {0}", RelPluginPath); AdditionalPropertiesForReceipt.Add("AndroidPlugin", RelPluginPath); } } } }
public FMODStudio(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; PrivatePCHHeaderFile = "Private/FMODStudioPrivatePCH.h"; bUseUnity = false; PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public/FMOD")); PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Classes")); PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", "Media", "Projects" } ); PrivateDependencyModuleNames.AddRange( new string[] { "MovieScene", "MovieSceneTracks" } ); if (Target.bBuildEditor == true) { PrivateDependencyModuleNames.Add("AssetRegistry"); PrivateDependencyModuleNames.Add("UnrealEd"); PrivateDependencyModuleNames.Add("Settings"); } DynamicallyLoadedModuleNames.AddRange( new string[] { } ); string configName = ""; if (Target.Configuration != UnrealTargetConfiguration.Shipping) { configName = "L"; PublicDefinitions.Add("FMODSTUDIO_LINK_LOGGING=1"); } else { configName = ""; PublicDefinitions.Add("FMODSTUDIO_LINK_RELEASE=1"); } string linkExtension = ""; string dllExtension = ""; string libPrefix = ""; string libPath = FMODLibDir; bool bCopyToOutput = false; bool bAddRuntimeDependencies = true; bool bAddDelayLoad = false; bool bLinkDebugFiles = false; if (libPath == null) { string platformName = Target.Platform.ToString(); libPath = System.IO.Path.Combine(LibRootDirectory, platformName); // Minimum UE version for Switch 4.15 System.Console.WriteLine("Target Platform -- " + Target.Platform.ToString()); if (Target.Platform == UnrealTargetPlatform.Switch) { linkExtension = ".a"; dllExtension = ".a"; libPrefix = "lib"; bAddRuntimeDependencies = false; } else if (Target.Platform.ToString() == "UWP64") { linkExtension = ".lib"; dllExtension = ".dll"; bAddDelayLoad = true; } else if (Target.IsInPlatformGroup(UnrealPlatformGroup.Windows)) { linkExtension = "_vc.lib"; dllExtension = ".dll"; bAddDelayLoad = true; } else if (Target.Platform == UnrealTargetPlatform.Mac) { linkExtension = dllExtension = ".dylib"; libPrefix = "lib"; libPath = System.IO.Path.Combine(ModuleDirectory, "../../Libs/Mac/"); } else if (Target.Platform == UnrealTargetPlatform.XboxOne) { linkExtension = "_vc.lib"; dllExtension = ".dll"; bCopyToOutput = true; bAddRuntimeDependencies = false; } else if (Target.Platform == UnrealTargetPlatform.PS4) { linkExtension = "_stub.a"; dllExtension = ".prx"; libPrefix = "lib"; bAddDelayLoad = true; } else if (Target.Platform == UnrealTargetPlatform.Android) { bAddRuntimeDependencies = false; // Don't use this system linkExtension = dllExtension = ".so"; libPrefix = "lib"; } else if (Target.Platform == UnrealTargetPlatform.IOS) { linkExtension = "_iphoneos.a"; libPrefix = "lib"; bAddRuntimeDependencies = false; } else if (Target.Platform == UnrealTargetPlatform.TVOS) { linkExtension = "_appletvos.a"; libPrefix = "lib"; bAddRuntimeDependencies = false; } else if (Target.Platform == UnrealTargetPlatform.Linux) { libPath = System.IO.Path.Combine(libPath, "x86_64"); linkExtension = ".so"; dllExtension = ".so"; libPrefix = "lib"; } } else { linkExtension = ConsoleLinkExt; dllExtension = ConsoleDllExt; libPrefix = ConsoleLibPrefix; bAddRuntimeDependencies = ConsoleRuntimeDependencies; bAddDelayLoad = ConsoleDelayLoad; bLinkDebugFiles = LinkDebugFiles; } // Collapse the directory path, otherwise MacOS has issues with plugin paths. libPath = Utils.CleanDirectorySeparators(libPath); string fmodLibName = System.String.Format("{0}fmod{1}{2}", libPrefix, configName, linkExtension); string fmodStudioLibName = System.String.Format("{0}fmodstudio{1}{2}", libPrefix, configName, linkExtension); string fmodDllName = System.String.Format("{0}fmod{1}{2}", libPrefix, configName, dllExtension); string fmodStudioDllName = System.String.Format("{0}fmodstudio{1}{2}", libPrefix, configName, dllExtension); string fmodLibPath = System.IO.Path.Combine(libPath, fmodLibName); string fmodStudioLibPath = System.IO.Path.Combine(libPath, fmodStudioLibName); string fmodDllPath = System.IO.Path.Combine(libPath, fmodDllName); string fmodStudioDllPath = System.IO.Path.Combine(libPath, fmodStudioDllName); System.Collections.Generic.List <string> plugins = GetPlugins(libPath); if (Target.IsInPlatformGroup(UnrealPlatformGroup.Android)) { string[] archs = new string[] { "armeabi-v7a", "arm64-v8a", "x86_64" }; foreach (string arch in archs) { string LibPath = System.IO.Path.Combine(libPath, arch); PublicAdditionalLibraries.Add(System.String.Format("{0}/{1}", LibPath, fmodLibName)); PublicAdditionalLibraries.Add(System.String.Format("{0}/{1}", LibPath, fmodStudioLibName)); } } else { PublicAdditionalLibraries.Add(fmodLibPath); PublicAdditionalLibraries.Add(fmodStudioLibPath); } if (bCopyToOutput) { RuntimeDependencies.Add("$(TargetOutputDir)/" + fmodDllName, fmodDllPath); RuntimeDependencies.Add("$(TargetOutputDir)/" + fmodStudioDllName, fmodStudioDllPath); } else if (bAddRuntimeDependencies) { RuntimeDependencies.Add(fmodDllPath); RuntimeDependencies.Add(fmodStudioDllPath); foreach (string plugin in plugins) { string pluginPath = System.IO.Path.Combine(libPath, plugin + dllExtension); System.Console.WriteLine("Adding reference to FMOD plugin: " + pluginPath); RuntimeDependencies.Add(pluginPath); } } if (bLinkDebugFiles) { RuntimeDependencies.Add(fmodDllPath + ".debug", StagedFileType.DebugNonUFS); RuntimeDependencies.Add(fmodStudioDllPath + ".debug", StagedFileType.DebugNonUFS); } if (bAddDelayLoad) { PublicDelayLoadDLLs.AddRange( new string[] { fmodDllName, fmodStudioDllName } ); } if (Target.Platform == UnrealTargetPlatform.Android) { string APLName = System.String.Format("FMODStudio{0}_APL.xml", configName); string RelAPLPath = Utils.MakePathRelativeTo(System.IO.Path.Combine(ModuleDirectory, APLName), Target.RelativeEnginePath); System.Console.WriteLine("Adding {0}", RelAPLPath); AdditionalPropertiesForReceipt.Add("AndroidPlugin", RelAPLPath); foreach (string PluginName in System.IO.Directory.GetFiles(libPath)) { if (PluginName.EndsWith("_APL.xml", System.StringComparison.OrdinalIgnoreCase)) { string RelPluginPath = Utils.MakePathRelativeTo(PluginName, Target.RelativeEnginePath); System.Console.WriteLine("Adding {0}", RelPluginPath); AdditionalPropertiesForReceipt.Add("AndroidPlugin", RelPluginPath); } } } }
public override void ExecuteBuild() { var UEProjectRoot = ParseParamValue("UEProjectRoot"); if (UEProjectRoot == null) { UEProjectRoot = CmdEnv.LocalRoot; } 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) { foreach (var ProjectName in LocalizationProjectNamesStr.Split(',')) { LocalizationProjectNames.Add(ProjectName.Trim()); } } } var LocalizationProviderName = ParseParamValue("LocalizationProvider"); if (LocalizationProviderName == null) { LocalizationProviderName = "OneSky"; } var LocalizationSteps = new List <string>(); { var LocalizationStepsStr = ParseParamValue("LocalizationSteps"); if (LocalizationStepsStr == null) { LocalizationSteps.AddRange(new string[] { "Download", "Gather", "Import", "Export", "Compile", "GenerateReports", "Upload" }); } else { foreach (var StepName in LocalizationStepsStr.Split(',')) { LocalizationSteps.Add(StepName.Trim()); } } LocalizationSteps.Add("Monolithic"); // Always allow the monolithic scripts to run as we don't know which steps they do } var ShouldGatherPlugins = ParseParam("IncludePlugins"); var IncludePlugins = new List <string>(); var ExcludePlugins = new List <string>(); if (ShouldGatherPlugins) { var IncludePluginsStr = ParseParamValue("IncludePlugins"); if (IncludePluginsStr != null) { foreach (var PluginName in IncludePluginsStr.Split(',')) { IncludePlugins.Add(PluginName.Trim()); } } var ExcludePluginsStr = ParseParamValue("ExcludePlugins"); if (ExcludePluginsStr != null) { foreach (var PluginName in ExcludePluginsStr.Split(',')) { ExcludePlugins.Add(PluginName.Trim()); } } } var AdditionalCommandletArguments = ParseParamValue("AdditionalCommandletArguments"); if (AdditionalCommandletArguments == null) { AdditionalCommandletArguments = ""; } var LocalizationBatches = new List <LocalizationBatch>(); // Add the static set of localization projects as a batch if (LocalizationProjectNames.Count > 0) { LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, UEProjectDirectory, "", LocalizationProjectNames)); } // Build up any additional batches needed for plugins if (ShouldGatherPlugins) { var PluginsRootDirectory = CombinePaths(UEProjectRoot, UEProjectDirectory, "Plugins"); IReadOnlyList <PluginInfo> AllPlugins = Plugins.ReadPluginsFromDirectory(new DirectoryReference(PluginsRootDirectory), UEProjectName.Length == 0 ? PluginLoadedFrom.Engine : PluginLoadedFrom.GameProject); // Add a batch for each plugin that meets our criteria foreach (var PluginInfo in AllPlugins) { bool ShouldIncludePlugin = (IncludePlugins.Count == 0 || IncludePlugins.Contains(PluginInfo.Name)) && !ExcludePlugins.Contains(PluginInfo.Name); if (ShouldIncludePlugin && PluginInfo.Descriptor.LocalizationTargets != null && PluginInfo.Descriptor.LocalizationTargets.Length > 0) { var RootRelativePluginPath = PluginInfo.Directory.MakeRelativeTo(new DirectoryReference(UEProjectRoot)); RootRelativePluginPath = RootRelativePluginPath.Replace('\\', '/'); // Make sure we use / as these paths are used with P4 var PluginTargetNames = new List <string>(); foreach (var LocalizationTarget in PluginInfo.Descriptor.LocalizationTargets) { PluginTargetNames.Add(LocalizationTarget.Name); } LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, RootRelativePluginPath, PluginInfo.Name, PluginTargetNames)); } } } // Create a single changelist to use for all changes, and hash the current PO files on disk so we can work out whether they actually change int PendingChangeList = 0; Dictionary <string, byte[]> InitalPOFileHashes = null; if (P4Enabled) { PendingChangeList = P4.CreateChange(P4Env.Client, "Localization Automation"); InitalPOFileHashes = GetPOFileHashes(LocalizationBatches, UEProjectRoot); } // Process each localization batch foreach (var LocalizationBatch in LocalizationBatches) { ProcessLocalizationProjects(LocalizationBatch, PendingChangeList, UEProjectRoot, UEProjectName, LocalizationProviderName, LocalizationSteps, AdditionalCommandletArguments); } // Submit that single changelist now if (P4Enabled && AllowSubmit) { // Revert any PO files that haven't changed aside from their header { var POFilesToRevert = new List <string>(); var CurrentPOFileHashes = GetPOFileHashes(LocalizationBatches, UEProjectRoot); foreach (var CurrentPOFileHashPair in CurrentPOFileHashes) { byte[] InitialPOFileHash; if (InitalPOFileHashes.TryGetValue(CurrentPOFileHashPair.Key, out InitialPOFileHash) && InitialPOFileHash.SequenceEqual(CurrentPOFileHashPair.Value)) { POFilesToRevert.Add(CurrentPOFileHashPair.Key); } } if (POFilesToRevert.Count > 0) { var P4RevertArgsFilename = CombinePaths(CmdEnv.LocalRoot, "Engine", "Intermediate", String.Format("LocalizationP4RevertArgs-{0}.txt", Guid.NewGuid().ToString())); using (StreamWriter P4RevertArgsWriter = File.CreateText(P4RevertArgsFilename)) { foreach (var POFileToRevert in POFilesToRevert) { P4RevertArgsWriter.WriteLine(POFileToRevert); } } P4.LogP4(String.Format("-x{0} revert", P4RevertArgsFilename)); DeleteFile_NoExceptions(P4RevertArgsFilename); } } // Revert any other unchanged files P4.RevertUnchanged(PendingChangeList); int SubmittedChangeList; P4.Submit(PendingChangeList, out SubmittedChangeList); } }
public bool Execute(VpPluginContext ctx) { if (IsLoad && ctx.Plugins.ActivePlugins().Find(p => p.Description.Name.ToLower() == PluginName.ToLower()) != null) { ctx.Cli.WriteLine(ConsoleMessageType.Error, string.Format("Plugin {0} already loaded.", PluginName)); return(true); } if (IsLoad) { var plugin = ctx.Plugins.Instances.Find(p => p.Description.Name.ToLower() == PluginName.ToLower()); if (plugin == null) { ctx.Cli.WriteLine(ConsoleMessageType.Error, string.Format("Plugin named {0} not found.", PluginName)); return(true); } if (plugin.DependentOn != null) { foreach (var item in plugin.DependentOn) { var dependency = ctx.Plugins.Instances.Find(p => p.Description.Name.ToLower() == item); if (dependency == null) { ctx.Cli.WriteLine(ConsoleMessageType.Error, string.Format( "Plugin named {0} can not be initialized as its dependend on plugin {1}, which is not found.", PluginName, item)); return(true); } if (!ctx.Plugins.ActivePlugins().Contains(dependency)) { dependency.Console = ctx.Cli; dependency.InitializePlugin(ctx.Vp); ctx.Plugins.Activate(dependency); ctx.Cli.WriteLine(ConsoleMessageType.Information, string.Format("Dependency Plugin {0} initialized.", item)); } } } plugin.Console = ctx.Cli; plugin.InitializePlugin(ctx.Vp); ctx.Plugins.Activate(plugin); ctx.Cli.WriteLine(ConsoleMessageType.Information, string.Format("Plugin {0} initialized.", PluginName)); ctx.Plugins.SaveConfiguration("pluginConfiguration.xml"); return(true); } if (!IsLoad && ctx.Plugins.ActivePlugins().Find(p => p.Description.Name.ToLower() == PluginName.ToLower()) == null) { ctx.Cli.WriteLine(ConsoleMessageType.Error, string.Format("Plugin {0} is not loaded.", PluginName)); return(true); } if (!IsLoad) { var plugin = ctx.Plugins.Instances.Find(p => p.Description.Name.ToLower() == PluginName.ToLower()); if (plugin == null) { ctx.Cli.WriteLine(ConsoleMessageType.Error, string.Format("Plugin named {0} not found.", PluginName)); return(true); } ctx.Plugins.Deactivate(plugin); ctx.Cli.WriteLine(ConsoleMessageType.Information, string.Format("Plugin {0} unloaded.", PluginName)); ctx.Plugins.SaveConfiguration("pluginConfiguration.xml"); return(true); } return(true); }
void LoadSettingsFromTemplate(string TemplateXml) { XmlDocument XDoc = new XmlDocument(); XDoc.LoadXml(TemplateXml); foreach (XmlNode Node in XDoc.ChildNodes[1].ChildNodes) { switch (Node.Name) { case ("scan_type"): break; case ("inject_upp"): InjectUrlPathPartsCB.Checked = (Node.InnerText == "true"); break; case ("inject_query"): InjectQueryCB.Checked = (Node.InnerText == "true"); break; case ("inject_body"): InjectBodyCB.Checked = (Node.InnerText == "true"); break; case ("inject_cookie"): InjectCookieCB.Checked = (Node.InnerText == "true"); break; case ("inject_header"): InjectHeadersCB.Checked = (Node.InnerText == "true"); break; case ("inject_names"): InjectNamesCB.Checked = (Node.InnerText == "true"); break; case ("checks"): int CheckedCount = 0; foreach (string PluginName in Node.InnerText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { foreach (DataGridViewRow Row in ScanPluginsGrid.Rows) { if (Row.Cells[1].Value.ToString().Equals(PluginName.Trim())) { Row.Cells[0].Value = true; CheckedCount++; } } } if (CheckedCount == ScanPluginsGrid.Rows.Count) { ScanAllPluginsCB.Checked = true; } else { ScanAllPluginsCB.Checked = false; } break; case ("formats"): foreach (string PluginName in Node.InnerText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { foreach (DataGridViewRow Row in FormatGrid.Rows) { if (Row.Cells[1].Value.ToString().Equals(PluginName.Trim())) { Row.Cells[0].Value = true; } } } break; case ("session_plugin"): try { ScanBranchSessionPluginsCombo.SelectedIndex = ScanBranchSessionPluginsCombo.Items.IndexOf(Node.InnerText); } catch { } break; case ("query_white_list"): QueryParametersPlusTB.Text = Node.InnerText; QueryParametersPlusRB.Checked = true; break; case ("query_black_list"): QueryParametersMinusTB.Text = Node.InnerText; QueryParametersMinusRB.Checked = true; break; case ("body_white_list"): BodyParametersPlusTB.Text = Node.InnerText; BodyParametersPlusRB.Checked = true; break; case ("body_black_list"): BodyParametersMinusTB.Text = Node.InnerText; BodyParametersMinusRB.Checked = true; break; case ("cookie_white_list"): CookieParametersPlusTB.Text = Node.InnerText; CookieParametersPlusRB.Checked = true; break; case ("cookie_black_list"): CookieParametersMinusTB.Text = Node.InnerText; CookieParametersMinusRB.Checked = true; break; case ("headers_white_list"): HeadersParametersPlusTB.Text = Node.InnerText; HeadersParametersPlusRB.Checked = true; break; case ("headers_black_list"): HeadersParametersMinusTB.Text = Node.InnerText; HeadersParametersMinusRB.Checked = true; break; case ("query_filter_type"): if (Node.InnerText.Equals("+")) { QueryParametersPlusRB.Checked = true; } else { QueryParametersMinusRB.Checked = true; } break; case ("body_filter_type"): if (Node.InnerText.Equals("+")) { BodyParametersPlusRB.Checked = true; } else { BodyParametersMinusRB.Checked = true; } break; case ("cookie_filter_type"): if (Node.InnerText.Equals("+")) { CookieParametersPlusRB.Checked = true; } else { CookieParametersMinusRB.Checked = true; } break; case ("headers_filter_type"): if (Node.InnerText.Equals("+")) { HeadersParametersPlusRB.Checked = true; } else { HeadersParametersMinusRB.Checked = true; } break; } } }
public PluginInfo(PluginName name) { Name = name; Accounts = new PluginAccount[] {}; }
void LoadSettingsFromTemplate(string TemplateXml) { XmlDocument XDoc = new XmlDocument(); XDoc.LoadXml(TemplateXml); foreach (XmlNode Node in XDoc.ChildNodes[1].ChildNodes) { switch (Node.Name) { case ("scan_type"): break; case ("crawler_threads"): try { ConfigCrawlerThreadMaxCountTB.Value = Int32.Parse(Node.InnerText); } catch { } break; case ("user_agent"): ConfigCrawlerUserAgentTB.Text = Node.InnerText; break; case ("spl_header_name"): UseSpecialHeaderCB.Checked = true; SpecialHeaderNameTB.Text = Node.InnerText; break; case ("spl_header_value"): SpecialHeaderValueTB.Text = Node.InnerText; break; case ("do_dir_guessing"): ConfigureScanDirAndFileGuessingCB.Checked = (Node.InnerText == "true"); break; case ("prompt_user"): PromptUserCB.Checked = (Node.InnerText == "true"); break; case ("inject_upp"): InjectUrlPathPartsCB.Checked = (Node.InnerText == "true"); break; case ("inject_query"): InjectQueryCB.Checked = (Node.InnerText == "true"); break; case ("inject_body"): InjectBodyCB.Checked = (Node.InnerText == "true"); break; case ("inject_cookie"): InjectCookieCB.Checked = (Node.InnerText == "true"); break; case ("inject_header"): InjectHeadersCB.Checked = (Node.InnerText == "true"); break; case ("inject_names"): InjectNamesCB.Checked = (Node.InnerText == "true"); break; case ("checks"): int CheckedCount = 0; foreach (string PluginName in Node.InnerText.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { foreach (DataGridViewRow Row in ScanPluginsGrid.Rows) { if (Row.Cells[1].Value.ToString().Equals(PluginName.Trim())) { Row.Cells[0].Value = true; CheckedCount++; } } } if (CheckedCount == ScanPluginsGrid.Rows.Count) { ScanAllPluginsCB.Checked = true; } else { ScanAllPluginsCB.Checked = false; } break; case ("query_white_list"): QueryParametersPlusTB.Text = Node.InnerText; QueryParametersPlusRB.Checked = true; break; case ("query_black_list"): QueryParametersMinusTB.Text = Node.InnerText; QueryParametersMinusRB.Checked = true; break; case ("body_white_list"): BodyParametersPlusTB.Text = Node.InnerText; BodyParametersPlusRB.Checked = true; break; case ("body_black_list"): BodyParametersMinusTB.Text = Node.InnerText; BodyParametersMinusRB.Checked = true; break; case ("cookie_white_list"): CookieParametersPlusTB.Text = Node.InnerText; CookieParametersPlusRB.Checked = true; break; case ("cookie_black_list"): CookieParametersMinusTB.Text = Node.InnerText; CookieParametersMinusRB.Checked = true; break; case ("headers_white_list"): HeadersParametersPlusTB.Text = Node.InnerText; HeadersParametersPlusRB.Checked = true; break; case ("headers_black_list"): HeadersParametersMinusTB.Text = Node.InnerText; HeadersParametersMinusRB.Checked = true; break; case ("query_filter_type"): if (Node.InnerText.Equals("+")) { QueryParametersPlusRB.Checked = true; } else { QueryParametersMinusRB.Checked = true; } break; case ("body_filter_type"): if (Node.InnerText.Equals("+")) { BodyParametersPlusRB.Checked = true; } else { BodyParametersMinusRB.Checked = true; } break; case ("cookie_filter_type"): if (Node.InnerText.Equals("+")) { CookieParametersPlusRB.Checked = true; } else { CookieParametersMinusRB.Checked = true; } break; case ("headers_filter_type"): if (Node.InnerText.Equals("+")) { HeadersParametersPlusRB.Checked = true; } else { HeadersParametersMinusRB.Checked = true; } break; } } }
public ProfileEditorMashupName(PluginName pluginName) { _pluginName = pluginName; }
public override void ExecuteBuild() { var UEProjectRoot = ParseParamValue("UEProjectRoot"); if (UEProjectRoot == null) { UEProjectRoot = CmdEnv.LocalRoot; } 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) { foreach (var ProjectName in LocalizationProjectNamesStr.Split(',')) { LocalizationProjectNames.Add(ProjectName.Trim()); } } } var LocalizationProviderName = ParseParamValue("LocalizationProvider"); if (LocalizationProviderName == null) { LocalizationProviderName = ""; } var LocalizationStepNames = new List <string>(); { var LocalizationStepNamesStr = ParseParamValue("LocalizationSteps"); if (LocalizationStepNamesStr == null) { LocalizationStepNames.AddRange(new string[] { "Download", "Gather", "Import", "Export", "Compile", "GenerateReports", "Upload" }); } else { foreach (var StepName in LocalizationStepNamesStr.Split(',')) { LocalizationStepNames.Add(StepName.Trim()); } } LocalizationStepNames.Add("Monolithic"); // Always allow the monolithic scripts to run as we don't know which steps they do } var ShouldGatherPlugins = ParseParam("IncludePlugins"); var IncludePlugins = new List <string>(); var ExcludePlugins = new List <string>(); if (ShouldGatherPlugins) { var IncludePluginsStr = ParseParamValue("IncludePlugins"); if (IncludePluginsStr != null) { foreach (var PluginName in IncludePluginsStr.Split(',')) { IncludePlugins.Add(PluginName.Trim()); } } var ExcludePluginsStr = ParseParamValue("ExcludePlugins"); if (ExcludePluginsStr != null) { foreach (var PluginName in ExcludePluginsStr.Split(',')) { ExcludePlugins.Add(PluginName.Trim()); } } } var ShouldGatherPlatforms = ParseParam("IncludePlatforms"); var AdditionalCommandletArguments = ParseParamValue("AdditionalCommandletArguments"); if (AdditionalCommandletArguments == null) { AdditionalCommandletArguments = ""; } var EnableParallelGather = ParseParam("ParallelGather"); var StartTime = DateTime.UtcNow; var LocalizationBatches = new List <LocalizationBatch>(); // Add the static set of localization projects as a batch if (LocalizationProjectNames.Count > 0) { LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, UEProjectDirectory, "", LocalizationProjectNames)); } // Build up any additional batches needed for platforms if (ShouldGatherPlatforms) { var PlatformsRootDirectory = new DirectoryReference(CombinePaths(UEProjectRoot, UEProjectDirectory, "Platforms")); if (DirectoryReference.Exists(PlatformsRootDirectory)) { foreach (DirectoryReference PlatformDirectory in DirectoryReference.EnumerateDirectories(PlatformsRootDirectory)) { // Find the localization targets defined for this platform var PlatformTargetNames = GetLocalizationTargetsFromDirectory(new DirectoryReference(CombinePaths(PlatformDirectory.FullName, "Config", "Localization"))); if (PlatformTargetNames.Count > 0) { var RootRelativePluginPath = PlatformDirectory.MakeRelativeTo(new DirectoryReference(UEProjectRoot)); RootRelativePluginPath = RootRelativePluginPath.Replace('\\', '/'); // Make sure we use / as these paths are used with P4 LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, RootRelativePluginPath, "", PlatformTargetNames)); } } } } // Build up any additional batches needed for plugins if (ShouldGatherPlugins) { var PluginsRootDirectory = new DirectoryReference(CombinePaths(UEProjectRoot, UEProjectDirectory)); IReadOnlyList <PluginInfo> AllPlugins = Plugins.ReadPluginsFromDirectory(PluginsRootDirectory, "Plugins", UEProjectName.Length == 0 ? PluginType.Engine : PluginType.Project); // Add a batch for each plugin that meets our criteria var AvailablePluginNames = new HashSet <string>(); foreach (var PluginInfo in AllPlugins) { AvailablePluginNames.Add(PluginInfo.Name); bool ShouldIncludePlugin = (IncludePlugins.Count == 0 || IncludePlugins.Contains(PluginInfo.Name)) && !ExcludePlugins.Contains(PluginInfo.Name); if (ShouldIncludePlugin && PluginInfo.Descriptor.LocalizationTargets != null && PluginInfo.Descriptor.LocalizationTargets.Length > 0) { var RootRelativePluginPath = PluginInfo.Directory.MakeRelativeTo(new DirectoryReference(UEProjectRoot)); RootRelativePluginPath = RootRelativePluginPath.Replace('\\', '/'); // Make sure we use / as these paths are used with P4 var PluginTargetNames = new List <string>(); foreach (var LocalizationTarget in PluginInfo.Descriptor.LocalizationTargets) { PluginTargetNames.Add(LocalizationTarget.Name); } LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, RootRelativePluginPath, PluginInfo.Name, PluginTargetNames)); } } // If we had an explicit list of plugins to include, warn if any were missing foreach (string PluginName in IncludePlugins) { if (!AvailablePluginNames.Contains(PluginName)) { LogWarning("The plugin '{0}' specified by -IncludePlugins wasn't found and will be skipped.", PluginName); } } } // Create a single changelist to use for all changes int PendingChangeList = 0; if (P4Enabled) { var ChangeListCommitMessage = String.Format("Localization Automation using CL {0}", P4Env.Changelist); if (File.Exists(CombinePaths(CmdEnv.LocalRoot, @"Engine/Restricted/NotForLicensees/Build/EpicInternal.txt"))) { ChangeListCommitMessage += "\n#okforgithub ignore"; } PendingChangeList = P4.CreateChange(P4Env.Client, ChangeListCommitMessage); } // Prepare to process each localization batch var LocalizationTasks = new List <LocalizationTask>(); foreach (var LocalizationBatch in LocalizationBatches) { var LocalizationTask = new LocalizationTask(LocalizationBatch, UEProjectRoot, LocalizationProviderName, PendingChangeList, this); LocalizationTasks.Add(LocalizationTask); // Make sure the Localization configs and content is up-to-date to ensure we don't get errors later on if (P4Enabled) { LogInformation("Sync necessary content to head revision"); P4.Sync(P4Env.Branch + "/" + LocalizationTask.Batch.LocalizationTargetDirectory + "/Config/Localization/..."); P4.Sync(P4Env.Branch + "/" + LocalizationTask.Batch.LocalizationTargetDirectory + "/Content/Localization/..."); } // Generate the info we need to gather for each project foreach (var ProjectName in LocalizationTask.Batch.LocalizationProjectNames) { LocalizationTask.ProjectInfos.Add(GenerateProjectInfo(LocalizationTask.RootLocalizationTargetDirectory, ProjectName, LocalizationStepNames)); } } // Hash the current PO files on disk so we can work out whether they actually change Dictionary <string, byte[]> InitalPOFileHashes = null; if (P4Enabled) { InitalPOFileHashes = GetPOFileHashes(LocalizationBatches, UEProjectRoot); } // Download the latest translations from our localization provider if (LocalizationStepNames.Contains("Download")) { foreach (var LocalizationTask in LocalizationTasks) { if (LocalizationTask.LocProvider != null) { foreach (var ProjectInfo in LocalizationTask.ProjectInfos) { LocalizationTask.LocProvider.DownloadProjectFromLocalizationProvider(ProjectInfo.ProjectName, ProjectInfo.ImportInfo); } } } } // Begin the gather command for each task // These can run in parallel when ParallelGather is enabled { var EditorExe = CombinePaths(CmdEnv.LocalRoot, @"Engine/Binaries/Win64/UE4Editor-Cmd.exe"); // Set the common basic editor arguments var EditorArguments = P4Enabled ? String.Format("-SCCProvider=Perforce -P4Port={0} -P4User={1} -P4Client={2} -P4Passwd={3} -P4Changelist={4} -EnableSCC -DisableSCCSubmit", P4Env.ServerAndPort, P4Env.User, P4Env.Client, P4.GetAuthenticationToken(), PendingChangeList) : "-SCCProvider=None"; if (IsBuildMachine) { EditorArguments += " -BuildMachine"; } EditorArguments += " -Unattended -LogLocalizationConflicts"; if (EnableParallelGather) { EditorArguments += " -multiprocess"; } if (!String.IsNullOrEmpty(AdditionalCommandletArguments)) { EditorArguments += " " + AdditionalCommandletArguments; } // Set the common process run options var CommandletRunOptions = ERunOptions.Default | ERunOptions.NoLoggingOfRunCommand; // Disable logging of the run command as it will print the exit code which GUBP can pick up as an error (we do that ourselves later) if (EnableParallelGather) { CommandletRunOptions |= ERunOptions.NoWaitForExit; } foreach (var LocalizationTask in LocalizationTasks) { var ProjectArgument = String.IsNullOrEmpty(UEProjectName) ? "" : String.Format("\"{0}\"", Path.Combine(LocalizationTask.RootWorkingDirectory, String.Format("{0}.uproject", UEProjectName))); foreach (var ProjectInfo in LocalizationTask.ProjectInfos) { var LocalizationConfigFiles = new List <string>(); foreach (var LocalizationStep in ProjectInfo.LocalizationSteps) { if (LocalizationStepNames.Contains(LocalizationStep.Name)) { LocalizationConfigFiles.Add(LocalizationStep.LocalizationConfigFile); } } if (LocalizationConfigFiles.Count > 0) { var Arguments = String.Format("{0} -run=GatherText -config=\"{1}\" {2}", ProjectArgument, String.Join(";", LocalizationConfigFiles), EditorArguments); LogInformation("Running localization commandlet for '{0}': {1}", ProjectInfo.ProjectName, Arguments); LocalizationTask.GatherProcessResults.Add(Run(EditorExe, Arguments, null, CommandletRunOptions)); } else { LocalizationTask.GatherProcessResults.Add(null); } } } } // Wait for each commandlet process to finish and report the result. // This runs even for non-parallel execution to log the exit state of the process. foreach (var LocalizationTask in LocalizationTasks) { for (int ProjectIndex = 0; ProjectIndex < LocalizationTask.ProjectInfos.Count; ++ProjectIndex) { var ProjectInfo = LocalizationTask.ProjectInfos[ProjectIndex]; var RunResult = LocalizationTask.GatherProcessResults[ProjectIndex]; if (RunResult != null) { RunResult.WaitForExit(); RunResult.OnProcessExited(); RunResult.DisposeProcess(); if (RunResult.ExitCode == 0) { LogInformation("The localization commandlet for '{0}' exited with code 0.", ProjectInfo.ProjectName); } else { LogWarning("The localization commandlet for '{0}' exited with code {1} which likely indicates a crash.", ProjectInfo.ProjectName, RunResult.ExitCode); } } } } // Upload the latest sources to our localization provider if (LocalizationStepNames.Contains("Upload")) { foreach (var LocalizationTask in LocalizationTasks) { if (LocalizationTask.LocProvider != null) { // Upload all text to our localization provider for (int ProjectIndex = 0; ProjectIndex < LocalizationTask.ProjectInfos.Count; ++ProjectIndex) { var ProjectInfo = LocalizationTask.ProjectInfos[ProjectIndex]; var RunResult = LocalizationTask.GatherProcessResults[ProjectIndex]; if (RunResult != null && RunResult.ExitCode == 0) { // Recalculate the split platform paths before doing the upload, as the export may have changed them ProjectInfo.ExportInfo.CalculateSplitPlatformNames(LocalizationTask.RootLocalizationTargetDirectory); LocalizationTask.LocProvider.UploadProjectToLocalizationProvider(ProjectInfo.ProjectName, ProjectInfo.ExportInfo); } else { LogWarning("Skipping upload to the localization provider for '{0}' due to an earlier commandlet failure.", ProjectInfo.ProjectName); } } } } } // Clean-up the changelist so it only contains the changed files, and then submit it (if we were asked to) if (P4Enabled) { // Revert any PO files that haven't changed aside from their header { var POFilesToRevert = new List <string>(); var CurrentPOFileHashes = GetPOFileHashes(LocalizationBatches, UEProjectRoot); foreach (var CurrentPOFileHashPair in CurrentPOFileHashes) { byte[] InitialPOFileHash; if (InitalPOFileHashes.TryGetValue(CurrentPOFileHashPair.Key, out InitialPOFileHash) && InitialPOFileHash.SequenceEqual(CurrentPOFileHashPair.Value)) { POFilesToRevert.Add(CurrentPOFileHashPair.Key); } } if (POFilesToRevert.Count > 0) { var P4RevertArgsFilename = CombinePaths(CmdEnv.LocalRoot, "Engine", "Intermediate", String.Format("LocalizationP4RevertArgs-{0}.txt", Guid.NewGuid().ToString())); using (StreamWriter P4RevertArgsWriter = File.CreateText(P4RevertArgsFilename)) { foreach (var POFileToRevert in POFilesToRevert) { P4RevertArgsWriter.WriteLine(POFileToRevert); } } P4.LogP4(String.Format("-x{0} revert", P4RevertArgsFilename)); DeleteFile_NoExceptions(P4RevertArgsFilename); } } // Revert any other unchanged files P4.RevertUnchanged(PendingChangeList); // Submit that single changelist now if (AllowSubmit) { int SubmittedChangeList; P4.Submit(PendingChangeList, out SubmittedChangeList); } } var RunDuration = (DateTime.UtcNow - StartTime).TotalMilliseconds; LogInformation("Localize command finished in {0} seconds", RunDuration / 1000); }
public override void ExecuteBuild() { var UEProjectRoot = ParseParamValue("UEProjectRoot"); if (UEProjectRoot == null) { UEProjectRoot = CmdEnv.LocalRoot; } 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) { foreach (var ProjectName in LocalizationProjectNamesStr.Split(',')) { LocalizationProjectNames.Add(ProjectName.Trim()); } } } var LocalizationProviderName = ParseParamValue("LocalizationProvider"); if (LocalizationProviderName == null) { LocalizationProviderName = "OneSky"; } var LocalizationSteps = new List <string>(); { var LocalizationStepsStr = ParseParamValue("LocalizationSteps"); if (LocalizationStepsStr == null) { LocalizationSteps.AddRange(new string[] { "Download", "Gather", "Import", "Export", "Compile", "GenerateReports", "Upload" }); } else { foreach (var StepName in LocalizationStepsStr.Split(',')) { LocalizationSteps.Add(StepName.Trim()); } } LocalizationSteps.Add("Monolithic"); // Always allow the monolithic scripts to run as we don't know which steps they do } var ShouldGatherPlugins = ParseParam("IncludePlugins"); var IncludePlugins = new List <string>(); var ExcludePlugins = new List <string>(); if (ShouldGatherPlugins) { var IncludePluginsStr = ParseParamValue("IncludePlugins"); if (IncludePluginsStr != null) { foreach (var PluginName in IncludePluginsStr.Split(',')) { IncludePlugins.Add(PluginName.Trim()); } } var ExcludePluginsStr = ParseParamValue("ExcludePlugins"); if (ExcludePluginsStr != null) { foreach (var PluginName in ExcludePluginsStr.Split(',')) { ExcludePlugins.Add(PluginName.Trim()); } } } var AdditionalCommandletArguments = ParseParamValue("AdditionalCommandletArguments"); if (AdditionalCommandletArguments == null) { AdditionalCommandletArguments = ""; } var LocalizationBatches = new List <LocalizationBatch>(); // Add the static set of localization projects as a batch if (LocalizationProjectNames.Count > 0) { LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, "", LocalizationProjectNames)); } // Build up any additional batches needed for plugins if (ShouldGatherPlugins) { var PluginsRootDirectory = CombinePaths(UEProjectRoot, UEProjectDirectory, "Plugins"); IReadOnlyList <PluginInfo> AllPlugins = Plugins.ReadPluginsFromDirectory(new DirectoryReference(PluginsRootDirectory), UEProjectName.Length == 0 ? PluginLoadedFrom.Engine : PluginLoadedFrom.GameProject); // Add a batch for each plugin that meets our criteria foreach (var PluginInfo in AllPlugins) { bool ShouldIncludePlugin = (IncludePlugins.Count == 0 || IncludePlugins.Contains(PluginInfo.Name)) && !ExcludePlugins.Contains(PluginInfo.Name); if (ShouldIncludePlugin && PluginInfo.Descriptor.LocalizationTargets != null && PluginInfo.Descriptor.LocalizationTargets.Length > 0) { var RootRelativePluginPath = PluginInfo.Directory.MakeRelativeTo(new DirectoryReference(UEProjectRoot)); RootRelativePluginPath = RootRelativePluginPath.Replace('\\', '/'); // Make sure we use / as these paths are used with P4 var PluginTargetNames = new List <string>(); foreach (var LocalizationTarget in PluginInfo.Descriptor.LocalizationTargets) { PluginTargetNames.Add(LocalizationTarget.Name); } LocalizationBatches.Add(new LocalizationBatch(RootRelativePluginPath, PluginInfo.Name, PluginTargetNames)); } } } // Process each localization batch foreach (var LocalizationBatch in LocalizationBatches) { ProcessLocalizationProjects(LocalizationBatch, UEProjectRoot, UEProjectName, LocalizationProviderName, LocalizationSteps, AdditionalCommandletArguments); } }
public override void ExecuteBuild() { var UEProjectRoot = ParseParamValue("UEProjectRoot"); if (UEProjectRoot == null) { UEProjectRoot = CmdEnv.LocalRoot; } 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) { foreach (var ProjectName in LocalizationProjectNamesStr.Split(',')) { LocalizationProjectNames.Add(ProjectName.Trim()); } } } var LocalizationProviderName = ParseParamValue("LocalizationProvider"); if (LocalizationProviderName == null) { LocalizationProviderName = ""; } var LocalizationStepNames = new List <string>(); { var LocalizationStepNamesStr = ParseParamValue("LocalizationSteps"); if (LocalizationStepNamesStr == null) { LocalizationStepNames.AddRange(new string[] { "Download", "Gather", "Import", "Export", "Compile", "GenerateReports", "Upload" }); } else { foreach (var StepName in LocalizationStepNamesStr.Split(',')) { LocalizationStepNames.Add(StepName.Trim()); } } LocalizationStepNames.Add("Monolithic"); // Always allow the monolithic scripts to run as we don't know which steps they do } var ShouldGatherPlugins = ParseParam("IncludePlugins"); var IncludePlugins = new List <string>(); var ExcludePlugins = new List <string>(); if (ShouldGatherPlugins) { var IncludePluginsStr = ParseParamValue("IncludePlugins"); if (IncludePluginsStr != null) { foreach (var PluginName in IncludePluginsStr.Split(',')) { IncludePlugins.Add(PluginName.Trim()); } } var ExcludePluginsStr = ParseParamValue("ExcludePlugins"); if (ExcludePluginsStr != null) { foreach (var PluginName in ExcludePluginsStr.Split(',')) { ExcludePlugins.Add(PluginName.Trim()); } } } var ShouldGatherPlatforms = ParseParam("IncludePlatforms"); var AdditionalCommandletArguments = ParseParamValue("AdditionalCommandletArguments"); if (AdditionalCommandletArguments == null) { AdditionalCommandletArguments = ""; } var LocalizationBatches = new List <LocalizationBatch>(); // Add the static set of localization projects as a batch if (LocalizationProjectNames.Count > 0) { LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, UEProjectDirectory, "", LocalizationProjectNames)); } // Build up any additional batches needed for platforms if (ShouldGatherPlatforms) { var PlatformsRootDirectory = new DirectoryReference(CombinePaths(UEProjectRoot, UEProjectDirectory, "Platforms")); if (DirectoryReference.Exists(PlatformsRootDirectory)) { foreach (DirectoryReference PlatformDirectory in DirectoryReference.EnumerateDirectories(PlatformsRootDirectory)) { // Find the localization targets defined for this platform var PlatformTargetNames = GetLocalizationTargetsFromDirectory(new DirectoryReference(CombinePaths(PlatformDirectory.FullName, "Config", "Localization"))); if (PlatformTargetNames.Count > 0) { var RootRelativePluginPath = PlatformDirectory.MakeRelativeTo(new DirectoryReference(UEProjectRoot)); RootRelativePluginPath = RootRelativePluginPath.Replace('\\', '/'); // Make sure we use / as these paths are used with P4 LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, RootRelativePluginPath, "", PlatformTargetNames)); } } } } // Build up any additional batches needed for plugins if (ShouldGatherPlugins) { var PluginsRootDirectory = new DirectoryReference(CombinePaths(UEProjectRoot, UEProjectDirectory)); IReadOnlyList <PluginInfo> AllPlugins = Plugins.ReadPluginsFromDirectory(PluginsRootDirectory, "Plugins", UEProjectName.Length == 0 ? PluginType.Engine : PluginType.Project); // Add a batch for each plugin that meets our criteria var AvailablePluginNames = new HashSet <string>(); foreach (var PluginInfo in AllPlugins) { AvailablePluginNames.Add(PluginInfo.Name); bool ShouldIncludePlugin = (IncludePlugins.Count == 0 || IncludePlugins.Contains(PluginInfo.Name)) && !ExcludePlugins.Contains(PluginInfo.Name); if (ShouldIncludePlugin && PluginInfo.Descriptor.LocalizationTargets != null && PluginInfo.Descriptor.LocalizationTargets.Length > 0) { var RootRelativePluginPath = PluginInfo.Directory.MakeRelativeTo(new DirectoryReference(UEProjectRoot)); RootRelativePluginPath = RootRelativePluginPath.Replace('\\', '/'); // Make sure we use / as these paths are used with P4 var PluginTargetNames = new List <string>(); foreach (var LocalizationTarget in PluginInfo.Descriptor.LocalizationTargets) { PluginTargetNames.Add(LocalizationTarget.Name); } LocalizationBatches.Add(new LocalizationBatch(UEProjectDirectory, RootRelativePluginPath, PluginInfo.Name, PluginTargetNames)); } } // If we had an explicit list of plugins to include, warn if any were missing foreach (string PluginName in IncludePlugins) { if (!AvailablePluginNames.Contains(PluginName)) { LogWarning("The plugin '{0}' specified by -IncludePlugins wasn't found and will be skipped.", PluginName); } } } // Create a single changelist to use for all changes, and hash the current PO files on disk so we can work out whether they actually change int PendingChangeList = 0; Dictionary <string, byte[]> InitalPOFileHashes = null; if (P4Enabled) { var ChangeListCommitMessage = "Localization Automation"; if (File.Exists(CombinePaths(CmdEnv.LocalRoot, @"Engine/Build/NotForLicensees/EpicInternal.txt"))) { ChangeListCommitMessage += "\n#okforgithub ignore"; } PendingChangeList = P4.CreateChange(P4Env.Client, ChangeListCommitMessage); InitalPOFileHashes = GetPOFileHashes(LocalizationBatches, UEProjectRoot); } // Process each localization batch foreach (var LocalizationBatch in LocalizationBatches) { ProcessLocalizationProjects(LocalizationBatch, PendingChangeList, UEProjectRoot, UEProjectName, LocalizationProviderName, LocalizationStepNames, AdditionalCommandletArguments); } // Clean-up the changelist so it only contains the changed files, and then submit it (if we were asked to) if (P4Enabled) { // Revert any PO files that haven't changed aside from their header { var POFilesToRevert = new List <string>(); var CurrentPOFileHashes = GetPOFileHashes(LocalizationBatches, UEProjectRoot); foreach (var CurrentPOFileHashPair in CurrentPOFileHashes) { byte[] InitialPOFileHash; if (InitalPOFileHashes.TryGetValue(CurrentPOFileHashPair.Key, out InitialPOFileHash) && InitialPOFileHash.SequenceEqual(CurrentPOFileHashPair.Value)) { POFilesToRevert.Add(CurrentPOFileHashPair.Key); } } if (POFilesToRevert.Count > 0) { var P4RevertArgsFilename = CombinePaths(CmdEnv.LocalRoot, "Engine", "Intermediate", String.Format("LocalizationP4RevertArgs-{0}.txt", Guid.NewGuid().ToString())); using (StreamWriter P4RevertArgsWriter = File.CreateText(P4RevertArgsFilename)) { foreach (var POFileToRevert in POFilesToRevert) { P4RevertArgsWriter.WriteLine(POFileToRevert); } } P4.LogP4(String.Format("-x{0} revert", P4RevertArgsFilename)); DeleteFile_NoExceptions(P4RevertArgsFilename); } } // Revert any other unchanged files P4.RevertUnchanged(PendingChangeList); // Submit that single changelist now if (AllowSubmit) { int SubmittedChangeList; P4.Submit(PendingChangeList, out SubmittedChangeList); } } }
public PluginContextSnapshot(AccountName accountName, ProfileName profileName, PluginName pluginName) { _accountName = accountName; _profileName = profileName; _pluginName = pluginName; }