private ProjectImportExportInfo GenerateProjectImportExportInfo(string RootWorkingDirectory, string LocalizationConfigFile) { ConfigFile File = new ConfigFile(new FileReference(LocalizationConfigFile), ConfigLineAction.Add); var LocalizationConfig = new ConfigHierarchy(new ConfigFile[] { File }); string DestinationPath; if (!LocalizationConfig.GetString("CommonSettings", "DestinationPath", out DestinationPath)) { throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'DestinationPath', File: '{0}'", LocalizationConfigFile); } string ManifestName; if (!LocalizationConfig.GetString("CommonSettings", "ManifestName", out ManifestName)) { throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ManifestName', File: '{0}'", LocalizationConfigFile); } string ArchiveName; if (!LocalizationConfig.GetString("CommonSettings", "ArchiveName", out ArchiveName)) { throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'ArchiveName', File: '{0}'", LocalizationConfigFile); } string PortableObjectName; if (!LocalizationConfig.GetString("CommonSettings", "PortableObjectName", out PortableObjectName)) { throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'PortableObjectName', File: '{0}'", LocalizationConfigFile); } string NativeCulture; if (!LocalizationConfig.GetString("CommonSettings", "NativeCulture", out NativeCulture)) { throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'NativeCulture', File: '{0}'", LocalizationConfigFile); } List <string> CulturesToGenerate; if (!LocalizationConfig.GetArray("CommonSettings", "CulturesToGenerate", out CulturesToGenerate)) { throw new AutomationException("Failed to find a required config key! Section: 'CommonSettings', Key: 'CulturesToGenerate', File: '{0}'", LocalizationConfigFile); } bool bUseCultureDirectory; if (!LocalizationConfig.GetBool("CommonSettings", "bUseCultureDirectory", out bUseCultureDirectory)) { // bUseCultureDirectory is optional, default is true bUseCultureDirectory = true; } var ProjectImportExportInfo = new ProjectImportExportInfo(DestinationPath, ManifestName, ArchiveName, PortableObjectName, NativeCulture, CulturesToGenerate, bUseCultureDirectory); ProjectImportExportInfo.CalculateSplitPlatformNames(RootWorkingDirectory); return(ProjectImportExportInfo); }
public void UploadToS3(DeploymentContext SC) { ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(SC.RawProjectPath), SC.StageTargetPlatform.PlatformType); bool Upload = false; string KeyId = ""; string AccessKey = ""; string BucketName = ""; string FolderName = ""; if (Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "UploadToS3", out Upload)) { if (!Upload) { return; } } else { return; } bool AmazonIdentity = Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3KeyID", out KeyId) && Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3SecretAccessKey", out AccessKey) && Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3BucketName", out BucketName) && Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3FolderName", out FolderName); if (!AmazonIdentity) { Log("Amazon S3 Incorrectly configured"); return; } if (FolderName == "") { FolderName = SC.ShortProjectName; } List <Task> UploadTasks = new List <Task>(); foreach (KeyValuePair <string, string> Entry in SC.ArchivedFiles) { FileInfo Info = new FileInfo(Entry.Key); UploadTasks.Add(Task.Factory.StartNew(() => UploadToS3Worker(Info, KeyId, AccessKey, BucketName, FolderName))); } Task.WaitAll(UploadTasks.ToArray()); string URL = "http://" + BucketName + ".s3.amazonaws.com/" + FolderName + "/" + SC.ShortProjectName + ".html"; Log("Your project's shareable link is: " + URL); Log("Upload Tasks finished."); }
public AndroidDeviceProfileSelector(ReadOnlyTargetRules Target) : base(Target) { ShortName = "AndroidDPS"; // get a value from .ini (ConfigFile attribute doesn't work in Build.cs files it seems) ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, Target.ProjectFile != null ? Target.ProjectFile.Directory : null, Target.Platform); string SecretGuid; Ini.GetString("AndroidDPSBuildSettings", "SecretGuid", out SecretGuid); if (!string.IsNullOrEmpty(SecretGuid)) { PrivateDefinitions.Add("HASH_PEPPER_SECRET_GUID=" + SecretGuid); } PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", } ); PrivateDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", "Engine", } ); }
public override void PlatformSetupParams(ref ProjectParams ProjParams) { base.PlatformSetupParams(ref ProjParams); string ConfigTargetArchicture = ""; ConfigHierarchy PlatformEngineConfig = null; if (ProjParams.EngineConfigs.TryGetValue(PlatformType, out PlatformEngineConfig)) { PlatformEngineConfig.GetString("/Script/MacTargetPlatform.MacTargetSettings", "TargetArchitecture", out ConfigTargetArchicture); if (ConfigTargetArchicture.ToLower().Contains("intel")) { ProjectTargetArchitectures = new[] { MacExports.IntelArchitecture }; } else if (ConfigTargetArchicture.ToLower().Contains("apple")) { ProjectTargetArchitectures = new[] { MacExports.AppleArchitecture }; } else if (ConfigTargetArchicture.ToLower().Contains("universal")) { ProjectTargetArchitectures = new[] { MacExports.IntelArchitecture, MacExports.AppleArchitecture }; } } }
public void SetupSteam() { // C++ Flags PublicDefinitions.Add("WARRIORB_WITH_STEAM=" + BoolToIntString(WARRIORB_WITH_STEAM)); PublicDefinitions.Add("WARRIORB_STEAM_APP_ID=" + IntToString(WARRIORB_STEAM_APP_ID)); PublicDefinitions.Add("WARRIORB_STEAM_DEMO_APP_ID=" + IntToString(WARRIORB_STEAM_DEMO_APP_ID)); PublicDefinitions.Add("WARRIORB_RELAUNCH_IN_STEAM=" + BoolToIntString(WARRIORB_RELAUNCH_IN_STEAM)); PublicDefinitions.Add("WARRIORB_STEAM_CHECK_IF_LIBRARY_CHECKSUM_MATCHES=" + BoolToIntString(WARRIORB_STEAM_CHECK_IF_LIBRARY_CHECKSUM_MATCHES)); PublicDefinitions.Add(String.Format("WARRIORB_STEAM_LIBRARY_WINDOWS_API64_SHA1_SUM=\"{0}\"", WARRIORB_STEAM_LIBRARY_WINDOWS_API64_SHA1_SUM)); ConfigHierarchy ConfigEngineHierarchy = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, new DirectoryReference(ProjectRootPath), Target.Platform); Dictionary <string, string> SteamReplacements = new Dictionary <string, string>(); // Steam if (WARRIORB_WITH_STEAM) { // Replace the steam id with our own defined one // Same for the Game Version // SteamDevAppId { int CurrentAppid; ConfigEngineHierarchy.GetInt32("OnlineSubsystemSteam", "SteamDevAppId", out CurrentAppid); string FormatString = "SteamDevAppId={0}"; SteamReplacements.Add(String.Format(FormatString, CurrentAppid), String.Format(FormatString, SteamAppid)); } // GameVersion { string CurrentGameVersion; ConfigEngineHierarchy.GetString("OnlineSubsystemSteam", "GameVersion", out CurrentGameVersion); string FormatString = "GameVersion={0}"; SteamReplacements.Add(String.Format(FormatString, CurrentGameVersion), String.Format(FormatString, WARRIORB_BUILD_VERSION)); } // Relaunch in Steam? // https://partner.steamgames.com/doc/api/steam_api#SteamAPI_RestartAppIfNecessary // NOTE: disabled at it is broken anyways // { // bool CurrentRelaunchInSteam; // ConfigEngineHierarchy.GetBool("OnlineSubsystemSteam", "bRelaunchInSteam", out CurrentRelaunchInSteam); // string FormatString = "bRelaunchInSteam={0}"; // SteamReplacements.Add(String.Format(FormatString, CurrentRelaunchInSteam), String.Format(FormatString, WARRIORB_RELAUNCH_IN_STEAM)); // } // Include plugins PrivateDependencyModuleNames.Add("NotYetSteam"); DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam"); } // bEnabled // { // bool CurrentEnabled; // ConfigEngineHierarchy.GetBool("OnlineSubsystemSteam", "bEnabled", out CurrentEnabled); // string FormatString = "bEnabled={0}"; // SteamReplacements.Add(String.Format(FormatString, CurrentEnabled), String.Format(FormatString, WARRIORB_WITH_STEAM)); // } PatchFile(DefaultEngineConfigPath, SteamReplacements); }
protected void DoBuildCookRun(ProjectParams Params) { const ProjectBuildTargets ClientTargets = ProjectBuildTargets.ClientCooked | ProjectBuildTargets.ServerCooked; bool bGenerateNativeScripts = Params.RunAssetNativization; int WorkingCL = -1; if (P4Enabled && GlobalCommandLine.Submit && AllowSubmit) { WorkingCL = P4.CreateChange(P4Env.Client, String.Format("{0} build from changelist {1}", Params.ShortProjectName, P4Env.Changelist)); } Project.Build(this, Params, WorkingCL, bGenerateNativeScripts ? (ProjectBuildTargets.All & ~ClientTargets) : ProjectBuildTargets.All); Project.Cook(Params); if (bGenerateNativeScripts) { // crash reporter is built along with client targets, so we need to // include that target flag here as well - note: that its not folded // into ClientTargets because the editor needs its own CrashReporter // as well (which would be built above) Project.Build(this, Params, WorkingCL, ClientTargets | ProjectBuildTargets.CrashReporter); } else { ConfigHierarchy GameIni = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, Params.RawProjectPath.Directory, HostPlatform.Current.HostEditorPlatform); if (GameIni != null) { List <string> NativizeBlueprintAssets = null; string BlueprintNativizationMethod = "Disabled"; bool bWarnIfPackagedWithoutNativizationFlag = true; GameIni.GetString("/Script/UnrealEd.ProjectPackagingSettings", "BlueprintNativizationMethod", out BlueprintNativizationMethod); GameIni.GetBool("/Script/UnrealEd.ProjectPackagingSettings", "bWarnIfPackagedWithoutNativizationFlag", out bWarnIfPackagedWithoutNativizationFlag); GameIni.GetArray("/Script/UnrealEd.ProjectPackagingSettings", "NativizeBlueprintAssets", out NativizeBlueprintAssets); if (bWarnIfPackagedWithoutNativizationFlag && BlueprintNativizationMethod != "Disabled") { // Warn if we're cooking without the -nativizeAssets flag, when the project settings specify a nativization method. // If the "exclusive" (whitelist) method is set, we only warn if at least one asset has been selected for conversion. if (BlueprintNativizationMethod != "Exclusive" || (NativizeBlueprintAssets != null && NativizeBlueprintAssets.Count > 0)) { LogWarning("Project is configured for Blueprint nativization, but the conversion flag (-nativizeAssets) was omitted from the command line. No nativized assets have been built as a result."); } } } } Project.CopyBuildToStagingDirectory(Params); Project.Package(Params, WorkingCL); Project.Archive(Params); Project.Deploy(Params); PrintRunTime(); Project.Run(Params); // Check everything in! if (WorkingCL != -1) { int SubmittedCL; P4.Submit(WorkingCL, out SubmittedCL, true, true); } }
private ProjectImportExportInfo GenerateProjectImportExportInfo(string LocalizationConfigFile) { var ProjectImportExportInfo = new ProjectImportExportInfo(); ConfigFile File = new ConfigFile(new FileReference(LocalizationConfigFile), ConfigLineAction.Add); var LocalizationConfig = new ConfigHierarchy(new ConfigFile[] { File }); 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); }
public static string GetBundleName(DirectoryReference ProjectDirectory, FileReference ProjectFile) { ConfigHierarchy Ini = GetIni(ProjectDirectory); string BundleName; Ini.GetString("/Script/IOSRuntimeSettings.IOSRuntimeSettings", "BundleName", out BundleName); BundleName = BundleName.Replace("[PROJECT_NAME]", ((ProjectFile != null) ? ProjectFile.GetFileNameWithoutAnyExtensions() : "UE4Game")).Replace("_", ""); return(BundleName); }
//public bool CopyFileToDevice(string PackageName, string SourcePath, string DestPath, bool IgnoreDependencies = false) //{ // This function existed for Android, but I don't think we necessarily need it for Lumin. No separate OBB-style data currently. // If needed in the future can base it off Gauntlet.TargetDeviceAndroid.cs' implementation. //} // This is the com.yourcompany.projectname that is shown for installs on device public string GetQualifiedProjectName(string ProjectName) { // ask the .ini system for what version to use ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromString(Path.Combine(Environment.CurrentDirectory, ProjectName).ToString()), UnrealTargetPlatform.Lumin); // check for project override of NDK API level string QualifiedPackageName; Ini.GetString("/Script/LuminRuntimeSettings.LuminRuntimeSettings", "PackageName", out QualifiedPackageName); QualifiedPackageName = QualifiedPackageName.Trim(); QualifiedPackageName = QualifiedPackageName.Replace("[PROJECT]", ProjectName); return QualifiedPackageName.ToLower(); }
public static bool LoadBundleConfig(string BundleIniFile, ref Dictionary <string, BundleSettings> Bundles) { if (System.IO.File.Exists(BundleIniFile) == false) { CommandUtils.LogWarning("Unable to find bundle config ini file {0}", BundleIniFile); return(false); } FileReference BundleFileReference = new FileReference(BundleIniFile); ConfigHierarchy BundleConfig = new ConfigHierarchy(new ConfigFile[] { new ConfigFile(BundleFileReference) }); int PriorityCounter = 0; foreach (string SectionName in BundleConfig.SectionNames) { BundleSettings Bundle = new BundleSettings(); Bundle.Name = SectionName; Bundle.Priority = PriorityCounter; ++PriorityCounter; { string ExecFileName; BundleConfig.GetString(SectionName, "ExecFileName", out ExecFileName); Bundle.ExecFileName = ExecFileName; } { List <string> Tags; BundleConfig.GetArray(SectionName, "Tags", out Tags); Bundle.Tags = Tags; } { List <string> FileRegex; BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex); Bundle.FileRegex = FileRegex; } { bool bContainsShaderLibrary; BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary); Bundle.bContainsShaderLibrary = bContainsShaderLibrary; } if (Bundle.Tags == null) { Bundle.Tags = new List <string>(); } Bundles.Add(SectionName, Bundle); } return(true); }
public void UploadToS3(DeploymentContext SC, string OutputFilename) { ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(SC.RawProjectPath), SC.StageTargetPlatform.PlatformType); bool Upload = false; string Region = ""; string KeyId = ""; string AccessKey = ""; string BucketName = ""; string FolderName = ""; if (!Ini.GetBool("/Script/HTML5PlatformEditor.HTML5TargetSettings", "UploadToS3", out Upload) || !Upload) { return; } bool AmazonIdentity = Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3Region", out Region) && Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3KeyID", out KeyId) && Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3SecretAccessKey", out AccessKey) && Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3BucketName", out BucketName); if (!AmazonIdentity) { Log("Amazon S3 Incorrectly configured"); return; } Ini.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "S3FolderName", out FolderName); if (FolderName == "") { FolderName = SC.ShortProjectName; } else { // strip any before and after folder "/" FolderName = Regex.Replace(Regex.Replace(FolderName, "^/+", ""), "/+$", ""); } List <Task> UploadTasks = new List <Task>(); long msTimeOut = 0; foreach (KeyValuePair <string, string> Entry in SC.ArchivedFiles) { FileInfo Info = new FileInfo(Entry.Key); UploadTasks.Add(UploadToS3Worker(Info, Region, KeyId, AccessKey, BucketName, FolderName)); if (msTimeOut < Info.Length) { msTimeOut = Info.Length; } } msTimeOut /= 100; // [miliseconds] give 10 secs for each ~MB ( (10s * 1000ms) / ( 1024KB * 1024MB * 1000ms ) ) if (msTimeOut < (100 * 1000)) // HttpClient: default timeout is 100 sec { msTimeOut = 100 * 1000; } Log("Upload Timeout set to: " + (msTimeOut / 1000) + "secs"); Task.WaitAll(UploadTasks.ToArray(), (int)msTimeOut); // set timeout [miliseconds] string URL = "https://" + BucketName + ".s3.amazonaws.com/" + FolderName + "/" + OutputFilename; Log("Your project's shareable link is: " + URL); Log("Upload Tasks finished."); }
protected void GenerateFileFromTemplate(string InTemplateFile, string InOutputFile, ProjectParams Params, DeploymentContext SC, ConfigHierarchy ConfigCache) { bool IsContentOnly = !Params.IsCodeBasedProject; string ProjectConfiguration = Params.ClientConfigsToBuild[0].ToString(); string UE4GameName = IsContentOnly ? "UE4Game" : (Params.HasClientCookedTargets ? Params.ClientCookedTargets[0] : Params.ShortProjectName); string ProjectName = Params.ShortProjectName; if (ProjectConfiguration != "Development") { UE4GameName += "-HTML5-" + ProjectConfiguration; ProjectName += "-HTML5-" + ProjectConfiguration; } string CanvasScaleMode; ConfigCache.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "CanvasScalingMode", out CanvasScaleMode); StringBuilder outputContents = new StringBuilder(); using (StreamReader reader = new StreamReader(InTemplateFile)) { string LineStr = null; while (reader.Peek() != -1) { LineStr = reader.ReadLine(); if (LineStr.Contains("%TIMESTAMP%")) { string TimeStamp = DateTime.UtcNow.ToString("yyyyMMddHHmm"); LineStr = LineStr.Replace("%TIMESTAMP%", TimeStamp); } if (LineStr.Contains("%SHORTNAME%")) { LineStr = LineStr.Replace("%SHORTNAME%", Params.ShortProjectName); } if (LineStr.Contains("%UE4GAMENAME%")) { LineStr = LineStr.Replace("%UE4GAMENAME%", UE4GameName); } if (LineStr.Contains("%PROJECTNAME%")) { LineStr = LineStr.Replace("%PROJECTNAME%", ProjectName); } if (LineStr.Contains("%SERVE_COMPRESSED%")) { LineStr = LineStr.Replace("%SERVE_COMPRESSED%", Compressed ? "true" : "false"); } if (LineStr.Contains("%DISABLE_INDEXEDDB%")) { LineStr = LineStr.Replace("%DISABLE_INDEXEDDB%", enableIndexedDB ? "" : "enableReadFromIndexedDB = false;\nenableWriteToIndexedDB = false;"); } if (LineStr.Contains("%UE4CMDLINE%")) { string ArgumentString = "'../../../" + Params.ShortProjectName + "/" + Params.ShortProjectName + ".uproject',"; if (Params.MapToRun.Length > 0) { ArgumentString += "'" + Params.MapToRun + "',"; } ArgumentString += "'-stdout',"; // suppress double printing to console.log LineStr = LineStr.Replace("%UE4CMDLINE%", ArgumentString); } if (LineStr.Contains("%CANVASSCALEMODE%")) { string mode = "2 /*ASPECT*/"; // default if (CanvasScaleMode.Equals("stretch", StringComparison.InvariantCultureIgnoreCase)) { mode = "1 /*STRETCH*/"; } else if (CanvasScaleMode.Equals("fixed", StringComparison.InvariantCultureIgnoreCase)) { mode = "3 /*FIXED*/"; } LineStr = LineStr.Replace("%CANVASSCALEMODE%", mode); } if (LineStr.Contains("%MULTITHREADED%")) { LineStr = LineStr.Replace("%MULTITHREADED%", enableMultithreading ? "true" : "false"); } if (LineStr.Contains("%OFFSCREENCANVAS%")) { LineStr = LineStr.Replace("%OFFSCREENCANVAS%", bMultithreading_UseOffscreenCanvas ? "true" : "false"); } if (LineStr.Contains("%EMSDK_VERSION%")) { string escpath = HTML5SDKInfo.EMSCRIPTEN_ROOT.Replace("\\", "/"); LineStr = LineStr.Replace("%EMSDK_VERSION%", (ProjectConfiguration == "Shipping") ? HTML5SDKInfo.EmscriptenVersion() : escpath); } if (LineStr.Contains("%EMSDK_CONFIG%")) { string escpath = HTML5SDKInfo.DOT_EMSCRIPTEN.Replace("\\", "/"); LineStr = LineStr.Replace("%EMSDK_CONFIG%", (ProjectConfiguration == "Shipping") ? "" : escpath); } outputContents.AppendLine(LineStr); } } if (outputContents.Length > 0) { // Save the file try { Directory.CreateDirectory(Path.GetDirectoryName(InOutputFile)); File.WriteAllText(InOutputFile, outputContents.ToString(), Encoding.UTF8); } catch (Exception) { // Unable to write to the project file. } } }
protected void GenerateFileFromTemplate(string InTemplateFile, string InOutputFile, ProjectParams Params, ConfigHierarchy ConfigCache) { bool IsContentOnly = !Params.IsCodeBasedProject; string ProjectConfiguration = Params.ClientConfigsToBuild[0].ToString(); string UE4GameName = IsContentOnly ? "UE4Game" : Params.ShortProjectName; string ProjectName = Params.ShortProjectName; if (ProjectConfiguration != "Development") { UE4GameName += "-HTML5-" + ProjectConfiguration; ProjectName += "-HTML5-" + ProjectConfiguration; } string CanvasScaleMode; ConfigCache.GetString("/Script/HTML5PlatformEditor.HTML5TargetSettings", "CanvasScalingMode", out CanvasScaleMode); string HeapSize = HTML5SDKInfo.HeapSize(ConfigCache, ProjectConfiguration).ToString(); StringBuilder outputContents = new StringBuilder(); using (StreamReader reader = new StreamReader(InTemplateFile)) { string LineStr = null; while (reader.Peek() != -1) { LineStr = reader.ReadLine(); if (LineStr.Contains("%TIMESTAMP%")) { string TimeStamp = DateTime.UtcNow.ToString("yyyyMMddHHmm"); LineStr = LineStr.Replace("%TIMESTAMP%", TimeStamp); } if (LineStr.Contains("%SHORTNAME%")) { LineStr = LineStr.Replace("%SHORTNAME%", Params.ShortProjectName); } if (LineStr.Contains("%UE4GAMENAME%")) { LineStr = LineStr.Replace("%UE4GAMENAME%", UE4GameName); } if (LineStr.Contains("%PROJECTNAME%")) { LineStr = LineStr.Replace("%PROJECTNAME%", ProjectName); } if (LineStr.Contains("%SERVE_COMPRESSED%")) { LineStr = LineStr.Replace("%SERVE_COMPRESSED%", Compressed ? "true" : "false"); } if (LineStr.Contains("%DISABLE_INDEXEDDB%")) { LineStr = LineStr.Replace("%DISABLE_INDEXEDDB%", enableIndexedDB ? "" : "enableReadFromIndexedDB = false;\nenableWriteToIndexedDB = false;"); } if (LineStr.Contains("%HEAPSIZE%")) { LineStr = LineStr.Replace("%HEAPSIZE%", HeapSize + " * 1024 * 1024"); } if (LineStr.Contains("%UE4CMDLINE%")) { string ArgumentString = "'../../../" + Params.ShortProjectName + "/" + Params.ShortProjectName + ".uproject',"; ArgumentString += "'-stdout',"; // suppress double printing to console.log LineStr = LineStr.Replace("%UE4CMDLINE%", ArgumentString); } if (LineStr.Contains("%CANVASSCALEMODE%")) { string mode = "2 /*ASPECT*/"; // default if (CanvasScaleMode.Equals("stretch", StringComparison.InvariantCultureIgnoreCase)) { mode = "1 /*STRETCH*/"; } else if (CanvasScaleMode.Equals("fixed", StringComparison.InvariantCultureIgnoreCase)) { mode = "3 /*FIXED*/"; } LineStr = LineStr.Replace("%CANVASSCALEMODE%", mode); } outputContents.AppendLine(LineStr); } } if (outputContents.Length > 0) { // Save the file try { Directory.CreateDirectory(Path.GetDirectoryName(InOutputFile)); File.WriteAllText(InOutputFile, outputContents.ToString(), Encoding.UTF8); } catch (Exception) { // Unable to write to the project file. } } }
public AppCenter(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs; PublicDependencyModuleNames.AddRange( new string[] { "Core", // ... add other public dependencies that you statically link with here ... } ); PrivateDependencyModuleNames.AddRange( new string[] { "CoreUObject", "Engine", "Slate", "SlateCore", // ... add private dependencies that you statically link with here ... } ); // Setup platform include paths if (Target.Platform == UnrealTargetPlatform.Android) { PrivateIncludePaths.Add("AppCenter/Private/Android"); } else if (Target.Platform == UnrealTargetPlatform.IOS) { PrivateIncludePaths.Add("AppCenter/Private/IOS"); } // Configure build defines bool bAppCenterEnabled = false; bool bEnableAnalytics = false; bool bEnableCrashes = false; bool bEnableDistribute = false; bool bEnablePush = false; string AppSecretAndroid = ""; string AppSecretIOS = ""; // Read from config ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, Target.ProjectFile.Directory, Target.Platform); string SettingsSection = "/Script/AppCenter.AppCenterSettings"; Ini.GetBool(SettingsSection, "bEnableAnalytics", out bEnableAnalytics); Ini.GetBool(SettingsSection, "bEnableCrashes", out bEnableCrashes); Ini.GetBool(SettingsSection, "bEnableDistribute", out bEnableDistribute); Ini.GetBool(SettingsSection, "bEnablePush", out bEnablePush); Ini.GetString(SettingsSection, "AppSecretAndroid", out AppSecretAndroid); Ini.GetString(SettingsSection, "AppSecretIOS", out AppSecretIOS); bool bAnyModuleEnabled = (bEnableAnalytics | bEnableCrashes | bEnableDistribute | bEnablePush); if (bAnyModuleEnabled) { if (Target.Platform == UnrealTargetPlatform.Android && AppSecretAndroid != "") { bAppCenterEnabled = true; PublicDependencyModuleNames.AddRange(new string[] { "Launch" }); string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath); AdditionalPropertiesForReceipt.Add("AndroidPlugin", Path.Combine(PluginPath, "AppCenter_UPL_Android.xml")); if (bEnableCrashes) { /** * Application.mk * * APP_STL := gnustl_static * APP_ABI := armeabi-v7a, arm64-v8a * APP_CXXFLAGS := -std=c++11 -D__STDC_LIMIT_MACROS * APP_PLATFORM := android-19 */ string ThirdPartyPath = Path.Combine(ModuleDirectory, "..", "ThirdParty"); PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Breakpad", "src")); PublicLibraryPaths.Add(Path.Combine(ThirdPartyPath, "Breakpad", "lib", "armeabi-v7a")); PublicLibraryPaths.Add(Path.Combine(ThirdPartyPath, "Breakpad", "lib", "arm64-v8a")); PublicAdditionalLibraries.Add("breakpad_client"); } } else if (Target.Platform == UnrealTargetPlatform.IOS && AppSecretIOS != "") { bAppCenterEnabled = true; string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, Target.RelativeEnginePath); AdditionalPropertiesForReceipt.Add("IOSPlugin", Path.Combine(PluginPath, "AppCenter_UPL_IOS.xml")); // The AppCenter.framework is required to start the SDK. If it is not added to the project, // the other modules won't work and your app won't compile. PublicAdditionalFrameworks.Add( new Framework( "AppCenter", "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenter.embeddedframework.zip" ) ); if (bEnableAnalytics) { PublicAdditionalFrameworks.Add( new Framework( "AppCenterAnalytics", "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterAnalytics.embeddedframework.zip" ) ); } if (bEnableCrashes) { PublicAdditionalFrameworks.Add( new Framework( "AppCenterCrashes", "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterCrashes.embeddedframework.zip" ) ); } if (bEnableDistribute) { PublicAdditionalFrameworks.Add( new Framework( "AppCenterDistribute", "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterDistribute.embeddedframework.zip", "AppCenterDistributeResources.bundle" ) ); } if (bEnablePush) { PublicAdditionalFrameworks.Add( new Framework( "AppCenterPush", "../../ThirdParty/AppCenter-SDK-Apple/iOS/AppCenterPush.embeddedframework.zip" ) ); } } } // Setup defines based on reality if (bAppCenterEnabled) { PublicDefinitions.Add("WITH_APPCENTER=" + (bAnyModuleEnabled ? "1" : "0")); PublicDefinitions.Add("WITH_APPCENTER_ANALYTICS=" + (bEnableAnalytics ? "1" : "0")); PublicDefinitions.Add("WITH_APPCENTER_CRASHES=" + (bEnableCrashes ? "1" : "0")); PublicDefinitions.Add("WITH_APPCENTER_DISTIBUTE=" + (bEnableDistribute ? "1" : "0")); PublicDefinitions.Add("WITH_APPCENTER_PUSH=" + (bEnablePush ? "1" : "0")); } else { PublicDefinitions.Add("WITH_APPCENTER=0"); PublicDefinitions.Add("WITH_APPCENTER_ANALYTICS=0"); PublicDefinitions.Add("WITH_APPCENTER_CRASHES=0"); PublicDefinitions.Add("WITH_APPCENTER_DISTIBUTE=0"); PublicDefinitions.Add("WITH_APPCENTER_PUSH=0"); } }
public static bool LoadBundleConfig(string BundleIniFile, ref Dictionary <string, BundleSettings> Bundles) { if (System.IO.File.Exists(BundleIniFile) == false) { CommandUtils.LogWarning("Unable to find bundle config ini file {0}", BundleIniFile); return(false); } FileReference BundleFileReference = new FileReference(BundleIniFile); ConfigHierarchy BundleConfig = new ConfigHierarchy(new ConfigFile[] { new ConfigFile(BundleFileReference) }); int PriorityCounter = 0; foreach (string SectionName in BundleConfig.SectionNames) { BundleSettings Bundle = new BundleSettings(); Bundle.Name = SectionName; Bundle.Priority = PriorityCounter; ++PriorityCounter; { string OverrideName; if (BundleConfig.GetString(SectionName, "OverrideName", out OverrideName)) { Bundle.OverrideName = OverrideName; } else { Bundle.OverrideName = Bundle.Name; } } { string ParentName; BundleConfig.GetString(SectionName, "Parent", out ParentName); Bundle.ParentName = ParentName; } { List <string> Tags; BundleConfig.GetArray(SectionName, "Tags", out Tags); Bundle.Tags = Tags; } { List <string> FileRegex; BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex); Bundle.FileRegex = FileRegex; } { bool bContainsShaderLibrary; BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary); Bundle.bContainsShaderLibrary = bContainsShaderLibrary; } if (Bundle.Tags == null) { Bundle.Tags = new List <string>(); } Bundles.Add(SectionName, Bundle); //BundleConfig.GetArray(SectionName, "OptionalTags", out Bundle.OptionalTags); } foreach (var BundleIt in Bundles) { BundleSettings Bundle = BundleIt.Value; if (Bundles.ContainsKey(Bundle.ParentName)) { BundleSettings ParentBundle = Bundles[Bundle.ParentName]; ParentBundle.Children.Add(Bundle); Bundle.bFoundParent = true; } } return(true); }
public void SetupBuildVersion() { string BUILD_VERSION = WARRIORB_BUILD_VERSION; string BRANCH = "None"; string COMMIT = "None"; string DEMO = WARRIORB_DEMO ? "-DEMO" : ""; // Read build version GetCurrentBranchAndCommit(ref BRANCH, ref COMMIT); Console.WriteLine(""); PrintBlue(String.Format("BUILD_VERSION = {0}, BRANCH = {1}, COMMIT = {2}, DEMO = {3}", BUILD_VERSION, BRANCH, COMMIT, WARRIORB_DEMO)); Console.WriteLine(""); // The current build number // NOTE: this also sets the GameAnalytics version for all platforms, so you do not need to update those values. PublicDefinitions.Add(String.Format("WARRIORB_BUILD_VERSION=\"{0}\"", BUILD_VERSION)); PublicDefinitions.Add(String.Format("WARRIORB_BUILD_BRANCH=\"{0}\"", BRANCH)); PublicDefinitions.Add(String.Format("WARRIORB_BUILD_COMMIT=\"{0}\"", COMMIT)); // Write to file so that other resources can use it string VersionFileText = @" // DO NOT MODIFY - FILE AUTOMATICALLY GENERATED in SOrb.Build.cs - DO NOT MODIFY #define WARRIORB_BUILD_VERSION {0} #define WARRIORB_BUILD_BRANCH {1} #define WARRIORB_BUILD_COMMIT {2} #define WARRIORB_BUILD_ALL {0}-{1}-{2}{3} // DO NOT MODIFY - FILE AUTOMATICALLY GENERATED in SOrb.Build.cs - DO NOT MODIFY "; string VersionFileTextFormat = String.Format(VersionFileText, BUILD_VERSION, BRANCH, COMMIT, DEMO); File.WriteAllText(WarriorbVersionFilePath, VersionFileTextFormat); // Do replacements in GeneralProjectSettings ConfigHierarchy ConfigGameHierarchy = ConfigCache.ReadHierarchy(ConfigHierarchyType.Game, new DirectoryReference(ProjectRootPath), Target.Platform); Dictionary <string, string> GeneralProjectSettingsReplacements = new Dictionary <string, string>(); // ProjectVersion { string CurrentProjectVersion; ConfigGameHierarchy.GetString("/Script/EngineSettings.GeneralProjectSettings", "ProjectVersion", out CurrentProjectVersion); string FormatString = "ProjectVersion={0}"; GeneralProjectSettingsReplacements.Add(String.Format(FormatString, CurrentProjectVersion), String.Format(FormatString, WARRIORB_BUILD_VERSION)); } // ProjectName { string CurrentProjectName; ConfigGameHierarchy.GetString("/Script/EngineSettings.GeneralProjectSettings", "ProjectName", out CurrentProjectName); string FormatString = "ProjectName={0}"; string ReplacementString = WARRIORB_DEMO ? ProjectNameDemo : ProjectName; GeneralProjectSettingsReplacements.Add(String.Format(FormatString, CurrentProjectName), String.Format(FormatString, ReplacementString)); } // ProjectDisplayedTitle { string CurrentProjectDisplayedTitle; ConfigGameHierarchy.GetString("/Script/EngineSettings.GeneralProjectSettings", "ProjectDisplayedTitle", out CurrentProjectDisplayedTitle); string FormatString = "ProjectDisplayedTitle={0}"; string ReplacementString = WARRIORB_DEMO ? ProjectDisplayedTitleDemo : ProjectDisplayedTitle; GeneralProjectSettingsReplacements.Add(String.Format(FormatString, CurrentProjectDisplayedTitle), String.Format(FormatString, ReplacementString)); } PatchFile(DefaultGameConfigPath, GeneralProjectSettingsReplacements); }
public static void LoadBundleConfig <TPlatformBundleSettings>(DirectoryReference ProjectDir, UnrealTargetPlatform Platform, out List <TPlatformBundleSettings> Bundles, Action <TPlatformBundleSettings, ConfigHierarchy, string> GetPlatformSettings) where TPlatformBundleSettings : BundleSettings, new() { Bundles = new List <TPlatformBundleSettings>(); ConfigHierarchy BundleConfig = ConfigCache.ReadHierarchy(ConfigHierarchyType.InstallBundle, ProjectDir, Platform); const string BundleDefinitionPrefix = "InstallBundleDefinition "; foreach (string SectionName in BundleConfig.SectionNames) { if (!SectionName.StartsWith(BundleDefinitionPrefix)) { continue; } TPlatformBundleSettings Bundle = new TPlatformBundleSettings(); Bundle.Name = SectionName.Substring(BundleDefinitionPrefix.Length); { int Order; if (BundleConfig.GetInt32(SectionName, "Order", out Order)) { Bundle.Order = Order; } else { Bundle.Order = int.MaxValue; } } { string ExecFileName; BundleConfig.GetString(SectionName, "ExecFileName", out ExecFileName); Bundle.ExecFileName = ExecFileName; } { List <string> Tags; BundleConfig.GetArray(SectionName, "Tags", out Tags); Bundle.Tags = Tags; } { List <string> FileRegex; BundleConfig.GetArray(SectionName, "FileRegex", out FileRegex); Bundle.FileRegex = FileRegex; } { bool bContainsShaderLibrary; BundleConfig.GetBool(SectionName, "ContainsShaderLibrary", out bContainsShaderLibrary); Bundle.bContainsShaderLibrary = bContainsShaderLibrary; } if (Bundle.Tags == null) { Bundle.Tags = new List <string>(); } GetPlatformSettings(Bundle, BundleConfig, BundleDefinitionPrefix + Bundle.Name); Bundles.Add(Bundle); } // Use OrderBy and not Sort because OrderBy is stable Bundles = Bundles.OrderBy(Bundle => Bundle.Order).ToList(); }
static void CopySharedCookedBuildForTarget(ProjectParams Params, TargetPlatformDescriptor TargetPlatform, string CookPlatform) { string ProjectPath = Params.RawProjectPath.FullName; var LocalPath = CombinePaths(GetDirectoryName(ProjectPath), "Saved", "SharedIterativeBuild", CookPlatform); // get network location ConfigHierarchy Hierarchy = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(Params.RawProjectPath), TargetPlatform.Type); string CookedBuildPath; if (Hierarchy.GetString("SharedCookedBuildSettings", "SharedCookedBuildPath", out CookedBuildPath) == false) { Log("Unable to copy shared cooked build: SharedCookedBuildPath not set in Engine.ini SharedCookedBuildSettings"); return; } string BuildRoot = P4Enabled ? P4Env.BuildRootP4.Replace("/", "+") : ""; int RecentCL = P4Enabled ? P4Env.Changelist : 0; BuildVersion Version; if (BuildVersion.TryRead(out Version)) { RecentCL = Version.Changelist; BuildRoot = Version.BranchName; } // check to see if we have already synced this build ;) var SyncedBuildFile = CombinePaths(LocalPath, "SyncedBuild.txt"); string BuildCL = "Invalid"; if (File.Exists(SyncedBuildFile)) { BuildCL = File.ReadAllText(SyncedBuildFile); } if (RecentCL == 0 && CookedBuildPath.Contains("[CL]")) { Log("Unable to copy shared cooked build: Unable to determine CL number from P4 or UGS, and is required by SharedCookedBuildPath"); return; } if (RecentCL == 0 && CookedBuildPath.Contains("[BRANCHNAME]")) { Log("Unable to copy shared cooked build: Unable to determine BRANCHNAME number from P4 or UGS, and is required by SharedCookedBuildPath"); return; } CookedBuildPath = CookedBuildPath.Replace("[CL]", RecentCL.ToString()); CookedBuildPath = CookedBuildPath.Replace("[BRANCHNAME]", BuildRoot); CookedBuildPath = CookedBuildPath.Replace("[PLATFORM]", CookPlatform); if (Directory.Exists(CookedBuildPath) == false) { Log("Unable to copy shared cooked build: Unable to find shared build at location {0} check SharedCookedBuildPath in Engine.ini SharedCookedBuildSettings is correct", CookedBuildPath); return; } Log("Attempting download of latest shared build CL {0} from location {1}", RecentCL, CookedBuildPath); if (BuildCL == RecentCL.ToString()) { Log("Already downloaded latest shared build at CL {0}", RecentCL); return; } // delete all the stuff Log("Deleting previous shared build because it was out of date"); CommandUtils.DeleteDirectory(LocalPath); Directory.CreateDirectory(LocalPath); // find all the files in the staged directory string CookedBuildStagedDirectory = Path.GetFullPath(Path.Combine(CookedBuildPath, "Staged")); string LocalBuildStagedDirectory = Path.GetFullPath(Path.Combine(LocalPath, "Staged")); if (Directory.Exists(CookedBuildStagedDirectory)) { foreach (string FileName in Directory.EnumerateFiles(CookedBuildStagedDirectory, "*.*", SearchOption.AllDirectories)) { string SourceFileName = Path.GetFullPath(FileName); string DestFileName = SourceFileName.Replace(CookedBuildStagedDirectory, LocalBuildStagedDirectory); Directory.CreateDirectory(Path.GetDirectoryName(DestFileName)); File.Copy(SourceFileName, DestFileName); } } string CookedBuildCookedDirectory = Path.Combine(CookedBuildPath, "Cooked"); CookedBuildCookedDirectory = Path.GetFullPath(CookedBuildCookedDirectory); string LocalBuildCookedDirectory = Path.Combine(LocalPath, "Cooked"); LocalBuildCookedDirectory = Path.GetFullPath(LocalBuildCookedDirectory); if (Directory.Exists(CookedBuildCookedDirectory)) { foreach (string FileName in Directory.EnumerateFiles(CookedBuildCookedDirectory, "*.*", SearchOption.AllDirectories)) { string SourceFileName = Path.GetFullPath(FileName); string DestFileName = SourceFileName.Replace(CookedBuildCookedDirectory, LocalBuildCookedDirectory); Directory.CreateDirectory(Path.GetDirectoryName(DestFileName)); File.Copy(SourceFileName, DestFileName); } } File.WriteAllText(SyncedBuildFile, RecentCL.ToString()); return; }