public string GetPlatformPath(UnrealTargetRole Type, UnrealTargetPlatform Platform) { if (Type.UsesEditor()) { return(UnrealPath.FullName); } string BuildPath = BuildPaths.ElementAt(0); if (string.IsNullOrEmpty(BuildPath)) { return(null); } string PlatformPath = Path.Combine(BuildPath, UnrealHelpers.GetPlatformName(Platform, Type, UsesSharedBuildType)); // On some builds we stage the actual loose files into a "Staged" folder if (Directory.Exists(PlatformPath) && Directory.Exists(Path.Combine(PlatformPath, "staged"))) { PlatformPath = Path.Combine(PlatformPath, "Staged"); } // Urgh - build share uses a different style... if (Platform == UnrealTargetPlatform.Android && BuildName.Equals("Local", StringComparison.OrdinalIgnoreCase) == false) { PlatformPath = PlatformPath.Replace("Android_ETC2Client", "Android\\FullPackages"); } return(PlatformPath); }
/// <summary> /// Constructor taking optional params /// </summary> /// <param name="InType"></param> /// <param name="InPlatform"></param> /// <param name="InConfiguration"></param> /// <param name="InCommandLine"></param> /// <param name="InOptions"></param> public UnrealSessionRole(UnrealTargetRole InType, UnrealTargetPlatform InPlatform, UnrealTargetConfiguration InConfiguration, string InCommandLine = null, IConfigOption <UnrealAppConfig> InOptions = null) { RoleType = InType; Platform = InPlatform; Configuration = InConfiguration; if (string.IsNullOrEmpty(InCommandLine)) { CommandLine = ""; } else { CommandLine = InCommandLine; } RequiredBuildFlags = BuildFlags.None; if (Globals.Params.ParseParam("dev") && !RoleType.UsesEditor()) { RequiredBuildFlags |= BuildFlags.CanReplaceExecutable; } if (Globals.Params.ParseParam("bulk") && InPlatform == UnrealTargetPlatform.Android) { RequiredBuildFlags |= BuildFlags.Bulk; } Options = InOptions; FilesToCopy = new List <UnrealFileToCopy>(); RoleModifier = ERoleModifier.None; }
/// <summary> /// Constructor taking optional params /// </summary> /// <param name="InType"></param> /// <param name="InPlatform"></param> /// <param name="InConfiguration"></param> /// <param name="InCommandLine"></param> /// <param name="InOptions"></param> public UnrealSessionRole(UnrealTargetRole InType, UnrealTargetPlatform?InPlatform, UnrealTargetConfiguration InConfiguration, string InCommandLine = null, IConfigOption <UnrealAppConfig> InOptions = null) { RoleType = InType; Platform = InPlatform; Configuration = InConfiguration; MapOverride = string.Empty; if (string.IsNullOrEmpty(InCommandLine)) { CommandLine = string.Empty; } else { CommandLine = InCommandLine; } RequiredBuildFlags = BuildFlags.None; if (Globals.Params.ParseParam("dev") && !RoleType.UsesEditor()) { RequiredBuildFlags |= BuildFlags.CanReplaceExecutable; } //@todo: for bulk/packaged builds, we should mark the platform as capable of these as we're catching global and not test specific flags // where we may be running parallel tests on multiple platforms if (InPlatform == UnrealTargetPlatform.Android || InPlatform == UnrealTargetPlatform.IOS) { if (Globals.Params.ParseParam("bulk")) { RequiredBuildFlags |= BuildFlags.Bulk; } else { RequiredBuildFlags |= BuildFlags.NotBulk; } } if (Globals.Params.ParseParam("packaged") && (InPlatform == UnrealTargetPlatform.Switch || InPlatform == UnrealTargetPlatform.XboxOne || InPlatform == UnrealTargetPlatform.PS4)) { RequiredBuildFlags |= BuildFlags.Packaged; } Options = InOptions; FilesToCopy = new List <UnrealFileToCopy>(); CommandLineParams = new GauntletCommandLine(); RoleModifier = ERoleModifier.None; }
/// <summary> /// Given a platform, a build config, and true/false for client, returns the path to the binary for that config. E.g. /// Win64, Shipping, false = Binaries\Win64\FooServer-Win64-Shipping.exe /// </summary> /// <param name="TargetPlatform"></param> /// <param name="BuildConfig"></param> /// <param name="IsClient"></param> /// <returns></returns> virtual public string GetRelativeExecutablePath(UnrealTargetRole TargetType, UnrealTargetPlatform TargetPlatform, UnrealTargetConfiguration TargetConfiguration) { string ExePath; if (TargetType.UsesEditor()) { ExePath = string.Format("Engine/Binaries/{0}/UE4Editor{1}", BuildHostPlatform.Current.Platform, Platform.GetExeExtension(TargetPlatform)); } else { string BuildType = ""; if (TargetType == UnrealTargetRole.Client) { if (!UsesSharedBuildType) { BuildType = "Client"; } } else if (TargetType == UnrealTargetRole.Server) { if (!UsesSharedBuildType) { BuildType = "Server"; } } bool IsRunningDev = Globals.Params.ParseParam("dev"); // Turn FooGame into Foo string ExeBase = ProjectName.Replace("Game", ""); if (TargetPlatform == UnrealTargetPlatform.Android) { // use the archive results for android. //var AndroidSource = new AndroidBuild(ProjectName, GetPlatformPath(TargetType, TargetPlatform), TargetConfiguration); // We always (currently..) need to be able to replace the command line BuildFlags Flags = BuildFlags.CanReplaceCommandLine; if (IsRunningDev) { Flags |= BuildFlags.CanReplaceExecutable; } if (Globals.Params.ParseParam("bulk")) { Flags |= BuildFlags.Bulk; } else if (Globals.Params.ParseParam("notbulk")) { Flags |= BuildFlags.NotBulk; } var Build = GetMatchingBuilds(TargetType, TargetPlatform, TargetConfiguration, Flags).FirstOrDefault(); if (Build != null) { AndroidBuild AndroidBuild = Build as AndroidBuild; ExePath = AndroidBuild.SourceApkPath; } else { throw new AutomationException("No suitable build for {0} found at {1}", TargetPlatform, string.Join(",", BuildPaths)); } //ExePath = AndroidSource.SourceApkPath; } else { string ExeFileName = string.Format("{0}{1}", ExeBase, BuildType); if (TargetConfiguration != UnrealTargetConfiguration.Development) { ExeFileName += string.Format("-{0}-{1}", TargetPlatform.ToString(), TargetConfiguration.ToString()); } ExeFileName += Platform.GetExeExtension(TargetPlatform); string BasePath = GetPlatformPath(TargetType, TargetPlatform); string ProjectBinary = string.Format("{0}\\Binaries\\{1}\\{2}", ProjectName, TargetPlatform.ToString(), ExeFileName); string StubBinary = Path.Combine(BasePath, ExeFileName); string DevBinary = Path.Combine(Environment.CurrentDirectory, ProjectBinary); string NonCodeProjectName = "UE4Game" + Platform.GetExeExtension(TargetPlatform); string NonCodeProjectBinary = Path.Combine(BasePath, "Engine", "Binaries", TargetPlatform.ToString()); NonCodeProjectBinary = Path.Combine(NonCodeProjectBinary, NonCodeProjectName); // check the project binaries folder if (File.Exists(Path.Combine(BasePath, ProjectBinary))) { ExePath = ProjectBinary; } else if (File.Exists(StubBinary)) { ExePath = Path.Combine(BasePath, ExeFileName); } else if (IsRunningDev && File.Exists(DevBinary)) { ExePath = DevBinary; } else if (File.Exists(NonCodeProjectBinary)) { ExePath = NonCodeProjectBinary; } else { List <string> CheckedFiles = new List <String>() { Path.Combine(BasePath, ProjectBinary), StubBinary, NonCodeProjectBinary }; if (IsRunningDev) { CheckedFiles.Add(DevBinary); } throw new AutomationException("Executable not found, upstream compile job may have failed. Could not find executable {0} within {1}, binaries checked: {2}", ExeFileName, BasePath, String.Join(" - ", CheckedFiles)); } } } return(Utils.SystemHelpers.CorrectDirectorySeparators(ExePath)); }
public bool CanSupportRole(UnrealTargetRole InRoleType) { return(InRoleType.UsesEditor()); }