Exemplo n.º 1
0
 public override void AddFilesToManifest(ref FileManifest Manifest, UEBuildBinary Binary)
 {
     // we need to include the generated .mem file.
     string MemFile = Binary.Config.OutputFilePath + ".mem";
     // make sure we don't add mem files more than once.
     Manifest.AddBinaryNames(MemFile, null);
 }
Exemplo n.º 2
0
 public override void AddFilesToManifest(ref FileManifest 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.AddBinaryNames(Path.Combine(Binary.Config.IntermediateDirectory, Path.GetFileNameWithoutExtension(Binary.Config.OutputFilePath) + ".lib"), "");
     }
 }
Exemplo n.º 3
0
    public override void ExecuteBuild()
    {
        Log("************************* BuildCommonTools");

        // Get the list of platform names
        string[] PlatformNames = ParseParamValue("platforms", BuildHostPlatform.Current.Platform.ToString()).Split('+');

        // Parse the platforms
        List <UnrealBuildTool.UnrealTargetPlatform> Platforms = new List <UnrealTargetPlatform>();

        foreach (string PlatformName in PlatformNames)
        {
            UnrealBuildTool.UnrealTargetPlatform Platform;
            if (!UnrealBuildTool.UnrealTargetPlatform.TryParse(PlatformName, out Platform))
            {
                throw new AutomationException("Unknown platform specified on command line - '{0}' - valid platforms are {1}", PlatformName, String.Join("/", Enum.GetNames(typeof(UnrealBuildTool.UnrealTargetPlatform))));
            }
            Platforms.Add(Platform);
        }

        // Get the agenda
        UE4Build.BuildAgenda Agenda = MakeAgenda(Platforms.ToArray());

        // Build everything. We don't want to touch version files for GitHub builds -- these are "programmer builds" and won't have a canonical build version
        UE4Build Builder = new UE4Build(this);

        Builder.Build(Agenda, InDeleteBuildProducts: true, InUpdateVersionFiles: false);

        // Add UAT and UBT to the build products
        Builder.AddUATFilesToBuildProducts();
        Builder.AddUBTFilesToBuildProducts();

        // Make sure all the build products exist
        UE4Build.CheckBuildProducts(Builder.BuildProductFiles);

        // Write the manifest if needed
        string ManifestPath = ParseParamValue("manifest");

        if (ManifestPath != null)
        {
            UnrealBuildTool.FileManifest Manifest = new UnrealBuildTool.FileManifest();
            foreach (string BuildProductFile in Builder.BuildProductFiles)
            {
                Manifest.AddFileName(BuildProductFile);
            }
            UnrealBuildTool.Utils.WriteClass(Manifest, ManifestPath, "");
        }
    }
Exemplo n.º 4
0
        public static void AddAppBundleContentsToManifest(ref FileManifest Manifest, UEBuildBinary Binary)
        {
            if (Binary.Target.GlobalLinkEnvironment.Config.bIsBuildingConsoleApplication || Binary.Config.Type != UEBuildBinaryType.Executable)
            {
                return;
            }

            string ContentsDirectory = 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 = new LinkEnvironment(Binary.Target.GlobalLinkEnvironment);
            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")
                    {
                        Manifest.AddFileName(ContentsDirectory + "MacOS/" + LibName);
                    }
                }
            }

            // And we also need all the resources
            Manifest.AddFileName(ContentsDirectory + "Info.plist");
            Manifest.AddFileName(ContentsDirectory + "PkgInfo");
            Manifest.AddFileName(ContentsDirectory + "Resources/UE4.icns");
            Manifest.AddFileName(ContentsDirectory + "Resources/OpenXcodeAtFileAndLine.applescript");
            Manifest.AddFileName(ContentsDirectory + "Resources/English.lproj/InfoPlist.strings");
            Manifest.AddFileName(ContentsDirectory + "Resources/English.lproj/MainMenu.nib");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/MacOS/RadioEffectUnit");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Resources/English.lproj/Localizable.strings");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Resources/RadioEffectUnit.rsrc");
            Manifest.AddFileName(ContentsDirectory + "Resources/RadioEffectUnit.component/Contents/Info.plist");
        }
        /// <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()
        {
            FileManifest Manifest = new FileManifest();
            foreach( var CurProject in GeneratedProjectFiles )
            {
                foreach( var SourceFile in CurProject.SourceFiles )
                {
                    Manifest.AddFileName( SourceFile.FilePath );
                }
            }

            string ManifestName = Path.Combine( ProjectFileGenerator.IntermediateProjectFilesPath, "UE4SourceFiles.xml" );
            Utils.WriteClass<FileManifest>( Manifest, ManifestName, "" );
            return true;
        }
