Exemplo n.º 1
0
 public override void AddFilesToManifest(BuildManifest Manifest, STBuildBinary Binary)
 {
     // ok, this is pretty awful, we want the import libraries that go with the editor, only on the PC
     if (STBuildTool.BuildingRocket() &&
         Path.GetFileNameWithoutExtension(Binary.Config.OutputFilePath).StartsWith("UE4Editor-", StringComparison.InvariantCultureIgnoreCase) &&
         Path.GetExtension(Binary.Config.OutputFilePath).EndsWith("dll", StringComparison.InvariantCultureIgnoreCase) &&
         Binary.Config.Type == STBuildBinaryType.DynamicLinkLibrary)
     {
         // ok, this is pretty awful, we want the import libraries that go with the editor, only on the PC
         Manifest.AddBuildProduct(Path.Combine(Binary.Config.IntermediateDirectory, Path.GetFileNameWithoutExtension(Binary.Config.OutputFilePath) + ".lib"), "");
     }
 }
Exemplo n.º 2
0
 public virtual void AddFilesToManifest(BuildManifest Manifest, STBuildBinary Binary)
 {
 }
Exemplo n.º 3
0
 public override void AddFilesToManifest(BuildManifest Manifest, STBuildBinary Binary)
 {
     if (BuildConfiguration.bCreateStubIPA)
     {
         string StubFile = Path.Combine (Path.GetDirectoryName (Binary.Config.OutputFilePath), Path.GetFileNameWithoutExtension (Binary.Config.OutputFilePath) + ".stub");
         Manifest.AddBuildProduct(StubFile);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Cleans all target intermediate files. May also clean UHT if the target uses UObjects.
        /// </summary>
        /// <param name="Binaries">Target binaries</param>
        /// <param name="Platform">Tareet platform</param>
        /// <param name="Manifest">Manifest</param>
        protected void CleanTarget(List<STBuildBinary> Binaries, CPPTargetPlatform Platform, BuildManifest Manifest)
        {
            {
                var LocalTargetName = (TargetType == TargetRules.TargetType.Program) ? AppName : GameName;
                Log.TraceVerbose("Cleaning target {0} - AppName {1}", LocalTargetName, AppName);

                var TargetFilename = RulesCompiler.GetTargetFilename(GameName);
                Log.TraceVerbose("\tTargetFilename {0}", TargetFilename);

                // Collect all files to delete.
                var AdditionalFileExtensions = new string[] { ".lib", ".exp", ".dll.response" };
                var AllFilesToDelete = new List<string>(Manifest.BuildProducts);
                foreach (var FileManifestItem in Manifest.BuildProducts)
                {
                    var FileExt = Path.GetExtension(FileManifestItem);
                    if (FileExt == ".dll" || FileExt == ".exe")
                    {
                        var ManifestFileWithoutExtension = Utils.GetPathWithoutExtension(FileManifestItem);
                        foreach (var AdditionalExt in AdditionalFileExtensions)
                        {
                            var AdditionalFileToDelete = ManifestFileWithoutExtension + AdditionalExt;
                            AllFilesToDelete.Add(AdditionalFileToDelete);
                        }
                    }
                }

                //@todo. This does not clean up files that are no longer built by the target...
                // Delete all output files listed in the manifest as well as any additional files.
                foreach (var FileToDelete in AllFilesToDelete)
                {
                    if (File.Exists(FileToDelete))
                    {
                        Log.TraceVerbose("\t\tDeleting " + FileToDelete);
                        CleanFile(FileToDelete);
                    }
                }

                // Generate a list of all the modules of each AppBinaries entry
                var ModuleList = new List<string>();
                var bTargetUsesUObjectModule = false;
                foreach (var AppBin in AppBinaries)
                {
                    STBuildBinaryCPP AppBinCPP = AppBin as STBuildBinaryCPP;
                    if (AppBinCPP != null)
                    {
                        // Collect all modules used by this binary.
                        Log.TraceVerbose("\tProcessing AppBinary " + AppBin.Config.OutputFilePaths[0]);
                        foreach (string ModuleName in AppBinCPP.ModuleNames)
                        {
                            if (ModuleList.Contains(ModuleName) == false)
                            {
                                Log.TraceVerbose("\t\tModule: " + ModuleName);
                                ModuleList.Add(ModuleName);
                                if (ModuleName == "CoreUObject")
                                {
                                    bTargetUsesUObjectModule = true;
                                }
                            }
                        }
                    }
                    else
                    {
                        Log.TraceVerbose("\t********* Skipping " + AppBin.Config.OutputFilePaths[0]);
                    }
                }

                var BaseEngineBuildDataFolder = Path.GetFullPath(BuildConfiguration.BaseIntermediatePath).Replace("\\", "/");
                var PlatformEngineBuildDataFolder = BuildConfiguration.BaseIntermediatePath;

                // Delete generated header files
                foreach (var ModuleName in ModuleList)
                {
                    var Module = GetModuleByName(ModuleName);
                    var ModuleIncludeDir = STBuildModuleCPP.GetGeneratedCodeDirectoryForModule(this, Module.ModuleDirectory, ModuleName).Replace("\\", "/");
                    if (!STBuildTool.RunningRocket() || !ModuleIncludeDir.StartsWith(BaseEngineBuildDataFolder, StringComparison.InvariantCultureIgnoreCase))
                    {
                        if (Directory.Exists(ModuleIncludeDir))
                        {
                            Log.TraceVerbose("\t\tDeleting " + ModuleIncludeDir);
                            CleanDirectory(ModuleIncludeDir);
                        }
                    }
                }

                //
                {
                    var AppEnginePath = Path.Combine(PlatformEngineBuildDataFolder, LocalTargetName, Configuration.ToString());
                    if (Directory.Exists(AppEnginePath))
                    {
                        CleanDirectory(AppEnginePath);
                    }
                }

                // Clean the intermediate directory
                if (!String.IsNullOrEmpty(ProjectIntermediateDirectory))
                {
                    if (Directory.Exists(ProjectIntermediateDirectory))
                    {
                        CleanDirectory(ProjectIntermediateDirectory);
                    }
                }
                if (!STBuildTool.RunningRocket())
                {
                    // This is always under Rocket installation folder
                    if (Directory.Exists(GlobalLinkEnvironment.Config.IntermediateDirectory))
                    {
                        Log.TraceVerbose("\tDeleting " + GlobalLinkEnvironment.Config.IntermediateDirectory);
                        CleanDirectory(GlobalLinkEnvironment.Config.IntermediateDirectory);
                    }
                }
                else if (ShouldCompileMonolithic())
                {
                    // Only in monolithic, otherwise it's pointing to Rocket installation folder
                    if (Directory.Exists(GlobalLinkEnvironment.Config.OutputDirectory))
                    {
                        Log.TraceVerbose("\tDeleting " + GlobalLinkEnvironment.Config.OutputDirectory);
                        CleanDirectory(GlobalCompileEnvironment.Config.OutputDirectory);
                    }
                }

                // Delete the dependency caches
                {
                    var FlatCPPIncludeDependencyCacheFilename = FlatCPPIncludeDependencyCache.GetDependencyCachePathForTarget(this);
                    if (File.Exists(FlatCPPIncludeDependencyCacheFilename))
                    {
                        Log.TraceVerbose("\tDeleting " + FlatCPPIncludeDependencyCacheFilename);
                        CleanFile(FlatCPPIncludeDependencyCacheFilename);
                    }
                    var DependencyCacheFilename = DependencyCache.GetDependencyCachePathForTarget(this);
                    if (File.Exists(DependencyCacheFilename))
                    {
                        Log.TraceVerbose("\tDeleting " + DependencyCacheFilename);
                        CleanFile(DependencyCacheFilename);
                    }
                }

                // Delete the UBT makefile
                {
                    // Figure out what to call our action graph based on everything we're building
                    var TargetDescs = new List<TargetDescriptor>();

                    // @todo ubtmake: Only supports cleaning one target at a time :(
                    TargetDescs.Add(new TargetDescriptor
                    {
                        TargetName = GetTargetName(),
                        Platform = this.Platform,
                        Configuration = this.Configuration
                    });

                    var UBTMakefilePath = STBuildTool.GetUBTMakefilePath(TargetDescs);
                    if (File.Exists(UBTMakefilePath))
                    {
                        Log.TraceVerbose("\tDeleting " + UBTMakefilePath);
                        CleanFile(UBTMakefilePath);
                    }
                }

                // Delete the action history
                {
                    var ActionHistoryFilename = ActionHistory.GeneratePathForTarget(this);
                    if (File.Exists(ActionHistoryFilename))
                    {
                        Log.TraceVerbose("\tDeleting " + ActionHistoryFilename);
                        CleanFile(ActionHistoryFilename);
                    }
                }

                // Finally clean UnrealHeaderTool if this target uses CoreUObject modules and we're not cleaning UHT already
                // and we want UHT to be cleaned.
                if (!STBuildConfiguration.bDoNotBuildUHT && bTargetUsesUObjectModule && GetTargetName() != "UnrealHeaderTool")
                {
                    CleanUnrealHeaderTool();
                }
            }
        }
Exemplo n.º 5
0
        /** Generates a public manifest file for writing out */
        public void GenerateManifest(ISTToolChain ToolChain, List<STBuildBinary> Binaries, CPPTargetPlatform Platform, List<string> SpecialRocketLibFilesThatAreBuildProducts)
        {
            string ManifestPath;
            if (STBuildTool.RunningRocket())
            {
                ManifestPath = Path.Combine(STBuildTool.GetUProjectPath(), BuildConfiguration.BaseIntermediateFolder, "Manifest.xml");
            }
            else
            {
                ManifestPath = "../Intermediate/Build/Manifest.xml";
            }

            BuildManifest Manifest = new BuildManifest();
            if (STBuildConfiguration.bMergeManifests)
            {
                // Load in existing manifest (if any)
                Manifest = Utils.ReadClass<BuildManifest>(ManifestPath);
            }

            STTargetPlatform TargetPlatform = CPPTargetPlatformToSTTargetPlatform(Platform);
            var BuildPlatform = STBuildPlatform.GetBuildPlatform(TargetPlatform);

            // Iterate over all the binaries, and add the relevant info to the manifest
            foreach (STBuildBinary Binary in Binaries)
            {
                // Get the platform specific extension for debug info files

                // Don't add static library files to the manifest as we do not check them into perforce.
                // However, add them to the manifest when cleaning the project as we do want to delete
                // them in that case.
                if (STBuildConfiguration.bCleanProject == false)
                {
                    if (Binary.Config.Type == STBuildBinaryType.StaticLibrary)
                    {
                        continue;
                    }
                }
                string DebugInfoExtension = BuildPlatform.GetDebugInfoExtension(Binary.Config.Type);

                // Create and add the binary and associated debug info
                foreach (string OutputFilePath in Binary.Config.OutputFilePaths)
                {
                    Manifest.AddBuildProduct(OutputFilePath, DebugInfoExtension);
                }

                // Add all the stripped debug symbols
                if (STBuildTool.BuildingRocket() && (Platform == CPPTargetPlatform.Win32 || Platform == CPPTargetPlatform.Win64))
                {
                    foreach (string OutputFilePath in Binary.Config.OutputFilePaths)
                    {
                        string StrippedPath = Path.Combine(Path.GetDirectoryName(OutputFilePath), Path.GetFileNameWithoutExtension(OutputFilePath) + "-Stripped" + DebugInfoExtension);
                        Manifest.AddBuildProduct(StrippedPath);
                    }
                }

                if (Binary.Config.Type == STBuildBinaryType.Executable &&
                      GlobalLinkEnvironment.Config.CanProduceAdditionalConsoleApp &&
                      STBuildConfiguration.bBuildEditor)
                {
                    foreach (string OutputFilePath in Binary.Config.OutputFilePaths)
                    {
                        Manifest.AddBuildProduct(STBuildBinary.GetAdditionalConsoleAppPath(OutputFilePath), DebugInfoExtension);
                    }
                }

                ToolChain.AddFilesToManifest(Manifest, Binary);
            }
            {
                string DebugInfoExtension = BuildPlatform.GetDebugInfoExtension(STBuildBinaryType.StaticLibrary);
                foreach (var RedistLib in SpecialRocketLibFilesThatAreBuildProducts)
                {
                    Manifest.AddBuildProduct(RedistLib, DebugInfoExtension);
                }
            }

            if (STBuildConfiguration.bCleanProject)
            {
                CleanTarget(Binaries, Platform, Manifest);
            }
            if (STBuildConfiguration.bGenerateManifest)
            {
                Utils.WriteClass<BuildManifest>(Manifest, ManifestPath, "");
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Write the project files manifest
        /// This is used by CIS to verify all files referenced are checked into perforce.
        /// </summary>
        protected virtual bool WriteProjectFileManifest()
        {
            BuildManifest Manifest = new BuildManifest();
            foreach (var CurProject in GeneratedProjectFiles)
            {
                foreach (var SourceFile in CurProject.SourceFiles)
                {
                    Manifest.AddBuildProduct(SourceFile.FilePath);
                }
            }

            string ManifestName = Path.Combine(ProjectFileGenerator.IntermediateProjectFilesPath, "UE4SourceFiles.xml");
            Utils.WriteClass<BuildManifest>(Manifest, ManifestName, "");
            return true;
        }