/// <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);
        }
示例#2
0
 public UHTModuleInfoCacheType(IEnumerable<string> InHeaderFilenames, UHTModuleInfo InInfo)
 {
     HeaderFilenames = InHeaderFilenames;
     Info            = InInfo;
 }
        /// <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, string ModuleDirectory, UEBuildModuleType ModuleType)
        {
            var ClassesFolder = Path.Combine(ModuleDirectory, "Classes");
            var PublicFolder  = Path.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 (UObjectHeaderFileItem.AbsolutePath.StartsWith(ClassesFolder))
                    {
                        AllClassesHeaders.Add(UObjectHeaderFileItem);
                    }
                    else if (UObjectHeaderFileItem.AbsolutePath.StartsWith(PublicFolder))
                    {
                        PublicUObjectHeaders.Add(UObjectHeaderFileItem);
                    }
                    else
                    {
                        PrivateUObjectHeaders.Add(UObjectHeaderFileItem);
                    }
                }
            }

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

            return Result;
        }
示例#4
0
        /// <summary>
        /// If any of this module's source files contain UObject definitions, this will return those header files back to the caller
        /// </summary>
        /// <param name="PublicUObjectClassesHeaders">All UObjects headers in the module's Classes folder (legacy)</param>
        /// <param name="PublicUObjectHeaders">Dependent UObject headers in Public source folders</param>
        /// <param name="PrivateUObjectHeaders">Dependent UObject headers not in Public source folders</param>
        /// <returns>
        public UHTModuleInfo GetUHTModuleInfo()
        {
            if (CachedModuleUHTInfo != null)
            {
                return CachedModuleUHTInfo;
            }

            var ClassesFolder = Path.Combine(this.ModuleDirectory, "Classes");
            var PublicFolder  = Path.Combine(this.ModuleDirectory, "Public");

            var BuildPlatform = UEBuildPlatform.GetBuildPlatform(Target.Platform);

            var ClassesFiles = Directory.GetFiles( this.ModuleDirectory, "*.h", SearchOption.AllDirectories );
            foreach (var ClassHeader in ClassesFiles)
            {
                // 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( ClassHeader );

                bool HasUObjects;
                var DirectIncludes = CPPEnvironment.GetDirectIncludeDependencies( Target, UObjectHeaderFileItem, BuildPlatform, bOnlyCachedDependencies:false, HasUObjects:out HasUObjects );
                Debug.Assert( DirectIncludes != null );

                if (HasUObjects)
                {
                    if (UObjectHeaderFileItem.AbsolutePath.StartsWith(ClassesFolder))
                    {
                        _AllClassesHeaders.Add(UObjectHeaderFileItem);
                    }
                    else if (UObjectHeaderFileItem.AbsolutePath.StartsWith(PublicFolder))
                    {
                        _PublicUObjectHeaders.Add(UObjectHeaderFileItem);
                    }
                    else
                    {
                        _PrivateUObjectHeaders.Add(UObjectHeaderFileItem);
                    }
                }
            }

            CachedModuleUHTInfo = new UHTModuleInfo
            {
                ModuleName                  = this.Name,
                ModuleDirectory             = this.ModuleDirectory,
                ModuleType					= this.Type.ToString(),
                PublicUObjectClassesHeaders = _AllClassesHeaders    .ToList(),
                PublicUObjectHeaders        = _PublicUObjectHeaders .ToList(),
                PrivateUObjectHeaders       = _PrivateUObjectHeaders.ToList(),
                GeneratedCodeVersion = this.Target.Rules.GetGeneratedCodeVersion()
            };

            return CachedModuleUHTInfo;
        }