Exemplo n.º 1
0
        /** Updates the intermediate include directory timestamps of all the passed in UObject modules */
        private static void UpdateDirectoryTimestamps(List <UHTModuleInfo> UObjectModules)
        {
            foreach (var Module in UObjectModules)
            {
                string GeneratedCodeDirectory     = Path.GetDirectoryName(Module.GeneratedCPPFilenameBase);
                var    GeneratedCodeDirectoryInfo = new DirectoryInfo(GeneratedCodeDirectory);

                try
                {
                    if (GeneratedCodeDirectoryInfo.Exists)
                    {
                        if (UnrealBuildTool.RunningRocket())
                        {
                            // If it is an Engine folder and we are building a rocket project do NOT update the timestamp!
                            // @todo Rocket: This contains check is hacky/fragile
                            string FullGeneratedCodeDirectory = GeneratedCodeDirectoryInfo.FullName;
                            FullGeneratedCodeDirectory = FullGeneratedCodeDirectory.Replace("\\", "/");
                            if (FullGeneratedCodeDirectory.Contains("Engine/Intermediate/Build"))
                            {
                                continue;
                            }

                            // Skip checking timestamps for engine plugin intermediate headers in Rocket
                            PluginInfo Info = Plugins.GetPluginInfoForModule(Module.ModuleName);
                            if (Info != null)
                            {
                                if (Info.LoadedFrom == PluginInfo.LoadedFromType.Engine)
                                {
                                    continue;
                                }
                            }
                        }

                        // Touch the include directory since we have technically 'generated' the headers
                        // However, the headers might not be touched at all since that would cause the compiler to recompile everything
                        // We can't alter the directory timestamp directly, because this may throw exceptions when the directory is
                        // open in visual studio or windows explorer, so instead we create a blank file that will change the timestamp for us
                        string TimestampFile = GeneratedCodeDirectoryInfo.FullName + Path.DirectorySeparatorChar + @"Timestamp";

                        if (!GeneratedCodeDirectoryInfo.Exists)
                        {
                            GeneratedCodeDirectoryInfo.Create();
                        }

                        if (File.Exists(TimestampFile))
                        {
                            File.Delete(TimestampFile);
                        }
                        using (File.Create(TimestampFile))
                        {
                        }
                    }
                }
                catch (Exception Exception)
                {
                    throw new BuildException(Exception, "Couldn't touch header directories: " + Exception.Message);
                }
            }
        }
Exemplo n.º 2
0
        /** Updates the intermediate include directory timestamps of all the passed in UObject modules */
        private static void UpdateDirectoryTimestamps(List <UHTModuleInfo> UObjectModules)
        {
            foreach (var Module in UObjectModules)
            {
                string GeneratedCodeDirectory     = Path.GetDirectoryName(Module.GeneratedCPPFilenameBase);
                var    GeneratedCodeDirectoryInfo = new DirectoryInfo(GeneratedCodeDirectory);

                try
                {
                    if (GeneratedCodeDirectoryInfo.Exists)
                    {
                        if (UnrealBuildTool.RunningRocket())
                        {
                            // If it is an Engine folder and we are building a rocket project do NOT update the timestamp!
                            // @todo Rocket: This contains check is hacky/fragile
                            string FullGeneratedCodeDirectory = GeneratedCodeDirectoryInfo.FullName;
                            FullGeneratedCodeDirectory = FullGeneratedCodeDirectory.Replace("\\", "/");
                            if (FullGeneratedCodeDirectory.Contains("Engine/Intermediate/Build"))
                            {
                                continue;
                            }

                            // Skip checking timestamps for engine plugin intermediate headers in Rocket
                            PluginInfo Info = Plugins.GetPluginInfoForModule(Module.ModuleName);
                            if (Info != null)
                            {
                                if (Info.LoadedFrom == PluginInfo.LoadedFromType.Engine)
                                {
                                    continue;
                                }
                            }
                        }

                        // Touch the include directory since we have technically 'generated' the headers
                        // However, the headers might not be touched at all since that would cause the compiler to recompile everything
                        // We can't alter the directory timestamp directly, because this may throw exceptions when the directory is
                        // open in visual studio or windows explorer, so instead we create a blank file that will change the timestamp for us
                        string TimestampFile = GeneratedCodeDirectoryInfo.FullName + Path.DirectorySeparatorChar + @"Timestamp";

                        if (!GeneratedCodeDirectoryInfo.Exists)
                        {
                            GeneratedCodeDirectoryInfo.Create();
                        }

                        // Save all of the UObject files to a timestamp file.  We'll load these on the next run to see if any new
                        // files with UObject classes were deleted, so that we'll know to run UHT even if the timestamps of all
                        // of the other source files were unchanged
                        {
                            var AllUObjectFiles = new List <string>();
                            AllUObjectFiles.AddRange(Module.PublicUObjectClassesHeaders.ConvertAll(Item => Item.AbsolutePath));
                            AllUObjectFiles.AddRange(Module.PublicUObjectHeaders.ConvertAll(Item => Item.AbsolutePath));
                            AllUObjectFiles.AddRange(Module.PrivateUObjectHeaders.ConvertAll(Item => Item.AbsolutePath));
                            ResponseFile.Create(TimestampFile, AllUObjectFiles);
                        }
                    }
                }
                catch (Exception Exception)
                {
                    throw new BuildException(Exception, "Couldn't touch header directories: " + Exception.Message);
                }
            }
        }