Ejemplo n.º 1
0
        public override void PostCodeGeneration(UHTManifest Manifest)
        {
            if (BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac)
            {
                // @todo UHT: Temporary workaround for UBT no longer being able to follow includes from generated headers unless
                //  the headers already existed before the build started.  We're working on a proper fix.

                // Make sure all generated headers are synced.  If we had to generate code, we need to assume that not all of the
                // header files existed on disk at the time that UBT scanned include statements looking for prerequisite files.  Those
                // files are created during code generation and must exist on disk by the time this function is called.  We'll scan
                // for generated code files and make sure they are enqueued for copying to the remote machine.
                foreach (var UObjectModule in Manifest.Modules)
                {
                    // @todo uht: Ideally would only copy exactly the files emitted by UnrealHeaderTool, rather than scanning directory (could copy stale files; not a big deal though)
                    try
                    {
                        var GeneratedCodeDirectory = Path.GetDirectoryName(UObjectModule.GeneratedCPPFilenameBase);
                        var GeneratedCodeFiles     = Directory.GetFiles(GeneratedCodeDirectory, "*", SearchOption.AllDirectories);
                        foreach (var GeneratedCodeFile in GeneratedCodeFiles)
                        {
                            // Skip copying "Timestamp" files (UBT temporary files)
                            if (!Path.GetFileName(GeneratedCodeFile).Equals(@"Timestamp", StringComparison.InvariantCultureIgnoreCase))
                            {
                                var GeneratedCodeFileItem = FileItem.GetExistingItemByPath(GeneratedCodeFile);
                                QueueFileForBatchUpload(GeneratedCodeFileItem);
                            }
                        }
                    }
                    catch (System.IO.DirectoryNotFoundException)
                    {
                        // Ignore directory not found
                    }

                    // For source files in legacy "Classes" directories, we need to make sure they all get copied over too, since
                    // they may not have been directly included in any C++ source files (only generated headers), and the initial
                    // header scan wouldn't have picked them up if they hadn't been generated yet!
                    try
                    {
                        var SourceFiles = Directory.GetFiles(UObjectModule.BaseDirectory, "*", SearchOption.AllDirectories);
                        foreach (var SourceFile in SourceFiles)
                        {
                            var SourceFileItem = FileItem.GetExistingItemByPath(SourceFile);
                            QueueFileForBatchUpload(SourceFileItem);
                        }
                    }
                    catch (System.IO.DirectoryNotFoundException)
                    {
                        // Ignore directory not found
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates a UHTModuleInfo for a particular named module under a directory.
        /// </summary>
        /// <returns>
        public static UHTModuleInfo CreateUHTModuleInfo(IEnumerable <string> HeaderFilenames, UEBuildTarget Target, string ModuleName, DirectoryReference ModuleDirectory, UEBuildModuleType ModuleType)
        {
            var ClassesFolder = DirectoryReference.Combine(ModuleDirectory, "Classes");
            var PublicFolder  = DirectoryReference.Combine(ModuleDirectory, "Public");
            var BuildPlatform = UEBuildPlatform.GetBuildPlatform(Target.Platform);

            var AllClassesHeaders     = new List <FileItem>();
            var PublicUObjectHeaders  = new List <FileItem>();
            var PrivateUObjectHeaders = new List <FileItem>();

            foreach (var Header in HeaderFilenames)
            {
                // Check to see if we know anything about this file.  If we have up-to-date cached information about whether it has
                // UObjects or not, we can skip doing a test here.
                var UObjectHeaderFileItem = FileItem.GetExistingItemByPath(Header);

                if (CPPEnvironment.DoesFileContainUObjects(UObjectHeaderFileItem.AbsolutePath))
                {
                    if (new FileReference(UObjectHeaderFileItem.AbsolutePath).IsUnderDirectory(ClassesFolder))
                    {
                        AllClassesHeaders.Add(UObjectHeaderFileItem);
                    }
                    else if (new FileReference(UObjectHeaderFileItem.AbsolutePath).IsUnderDirectory(PublicFolder))
                    {
                        PublicUObjectHeaders.Add(UObjectHeaderFileItem);
                    }
                    else
                    {
                        PrivateUObjectHeaders.Add(UObjectHeaderFileItem);
                    }
                }
            }

            var Result = new UHTModuleInfo
            {
                ModuleName                  = ModuleName,
                ModuleDirectory             = ModuleDirectory.FullName,
                ModuleType                  = ModuleType.ToString(),
                PublicUObjectClassesHeaders = AllClassesHeaders,
                PublicUObjectHeaders        = PublicUObjectHeaders,
                PrivateUObjectHeaders       = PrivateUObjectHeaders,
                GeneratedCodeVersion        = Target.Rules.GetGeneratedCodeVersion()
            };

            return(Result);
        }