示例#1
0
 public string[] GetExternalFileList(BuildAgenda Agenda)
 {
     string FileListPath = GenerateExternalFileList(Agenda);
     return UnrealBuildTool.Utils.ReadClass<UnrealBuildTool.ExternalFileList>(FileListPath).FileNames.ToArray();
 }
示例#2
0
 public string GenerateExternalFileList(BuildAgenda Agenda)
 {
     string AdditionalArguments = "";
     foreach (var Target in Agenda.Targets)
     {
         RunUBT(CmdEnv, UBTExecutable, Target.UprojectPath, Target.TargetName, Target.Platform.ToString(), Target.Config.ToString(), "-generateexternalfilelist" + AdditionalArguments + " " + Target.UBTArgs);
         AdditionalArguments = " -mergeexternalfilelist";
     }
     return CommandUtils.CombinePaths(CmdEnv.LocalRoot, @"/Engine/Intermediate/Build/ExternalFiles.xml");
 }
示例#3
0
		/// <summary>
		/// Executes a build.
		/// </summary>
		/// <param name="Agenda">Build agenda.</param>
		/// <param name="InDeleteBuildProducts">if specified, determines if the build products will be deleted before building. If not specified -clean parameter will be used,</param>
		/// <param name="InUpdateVersionFiles">True if the version files are to be updated </param>
		/// <param name="InForceNoXGE">If true will force XGE off</param>
		/// <param name="InUseParallelExecutor">If true AND XGE not present or not being used then use ParallelExecutor</param>
		public void Build(BuildAgenda Agenda, bool? InDeleteBuildProducts = null, bool InUpdateVersionFiles = true, bool InForceNoXGE = false, bool InUseParallelExecutor = false, bool InForceNonUnity = false, bool InForceUnity = false, bool InShowProgress = false, Dictionary<UnrealBuildTool.UnrealTargetPlatform, Dictionary<string, string>> PlatformEnvVars = null, int? InChangelistNumberOverride = null, Dictionary<BuildTarget, BuildManifest> InTargetToManifest = null)
		{
			if (!CmdEnv.HasCapabilityToCompile)
			{
				throw new AutomationException("You are attempting to compile on a machine that does not have a supported compiler!");
			}
			DeleteBuildProducts = InDeleteBuildProducts.HasValue ? InDeleteBuildProducts.Value : ParseParam("Clean");
			if (InUpdateVersionFiles)
			{
				UpdateVersionFiles(ActuallyUpdateVersionFiles: true, ChangelistNumberOverride: InChangelistNumberOverride);
			}

			//////////////////////////////////////

			// make a set of unique platforms involved
			var UniquePlatforms = new List<UnrealBuildTool.UnrealTargetPlatform>();
			foreach (var Target in Agenda.Targets)
			{
				if (!UniquePlatforms.Contains(Target.Platform))
				{
					UniquePlatforms.Add(Target.Platform);
				}
			}

			// allow all involved platforms to hook into the agenda
			foreach (var TargetPlatform in UniquePlatforms)
			{
				Platform.GetPlatform(TargetPlatform).PreBuildAgenda(this, Agenda);
			}


			foreach (var File in Agenda.ExtraDotNetFiles)
			{
				PrepareBuildProductsForCSharpProj(Path.Combine(CmdEnv.LocalRoot, File));
			}

			if (Agenda.SwarmProject != "")
			{
				string SwarmSolution = Path.Combine(CmdEnv.LocalRoot, Agenda.SwarmProject);
				PrepareBuildProductsForCSharpProj(SwarmSolution);

				BuildSolution(CmdEnv, SwarmSolution, "Development", "Mixed Platforms");
				AddSwarmBuildProducts();
			}

			foreach (var DotNetSolution in Agenda.DotNetSolutions)
			{
				string Solution = Path.Combine(CmdEnv.LocalRoot, DotNetSolution);

				PrepareBuildProductsForCSharpProj(Solution);

				BuildSolution(CmdEnv, Solution, "Development", "Any CPU");

				AddBuildProductsForCSharpProj(Solution);
			}

			foreach (var DotNetProject in Agenda.DotNetProjects)
			{
				string CsProj = Path.Combine(CmdEnv.LocalRoot, DotNetProject);

				PrepareBuildProductsForCSharpProj(CsProj);

				BuildCSharpProject(CmdEnv, CsProj);

				AddBuildProductsForCSharpProj(CsProj);
			}

			foreach (var IOSDotNetProject in Agenda.IOSDotNetProjects)
			{
				string IOSCsProj = Path.Combine(CmdEnv.LocalRoot, IOSDotNetProject);

				PrepareBuildProductsForCSharpProj(IOSCsProj);

				BuildCSharpProject(CmdEnv, IOSCsProj);

				AddIOSBuildProductsForCSharpProj(IOSCsProj);
			}

			foreach (var HTML5DotNetProject in Agenda.HTML5DotNetProjects)
			{
				string CsProj = Path.Combine(CmdEnv.LocalRoot, HTML5DotNetProject);

				PrepareBuildProductsForCSharpProj(CsProj);

				BuildCSharpProject(CmdEnv, CsProj);

				AddBuildProductsForCSharpProj(CsProj);
			}

			foreach (var File in Agenda.ExtraDotNetFiles)
			{
				AddBuildProductsForCSharpProj(Path.Combine(CmdEnv.LocalRoot, File));
			}

			bool bForceMonolithic = ParseParam("ForceMonolithic");
			bool bForceNonUnity = ParseParam("ForceNonUnity") || InForceNonUnity;
			bool bForceUnity = ParseParam("ForceUnity") || InForceUnity;
			bool bForceDebugInfo = ParseParam("ForceDebugInfo");
			bool bUsedXGE = false;
			bool bCanUseXGE = !ParseParam("NoXGE") && !InForceNoXGE;
			string XGEConsole = XGEConsoleExe();
			if (bCanUseXGE && string.IsNullOrEmpty(XGEConsole))
			{
				LogLog("XGE was requested, but is unavailable, so we won't use it.");
				bCanUseXGE = false;
			}

			// only run ParallelExecutor if not running XGE (and we've requested ParallelExecutor and it exists)
			bool bCanUseParallelExecutor = !bCanUseXGE && InUseParallelExecutor && (HostPlatform.Current.HostEditorPlatform == UnrealTargetPlatform.Win64);
			LogLog("************************* UE4Build:");
			LogLog("************************* ForceMonolithic: {0}", bForceMonolithic);
			LogLog("************************* ForceNonUnity:{0} ", bForceNonUnity);
			LogLog("************************* ForceDebugInfo: {0}", bForceDebugInfo);
			LogLog("************************* UseXGE: {0}", bCanUseXGE);
			LogLog("************************* UseParallelExecutor: {0}", bCanUseParallelExecutor);

			// process XGE files
			if (bCanUseXGE || bCanUseParallelExecutor)
			{
				string TaskFilePath = CombinePaths(CmdEnv.LogFolder, @"UAT_XGE.xml");

				if (DeleteBuildProducts)
				{
					foreach (var Target in Agenda.Targets)
					{
						CleanWithUBT(Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, Target.UBTArgs, bForceUnity);
					}
				}
				foreach (var Target in Agenda.Targets)
				{
					if (Target.TargetName == "UnrealHeaderTool" || !CanUseXGE(Target.Platform))
					{
						// When building a target for Mac or iOS, use UBT's -flushmac option to clean up the remote builder
						bool bForceFlushMac = DeleteBuildProducts && (Target.Platform == UnrealBuildTool.UnrealTargetPlatform.Mac || Target.Platform == UnrealBuildTool.UnrealTargetPlatform.IOS);
						LogSetProgress(InShowProgress, "Building header tool...");
						BuildManifest Manifest = BuildWithUBT(Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, bForceFlushMac, !bCanUseXGE || !CanUseXGE(Target.Platform), Target.UBTArgs, bForceUnity);
						if(InTargetToManifest != null)
						{
							InTargetToManifest[Target] = Manifest;
						}
					}
				}

				List<XGEItem> XGEItems = new List<XGEItem>();
				LogSetProgress(InShowProgress, "Generating headers...");
				foreach (var Target in Agenda.Targets)
				{
					if (Target.TargetName != "UnrealHeaderTool" && CanUseXGE(Target.Platform))
					{
						XGEItem Item = XGEPrepareBuildWithUBT(Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, Target.UBTArgs, bForceUnity);
						if(InTargetToManifest != null)
						{
							InTargetToManifest[Target] = Item.Manifest;
						}
						XGEItems.Add(Item);
					}
				}
				if (XGEItems.Count > 0)
				{
					string XGETool = null;
					string Args = null;
					if (bCanUseXGE) 
					{
						XGETool = XGEConsoleExePath;
						Args = "\"" + TaskFilePath + "\" /Rebuild /MaxCPUS=200";
						if (ParseParam("StopOnErrors"))
						{
							Args += " /StopOnErrors";
						}
					}

					if (!bCanUseParallelExecutor && String.IsNullOrEmpty(XGETool))
					{
						throw new AutomationException("BUILD FAILED: no tool present to process XGE files");
					}

					LogSetProgress(InShowProgress, "Building...");
					if (!ProcessXGEItems(XGEItems, XGETool, Args, TaskFilePath, Agenda.DoRetries, Agenda.SpecialTestFlag, InShowProgress))
					{
						throw new AutomationException("BUILD FAILED: {0} failed, retries not enabled:", XGETool);
					}
					else
					{
						bUsedXGE = true;
					}
				}
				else
				{
					bUsedXGE = true; // if there was nothing to build, we still consider this a success
				}
			}

			if (!bUsedXGE)
			{
				if (DeleteBuildProducts)
				{
					foreach (var Target in Agenda.Targets)
					{
						CleanWithUBT(Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, Target.UBTArgs, bForceUnity);
					}
				}
				foreach (var Target in Agenda.Targets)
				{
					// When building a target for Mac or iOS, use UBT's -flushmac option to clean up the remote builder
					bool bForceFlushMac = DeleteBuildProducts && (Target.Platform == UnrealBuildTool.UnrealTargetPlatform.Mac || Target.Platform == UnrealBuildTool.UnrealTargetPlatform.IOS);
					BuildManifest Manifest = BuildWithUBT(Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, bForceFlushMac, true, Target.UBTArgs, bForceUnity);
					if(InTargetToManifest != null)
					{
						InTargetToManifest[Target] = Manifest;
					}
				}
			}

			// NOTE: OK, we're done building projects.  You can build additional targets after this.  Call FinalizebuildProducts() when done.
		}
