1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
public FileReference[] CreatePreBuildScripts() { List < Tuple < string[], UEBuildPlugin >> PreBuildCommandBatches = new List < Tuple < string[], UEBuildPlugin >> (); if (ProjectDescriptor != null && ProjectDescriptor.PreBuildSteps != null) { AddCustomBuildSteps(ProjectDescriptor.PreBuildSteps, null, PreBuildCommandBatches); } if (Rules.PreBuildSteps.Count > 0) { PreBuildCommandBatches.Add(new Tuple < string[], UEBuildPlugin > (Rules.PreBuildSteps.ToArray(), null)); } foreach(UEBuildPlugin BuildPlugin in BuildPlugins.Where(x =>x.Descriptor.PreBuildSteps != null)) { AddCustomBuildSteps(BuildPlugin.Descriptor.PreBuildSteps, BuildPlugin, PreBuildCommandBatches); } return WriteCustomBuildStepScripts(BuildHostPlatform.Current.Platform, ProjectIntermediateDirectory, "PreBuild", PreBuildCommandBatches); }
private FileReference[] CreatePostBuildScripts() { List < Tuple < string[], UEBuildPlugin >> PostBuildCommandBatches = new List < Tuple < string[], UEBuildPlugin >> (); if (!Rules.bDisableLinking) { if (ProjectDescriptor != null && ProjectDescriptor.PostBuildSteps != null) { AddCustomBuildSteps(ProjectDescriptor.PostBuildSteps, null, PostBuildCommandBatches); } if (Rules.PostBuildSteps.Count > 0) { PostBuildCommandBatches.Add(new Tuple < string[], UEBuildPlugin > (Rules.PostBuildSteps.ToArray(), null)); } foreach(UEBuildPlugin BuildPlugin in BuildPlugins.Where(x =>x.Descriptor.PostBuildSteps != null)) { AddCustomBuildSteps(BuildPlugin.Descriptor.PostBuildSteps, BuildPlugin, PostBuildCommandBatches); } } return WriteCustomBuildStepScripts(BuildHostPlatform.Current.Platform, ProjectIntermediateDirectory, "PostBuild", PostBuildCommandBatches); }
private void AddCustomBuildSteps(CustomBuildSteps BuildSteps, UEBuildPlugin Plugin, List < Tuple < string[], UEBuildPlugin >> CommandBatches) { string[] Commands; if (BuildSteps.TryGetCommands(BuildHostPlatform.Current.Platform, out Commands)) { CommandBatches.Add(Tuple.Create(Commands, Plugin)); } }
private FileReference[] WriteCustomBuildStepScripts(UnrealTargetPlatform HostPlatform, DirectoryReference Directory, string FilePrefix, List < Tuple < string[], UEBuildPlugin >> CommandBatches) { List < FileReference > ScriptFiles = new List < FileReference > (); foreach(Tuple < string[], UEBuildPlugin > CommandBatch in CommandBatches) { Dictionary < string, string > Variables = GetTargetVariables(CommandBatch.Item2);
string ScriptExtension = (HostPlatform == UnrealTargetPlatform.Win64) ? ".bat": ".sh"; FileReference ScriptFile = FileReference.Combine(Directory, String.Format("{0}-{1}{2}", FilePrefix, ScriptFiles.Count + 1, ScriptExtension));
List < string > Contents = new List < string > (); if (HostPlatform == UnrealTargetPlatform.Win64) { Contents.Insert(0, "@echo off"); } foreach(string Command in CommandBatch.Item1) { Contents.Add(Utils.ExpandVariables(Command, Variables)); } if (!DirectoryReference.Exists(ScriptFile.Directory)) { DirectoryReference.CreateDirectory(ScriptFile.Directory); } File.WriteAllLines(ScriptFile.FullName, Contents);
ScriptFiles.Add(ScriptFile); } return ScriptFiles.ToArray(); }
|