/// <summary> /// Called after command line params are applied. Perform any checks / fixup /// </summary> /// <param name="InParams"></param> public virtual void ParametersWereApplied(string[] InParams) { // save params this.Params = new Params(InParams); if (string.IsNullOrEmpty(TempDir)) { TempDir = Globals.TempDir; } else { Globals.TempDir = TempDir; } if (string.IsNullOrEmpty(LogDir)) { LogDir = Globals.LogDir; } else { Globals.LogDir = LogDir; } // normalize the project name and get the path if (File.Exists(Project)) { ProjectPath = new FileReference(Project); Project = ProjectPath.GetFileNameWithoutExtension(); } else { if (!string.IsNullOrEmpty(Project)) { ProjectPath = ProjectUtils.FindProjectFileFromName(Project); if (ProjectPath == null) { throw new AutomationException("Could not find project file for {0}", Project); } Project = ProjectPath.GetFileNameWithoutExtension(); } } if (string.IsNullOrEmpty(Sandbox)) { Sandbox = Project; } // parse platforms. These will be in the format of Win64(param1,param2='foo,bar') etc // check for old-style -platform=Win64(params) List <string> PlatformArgStrings = Params.ParseValues("Platform="); // check for convenience flags of -Win64(params) (TODO - need to think about this..) /*foreach (UnrealTargetPlatform Plat in UnrealTargetPlatform.GetValidPlatforms()) * { * IEnumerable<string> RawPlatformArgs = InParams.Where(P => P.ToLower().StartsWith(Plat.ToString().ToLower())); * * PlatformArgStrings.AddRange(RawPlatformArgs); * }*/ // now turn the Plat(param1,param2) etc into an argument/parm pair PlatformList = PlatformArgStrings.SelectMany(P => ArgumentWithParams.CreateFromString(P)).ToList(); List <string> TestArgStrings = Params.ParseValues("test="); // clear all tests incase this is called multiple times TestList.Clear(); if (TestArgStrings.Count == 0) { TestArgStrings = Params.ParseValues("tests="); } foreach (string TestArg in TestArgStrings) { foreach (ArgumentWithParams TestWithParms in ArgumentWithParams.CreateFromString(TestArg)) { TestRequest Test = new TestRequest() { TestName = TestWithParms.Argument, TestParams = new Params(TestWithParms.AllArguments) }; // parse any specified platforms foreach (string PlatformArg in Test.TestParams.ParseValues("Platform=")) { List <ArgumentWithParams> PlatParams = ArgumentWithParams.CreateFromString(PlatformArg); Test.Platforms.AddRange(PlatParams); // register platform in test options PlatParams.ForEach(TestPlat => { if (PlatformList.Where(Plat => Plat.Argument == TestPlat.Argument).Count() == 0) { PlatformList.Add(TestPlat); } }); } TestList.Add(Test); } } if (PlatformList.Count == 0) { // Default to local platform PlatformList.Add(new ArgumentWithParams(BuildHostPlatform.Current.Platform.ToString(), new string[0])); } // do we have any tests? Need to check the global test list bool HaveTests = TestList.Count > 0 || PlatformList.Where(Plat => Plat.ParseValues("test").Count() > 0).Count() > 0; // turn -device=BobsKit,BobsKit(PS4) into a device list List <string> DeviceArgStrings = Params.ParseValues("device="); if (DeviceArgStrings.Count == 0) { DeviceArgStrings = Params.ParseValues("devices="); } DeviceList = DeviceArgStrings.SelectMany(D => ArgumentWithParams.CreateFromString(D)).ToList(); if (DeviceList.Count == 0) { // Add the default test DeviceList.Add(new ArgumentWithParams("default", new string[0])); } // remote all -test and -platform arguments from our params. Nothing else should be looking at these now... string[] CleanArgs = Params.AllArguments .Where(Arg => !Arg.StartsWith("test=", StringComparison.OrdinalIgnoreCase) && !Arg.StartsWith("platform=", StringComparison.OrdinalIgnoreCase) && !Arg.StartsWith("device=", StringComparison.OrdinalIgnoreCase)) .ToArray(); Params = new Params(CleanArgs); }