Exemplo n.º 6
0
        public override void AddFilesToManifest(ref FileManifest 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;
                        if (!Manifest.FileManifestItems.Contains(Path.GetFullPath(Entry)))
                        {
                            Manifest.AddFileName(Entry);
                        }
                    }
                }
            }

            foreach (UEBuildBundleResource Resource in BinaryLinkEnvironment.Config.AdditionalBundleResources)
            {
                if (Directory.Exists(Resource.ResourcePath))
                {
                    foreach (string ResourceFile in Directory.GetFiles(Resource.ResourcePath, "*", SearchOption.AllDirectories))
                    {
                        Manifest.AddFileName(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, ResourceFile.Substring(Path.GetDirectoryName(Resource.ResourcePath).Length + 1)));
                    }
                }
                else
                {
                    Manifest.AddFileName(Path.Combine(BundleContentsDirectory, Resource.BundleContentsSubdir, Path.GetFileName(Resource.ResourcePath)));
                }
            }

            if (Binary.Config.Type == UEBuildBinaryType.Executable)
            {
                // And we also need all the resources
                Manifest.AddFileName(BundleContentsDirectory + "Info.plist");
                Manifest.AddFileName(BundleContentsDirectory + "PkgInfo");
                Manifest.AddFileName(BundleContentsDirectory + "Resources/UE4.icns");

                if (Binary.Config.TargetName.StartsWith("UE4Editor"))
                {
                    Manifest.AddFileName(BundleContentsDirectory + "Resources/UProject.icns");
                }
            }
        }
Exemplo n.º 7
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<UEBuildBinary> Binaries, CPPTargetPlatform Platform, FileManifest Manifest)
        {
            {
                var TargetFilename = RulesCompiler.GetTargetFilename(GameName);
                var LocalTargetName = (TargetType == TargetRules.TargetType.Program) ? AppName : GameName;

                Log.TraceVerbose("Cleaning target {0} - AppName {1}", LocalTargetName, AppName);
                Log.TraceVerbose("\tTargetFilename {0}", TargetFilename);

                var TargetFolder = "";
                if (String.IsNullOrEmpty(TargetFilename) == false)
                {
                    var TargetInfo = new FileInfo(TargetFilename);
                    TargetFolder = TargetInfo.Directory.FullName;
                    var SourceIdx = TargetFolder.LastIndexOf("\\Source");
                    if (SourceIdx != -1)
                    {
                        TargetFolder = TargetFolder.Substring(0, SourceIdx + 1);
                    }
                }

                // Collect all files to delete.
                var AdditionalFileExtensions = new string[] { ".lib", ".exp", ".dll.response" };
                var AllFilesToDelete = new List<string>(Manifest.FileManifestItems);
                foreach (var FileManifestItem in Manifest.FileManifestItems)
                {
                    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 (!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();
                }
            }
        }
Exemplo n.º 8
0
        /** 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";
            }

            FileManifest Manifest = new FileManifest();
            if (UEBuildConfiguration.bMergeManifests)
            {
                // Load in existing manifest (if any)
                Manifest = Utils.ReadClass<FileManifest>(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.AddBinaryNames(OutputFilePath, DebugInfoExtension);
                }

                if (Binary.Config.Type == UEBuildBinaryType.Executable &&
                      GlobalLinkEnvironment.Config.CanProduceAdditionalConsoleApp &&
                      UEBuildConfiguration.bBuildEditor)
                {
                    foreach (string OutputFilePath in Binary.Config.OutputFilePaths)
                    {
                        Manifest.AddBinaryNames(UEBuildBinary.GetAdditionalConsoleAppPath(OutputFilePath), DebugInfoExtension);
                    }
                }

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

            if (UEBuildConfiguration.bCleanProject)
            {
                CleanTarget(Binaries, Platform, Manifest);
            }
            if (UEBuildConfiguration.bGenerateManifest)
            {
                Utils.WriteClass<FileManifest>(Manifest, ManifestPath, "");
            }
        }
Exemplo n.º 9
0
 public virtual void AddFilesToManifest(ref FileManifest manifest, UEBuildBinary Binary )
 {
 }
Exemplo n.º 10
0
 public override void AddFilesToManifest(ref FileManifest 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)
     string ApkFile = Path.ChangeExtension(RemoveArchName(Binary.Config.OutputFilePaths[0]), ".apk");
     Manifest.AddFileName(ApkFile);
 }
Exemplo n.º 11
0
 public override void AddFilesToManifest(ref FileManifest Manifest, UEBuildBinary Binary)
 {
     if (BuildConfiguration.bCreateStubIPA)
     {
         string StubFile = Path.Combine (Path.GetDirectoryName (Binary.Config.OutputFilePath), Path.GetFileNameWithoutExtension (Binary.Config.OutputFilePath) + ".stub");
         Manifest.AddFileName (StubFile);
     }
 }