示例#4
0
        /// <summary>
        /// Executes a build.
        /// </summary>
        /// <param name="Agenda">Build agenda.</param>
        /// <param name="InDeleteBuildProducts">if specified, determines if the build products will be deleted before building. If not specified -clean parameter will be used,</param>
        /// <param name="InUpdateVersionFiles">True if the version files are to be updated </param>
        /// <param name="InForceNoXGE">If true will force XGE off</param>
        public void Build(BuildAgenda Agenda, bool? InDeleteBuildProducts = null, bool InUpdateVersionFiles = true, bool InForceNoXGE = false, bool InForceNonUnity = false, bool InForceUnity = false, Dictionary<UnrealBuildTool.UnrealTargetPlatform, Dictionary<string, string>> PlatformEnvVars = null)
        {
            if (GlobalCommandLine.NoCodeProject)
            {
                throw new AutomationException("Building is not supported when -nocodeproject flag is provided.");
            }

            if (!CmdEnv.HasCapabilityToCompile)
            {
                throw new AutomationException("You are attempting to compile on a machine that does not have a supported compiler!");
            }
            DeleteBuildProducts = InDeleteBuildProducts.HasValue ? InDeleteBuildProducts.Value : OwnerCommand.ParseParam("Clean");
            if (InUpdateVersionFiles)
            {
                UpdateVersionFiles();
            }

            {
                var EncryptionKeyFilename = OwnerCommand.ParseParamValue("SignPak");
                if (String.IsNullOrEmpty(EncryptionKeyFilename) == false)
                {
                    UpdatePublicKey(EncryptionKeyFilename);
                }
            }

            //////////////////////////////////////

            // make a set of unique platforms involved
            var UniquePlatforms = new List<UnrealBuildTool.UnrealTargetPlatform>();
            foreach (var Target in Agenda.Targets)
            {
                if (!UniquePlatforms.Contains(Target.Platform))
                {
                    UniquePlatforms.Add(Target.Platform);
                }
            }

            // allow all involved platforms to hook into the agenda
            foreach (var TargetPlatform in UniquePlatforms)
            {
                Platform.Platforms[TargetPlatform].PreBuildAgenda(this, Agenda);
            }

            foreach (var File in Agenda.ExtraDotNetFiles)
            {
                PrepareBuildProductsForCSharpProj(Path.Combine(CmdEnv.LocalRoot, File));
            }

            if (Agenda.SwarmProject != "")
            {
                string SwarmSolution = Path.Combine(CmdEnv.LocalRoot, Agenda.SwarmProject);
                PrepareBuildProductsForCSharpProj(SwarmSolution);

                BuildSolution(CmdEnv, SwarmSolution);
                AddSwarmBuildProducts();
            }

            foreach (var DotNetSolution in Agenda.DotNetSolutions)
            {
                string Solution = Path.Combine(CmdEnv.LocalRoot, DotNetSolution);

                PrepareBuildProductsForCSharpProj(Solution);

                BuildSolution(CmdEnv, Solution);

                AddBuildProductsForCSharpProj(Solution);
            }

            foreach (var DotNetProject in Agenda.DotNetProjects)
            {
                string CsProj = Path.Combine(CmdEnv.LocalRoot, DotNetProject);

                PrepareBuildProductsForCSharpProj(CsProj);

                BuildCSharpProject(CmdEnv, CsProj);

                AddBuildProductsForCSharpProj(CsProj);
            }

            foreach (var IOSDotNetProject in Agenda.IOSDotNetProjects)
            {
                string IOSCsProj = Path.Combine(CmdEnv.LocalRoot, IOSDotNetProject);

                PrepareBuildProductsForCSharpProj(IOSCsProj);

                BuildCSharpProject(CmdEnv, IOSCsProj);

                AddIOSBuildProductsForCSharpProj(IOSCsProj);
            }

            foreach (var File in Agenda.ExtraDotNetFiles)
            {
                AddBuildProductsForCSharpProj(Path.Combine(CmdEnv.LocalRoot, File));
            }

            bool bForceMonolithic = OwnerCommand.ParseParam("ForceMonolithic");
            bool bForceNonUnity = OwnerCommand.ParseParam("ForceNonUnity") || InForceNonUnity;
            bool bForceUnity = OwnerCommand.ParseParam("ForceUnity") || InForceUnity;
            bool bForceDebugInfo = OwnerCommand.ParseParam("ForceDebugInfo");
            bool bUsedXGE = false;
            bool bCanUseXGE = !OwnerCommand.ParseParam("NoXGE") && !InForceNoXGE;
            string XGEConsole = XGEConsoleExe();
            if (bCanUseXGE && !FileExists(XGEConsole))
            {
                Log("XGE was requested, but is unavailable, so we won't use it.");
                bCanUseXGE = false;
            }

            Log("************************* UE4Build:");
            Log("************************* ForceMonolithic: ", bForceMonolithic);
            Log("************************* ForceNonUnity: ", bForceNonUnity);
            Log("************************* ForceDebugInfo: ", bForceDebugInfo);
            Log("************************* UseXGE: ", bCanUseXGE);

            if (bCanUseXGE)
            {
                string TaskFilePath = CombinePaths(CmdEnv.LogFolder, @"UAT_XGE.xml");

                if (DeleteBuildProducts)
                {
                    foreach (var Target in Agenda.Targets)
                    {
                        CleanWithUBT(Target.ProjectName, Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, Target.UBTArgs, bForceUnity);
                    }
                }
                foreach (var Target in Agenda.Targets)
                {
                    if (Target.TargetName == "UnrealHeaderTool" || !CanUseXGE(Target.Platform))
                    {
                        // When building a target for Mac or iOS, use UBT's -flushmac option to clean up the remote builder
                        bool bForceFlushMac = DeleteBuildProducts && (Target.Platform == UnrealBuildTool.UnrealTargetPlatform.Mac || Target.Platform == UnrealBuildTool.UnrealTargetPlatform.IOS);
                        BuildWithUBT(Target.ProjectName, Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, bForceFlushMac, true, Target.UBTArgs, bForceUnity);
                    }
                }

                List<XGEItem> XGEItems = new List<XGEItem>();
                foreach (var Target in Agenda.Targets)
                {
                    if (Target.TargetName != "UnrealHeaderTool" && CanUseXGE(Target.Platform))
                    {
                        XGEItem Item = XGEPrepareBuildWithUBT(Target.ProjectName, Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, Target.UBTArgs, bForceUnity);
                        XGEItems.Add(Item);
                    }
                }
                if (XGEItems.Count > 0)
                {
                    if (!RunXGE(XGEItems, TaskFilePath, Agenda.DoRetries, Agenda.SpecialTestFlag))
                    {
                        throw new AutomationException("BUILD FAILED: XGE failed, retries not enabled:");
                    }
                    else
                    {
                        bUsedXGE = true;
                    }
                }
                else
                {
                    bUsedXGE = true; // if there was nothing to build, we still consider this a success
                }
            }
            if (!bUsedXGE)
            {
                if (DeleteBuildProducts)
                {
                    foreach (var Target in Agenda.Targets)
                    {
                        CleanWithUBT(Target.ProjectName, Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, Target.UBTArgs, bForceUnity);
                    }
                }
                foreach (var Target in Agenda.Targets)
                {
                    // When building a target for Mac or iOS, use UBT's -flushmac option to clean up the remote builder
                    bool bForceFlushMac = DeleteBuildProducts && (Target.Platform == UnrealBuildTool.UnrealTargetPlatform.Mac || Target.Platform == UnrealBuildTool.UnrealTargetPlatform.IOS);
                    BuildWithUBT(Target.ProjectName, Target.TargetName, Target.Platform, Target.Config.ToString(), Target.UprojectPath, bForceMonolithic, bForceNonUnity, bForceDebugInfo, bForceFlushMac, true, Target.UBTArgs, bForceUnity);
                }
            }

            // NOTE: OK, we're done building projects.  You can build additional targets after this.  Call FinalizebuildProducts() when done.
        }
示例#5
0
        public string[] GetExternalFileList(BuildAgenda Agenda)
        {
            // Create the file list
            string AdditionalArguments = "";
            foreach (var Target in Agenda.Targets)
            {
                RunUBT(CmdEnv, UBTExecutable, Target.UprojectPath, Target.TargetName, Target.Platform.ToString(), Target.Config.ToString(), "-generateexternalfilelist" + AdditionalArguments + " " + Target.UBTArgs);
                AdditionalArguments = " -mergeexternalfilelist";
            }

            // Read it in, and return the filenames as an array of strings
            string FileListPath = CommandUtils.CombinePaths(CmdEnv.LocalRoot, @"/Engine/Intermediate/Build/ExternalFiles.xml");
            return UnrealBuildTool.Utils.ReadClass<UnrealBuildTool.ExternalFileList>(FileListPath).FileNames.ToArray();
        }