示例#1
0
        protected void AddPrerequisiteSourceFile(UEBuildTarget Target, IUEBuildPlatform BuildPlatform, CPPEnvironment CompileEnvironment, FileItem SourceFile, List <FileItem> PrerequisiteItems)
        {
            PrerequisiteItems.Add(SourceFile);

            var  RemoteThis      = this as RemoteToolChain;
            bool bAllowUploading = RemoteThis != null && BuildHostPlatform.Current.Platform != UnrealTargetPlatform.Mac;                // Don't use remote features when compiling from a Mac

            if (bAllowUploading)
            {
                RemoteThis.QueueFileForBatchUpload(SourceFile);
            }

            if (!BuildConfiguration.bUseExperimentalFastBuildIteration)                 // In fast build iteration mode, we'll gather includes later on
            {
                // @todo fastubt: What if one of the prerequisite files has become missing since it was updated in our cache? (usually, because a coder eliminated the source file)
                //		-> Two CASES:
                //				1) NOT WORKING: Non-unity file went away (SourceFile in this context).  That seems like an existing old use case.  Compile params or Response file should have changed?
                //				2) WORKING: Indirect file went away (unity'd original source file or include).  This would return a file that no longer exists and adds to the prerequiteitems list
                var IncludedFileList = CPPEnvironment.FindAndCacheAllIncludedFiles(Target, SourceFile, BuildPlatform, CompileEnvironment.Config.CPPIncludeInfo, bOnlyCachedDependencies: BuildConfiguration.bUseExperimentalFastDependencyScan);
                foreach (FileItem IncludedFile in IncludedFileList)
                {
                    PrerequisiteItems.Add(IncludedFile);

                    if (bAllowUploading &&
                        !BuildConfiguration.bUseExperimentalFastDependencyScan)                                 // With fast dependency scanning, we will not have an exhaustive list of dependencies here.  We rely on PostCodeGeneration() to upload these files.
                    {
                        RemoteThis.QueueFileForBatchUpload(IncludedFile);
                    }
                }
            }
        }
示例#2
0
        public static List <FileItem> FindAndCacheAllIncludedFiles(UEBuildTarget Target, FileItem SourceFile, UEBuildPlatform BuildPlatform, CPPIncludeInfo CPPIncludeInfo, bool bOnlyCachedDependencies)
        {
            List <FileItem> Result = null;

            if (CPPIncludeInfo.IncludeFileSearchDictionary == null)
            {
                CPPIncludeInfo.IncludeFileSearchDictionary = new Dictionary <string, FileItem>();
            }

            bool bUseFlatCPPIncludeDependencyCache = BuildConfiguration.bUseUBTMakefiles && UnrealBuildTool.IsAssemblingBuild;

            if (bOnlyCachedDependencies && bUseFlatCPPIncludeDependencyCache)
            {
                Result = FlatCPPIncludeDependencyCache[Target].GetDependenciesForFile(SourceFile.Reference);
                if (Result == null)
                {
                    // Nothing cached for this file!  It is new to us.  This is the expected flow when our CPPIncludeDepencencyCache is missing.
                }
            }
            else
            {
                // @todo ubtmake: HeaderParser.h is missing from the include set for Module.UnrealHeaderTool.cpp (failed to find include using:  FileItem DirectIncludeResolvedFile = CPPEnvironment.FindIncludedFile(DirectInclude.IncludeName, !BuildConfiguration.bCheckExternalHeadersForModification, IncludePathsToSearch, IncludeFileSearchDictionary );)

                // If we're doing an exhaustive include scan, make sure that we have our include dependency cache loaded and ready
                if (!bOnlyCachedDependencies)
                {
                    if (!IncludeDependencyCache.ContainsKey(Target))
                    {
                        IncludeDependencyCache.Add(Target, DependencyCache.Create(DependencyCache.GetDependencyCachePathForTarget(Target)));
                    }
                }

                Result = new List <FileItem>();

                IncludedFilesSet IncludedFileList = new IncludedFilesSet();
                CPPEnvironment.FindAndCacheAllIncludedFiles(Target, SourceFile, BuildPlatform, CPPIncludeInfo, ref IncludedFileList, bOnlyCachedDependencies: bOnlyCachedDependencies);
                foreach (FileItem IncludedFile in IncludedFileList)
                {
                    Result.Add(IncludedFile);
                }

                // Update cache
                if (bUseFlatCPPIncludeDependencyCache && !bOnlyCachedDependencies)
                {
                    List <FileReference> Dependencies = new List <FileReference>();
                    foreach (FileItem IncludedFile in Result)
                    {
                        Dependencies.Add(IncludedFile.Reference);
                    }
                    FileReference PCHName = SourceFile.PrecompiledHeaderIncludeFilename;
                    FlatCPPIncludeDependencyCache[Target].SetDependenciesForFile(SourceFile.Reference, PCHName, Dependencies);
                }
            }

            return(Result);
        }
