public bool CopyBuild(DirectoryReference InstallPath) { CommandUtils.LogInformation("Installing shared cooked build from manifest: {0} to {1}", Manifest.FullName, InstallPath.FullName); DirectoryReference PlatformInstallPath = DirectoryReference.Combine(InstallPath, Platform.ToString()); FileReference PreviousManifest = FileReference.Combine(PlatformInstallPath, ".build", "Current.manifest"); FileReference BPTI = FileReference.Combine(CommandUtils.RootDirectory, "Engine", "Binaries", "Win64", "NotForLicensees", "BuildPatchToolInstaller.exe"); if (!FileReference.Exists(BPTI)) { CommandUtils.LogInformation("Could not locate BuildPatchToolInstaller.exe"); return false; } bool PreviousManifestExists = FileReference.Exists(PreviousManifest); if (!PreviousManifestExists && DirectoryReference.Exists(PlatformInstallPath)) { DirectoryReference.Delete(PlatformInstallPath, true); } IProcessResult Result = CommandUtils.Run(BPTI.FullName, string.Format("-Manifest={0} -OutputDir={1} -stdout -GenericConsoleOutput", Manifest.FullName, PlatformInstallPath.FullName), null, CommandUtils.ERunOptions.Default); if (Result.ExitCode != 0) { CommandUtils.LogWarning("Failed to install manifest {0} to {1}", Manifest.FullName, PlatformInstallPath.FullName); return false; } FileReference SyncedBuildFile = new FileReference(CommandUtils.CombinePaths(PlatformInstallPath.FullName, SyncedBuildFileName)); FileReference.WriteAllLines(SyncedBuildFile, new string[] { CL.ToString(), Manifest.FullName }); return true; }
protected override bool PerformPrequisites() { if (TaskOptions.HasFlag(DDCTaskOptions.ColdDDC)) { StoredEnvVars.Clear(); CachePaths.Clear(); // We put our temp DDC paths in here DirectoryReference BasePath = DirectoryReference.Combine(CommandUtils.EngineDirectory, "BenchmarkDDC"); IEnumerable <string> DDCEnvVars = new string[] { GetXPlatformEnvironmentKey("UE-BootDataCachePath"), GetXPlatformEnvironmentKey("UE-LocalDataCachePath") }; if (TaskOptions.HasFlag(DDCTaskOptions.KeepMemoryDDC)) { DDCEnvVars = DDCEnvVars.Where(E => !E.Contains("UE-Boot")); } // get all current environment vars and set them to our temp dir foreach (var Key in DDCEnvVars) { // save current key StoredEnvVars.Add(Key, Environment.GetEnvironmentVariable(Key)); // create a new dir for this key DirectoryReference Dir = DirectoryReference.Combine(BasePath, Key); if (DirectoryReference.Exists(Dir)) { DirectoryReference.Delete(Dir, true); } DirectoryReference.CreateDirectory(Dir); // save this dir and set it as the env var CachePaths.Add(Dir); Environment.SetEnvironmentVariable(Key, Dir.FullName); } // remove project files DirectoryReference ProjectDDC = DirectoryReference.Combine(ProjectFile.Directory, "DerivedDataCache"); CommandUtils.DeleteDirectory_NoExceptions(ProjectDDC.FullName); // remove S3 files DirectoryReference S3DDC = DirectoryReference.Combine(ProjectFile.Directory, "Saved", "S3DDC"); CommandUtils.DeleteDirectory_NoExceptions(S3DDC.FullName); } return(base.PerformPrequisites()); }
protected override void PerformCleanup() { // restore keys foreach (var KV in StoredEnvVars) { Environment.SetEnvironmentVariable(KV.Key, KV.Value); } foreach (var Dir in CachePaths) { DirectoryReference.Delete(Dir, true); } CachePaths.Clear(); StoredEnvVars.Clear(); }
public bool CopyBuild(DirectoryReference InstallPath) { CommandUtils.LogInformation("Copying shared cooked build from stage directory: {0} to {1}", Path.FullName, InstallPath.FullName); // Delete existing if (DirectoryReference.Exists(InstallPath)) { DirectoryReference.Delete(InstallPath, true); } DirectoryReference.CreateDirectory(InstallPath); // Copy new if (!CommandUtils.CopyDirectory_NoExceptions(Path.FullName, InstallPath.FullName)) { CommandUtils.LogWarning("Failed to copy {0} -> {1}", Path.FullName, InstallPath.FullName); return false; } FileReference SyncedBuildFile = new FileReference(CommandUtils.CombinePaths(InstallPath.FullName, SyncedBuildFileName)); FileReference.WriteAllLines(SyncedBuildFile, new string[] { CL.ToString(), Path.FullName }); return true; }
void StageBootstrapExecutable(DeploymentContext SC, string ExeName, string TargetFile, string StagedRelativeTargetPath, string StagedArguments) { DirectoryReference InputApp = DirectoryReference.Combine(SC.LocalRoot, "Engine", "Binaries", SC.PlatformDir, "BootstrapPackagedGame.app"); if (InternalUtils.SafeDirectoryExists(InputApp.FullName)) { // Create the new bootstrap program DirectoryReference IntermediateDir = DirectoryReference.Combine(SC.ProjectRoot, "Intermediate", "Staging"); InternalUtils.SafeCreateDirectory(IntermediateDir.FullName); DirectoryReference IntermediateApp = DirectoryReference.Combine(IntermediateDir, ExeName); if (DirectoryReference.Exists(IntermediateApp)) { DirectoryReference.Delete(IntermediateApp, true); } CloneDirectory(InputApp.FullName, IntermediateApp.FullName); // Rename the executable string GameName = Path.GetFileNameWithoutExtension(ExeName); FileReference.Move(FileReference.Combine(IntermediateApp, "Contents", "MacOS", "BootstrapPackagedGame"), FileReference.Combine(IntermediateApp, "Contents", "MacOS", GameName)); // Copy the icon string SrcInfoPlistPath = CombinePaths(TargetFile, "Contents", "Info.plist"); string SrcInfoPlist = File.ReadAllText(SrcInfoPlistPath); string IconName = GetValueFromInfoPlist(SrcInfoPlist, "CFBundleIconFile"); if (!string.IsNullOrEmpty(IconName)) { string IconPath = CombinePaths(TargetFile, "Contents", "Resources", IconName + ".icns"); InternalUtils.SafeCreateDirectory(CombinePaths(IntermediateApp.FullName, "Contents", "Resources")); File.Copy(IconPath, CombinePaths(IntermediateApp.FullName, "Contents", "Resources", IconName + ".icns")); } // Update Info.plist contents string DestInfoPlistPath = CombinePaths(IntermediateApp.FullName, "Contents", "Info.plist"); string DestInfoPlist = File.ReadAllText(DestInfoPlistPath); string AppIdentifier = GetValueFromInfoPlist(SrcInfoPlist, "CFBundleIdentifier"); if (AppIdentifier == "com.epicgames.UE4Game") { AppIdentifier = ""; } string Copyright = GetValueFromInfoPlist(SrcInfoPlist, "NSHumanReadableCopyright"); string BundleVersion = GetValueFromInfoPlist(SrcInfoPlist, "CFBundleVersion", "1"); string ShortVersion = GetValueFromInfoPlist(SrcInfoPlist, "CFBundleShortVersionString", "1.0"); DestInfoPlist = DestInfoPlist.Replace("com.epicgames.BootstrapPackagedGame", string.IsNullOrEmpty(AppIdentifier) ? "com.epicgames." + GameName + "_bootstrap" : AppIdentifier + "_bootstrap"); DestInfoPlist = DestInfoPlist.Replace("BootstrapPackagedGame", GameName); DestInfoPlist = DestInfoPlist.Replace("__UE4_ICON_FILE__", IconName); DestInfoPlist = DestInfoPlist.Replace("__UE4_APP_TO_LAUNCH__", StagedRelativeTargetPath); DestInfoPlist = DestInfoPlist.Replace("__UE4_COMMANDLINE__", StagedArguments); DestInfoPlist = DestInfoPlist.Replace("__UE4_COPYRIGHT__", Copyright); DestInfoPlist = DestInfoPlist.Replace("__UE4_BUNDLE_VERSION__", BundleVersion); DestInfoPlist = DestInfoPlist.Replace("__UE4_SHORT_VERSION__", ShortVersion); File.WriteAllText(DestInfoPlistPath, DestInfoPlist); StageAppBundle(SC, IntermediateApp, new StagedDirectoryReference(ExeName)); } }