示例#1
0
        public override void DoBuild(GUBP bp)
        {
            BuildProducts = new List<string>();
            FileFilter Filter = new FileFilter();

            // Include all the editor products
            AddRuleForBuildProducts(Filter, bp, GUBP.ToolsForCompileNode.StaticGetFullName(HostPlatform), FileFilterType.Include);
            AddRuleForBuildProducts(Filter, bp, GUBP.RootEditorNode.StaticGetFullName(HostPlatform), FileFilterType.Include);
            AddRuleForBuildProducts(Filter, bp, GUBP.ToolsNode.StaticGetFullName(HostPlatform), FileFilterType.Include);

            // Include win64 tools on Mac, to get the win64 build of UBT, UAT and IPP
            if (HostPlatform == UnrealTargetPlatform.Mac && bp.HostPlatforms.Contains(UnrealTargetPlatform.Win64))
            {
                AddRuleForBuildProducts(Filter, bp, GUBP.ToolsNode.StaticGetFullName(UnrealTargetPlatform.Win64), FileFilterType.Include);
                AddRuleForBuildProducts(Filter, bp, GUBP.ToolsForCompileNode.StaticGetFullName(UnrealTargetPlatform.Win64), FileFilterType.Include);
            }

            // Include the editor headers
            UnzipAndAddRuleForHeaders(GUBP.RootEditorNode.StaticGetArchivedHeadersPath(HostPlatform), Filter, FileFilterType.Include);

            // Include the build dependencies for every code platform
            foreach(UnrealTargetPlatform TargetPlatform in TargetPlatforms)
            {
                if(RocketBuild.IsCodeTargetPlatform(HostPlatform, TargetPlatform))
                {
                    UnrealTargetPlatform SourceHostPlatform = RocketBuild.GetSourceHostPlatform(bp, HostPlatform, TargetPlatform);
                    string FileListPath = GUBP.GamePlatformMonolithicsNode.StaticGetBuildDependenciesPath(SourceHostPlatform, bp.Branch.BaseEngineProject, TargetPlatform);
                    Filter.AddRuleForFiles(UnrealBuildTool.Utils.ReadClass<UnrealBuildTool.ExternalFileList>(FileListPath).FileNames, CommandUtils.CmdEnv.LocalRoot, FileFilterType.Include);
                    UnzipAndAddRuleForHeaders(GUBP.GamePlatformMonolithicsNode.StaticGetArchivedHeadersPath(SourceHostPlatform, bp.Branch.BaseEngineProject, TargetPlatform), Filter, FileFilterType.Include);
                }
            }

            // Add the monolithic binaries
            foreach(UnrealTargetPlatform TargetPlatform in TargetPlatforms)
            {
                UnrealTargetPlatform SourceHostPlatform = RocketBuild.GetSourceHostPlatform(bp, HostPlatform, TargetPlatform);
                bool bIsCodeTargetPlatform = RocketBuild.IsCodeTargetPlatform(SourceHostPlatform, TargetPlatform);
                AddRuleForBuildProducts(Filter, bp, GUBP.GamePlatformMonolithicsNode.StaticGetFullName(SourceHostPlatform, bp.Branch.BaseEngineProject, TargetPlatform, Precompiled: bIsCodeTargetPlatform), FileFilterType.Include);
            }

            // Include the feature packs
            foreach(string CurrentFeaturePack in CurrentFeaturePacks)
            {
                BranchInfo.BranchUProject Project = bp.Branch.FindGameChecked(CurrentFeaturePack);
                Filter.AddRuleForFile(GUBP.MakeFeaturePacksNode.GetOutputFile(Project), CommandUtils.CmdEnv.LocalRoot, FileFilterType.Include);
            }

            // Include all the templates
            foreach (string Template in CurrentTemplates)
            {
                BranchInfo.BranchUProject Project = bp.Branch.FindGameChecked(Template);
                Filter.Include("/" + Utils.StripBaseDirectory(Path.GetDirectoryName(Project.FilePath), CommandUtils.CmdEnv.LocalRoot).Replace('\\', '/') + "/...");
            }

            // Include all the standard rules
            string RulesFileName = CommandUtils.CombinePaths(CommandUtils.CmdEnv.LocalRoot, "Engine", "Build", "InstalledEngineFilters.ini");
            Filter.ReadRulesFromFile(RulesFileName, "CopyEditor", HostPlatform.ToString());
            Filter.ReadRulesFromFile(RulesFileName, "CopyTargetPlatforms", HostPlatform.ToString());

            // Custom rules for each target platform
            foreach(UnrealTargetPlatform TargetPlaform in TargetPlatforms)
            {
                string SectionName = String.Format("CopyTargetPlatform.{0}", TargetPlaform.ToString());
                Filter.ReadRulesFromFile(RulesFileName, SectionName, HostPlatform.ToString());
            }

            // Add the final exclusions for legal reasons.
            Filter.ExcludeConfidentialPlatforms();
            Filter.ExcludeConfidentialFolders();

            // Run the filter on the stripped symbols, and remove those files from the copy filter
            List<string> AllStrippedFiles = new List<string>();
            foreach(KeyValuePair<string, string> StrippedNodeManifestPath in StrippedNodeManifestPaths)
            {
                List<string> StrippedFiles = new List<string>();

                StripRocketNode StripNode = (StripRocketNode)bp.FindNode(StrippedNodeManifestPath.Key);
                foreach(string BuildProduct in StripNode.BuildProducts)
                {
                    if(Utils.IsFileUnderDirectory(BuildProduct, StripNode.StrippedDir))
                    {
                        string RelativePath = CommandUtils.StripBaseDirectory(Path.GetFullPath(BuildProduct), StripNode.StrippedDir);
                        if(Filter.Matches(RelativePath))
                        {
                            StrippedFiles.Add(RelativePath);
                            AllStrippedFiles.Add(RelativePath);
                            Filter.Exclude("/" + RelativePath);
                        }
                    }
                }

                WriteManifest(StrippedNodeManifestPath.Value, StrippedFiles);
                BuildProducts.Add(StrippedNodeManifestPath.Value);
            }

            // Write the filtered list of depot files to disk, removing any symlinks
            List<string> DepotFiles = Filter.ApplyToDirectory(CommandUtils.CmdEnv.LocalRoot, true).ToList();
            WriteManifest(DepotManifestPath, DepotFiles);
            BuildProducts.Add(DepotManifestPath);

            // Sort the list of output files
            SortedDictionary<string, bool> SortedFiles = new SortedDictionary<string,bool>(StringComparer.InvariantCultureIgnoreCase);
            foreach(string DepotFile in DepotFiles)
            {
                SortedFiles.Add(DepotFile, false);
            }
            foreach(string StrippedFile in AllStrippedFiles)
            {
                SortedFiles.Add(StrippedFile, true);
            }

            // Write the list to the log
            CommandUtils.Log("Files to be included in Rocket build:");
            foreach(KeyValuePair<string, bool> SortedFile in SortedFiles)
            {
                CommandUtils.Log("  {0}{1}", SortedFile.Key, SortedFile.Value? " (stripped)" : "");
            }
        }