示例#3
0
        public static List <FileItem> FindAndCacheAllIncludedFiles(UEBuildTarget Target, FileItem SourceFile, IUEBuildPlatform BuildPlatform, CPPIncludeInfo CPPIncludeInfo, bool bOnlyCachedDependencies)
        {
            var Result = new List <FileItem>();

            if (CPPIncludeInfo.IncludeFileSearchDictionary == null)
            {
                CPPIncludeInfo.IncludeFileSearchDictionary = new Dictionary <string, FileItem>();
            }

            bool bUseFlatCPPIncludeDependencyCache =
                (BuildConfiguration.bUseExperimentalFastDependencyScan &&
                 (!BuildConfiguration.bUseExperimentalFastBuildIteration || UnrealBuildTool.IsAssemblingBuild));

            if (bUseFlatCPPIncludeDependencyCache && bOnlyCachedDependencies)
            {
                var Dependencies = FlatCPPIncludeDependencyCache[Target].GetDependenciesForFile(SourceFile.AbsolutePath);
                if (Dependencies != null)
                {
                    foreach (string Dependency in Dependencies)
                    {
                        Result.Add(FileItem.GetItemByFullPath(Dependency));                             // @todo fastubt: Make sure this is as fast as possible (convert to FileItem)
                    }
                }
                else
                {
                    // Nothing cached for this file!  It is new to us.  This is the expected flow when our CPPIncludeDepencencyCache is missing.
                }
            }
            else
            {
                // @todo fastubt: HeaderParser.h is missing from the include set for Module.UnrealHeaderTool.cpp (failed to find include using:  FileItem DirectIncludeResolvedFile = CPPEnvironment.FindIncludedFile(DirectInclude.IncludeName, !BuildConfiguration.bCheckExternalHeadersForModification, IncludePathsToSearch, IncludeFileSearchDictionary );)

                var IncludedFileList = new IncludedFilesSet();
                CPPEnvironment.FindAndCacheAllIncludedFiles(Target, SourceFile, BuildPlatform, CPPIncludeInfo, ref IncludedFileList, bOnlyCachedDependencies: bOnlyCachedDependencies);
                foreach (FileItem IncludedFile in IncludedFileList)
                {
                    Result.Add(IncludedFile);
                }

                // Update cache
                if (bUseFlatCPPIncludeDependencyCache && !bOnlyCachedDependencies)
                {
                    var Dependencies = new List <string>();
                    foreach (var IncludedFile in Result)
                    {
                        Dependencies.Add(IncludedFile.AbsolutePath);
                    }
                    string PCHName = SourceFile.PrecompiledHeaderIncludeFilename;
                    FlatCPPIncludeDependencyCache[Target].SetDependenciesForFile(SourceFile.AbsolutePath, PCHName, Dependencies);
                }
            }

            return(Result);
        }