Ejemplo n.º 1
0
    private static void RunInternal(ProjectParams Params, string ServerLogFile, string ClientLogFile)
    {
        // Setup server process if required.
        if (Params.DedicatedServer && !Params.SkipServer)
        {
            if (Params.ServerTargetPlatforms.Count > 0)
            {
                TargetPlatformDescriptor ServerPlatformDesc = Params.ServerTargetPlatforms[0];
                ServerProcess = RunDedicatedServer(Params, ServerLogFile, Params.RunCommandline);
                // With dedicated server, the client connects to local host to load a map.
                if (ServerPlatformDesc.Type == UnrealTargetPlatform.Linux)
                {
                    Params.MapToRun = Params.ServerDeviceAddress;
                }
                else
                {
                    Params.MapToRun = "127.0.0.1";
                }
            }
            else
            {
                throw new AutomationException("Failed to run, server target platform not specified");
            }
        }
        else if (Params.FileServer && !Params.SkipServer)
        {
            ServerProcess = RunFileServer(Params, ServerLogFile, Params.RunCommandline);
        }

        if (ServerProcess != null)
        {
            Log("Waiting a few seconds for the server to start...");
            Thread.Sleep(5000);
        }

        if (!Params.NoClient)
        {
            Log("Starting Client....");

            var SC = CreateDeploymentContext(Params, false);

            ERunOptions ClientRunFlags;
            string      ClientApp;
            string      ClientCmdLine;
            SetupClientParams(SC, Params, ClientLogFile, out ClientRunFlags, out ClientApp, out ClientCmdLine);

            // Run the client.
            if (ServerProcess != null)
            {
                RunClientWithServer(SC, ServerLogFile, ServerProcess, ClientApp, ClientCmdLine, ClientRunFlags, ClientLogFile, Params);
            }
            else
            {
                RunStandaloneClient(SC, ClientLogFile, ClientRunFlags, ClientApp, ClientCmdLine, Params);
            }
        }
    }
Ejemplo n.º 2
0
	public SharedCookedBuild(ProjectParams Params)
	{
		List<string> Platforms = new List<string>();
		foreach (TargetPlatformDescriptor ClientPlatform in Params.ClientTargetPlatforms)
		{
			TargetPlatformDescriptor DataPlatformDesc = Params.GetCookedDataPlatformForClientTarget(ClientPlatform);
			Platforms.Add(Platform.Platforms[DataPlatformDesc].GetCookPlatform(false, Params.Client));
		}
		SharedCookType BuildType = (SharedCookType)Enum.Parse(typeof(SharedCookType), Params.IterateSharedCookedBuild, true);
		SharedCookedBuildConstructor(Params.RawProjectPath, Platforms, BuildType);
	}
Ejemplo n.º 3
0
		internal static void InitializePlatforms(Assembly[] AssembliesWithPlatforms = null)
		{
			LogVerbose("Creating platforms.");

			// Create all available platforms.
			foreach (var ScriptAssembly in (AssembliesWithPlatforms != null ? AssembliesWithPlatforms : AppDomain.CurrentDomain.GetAssemblies()))
			{
				CreatePlatformsFromAssembly(ScriptAssembly);
			}
			// Create dummy platforms for platforms we don't support
			foreach (var PlatformType in Enum.GetValues(typeof(UnrealTargetPlatform)))
			{
				var TargetDesc = new TargetPlatformDescriptor((UnrealTargetPlatform)PlatformType);
				Platform ExistingInstance;
				if (AllPlatforms.TryGetValue(TargetDesc, out ExistingInstance) == false)
				{
					LogVerbose("Creating placeholder platform for target: {0}", TargetDesc.Type);
					AllPlatforms.Add(TargetDesc, new Platform(TargetDesc.Type));
				}
			}
		}
