public override void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary) { // ok, this is pretty awful, we want the import libraries that go with the editor, only on the PC if (UnrealBuildTool.BuildingRocket() && Path.GetFileNameWithoutExtension(Binary.Config.OutputFilePath).StartsWith("UE4Editor-", StringComparison.InvariantCultureIgnoreCase) && Path.GetExtension(Binary.Config.OutputFilePath).EndsWith("dll", StringComparison.InvariantCultureIgnoreCase) && Binary.Config.Type == UEBuildBinaryType.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"), ""); } }
/// <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; }
public virtual void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary) { }
public override void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary) { if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication) { return; } if (BundleContentsDirectory == "" && Binary.Config.Type == UEBuildBinaryType.Executable) { BundleContentsDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Binary.Config.OutputFilePath)) + "/"; } // We need to know what third party dylibs would be copied to the bundle var Modules = Binary.GetAllDependencyModules(bIncludeDynamicallyLoaded: false, bForceCircular: false); var BinaryLinkEnvironment = Binary.Target.GlobalLinkEnvironment.DeepCopy(); var BinaryDependencies = new List<UEBuildBinary>(); var LinkEnvironmentVisitedModules = new Dictionary<UEBuildModule, bool>(); foreach (var Module in Modules) { Module.SetupPrivateLinkEnvironment(ref BinaryLinkEnvironment, ref BinaryDependencies, ref LinkEnvironmentVisitedModules); } foreach (string AdditionalLibrary in BinaryLinkEnvironment.Config.AdditionalLibraries) { string LibName = Path.GetFileName(AdditionalLibrary); if (LibName.StartsWith("lib")) { if (Path.GetExtension(AdditionalLibrary) == ".dylib") { string Entry = BundleContentsDirectory + "MacOS/" + LibName; Manifest.AddBuildProduct(Entry); } } } foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources) { if (Directory.Exists(Resource.ResourcePath)) { foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories)) { Manifest.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, ResourceFile.Substring(Path.GetDirectoryName(Resource.ResourcePath).Length + 1))); } } else { Manifest.AddBuildProduct(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath))); } } if (Binary.Config.Type == UEBuildBinaryType.Executable) { // And we also need all the resources Manifest.AddBuildProduct(BundleContentsDirectory + "Info.plist"); Manifest.AddBuildProduct(BundleContentsDirectory + "PkgInfo"); Manifest.AddBuildProduct(BundleContentsDirectory + "Resources/UE4.icns"); if (Binary.Config.TargetName.StartsWith("UE4Editor")) { Manifest.AddBuildProduct(BundleContentsDirectory + "Resources/UProject.icns"); } } }
public override void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary) { if (BuildConfiguration.bCreateStubIPA) { string StubFile = Path.Combine (Path.GetDirectoryName (Binary.Config.OutputFilePath), Path.GetFileNameWithoutExtension (Binary.Config.OutputFilePath) + ".stub"); Manifest.AddBuildProduct(StubFile); } }
public override void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary) { // the binary will have all of the .so's in the output files, we need to trim down to the shared apk (which is what needs to go into the manifest) foreach (string BinaryPath in Binary.Config.OutputFilePaths) { string ApkFile = Path.ChangeExtension(BinaryPath, ".apk"); Manifest.AddBuildProduct(ApkFile); } }
public override void AddFilesToManifest(BuildManifest Manifest, UEBuildBinary Binary) { // we need to include the generated .mem file. Manifest.AddBuildProduct(Binary.Config.OutputFilePath + ".mem"); }
/// <summary> /// Cleans all target intermediate files. May also clean UHT if the target uses UObjects. /// </summary> /// <param name="Manifest">Manifest</param> protected void CleanTarget(BuildManifest Manifest) { { Log.TraceVerbose("Cleaning target {0} - AppName {1}", TargetName, AppName); var TargetFilename = RulesCompiler.GetTargetFilename(TargetName); 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); } } // Delete the intermediate folder for each binary. This will catch all plugin intermediate folders, as well as any project and engine folders. foreach(UEBuildBinary Binary in AppBinaries) { if(Directory.Exists(Binary.Config.IntermediateDirectory)) { if (!UnrealBuildTool.RunningRocket() || !Utils.IsFileUnderDirectory(Binary.Config.IntermediateDirectory, BuildConfiguration.RelativeEnginePath)) { CleanDirectory(Binary.Config.IntermediateDirectory); } } } // Generate a list of all the modules of each AppBinaries entry var ModuleList = new List<string>(); var bTargetUsesUObjectModule = false; foreach (var AppBin in AppBinaries) { UEBuildBinaryCPP AppBinCPP = AppBin as UEBuildBinaryCPP; 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) { UEBuildModuleCPP Module = GetModuleByName(ModuleName) as UEBuildModuleCPP; if (Module != null && Module.GeneratedCodeDirectory != null && Directory.Exists(Module.GeneratedCodeDirectory)) { if(!UnrealBuildTool.IsEngineInstalled() || !Utils.IsFileUnderDirectory(Module.GeneratedCodeDirectory, BuildConfiguration.RelativeEnginePath)) { Log.TraceVerbose("\t\tDeleting " + Module.GeneratedCodeDirectory); CleanDirectory(Module.GeneratedCodeDirectory); } } } // { var AppEnginePath = Path.Combine(PlatformEngineBuildDataFolder, TargetName, Configuration.ToString()); if (Directory.Exists(AppEnginePath)) { CleanDirectory(AppEnginePath); } } // Clean the intermediate directory if( !String.IsNullOrEmpty( ProjectIntermediateDirectory ) && (!UnrealBuildTool.IsEngineInstalled() || !Utils.IsFileUnderDirectory(ProjectIntermediateDirectory, BuildConfiguration.RelativeEnginePath))) { if (Directory.Exists(ProjectIntermediateDirectory)) { CleanDirectory(ProjectIntermediateDirectory); } } if (!UnrealBuildTool.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 { // @todo ubtmake: Does not yet support cleaning Makefiles that were generated for multiple targets (that code path is currently not used though.) var TargetDescs = new List<TargetDescriptor>(); TargetDescs.Add( new TargetDescriptor { TargetName = GetTargetName(), Platform = this.Platform, Configuration = this.Configuration } ); // Normal makefile { var UBTMakefilePath = UnrealBuildTool.GetUBTMakefilePath( TargetDescs ); if (File.Exists(UBTMakefilePath)) { Log.TraceVerbose("\tDeleting " + UBTMakefilePath); CleanFile(UBTMakefilePath); } } // Hot reload makefile { UEBuildConfiguration.bHotReloadFromIDE = true; var UBTMakefilePath = UnrealBuildTool.GetUBTMakefilePath( TargetDescs ); if (File.Exists(UBTMakefilePath)) { Log.TraceVerbose("\tDeleting " + UBTMakefilePath); CleanFile(UBTMakefilePath); } UEBuildConfiguration.bHotReloadFromIDE = false; } } // 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 (!UEBuildConfiguration.bDoNotBuildUHT && bTargetUsesUObjectModule && GetTargetName() != "UnrealHeaderTool") { CleanUnrealHeaderTool(); } } }
/** Generates a public manifest file for writing out */ public void GenerateManifest() { string ManifestPath; if (UnrealBuildTool.RunningRocket() && UnrealBuildTool.HasUProjectFile()) { ManifestPath = Path.Combine(UnrealBuildTool.GetUProjectPath(), BuildConfiguration.BaseIntermediateFolder, "Manifest.xml"); } else { ManifestPath = "../Intermediate/Build/Manifest.xml"; } BuildManifest Manifest = new BuildManifest(); if (UEBuildConfiguration.bMergeManifests) { // Load in existing manifest (if any) Manifest = Utils.ReadClass<BuildManifest>(ManifestPath); } // Expand all the paths in the receipt; they'll currently use variables for the engine and project directories BuildReceipt ReceiptWithFullPaths = new BuildReceipt(Receipt); ReceiptWithFullPaths.ExpandPathVariables(BuildConfiguration.RelativeEnginePath, ProjectDirectory); foreach(BuildProduct BuildProduct in ReceiptWithFullPaths.BuildProducts) { // If we're cleaning, don't add any precompiled binaries to the manifest. We don't want to delete them. if(UEBuildConfiguration.bCleanProject && bUsePrecompiled && BuildProduct.IsPrecompiled) { continue; } // Don't add static libraries into the manifest unless we're explicitly building them; we don't submit them to Perforce. if(!UEBuildConfiguration.bCleanProject && !bPrecompile && (BuildProduct.Type == BuildProductType.StaticLibrary || BuildProduct.Type == BuildProductType.ImportLibrary)) { continue; } // Otherwise add it Manifest.AddBuildProduct(BuildProduct.Path); } IUEBuildPlatform BuildPlatform = UEBuildPlatform.GetBuildPlatform(Platform); if(OnlyModules.Count == 0) { Manifest.AddBuildProduct(BuildReceipt.GetDefaultPath(ProjectDirectory, TargetName, Platform, Configuration, BuildPlatform.GetActiveArchitecture())); } if (UEBuildConfiguration.bCleanProject) { CleanTarget(Manifest); } if (UEBuildConfiguration.bGenerateManifest) { Utils.WriteClass<BuildManifest>(Manifest, ManifestPath, ""); } }
/// <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<UEBuildBinary> 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) { UEBuildBinaryCPP AppBinCPP = AppBin as UEBuildBinaryCPP; 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 = UEBuildModuleCPP.GetGeneratedCodeDirectoryForModule(this, Module.ModuleDirectory, ModuleName).Replace("\\", "/"); if (!UnrealBuildTool.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 (!UnrealBuildTool.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 = UnrealBuildTool.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 (!UEBuildConfiguration.bDoNotBuildUHT && bTargetUsesUObjectModule && GetTargetName() != "UnrealHeaderTool") { CleanUnrealHeaderTool(); } } }
/** Generates a public manifest file for writing out */ public void GenerateManifest(IUEToolChain ToolChain, List<UEBuildBinary> Binaries, CPPTargetPlatform Platform, List<string> SpecialRocketLibFilesThatAreBuildProducts) { string ManifestPath; if (UnrealBuildTool.RunningRocket()) { ManifestPath = Path.Combine(UnrealBuildTool.GetUProjectPath(), BuildConfiguration.BaseIntermediateFolder, "Manifest.xml"); } else { ManifestPath = "../Intermediate/Build/Manifest.xml"; } BuildManifest Manifest = new BuildManifest(); if (UEBuildConfiguration.bMergeManifests) { // Load in existing manifest (if any) Manifest = Utils.ReadClass<BuildManifest>(ManifestPath); } UnrealTargetPlatform TargetPlatform = CPPTargetPlatformToUnrealTargetPlatform( Platform ); var BuildPlatform = UEBuildPlatform.GetBuildPlatform( TargetPlatform ); // Iterate over all the binaries, and add the relevant info to the manifest foreach( UEBuildBinary 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 (UEBuildConfiguration.bCleanProject == false) { if (Binary.Config.Type == UEBuildBinaryType.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(UnrealBuildTool.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 == UEBuildBinaryType.Executable && GlobalLinkEnvironment.Config.CanProduceAdditionalConsoleApp && UEBuildConfiguration.bBuildEditor) { foreach (string OutputFilePath in Binary.Config.OutputFilePaths) { Manifest.AddBuildProduct(UEBuildBinary.GetAdditionalConsoleAppPath(OutputFilePath), DebugInfoExtension); } } ToolChain.AddFilesToManifest(Manifest, Binary); } { string DebugInfoExtension = BuildPlatform.GetDebugInfoExtension(UEBuildBinaryType.StaticLibrary); foreach (var RedistLib in SpecialRocketLibFilesThatAreBuildProducts) { Manifest.AddBuildProduct(RedistLib, DebugInfoExtension); } } if (UEBuildConfiguration.bCleanProject) { CleanTarget(Binaries, Platform, Manifest); } if (UEBuildConfiguration.bGenerateManifest) { Utils.WriteClass<BuildManifest>(Manifest, ManifestPath, ""); } }