Ejemplo n.º 4
0
    private static IProcessResult RunDedicatedServer(ProjectParams Params, string ServerLogFile, string AdditionalCommandLine)
    {
        ProjectParams ServerParams = new ProjectParams(Params);

        ServerParams.Devices = new ParamList <string>(Params.ServerDevice);

        if (ServerParams.ServerTargetPlatforms.Count == 0)
        {
            throw new AutomationException("No ServerTargetPlatform set for RunDedicatedServer.");
        }

        var DeployContextList = CreateDeploymentContext(ServerParams, true);

        if (DeployContextList.Count == 0)
        {
            throw new AutomationException("No DeployContextList for RunDedicatedServer.");
        }

        var SC = DeployContextList[0];

        var ServerApp = CombinePaths(CmdEnv.LocalRoot, "Engine/Binaries/Win64/UE4Editor.exe");

        if (ServerParams.Cook)
        {
            List <string> Exes = SC.StageTargetPlatform.GetExecutableNames(SC);
            ServerApp = Exes[0];
        }
        var Args = ServerParams.Cook ? "" : (SC.ProjectArgForCommandLines + " ");

        Console.WriteLine(Params.ServerDeviceAddress);
        TargetPlatformDescriptor ServerPlatformDesc = ServerParams.ServerTargetPlatforms[0];

        if (ServerParams.Cook && ServerPlatformDesc.Type == UnrealTargetPlatform.Linux && !String.IsNullOrEmpty(ServerParams.ServerDeviceAddress))
        {
            ServerApp = @"C:\Windows\system32\cmd.exe";

            string plinkPath = CombinePaths(Environment.GetEnvironmentVariable("LINUX_ROOT"), "bin/PLINK.exe ");
            string exePath   = CombinePaths(SC.ShortProjectName, "Binaries", ServerPlatformDesc.Type.ToString(), SC.ShortProjectName + "Server");
            if (ServerParams.ServerConfigsToBuild[0] != UnrealTargetConfiguration.Development)
            {
                exePath += "-" + ServerPlatformDesc.Type.ToString() + "-" + ServerParams.ServerConfigsToBuild[0].ToString();
            }
            exePath = CombinePaths("LinuxServer", exePath.ToLower()).Replace("\\", "/");
            Args    = String.Format("/k {0} -batch -ssh -t -i {1} {2}@{3} {4} {5} {6} -server -Messaging", plinkPath, ServerParams.DevicePassword, ServerParams.DeviceUsername, ServerParams.ServerDeviceAddress, exePath, Args, ServerParams.MapToRun);
        }
        else
        {
            var Map = ServerParams.MapToRun;
            if (!String.IsNullOrEmpty(ServerParams.AdditionalServerMapParams))
            {
                Map += ServerParams.AdditionalServerMapParams;
            }
            if (Params.FakeClient)
            {
                Map += "?fake";
            }

            Args += String.Format("{0} -server -abslog={1}  -unattended -log -Messaging", Map, CommandUtils.MakePathSafeToUseWithCommandLine(ServerLogFile));

            // Do not blindly add -nomcp, only do so if the client is using it
            if (Params.RunCommandline.Contains("-nomcp"))
            {
                Args += " -nomcp";
            }

            if (Params.ServerCommandline.Length > 0)
            {
                Args += " " + Params.ServerCommandline;
            }
        }

        if (ServerParams.UsePak(SC.StageTargetPlatform))
        {
            if (ServerParams.SignedPak)
            {
                Args += " -signedpak";
            }
            else
            {
                Args += " -pak";
            }
        }
        if (IsBuildMachine || Params.Unattended)
        {
            Args += " -buildmachine";
        }
        Args += " -CrashForUAT";
        Args += " " + AdditionalCommandLine;


        if (ServerParams.Cook && ServerPlatformDesc.Type == UnrealTargetPlatform.Linux && !String.IsNullOrEmpty(ServerParams.ServerDeviceAddress))
        {
            Args += String.Format(" 2>&1 > {0}", ServerLogFile);
        }

        PushDir(Path.GetDirectoryName(ServerApp));
        var Result = Run(ServerApp, Args, null, ERunOptions.AllowSpew | ERunOptions.NoWaitForExit | ERunOptions.AppMustExist | ERunOptions.NoStdOutRedirect);

        PopDir();

        return(Result);
    }
Ejemplo n.º 5
0
 public TargetPlatformDescriptor GetCookedDataPlatformForServerTarget(TargetPlatformDescriptor TargetPlatformType)
 {
     if (ServerDependentPlatformMap.ContainsKey(TargetPlatformType))
     {
         return ServerDependentPlatformMap[TargetPlatformType];
     }
     return TargetPlatformType;
 }
Ejemplo n.º 6
0
 public TargetPlatformDescriptor GetCookedDataPlatformForClientTarget(TargetPlatformDescriptor TargetPlatformDesc)
 {
     if (ClientDependentPlatformMap.ContainsKey(TargetPlatformDesc))
     {
         return ClientDependentPlatformMap[TargetPlatformDesc];
     }
     return TargetPlatformDesc;
 }
Ejemplo n.º 7
0
    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;
    }
Ejemplo n.º 8
0
 public static bool IsSymbolFile(UnrealTargetPlatform ForPlatform, string FileToCopy)
 {
     TargetPlatformDescriptor PlatformDesc = new TargetPlatformDescriptor(ForPlatform);
     var DebugExts = Platform.Platforms[PlatformDesc].GetDebugFileExtentions();
     foreach (var DebugExt in DebugExts)
     {
         if (Path.GetExtension(FileToCopy).Equals(DebugExt, StringComparison.InvariantCultureIgnoreCase))
         {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 9
0
        public static List<TargetPlatformDescriptor> GetValidTargetPlatforms(UnrealTargetPlatform PlatformType, List<string> CookFlavors)
        {
            List<TargetPlatformDescriptor> ValidPlatforms = new List<TargetPlatformDescriptor>();
            if (!CommandUtils.IsNullOrEmpty(CookFlavors))
            {
                foreach (string CookFlavor in CookFlavors)
                {
                    TargetPlatformDescriptor TargetDesc = new TargetPlatformDescriptor(PlatformType, CookFlavor);
                    if (IsValidTargetPlatform(TargetDesc))
                    {
                        ValidPlatforms.Add(TargetDesc);
                    }
                }
            }

            // In case there are no flavors specified or this platform type does not care/support flavors add it as generic platform 
            if (ValidPlatforms.Count == 0)
            {
                TargetPlatformDescriptor TargetDesc = new TargetPlatformDescriptor(PlatformType);
                if (IsValidTargetPlatform(TargetDesc))
                {
                    ValidPlatforms.Add(TargetDesc);
                }
            }

            return ValidPlatforms;
        }
Ejemplo n.º 10
0
 public static bool IsValidTargetPlatform(TargetPlatformDescriptor PlatformDesc)
 {
     return AllPlatforms.ContainsKey(PlatformDesc);
 }
Ejemplo n.º 11
0
 public static Platform GetPlatform(UnrealTargetPlatform PlatformType, string CookFlavor)
 {
     TargetPlatformDescriptor Desc = new TargetPlatformDescriptor(PlatformType, CookFlavor);
     return AllPlatforms[Desc];
 }
Ejemplo n.º 12
0
 public static Platform GetPlatform(UnrealTargetPlatform PlatformType)
 {
     TargetPlatformDescriptor Desc = new TargetPlatformDescriptor(PlatformType);
     return AllPlatforms[Desc];
 }