Exemplo n.º 1
0
 // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
 //       program executable, so we want the application name to be the game name.  In the case of a modular
 //       binary, we use 'UnrealEngine' for our application name
 public STBuildEditor(
     string InGameName,
     STTargetPlatform InPlatform,
     STTargetConfiguration InConfiguration,
     TargetRules InRulesObject,
     List<string> InAdditionalDefinitions,
     string InRemoteRoot,
     List<OnlyModule> InOnlyModules,
     bool bInEditorRecompile)
     : base(InAppName: STBuildTarget.GetBinaryBaseName(
             InGameName,
             InRulesObject,
             InPlatform,
             InConfiguration,
             (InRulesObject.Type == TargetRules.TargetType.Editor) ? "Editor" : ""
             ),
         InGameName: InGameName,
         InPlatform: InPlatform,
         InConfiguration: InConfiguration,
         InRulesObject: InRulesObject,
         InAdditionalDefinitions: InAdditionalDefinitions,
         InRemoteRoot: InRemoteRoot,
         InOnlyModules: InOnlyModules,
         bInEditorRecompile: bInEditorRecompile)
 {
 }
 /// <summary>
 /// Allow various platform project generators to generate any special project properties if required
 /// </summary>
 /// <param name="InPlatform"></param>
 /// <returns></returns>
 public static bool GenerateGamePlatformSpecificProperties(STTargetPlatform InPlatform, STTargetConfiguration Configuration, TargetRules.TargetType TargetType, StringBuilder VCProjectFileContent, string RootDirectory, string TargetFilePath)
 {
     if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
     {
         ProjectGeneratorDictionary[InPlatform].GenerateGameProperties(Configuration, VCProjectFileContent, TargetType, RootDirectory, TargetFilePath); ;
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  *	Retrieve the UEBuildDeploy instance for the given TargetPlatform
  *
  *	@param	InPlatform			The UnrealTargetPlatform being built
  *
  *	@return	UEBuildDeploy		The instance of the build deploy
  */
 public static ISTBuildDeploy GetBuildDeploy(STTargetPlatform InPlatform)
 {
     if (BuildDeployDictionary.ContainsKey(InPlatform) == true)
     {
         return BuildDeployDictionary[InPlatform];
     }
     // A platform does not *have* to have a deployment handler...
     return null;
 }
 /**
  *	Retrieve the UEPlatformProjectGenerator instance for the given TargetPlatform
  *
  *	@param	InPlatform					The STTargetPlatform being built
  *	@param	bInAllowFailure				If true, do not throw an exception and return null
  *
  *	@return	UEPlatformProjectGenerator	The instance of the project generator
  */
 public static STPlatformProjectGenerator GetPlatformProjectGenerator(STTargetPlatform InPlatform, bool bInAllowFailure = false)
 {
     if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
     {
         return ProjectGeneratorDictionary[InPlatform];
     }
     if (bInAllowFailure == true)
     {
         return null;
     }
     throw new BuildException("GetPlatformProjectGenerator: No PlatformProjectGenerator found for {0}", InPlatform.ToString());
 }
Exemplo n.º 5
0
 /**
  *	Register the given platforms UEBuildDeploy instance
  *
  *	@param	InPlatform			The UnrealTargetPlatform to register with
  *	@param	InBuildDeploy		The UEBuildDeploy instance to use for the InPlatform
  */
 public static void RegisterBuildDeploy(STTargetPlatform InPlatform, ISTBuildDeploy InBuildDeploy)
 {
     if (BuildDeployDictionary.ContainsKey(InPlatform) == true)
     {
         Log.TraceWarning("RegisterBuildDeply Warning: Registering build deploy {0} for {1} when it is already set to {2}",
             InBuildDeploy.ToString(), InPlatform.ToString(), BuildDeployDictionary[InPlatform].ToString());
         BuildDeployDictionary[InPlatform] = InBuildDeploy;
     }
     else
     {
         BuildDeployDictionary.Add(InPlatform, InBuildDeploy);
     }
 }
Exemplo n.º 6
0
 // NOTE: If we're building a monolithic binary, then the game and engine code are linked together into one
 //       program executable, so we want the application name to be the game name.  In the case of a modular
 //       binary, we use 'UnrealEngine' for our application name
 public STBuildClient(
     string InGameName,
     STTargetPlatform InPlatform,
     STTargetConfiguration InConfiguration,
     TargetRules InRulesObject,
     List<string> InAdditionalDefinitions,
     string InRemoteRoot,
     List<OnlyModule> InOnlyModules,
     bool bInEditorRecompile)
     : base(InAppName: STBuildTarget.GetBinaryBaseName(InGameName, InRulesObject, InPlatform, InConfiguration, "Client"),
         InGameName: InGameName,
         InPlatform: InPlatform,
         InConfiguration: InConfiguration,
         InRulesObject: InRulesObject,
         InAdditionalDefinitions: InAdditionalDefinitions,
         InRemoteRoot: InRemoteRoot,
         InOnlyModules: InOnlyModules,
         bInEditorRecompile: bInEditorRecompile)
 {
     if (ShouldCompileMonolithic())
     {
         if ((STBuildTool.IsDesktopPlatform(Platform) == false) ||
             (Platform == STTargetPlatform.WinRT) ||
             (Platform == STTargetPlatform.WinRT_ARM))
         {
             // We are compiling for a console...
             // We want the output to go into the <GAME>\Binaries folder
             if (InRulesObject.bOutputToEngineBinaries == false)
             {
                 for (int Index = 0; Index < OutputPaths.Length; Index++)
                 {
                     OutputPaths[Index] = OutputPaths[Index].Replace("Engine\\Binaries", InGameName + "\\Binaries");
                 }
             }
         }
     }
 }
 /**
  *	Register the given platforms UEPlatformProjectGenerator instance
  *
  *	@param	InPlatform			The STTargetPlatform to register with
  *	@param	InProjectGenerator	The UEPlatformProjectGenerator instance to use for the InPlatform
  */
 public static void RegisterPlatformProjectGenerator(STTargetPlatform InPlatform, STPlatformProjectGenerator InProjectGenerator)
 {
     // Make sure the build platform is legal
     var BuildPlatform = STBuildPlatform.GetBuildPlatform(InPlatform, true);
     if (BuildPlatform != null)
     {
         if (ProjectGeneratorDictionary.ContainsKey(InPlatform) == true)
         {
             Log.TraceInformation("RegisterPlatformProjectGenerator Warning: Registering project generator {0} for {1} when it is already set to {2}",
                 InProjectGenerator.ToString(), InPlatform.ToString(), ProjectGeneratorDictionary[InPlatform].ToString());
             ProjectGeneratorDictionary[InPlatform] = InProjectGenerator;
         }
         else
         {
             ProjectGeneratorDictionary.Add(InPlatform, InProjectGenerator);
         }
     }
     else
     {
         Log.TraceVerbose("Skipping project file generator registration for {0} due to no valid BuildPlatform.", InPlatform.ToString());
     }
 }
 ///
 ///	VisualStudio project generation functions
 ///	
 /**
  *	Whether this build platform has native support for VisualStudio
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *	@param	InConfiguration		The STTargetConfiguration being built
  *
  *	@return	bool				true if native VisualStudio support (or custom VSI) is available
  */
 public virtual bool HasVisualStudioSupport(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration)
 {
     // By default, we assume this is true
     return true;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Checks to see if the specified solution platform and configuration is able to map to this project
        /// </summary>
        /// <param name="ProjectTarget">The target that we're checking for a valid platform/config combination</param>
        /// <param name="Platform">Platform</param>
        /// <param name="Configuration">Configuration</param>
        /// <returns>True if this is a valid combination for this project, otherwise false</returns>
        public static bool IsValidProjectPlatformAndConfiguration(ProjectTarget ProjectTarget, STTargetPlatform Platform, STTargetConfiguration Configuration)
        {
            var PlatformProjectGenerator = STPlatformProjectGenerator.GetPlatformProjectGenerator(Platform, true);
            if (PlatformProjectGenerator == null)
            {
                return false;
            }

            var BuildPlatform = STBuildPlatform.GetBuildPlatform(Platform, true);
            if (BuildPlatform == null)
            {
                return false;
            }

            if (BuildPlatform.HasRequiredSDKsInstalled() != SDKStatus.Valid)
            {
                return false;
            }

            var SupportedConfigurations = new List<STTargetConfiguration>();
            var SupportedPlatforms = new List<STTargetPlatform>();
            if (!ProjectFileGenerator.bCreateDummyConfigsForUnsupportedPlatforms || ProjectFileGenerator.bGeneratingRocketProjectFiles)
            {
                if (ProjectTarget.TargetRules != null)
                {
                    ProjectTarget.TargetRules.GetSupportedPlatforms(ref SupportedPlatforms);
                }
            }
            else
            {
                STBuildTool.GetAllPlatforms(ref SupportedPlatforms);
            }
            bool bIncludeTestAndShippingConfigs = ProjectFileGenerator.bIncludeTestAndShippingConfigs || ProjectFileGenerator.bGeneratingRocketProjectFiles;
            if (ProjectTarget.TargetRules != null)
            {
                // Rocket projects always get shipping configs
                ProjectTarget.TargetRules.GetSupportedConfigurations(ref SupportedConfigurations, bIncludeTestAndShippingConfigs: bIncludeTestAndShippingConfigs);
            }

            // Add all of the extra platforms/configurations for this target
            {
                foreach (var ExtraPlatform in ProjectTarget.ExtraSupportedPlatforms)
                {
                    if (!SupportedPlatforms.Contains(ExtraPlatform))
                    {
                        SupportedPlatforms.Add(ExtraPlatform);
                    }
                }
                foreach (var ExtraConfig in ProjectTarget.ExtraSupportedConfigurations)
                {
                    if (bIncludeTestAndShippingConfigs || (ExtraConfig != STTargetConfiguration.Shipping && ExtraConfig != STTargetConfiguration.Test))
                    {
                        if (!SupportedConfigurations.Contains(ExtraConfig))
                        {
                            SupportedConfigurations.Add(ExtraConfig);
                        }
                    }
                }
            }

            // Only build for supported platforms
            if (SupportedPlatforms.Contains(Platform) == false)
            {
                return false;
            }

            // Only build for supported configurations
            if (SupportedConfigurations.Contains(Configuration) == false)
            {
                return false;
            }

            // For Rocket projects, we currently only allow 64-bit versions of Debug and Development binaries to be compiled
            // and only 32-bit versions of Shipping binaries to be compiled.  This has to do with our choice of which build
            // configurations we want to ship with that product.  So to simplify things, we're merging Win32 and Win64
            // configurations together in the IDE under "Windows".  In order for this to work properly, we need to make
            // sure that Rocket projects only report the respective Windows platform that is valid for each configuration
            if (STBuildTool.RunningRocket() && ProjectTarget.TargetRules != null)
            {
                if (Platform == STTargetPlatform.Win32 || Platform == STTargetPlatform.Win64)
                {
                    // In Rocket, shipping game targets are always 32-bit
                    if (Configuration == STTargetConfiguration.Shipping && ProjectTarget.TargetRules.Type == TargetRules.TargetType.Game)
                    {
                        if (Platform != STTargetPlatform.Win32)
                        {
                            return false;
                        }
                    }
                    else
                    {
                        // Everything else is expecting to be 64-bit
                        if (Platform != STTargetPlatform.Win64)
                        {
                            return false;
                        }
                    }
                }
            }

            return true;
        }
Exemplo n.º 10
0
        /// <summary>
        /// Given a target platform and configuration, generates a platform and configuration name string to use in Visual Studio projects.
        /// Unlike with solution configurations, Visual Studio project configurations only support certain types of platforms, so we'll
        /// generate a configuration name that has the platform "built in", and use a default platform type
        /// </summary>
        /// <param name="Platform">Actual platform</param>
        /// <param name="Configuration">Actual configuration</param>
        /// <param name="TargetConfigurationName">The configuration name from the target rules, or null if we don't have one</param>
        /// <param name="ProjectPlatformName">Name of platform string to use for Visual Studio project</param>
        /// <param name="ProjectConfigurationName">Name of configuration string to use for Visual Studio project</param>
        public void MakeProjectPlatformAndConfigurationNames(STTargetPlatform Platform, STTargetConfiguration Configuration, string TargetConfigurationName, out string ProjectPlatformName, out string ProjectConfigurationName)
        {
            if (IsStubProject)
            {
                if (Platform != STTargetPlatform.Unknown || Configuration != STTargetConfiguration.Unknown)
                {
                    throw new BuildException("Stub project was expecting platform and configuration type to be set to Unknown");
                }
                ProjectPlatformName = StubProjectPlatformName;
                ProjectConfigurationName = StubProjectConfigurationName;
            }
            else
            {
                // If this is a C# project, then the project platform name must always be "Any CPU"
                if (this is VCSharpProjectFile)
                {
                    ProjectConfigurationName = Configuration.ToString();
                    ProjectPlatformName = VCProjectFileGenerator.DotNetPlatformName;
                }
                else
                {
                    var PlatformProjectGenerator = STPlatformProjectGenerator.GetPlatformProjectGenerator(Platform, bInAllowFailure: true);

                    // Check to see if this platform is supported directly by Visual Studio projects.
                    bool HasActualVSPlatform = (PlatformProjectGenerator != null) ? PlatformProjectGenerator.HasVisualStudioSupport(Platform, Configuration) : false;

                    if (HasActualVSPlatform)
                    {
                        // Great!  Visual Studio supports this platform natively, so we don't need to make up
                        // a fake project configuration name.

                        // Allow the platform to specify the name used in VisualStudio.
                        // Note that the actual name of the platform on the Visual Studio side may be different than what
                        // STBuildTool calls it (e.g. "Win64" -> "x64".) GetVisualStudioPlatformName() will figure this out.
                        ProjectConfigurationName = Configuration.ToString();
                        ProjectPlatformName = PlatformProjectGenerator.GetVisualStudioPlatformName(Platform, Configuration);
                    }
                    else
                    {
                        // Visual Studio doesn't natively support this platform, so we fake it by mapping it to
                        // a project configuration that has the platform name in that configuration as a suffix,
                        // and then using "Win32" as the actual VS platform name
                        ProjectConfigurationName = ProjectConfigurationNameOverride == "" ? Platform.ToString() + "_" + Configuration.ToString() : ProjectConfigurationNameOverride;
                        ProjectPlatformName = ProjectPlatformNameOverride == "" ? VCProjectFileGenerator.DefaultPlatformName : ProjectPlatformNameOverride;
                    }

                    if (!String.IsNullOrEmpty(TargetConfigurationName))
                    {
                        ProjectConfigurationName += "_" + TargetConfigurationName;
                    }
                }
            }
        }
 /// <summary>
 /// Get the text to insert into the user file for the given platform/configuration/target
 /// </summary>
 /// <param name="InPlatform">The platform being added</param>
 /// <param name="InConfiguration">The configuration being added</param>
 /// <param name="InConditionString">The condition string </param>
 /// <param name="InTargetRules">The target rules </param>
 /// <param name="TargetRulesPath">The target rules path</param>
 /// <param name="ProjectFilePath">The project file path</param>
 /// <returns>The string to append to the user file</returns>
 public virtual string GetVisualStudioUserFileStrings(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration,
     string InConditionString, TargetRules InTargetRules, string TargetRulesPath, string ProjectFilePath)
 {
     return "";
 }
Exemplo n.º 12
0
 // @todo projectfiles: Move this into the ProjectPlatformGeneration class?
 /// <summary>
 /// IsDesktopPlatform
 /// </summary>
 /// <param name="InPlatform">The platform of interest</param>
 /// <returns>True if the given platform is a 'desktop' platform</returns>
 public static bool IsDesktopPlatform(STTargetPlatform InPlatform)
 {
     // Windows and Mac are desktop platforms.
     return (
         (InPlatform == STTargetPlatform.Win64) ||
         (InPlatform == STTargetPlatform.Win32) ||
         (InPlatform == STTargetPlatform.Linux) ||
         (InPlatform == STTargetPlatform.Mac)
         );
 }
Exemplo n.º 13
0
 // @todo projectfiles: Move this into the ProjectPlatformGeneration class?
 /// <summary>
 /// IsServerPlatform
 /// </summary>
 /// <param name="InPlatform">The platform of interest</param>
 /// <returns>True if the given platform is a 'server' platform</returns>
 public static bool IsServerPlatform(STTargetPlatform InPlatform)
 {
     // Windows, Mac, and Linux are desktop platforms.
     return (
         (InPlatform == STTargetPlatform.Win64) ||
         (InPlatform == STTargetPlatform.Win32) ||
         (InPlatform == STTargetPlatform.Mac) ||
         (InPlatform == STTargetPlatform.WinRT) ||
         (InPlatform == STTargetPlatform.Linux)
         );
 }
        /**
         * Return any custom paths for VisualStudio this platform requires
         * This include ReferencePath, LibraryPath, LibraryWPath, IncludePath and ExecutablePath.
         *
         *	@param	InPlatform			The STTargetPlatform being built
         *	@param	TargetType			The type of target (game or program)
         *
         *	@return	string				The custom path lines for the project file; Empty string if it doesn't require one
         */
        public virtual string GetVisualStudioPathsEntries(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration, TargetRules.TargetType TargetType, string TargetRulesPath, string ProjectFilePath, string NMakeOutputPath)
        {
            // NOTE: We are intentionally overriding defaults for these paths with empty strings.  We never want Visual Studio's
            //       defaults for these fields to be propagated, since they are version-sensitive paths that may not reflect
            //       the environment that UBT is building in.  We'll set these environment variables ourselves!
            // NOTE: We don't touch 'ExecutablePath' because that would result in Visual Studio clobbering the system "Path"
            //       environment variable
            string PathsLines =
                "		<IncludePath />\n" +
                "		<ReferencePath />\n" +
                "		<LibraryPath />\n" +
                "		<LibraryWPath />\n" +
                "		<SourcePath />\n" +
                "		<ExcludePath />\n";

            return PathsLines;
        }
 /**
  * Return any custom property group lines
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *
  *	@return	string				The platform configuration type.  Defaults to "Makefile" unless overridden
  */
 public virtual string GetVisualStudioPlatformConfigurationType(STTargetPlatform InPlatform)
 {
     return "Makefile";
 }
 /**
  * Return any custom layout directory sections
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *	@param	TargetType			The type of target (game or program)
  *
  *	@return	string				The custom property import lines for the project file; Empty string if it doesn't require one
  */
 public virtual string GetVisualStudioLayoutDirSection(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration, string InConditionString, TargetRules.TargetType TargetType, string TargetRulesPath, string ProjectFilePath)
 {
     return "";
 }
 /**
  *	Get the output manifest section, if required
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *
  *	@return	string				The output manifest section for the project file; Empty string if it doesn't require one
  */
 public virtual string GetVisualStudioOutputManifestSection(STTargetPlatform InPlatform, TargetRules.TargetType TargetType, string TargetRulesPath, string ProjectFilePath)
 {
     return "";
 }
 /**
  * Get whether this platform deploys
  *
  * @return	bool		true if the 'Deploy' option should be enabled
  */
 public virtual bool GetVisualStudioDeploymentEnabled(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration)
 {
     return false;
 }
 /**
  * Return any custom property group lines
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *
  *	@return	string				The custom property import lines for the project file; Empty string if it doesn't require one
  */
 public virtual string GetAdditionalVisualStudioPropertyGroups(STTargetPlatform InPlatform)
 {
     return "";
 }
 /**
  * Return any custom property import lines
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *
  *	@return	string				The custom property import lines for the project file; Empty string if it doesn't require one
  */
 public virtual string GetAdditionalVisualStudioImportSettings(STTargetPlatform InPlatform)
 {
     return "";
 }
Exemplo n.º 21
0
        /**
         * Find all third party and private header includes in public engine headers.
         **/
        public static void FindThirdPartyIncludes(STTargetPlatform Platform, STTargetConfiguration Configuration)
        {
            Log.TraceInformation("Looking for third party header includes in public engine header files (this may take a few minutes)...");

            TargetInfo Target = new TargetInfo(Platform, Configuration);
            List<string> UncheckedModules = new List<string>();
            EngineHeaders = new List<Header>();
            ThirdPartyHeaders = new List<Header>();

            // Find all modules referenced by the current target
            List<string> ModuleFileNames = RulesCompiler.FindAllRulesSourceFiles(RulesCompiler.RulesFileType.Module, AdditionalSearchPaths: null);
            foreach (string ModuleFileName in ModuleFileNames)
            {
                string ModuleName = Path.GetFileNameWithoutExtension(Path.GetFileNameWithoutExtension(ModuleFileName));
                try
                {
                    string UnusedModuleFilename;
                    ModuleRules RulesObject = RulesCompiler.CreateModuleRules(ModuleName, Target, out UnusedModuleFilename);
                    bool bEngineHeaders = RulesObject.Type != ModuleRules.ModuleType.External;
                    foreach (string SystemIncludePath in RulesObject.PublicSystemIncludePaths)
                    {
                        FindHeaders(SystemIncludePath, bEngineHeaders ? EngineHeaders : ThirdPartyHeaders, bEngineHeaders);
                    }
                    foreach (string PublicIncludePath in RulesObject.PublicIncludePaths)
                    {
                        FindHeaders(PublicIncludePath, bEngineHeaders ? EngineHeaders : ThirdPartyHeaders, bEngineHeaders);
                    }
                }
                catch (Exception)
                {
                    // Ignore, some modules may fail here.
                    UncheckedModules.Add(ModuleName);
                }
            }

            // Search for illegal includes.
            List<IncludePath> ThirdPartyIncludes = new List<IncludePath>();
            List<IncludePath> PrivateIncludes = new List<IncludePath>();
            CheckIfThirdPartyHeadersAreIncluded(ThirdPartyIncludes, PrivateIncludes);

            // List all of the included 3rd party headers unless their name matches with any of the engine header.
            if (ThirdPartyIncludes.Count > 0)
            {
                // Remove ambiguous headers
                for (int IncludeIndex = ThirdPartyIncludes.Count - 1; IncludeIndex >= 0; --IncludeIndex)
                {
                    if (FindHeader(EngineHeaders, ThirdPartyIncludes[IncludeIndex].OtherHeader.Name) != null)
                    {
                        ThirdPartyIncludes.RemoveAt(IncludeIndex);
                    }
                }
                if (ThirdPartyIncludes.Count > 0)
                {
                    Log.TraceInformation("Warning: Found {0} third party header includes in public engine headers. Third party headers should only be included in private engine headers.", ThirdPartyIncludes.Count);
                    foreach (IncludePath HeaderPath in ThirdPartyIncludes)
                    {
                        if (FindHeader(EngineHeaders, HeaderPath.OtherHeader.Name) == null)
                        {
                            Log.TraceInformation("{0} includes {1}.", HeaderPath.PublicHeaderPath, HeaderPath.OtherHeader.Path);
                        }
                    }
                }
            }

            // List all private engine headers included from public engine headers
            if (PrivateIncludes.Count > 0)
            {
                Log.TraceInformation("Warning: Found {0} private engine header includes in public engine headers. Private engine headers should not be included in public engine headers.", PrivateIncludes.Count);
            }
            foreach (IncludePath HeaderPath in PrivateIncludes)
            {
                Log.TraceInformation("{0} includes {1}.", HeaderPath.PublicHeaderPath, HeaderPath.OtherHeader.Path);
            }
            if (PrivateIncludes.Count == 0 && ThirdPartyIncludes.Count == 0)
            {
                Log.TraceInformation("Finished looking for third party includes. Nothing found.");
            }
            if (UncheckedModules.Count > 0)
            {
                Log.TraceInformation("Warning: The following modules could not be checked (exception while trying to create ModuleRules object):");
                for (int ModuleIndex = 0; ModuleIndex < UncheckedModules.Count; ++ModuleIndex)
                {
                    Log.TraceInformation("  {0}", UncheckedModules[ModuleIndex]);
                }
            }
        }
Exemplo n.º 22
0
 /// <summary>
 /// Is this a valid platform
 /// Used primarily for Rocket vs non-Rocket
 /// </summary>
 /// <param name="InPlatform"></param>
 /// <returns>true if valid, false if not</returns>
 public static bool IsValidPlatform(STTargetPlatform InPlatform)
 {
     if (RunningRocket())
     {
         if (Utils.IsRunningOnMono)
         {
             if (InPlatform != STTargetPlatform.Mac && InPlatform != STTargetPlatform.IOS && InPlatform != STTargetPlatform.Linux)
             {
                 return false;
             }
         }
         else
         {
             if (InPlatform != STTargetPlatform.Win32 && InPlatform != STTargetPlatform.Win64 && InPlatform != STTargetPlatform.Android)
             {
                 return false;
             }
         }
     }
     return true;
 }
Exemplo n.º 23
0
        private static int Main(string[] Arguments)
        {
            InitLogging();
            Log.TraceVerbose(Environment.CommandLine);

            try
            {
                XmlConfigLoader.Init();
            }
            catch (BuildException Exception)
            {
                Log.TraceError("STBuildTool Exception: " + Exception);
                return (int)ECompilationResult.OtherCompilationError;
            }

            InitialEnvironment = Environment.GetEnvironmentVariables();
            if (InitialEnvironment.Count < 1)
            {
                throw new BuildException("Environment could not be read");
            }
            // Helpers used for stats tracking.
            StartTime = DateTime.UtcNow;

            Telemetry.Initialize();

            // Copy off the arguments to allow checking for command-line arguments elsewhere
            CmdLine = new List<string>(Arguments);

            foreach (string Arg in Arguments)
            {
                string TempGameName = null;
                if (ParseRocketCommandlineArg(Arg, ref TempGameName) == true)
                {
                    // This is to allow relative paths for the project file
                    Log.TraceVerbose("UBT Running for Rocket: " + UProjectFile);
                }
            }

            // Change the working directory to be the Engine/Source folder. We are running from Engine/Binaries/DotNET
            string EngineSourceDirectory = Path.Combine(Utils.GetExecutingAssemblyDirectory(), "..", "..", "STEngine", "Source");

            //@todo.Rocket: This is a workaround for recompiling game code in editor
            // The working directory when launching is *not* what we would expect
            if (Directory.Exists(EngineSourceDirectory) == false)
            {
                // We are assuming UBT always runs from <>/Engine/...
                EngineSourceDirectory = Path.GetDirectoryName(Utils.GetExecutingAssemblyLocation());
                EngineSourceDirectory = EngineSourceDirectory.Replace("\\", "/");
                Int32 EngineIdx = EngineSourceDirectory.IndexOf("/STEngine/");
                if (EngineIdx != 0)
                {
                    EngineSourceDirectory = EngineSourceDirectory.Substring(0, EngineIdx + 10);
                    EngineSourceDirectory += "Source";
                }
            }
            if (Directory.Exists(EngineSourceDirectory)) // only set the directory if it exists, this should only happen if we are launching the editor from an artist sync
            {
                Directory.SetCurrentDirectory(EngineSourceDirectory);
            }

            // Build the list of game projects that we know about. When building from the editor (for hot-reload) or for Rocket projects, we require the
            // project file to be passed in. Otherwise we scan for projects in directories named in UE4Games.uprojectdirs.
            if (HasUProjectFile())
            {
                string SourceFolder = Path.Combine(Path.GetDirectoryName(GetUProjectFile()), "Source");
                UProjectInfo.AddProject(GetUProjectFile(), Directory.Exists(SourceFolder));
            }
            else if (!RunningRocket())
            {
                UProjectInfo.FillProjectInfo();
            }

            var BasicInitStartTime = DateTime.UtcNow;

            ECompilationResult Result = ECompilationResult.Succeeded;

            // Reset early so we can access BuildConfiguration even before RunUBT() is called
            XmlConfigLoader.Reset<BuildConfiguration>();
            XmlConfigLoader.Reset<STBuildConfiguration>();

            Log.TraceVerbose("STBuildTool (DEBUG OUTPUT MODE)");
            Log.TraceVerbose("Command-line: {0}", String.Join(" ", Arguments));

            bool bRunCopyrightVerification = false;
            bool bDumpToFile = false;
            bool bCheckThirdPartyHeaders = false;
            bool bIgnoreJunk = false;

            // @todo: Ideally we never need to Mutex unless we are invoked with the same target project,
            // in the same branch/path!  This would allow two clientspecs to build at the same time (even though we need
            // to make sure that XGE is only used once at a time)
            bool bUseMutex = true;
            {
                int NoMutexArgumentIndex;
                if (Utils.ParseCommandLineFlag(Arguments, "-NoMutex", out NoMutexArgumentIndex))
                {
                    bUseMutex = false;
                }
            }

            bool bAutoSDKOnly = false;
            {
                int AutoSDKOnlyArgumentIndex;
                if (Utils.ParseCommandLineFlag(Arguments, "-autosdkonly", out AutoSDKOnlyArgumentIndex))
                {
                    bAutoSDKOnly = true;
                    bIgnoreJunk = true;
                }
            }
            bool bValidatePlatforms = false;
            {
                int ValidatePlatformsArgumentIndex;
                if (Utils.ParseCommandLineFlag(Arguments, "-validateplatform", out ValidatePlatformsArgumentIndex))
                {
                    bValidatePlatforms = true;
                    bIgnoreJunk = true;
                }
            }

            // Don't allow simultaneous execution of Unreal Built Tool. Multi-selection in the UI e.g. causes this and you want serial
            // execution in this case to avoid contention issues with shared produced items.
            bool bCreatedMutex = false;
            {
                Mutex SingleInstanceMutex = null;
                if (bUseMutex)
                {
                    int LocationHash = Utils.GetExecutingAssemblyLocation().GetHashCode();

                    String MutexName;
                    if (bAutoSDKOnly || bValidatePlatforms)
                    {
                        // this mutex has to be truly global because AutoSDK installs may change global state (like a console copying files into VS directories,
                        // or installing Target Management services
                        MutexName = "Global/STBuildTool_Mutex_AutoSDKS";
                    }
                    else
                    {
                        MutexName = "Global/STBuildTool_Mutex_" + LocationHash.ToString();
                    }
                    SingleInstanceMutex = new Mutex(true, MutexName, out bCreatedMutex);
                    if (!bCreatedMutex)
                    {
                        // If this instance didn't create the mutex, wait for the existing mutex to be released by the mutex's creator.
                        DateTime MutexWaitStartTime = DateTime.UtcNow;
                        SingleInstanceMutex.WaitOne();
                        MutexWaitTime = DateTime.UtcNow - MutexWaitStartTime;
                    }
                }

                try
                {
                    string GameName = null;
                    var bGenerateVCProjectFiles = false;
                    var bGenerateXcodeProjectFiles = false;
                    var bGenerateMakefiles = false;
                    var bGenerateCMakefiles = false;
                    var bGenerateQMakefiles = false;
                    var bValidPlatformsOnly = false;
                    var bSpecificModulesOnly = false;

                    // We need to be able to identify if one of the arguments is the platform...
                    // Leverage the existing parser function in STBuildTarget to get this information.
                    STTargetPlatform CheckPlatform;
                    STTargetConfiguration CheckConfiguration;
                    STBuildTarget.ParsePlatformAndConfiguration(Arguments, out CheckPlatform, out CheckConfiguration, false);
                    //@todo SAS: Add a true Debug mode!
                    if (RunningRocket())
                    {
                        // Only Development and Shipping are supported for engine modules
                        if (CheckConfiguration != STTargetConfiguration.Development && CheckConfiguration != STTargetConfiguration.Shipping)
                        {
                            CheckConfiguration = STTargetConfiguration.Development;
                        }
                    }

                    // If we were asked to enable fast build iteration, we want the 'gather' phase to default to off (unless it is overridden below
                    // using a command-line option.)
                    if (BuildConfiguration.bUseExperimentalFastBuildIteration)
                    {
                        bIsGatheringBuild_Unsafe = false;
                    }

                    foreach (var Arg in Arguments)
                    {
                        string LowercaseArg = Arg.ToLowerInvariant();
                        const string OnlyPlatformSpecificForArg = "-onlyplatformspecificfor=";
                        const string UCAUsageThresholdString = "-ucausagethreshold=";
                        const string UCAModuleToAnalyzeString = "-ucamoduletoanalyze=";
                        if (ParseRocketCommandlineArg(Arg, ref GameName))
                        {
                            // Already handled at startup. Calling now just to properly set the game name
                            continue;
                        }
                        else if (LowercaseArg == "-skipnonhostplatforms")
                        {
                            bSkipNonHostPlatforms = true;
                        }
                        else if (LowercaseArg.StartsWith(OnlyPlatformSpecificForArg))
                        {
                            string OtherPlatform = LowercaseArg.Substring(OnlyPlatformSpecificForArg.Length);
                            foreach (STTargetPlatform platform in Enum.GetValues(typeof(STTargetPlatform)))
                            {
                                if (OtherPlatform == platform.ToString().ToLowerInvariant())
                                {
                                    OnlyPlatformSpecificFor = platform;
                                }
                            }
                            if (OnlyPlatformSpecificFor == STTargetPlatform.Unknown)
                            {
                                throw new BuildException("Could not parse {0}", LowercaseArg);
                            }
                        }
                        else if (LowercaseArg.StartsWith("-makefile"))
                        {
                            bGenerateMakefiles = true;
                            ProjectFileGenerator.bGenerateProjectFiles = true;
                        }
                        else if (LowercaseArg.StartsWith("-cmakefile"))
                        {
                            bGenerateCMakefiles = true;
                            ProjectFileGenerator.bGenerateProjectFiles = true;
                        }
                        else if (LowercaseArg.StartsWith("-qmakefile"))
                        {
                            bGenerateQMakefiles = true;
                            ProjectFileGenerator.bGenerateProjectFiles = true;
                        }
                        else if (LowercaseArg.StartsWith("-projectfile"))
                        {
                            bGenerateVCProjectFiles = true;
                            ProjectFileGenerator.bGenerateProjectFiles = true;
                        }
                        else if (LowercaseArg.StartsWith("-xcodeprojectfile"))
                        {
                            bGenerateXcodeProjectFiles = true;
                            ProjectFileGenerator.bGenerateProjectFiles = true;
                        }
                        else if (LowercaseArg == "-validplatformsonly")
                        {
                            bValidPlatformsOnly = true;
                        }
                        else if (LowercaseArg == "development" || LowercaseArg == "debug" || LowercaseArg == "shipping" || LowercaseArg == "test" || LowercaseArg == "debuggame")
                        {
                            //ConfigName = Arg;
                        }
                        else if (LowercaseArg == "-modulewithsuffix")
                        {
                            bSpecificModulesOnly = true;
                            continue;
                        }
                        else if (LowercaseArg == "-forceheadergeneration")
                        {
                            // Don't reset this as we don't recheck the args in RunUBT
                            STBuildConfiguration.bForceHeaderGeneration = true;
                        }
                        else if (LowercaseArg == "-nobuilduht")
                        {
                            STBuildConfiguration.bDoNotBuildUHT = true;
                        }
                        else if (LowercaseArg == "-failifgeneratedcodechanges")
                        {
                            STBuildConfiguration.bFailIfGeneratedCodeChanges = true;
                        }
                        else if (LowercaseArg == "-copyrightverification")
                        {
                            bRunCopyrightVerification = true;
                        }
                        else if (LowercaseArg == "-dumptofile")
                        {
                            bDumpToFile = true;
                        }
                        else if (LowercaseArg == "-check3rdpartyheaders")
                        {
                            bCheckThirdPartyHeaders = true;
                        }
                        else if (LowercaseArg == "-clean")
                        {
                            STBuildConfiguration.bCleanProject = true;
                        }
                        else if (LowercaseArg == "-prepfordeploy")
                        {
                            STBuildConfiguration.bPrepForDeployment = true;
                        }
                        else if (LowercaseArg == "-generateexternalfilelist")
                        {
                            STBuildConfiguration.bGenerateExternalFileList = true;
                        }
                        else if (LowercaseArg == "-mergeexternalfilelist")
                        {
                            STBuildConfiguration.bMergeExternalFileList = true;
                        }
                        else if (LowercaseArg == "-generatemanifest")
                        {
                            // Generate a manifest file containing all the files required to be in Perforce
                            STBuildConfiguration.bGenerateManifest = true;
                        }
                        else if (LowercaseArg == "-mergemanifests")
                        {
                            // Whether to add to the existing manifest (if it exists), or start afresh
                            STBuildConfiguration.bMergeManifests = true;
                        }
                        else if (LowercaseArg == "-noxge")
                        {
                            BuildConfiguration.bAllowXGE = false;
                        }
                        else if (LowercaseArg == "-xgeexport")
                        {
                            BuildConfiguration.bXGEExport = true;
                            BuildConfiguration.bAllowXGE = true;
                        }
                        else if (LowercaseArg == "-gather")
                        {
                            STBuildTool.bIsGatheringBuild_Unsafe = true;
                        }
                        else if (LowercaseArg == "-nogather")
                        {
                            STBuildTool.bIsGatheringBuild_Unsafe = false;
                        }
                        else if (LowercaseArg == "-gatheronly")
                        {
                            STBuildTool.bIsGatheringBuild_Unsafe = true;
                            STBuildTool.bIsAssemblingBuild_Unsafe = false;
                        }
                        else if (LowercaseArg == "-assemble")
                        {
                            STBuildTool.bIsAssemblingBuild_Unsafe = true;
                        }
                        else if (LowercaseArg == "-noassemble")
                        {
                            STBuildTool.bIsAssemblingBuild_Unsafe = false;
                        }
                        else if (LowercaseArg == "-assembleonly")
                        {
                            STBuildTool.bIsGatheringBuild_Unsafe = false;
                            STBuildTool.bIsAssemblingBuild_Unsafe = true;
                        }
                        else if (LowercaseArg == "-nosimplygon")
                        {
                            STBuildConfiguration.bCompileSimplygon = false;
                        }
                        else if (LowercaseArg == "-nospeedtree")
                        {
                            STBuildConfiguration.bCompileSpeedTree = false;
                        }
                        else if (LowercaseArg == "-ignorejunk")
                        {
                            bIgnoreJunk = true;
                        }
                        else if (LowercaseArg == "-define")
                        {
                            // Skip -define
                        }
                        else if (LowercaseArg == "-progress")
                        {
                            ProgressWriter.bWriteMarkup = true;
                        }
                        else if (LowercaseArg == "-canskiplink")
                        {
                            STBuildConfiguration.bSkipLinkingWhenNothingToCompile = true;
                        }
                        else if (LowercaseArg == "-nocef3")
                        {
                            STBuildConfiguration.bCompileCEF3 = false;
                        }
                        else if (LowercaseArg == "-rununrealcodeanalyzer")
                        {
                            BuildConfiguration.bRunUnrealCodeAnalyzer = true;
                        }
                        else if (LowercaseArg.StartsWith(UCAUsageThresholdString))
                        {
                            string UCAUsageThresholdValue = LowercaseArg.Substring(UCAUsageThresholdString.Length);
                            BuildConfiguration.UCAUsageThreshold = float.Parse(UCAUsageThresholdValue.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                        }
                        else if (LowercaseArg.StartsWith(UCAModuleToAnalyzeString))
                        {
                            BuildConfiguration.UCAModuleToAnalyze = LowercaseArg.Substring(UCAModuleToAnalyzeString.Length).Trim();
                        }
                        else if (CheckPlatform.ToString().ToLowerInvariant() == LowercaseArg)
                        {
                            // It's the platform set...
                            //PlatformName = Arg;
                        }
                        else
                        {
                            // This arg may be a game name. Check for the existence of a game folder with this name.
                            // "Engine" is not a valid game name.
                            if (LowercaseArg != "engine" && Arg.IndexOfAny(Path.GetInvalidPathChars()) == -1 &&
                                Directory.Exists(Path.Combine(ProjectFileGenerator.RootRelativePath, Arg, "Config")))
                            {
                                GameName = Arg;
                                Log.TraceVerbose("CommandLine: Found game name '{0}'", GameName);
                            }
                            else if (LowercaseArg == "rocket")
                            {
                                GameName = Arg;
                                Log.TraceVerbose("CommandLine: Found game name '{0}'", GameName);
                            }
                        }
                    }

                    if (!bIsGatheringBuild_Unsafe && !bIsAssemblingBuild_Unsafe)
                    {
                        throw new BuildException("STBuildTool: At least one of either IsGatheringBuild or IsAssemblingBuild must be true.  Did you pass '-NoGather' with '-NoAssemble'?");
                    }

                    if (BuildConfiguration.bRunUnrealCodeAnalyzer && (BuildConfiguration.UCAModuleToAnalyze == null || BuildConfiguration.UCAModuleToAnalyze.Length == 0))
                    {
                        throw new BuildException("When running UnrealCodeAnalyzer, please specify module to analyze in UCAModuleToAnalyze field in BuildConfiguration.xml");
                    }

                    // Send an event with basic usage dimensions
                    // [RCL] 2014-11-03 FIXME: this is incorrect since we can have more than one action
                    Telemetry.SendEvent("CommonAttributes.2",
                        // @todo No platform independent way to do processor speed and count. Defer for now. Mono actually has ways to do this but needs to be tested.
                        "ProcessorCount", Environment.ProcessorCount.ToString(),
                        "ComputerName", Environment.MachineName,
                        "User", Environment.UserName,
                        "Domain", Environment.UserDomainName,
                        "CommandLine", string.Join(" ", Arguments),
                        "UBT Action", bGenerateVCProjectFiles
                            ? "GenerateVCProjectFiles"
                            : bGenerateXcodeProjectFiles
                                ? "GenerateXcodeProjectFiles"
                                : bRunCopyrightVerification
                                    ? "RunCopyrightVerification"
                                    : bGenerateMakefiles
                                        ? "GenerateMakefiles"
                                        : bGenerateCMakefiles
                                            ? "GenerateCMakeFiles"
                                            : bGenerateQMakefiles
                                                ? "GenerateQMakefiles"
                                                : bValidatePlatforms
                                                    ? "ValidatePlatfomrs"
                                                    : "Build",
                        "Platform", CheckPlatform.ToString(),
                        "Configuration", CheckConfiguration.ToString(),
                        "IsRocket", bRunningRocket.ToString(),
                        "EngineVersion", Utils.GetEngineVersionFromObjVersionCPP().ToString()
                        );

                    if (bValidPlatformsOnly == true)
                    {
                        // We turned the flag on if generating projects so that the
                        // build platforms would know we are doing so... In this case,
                        // turn it off to only generate projects for valid platforms.
                        ProjectFileGenerator.bGenerateProjectFiles = false;
                    }

                    // Find and register all tool chains, build platforms, etc. that are present
                    RegisterAllUBTClasses();
                    ProjectFileGenerator.bGenerateProjectFiles = false;

                    if (BuildConfiguration.bPrintPerformanceInfo)
                    {
                        var BasicInitTime = (DateTime.UtcNow - BasicInitStartTime).TotalSeconds;
                        Log.TraceInformation("Basic UBT initialization took " + BasicInitTime + "s");
                    }

                    // now that we know the available platforms, we can delete other platforms' junk. if we're only building specific modules from the editor, don't touch anything else (it may be in use).
                    if (!bSpecificModulesOnly && !bIgnoreJunk)
                    {
                        JunkDeleter.DeleteJunk();
                    }

                    if (bGenerateVCProjectFiles || bGenerateXcodeProjectFiles || bGenerateMakefiles || bGenerateCMakefiles || bGenerateQMakefiles)
                    {
                        bool bGenerationSuccess = true;
                        if (bGenerateVCProjectFiles)
                        {
                            bGenerationSuccess &= GenerateProjectFiles(new VCProjectFileGenerator(), Arguments);
                        }
                        if (bGenerateXcodeProjectFiles)
                        {
                            bGenerationSuccess &= GenerateProjectFiles(new XcodeProjectFileGenerator(), Arguments);
                        }
                        if (bGenerateMakefiles)
                        {
                            bGenerationSuccess &= GenerateProjectFiles(new MakefileGenerator(), Arguments);
                        }
                        if (bGenerateCMakefiles)
                        {
                            bGenerationSuccess &= GenerateProjectFiles(new CMakefileGenerator(), Arguments);
                        }
                        if (bGenerateQMakefiles)
                        {
                            bGenerationSuccess &= GenerateProjectFiles(new QMakefileGenerator(), Arguments);
                        }

                        if (!bGenerationSuccess)
                        {
                            Result = ECompilationResult.OtherCompilationError;
                        }
                    }
                    else if (bRunCopyrightVerification)
                    {
                        CopyrightVerify.RunCopyrightVerification(EngineSourceDirectory, GameName, bDumpToFile);
                        Log.TraceInformation("Completed... exiting.");
                    }
                    else if (bAutoSDKOnly)
                    {
                        // RegisterAllUBTClasses has already done all the SDK setup.
                        Result = ECompilationResult.Succeeded;
                    }
                    else if (bValidatePlatforms)
                    {
                        ValidatePlatforms(Arguments);
                    }
                    else
                    {
                        // Check if any third party headers are included from public engine headers.
                        if (bCheckThirdPartyHeaders)
                        {
                            ThirdPartyHeaderFinder.FindThirdPartyIncludes(CheckPlatform, CheckConfiguration);
                        }

                        // Build our project
                        if (Result == ECompilationResult.Succeeded)
                        {
                            if (STBuildConfiguration.bPrepForDeployment == false)
                            {
                                int PassCount = 1;	// @todo ubtmake: It's useful to set this to a high number when running UBT under a sampling profiler
                                for (int PassIndex = 0; PassIndex < PassCount; ++PassIndex)
                                {
                                    // If we are only prepping for deployment, assume the build already occurred.
                                    Result = RunUBT(Arguments);
                                    if (Result != ECompilationResult.Succeeded)
                                    {
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                var BuildPlatform = STBuildPlatform.GetBuildPlatform(CheckPlatform, true);
                                if (BuildPlatform != null)
                                {
                                    // Setup environment wasn't called, so set the flag
                                    BuildConfiguration.bDeployAfterCompile = BuildPlatform.RequiresDeployPrepAfterCompile();
                                    BuildConfiguration.PlatformIntermediateFolder = Path.Combine(BuildConfiguration.BaseIntermediateFolder, CheckPlatform.ToString(), BuildPlatform.GetActiveArchitecture());
                                }
                            }

                            // If we build w/ bXGEExport true, we didn't REALLY build at this point,
                            // so don't bother with doing the PrepTargetForDeployment call.
                            if ((Result == ECompilationResult.Succeeded) && (BuildConfiguration.bDeployAfterCompile == true) && (BuildConfiguration.bXGEExport == false) &&
                                (STBuildConfiguration.bGenerateManifest == false) && (STBuildConfiguration.bGenerateExternalFileList == false) && (STBuildConfiguration.bCleanProject == false))
                            {
                                var DeployHandler = STBuildDeploy.GetBuildDeploy(CheckPlatform);
                                if (DeployHandler != null)
                                {
                                    // We need to be able to identify the Target.Type we can derive it from the Arguments.
                                    BuildConfiguration.bFlushBuildDirOnRemoteMac = false;
                                    var TargetDescs = STBuildTarget.ParseTargetCommandLine(Arguments);
                                    STBuildTarget CheckTarget = STBuildTarget.CreateTarget(TargetDescs[0]);	// @todo ubtmake: This may not work in assembler only mode.  We don't want to be loading target rules assemblies here either.
                                    CheckTarget.SetupGlobalEnvironment();
                                    if ((CheckTarget.TargetType == TargetRules.TargetType.Game) ||
                                        (CheckTarget.TargetType == TargetRules.TargetType.Server) ||
                                        (CheckTarget.TargetType == TargetRules.TargetType.Client))
                                    {
                                        CheckTarget.AppName = CheckTarget.GameName;
                                    }
                                    DeployHandler.PrepTargetForDeployment(CheckTarget);
                                }
                            }
                        }
                    }
                    // Print some performance info
                    var BuildDuration = (DateTime.UtcNow - StartTime - MutexWaitTime).TotalSeconds;
                    if (BuildConfiguration.bPrintPerformanceInfo)
                    {
                        Log.TraceInformation("GetIncludes time: " + CPPEnvironment.TotalTimeSpentGettingIncludes + "s (" + CPPEnvironment.TotalIncludesRequested + " includes)");
                        Log.TraceInformation("DirectIncludes cache miss time: " + CPPEnvironment.DirectIncludeCacheMissesTotalTime + "s (" + CPPEnvironment.TotalDirectIncludeCacheMisses + " misses)");
                        Log.TraceInformation("FindIncludePaths calls: " + CPPEnvironment.TotalFindIncludedFileCalls + " (" + CPPEnvironment.IncludePathSearchAttempts + " searches)");
                        Log.TraceInformation("PCH gen time: " + STBuildModuleCPP.TotalPCHGenTime + "s");
                        Log.TraceInformation("PCH cache time: " + STBuildModuleCPP.TotalPCHCacheTime + "s");
                        Log.TraceInformation("Deep C++ include scan time: " + STBuildTool.TotalDeepIncludeScanTime + "s");
                        Log.TraceInformation("Include Resolves: {0} ({1} misses, {2:0.00}%)", CPPEnvironment.TotalDirectIncludeResolves, CPPEnvironment.TotalDirectIncludeResolveCacheMisses, (float)CPPEnvironment.TotalDirectIncludeResolveCacheMisses / (float)CPPEnvironment.TotalDirectIncludeResolves * 100);
                        Log.TraceInformation("Total FileItems: {0} ({1} missing)", FileItem.TotalFileItemCount, FileItem.MissingFileItemCount);

                        Log.TraceInformation("Execution time: {0}s", BuildDuration);
                    }

                    Telemetry.SendEvent("PerformanceInfo.2",
                        "TotalExecutionTimeSec", BuildDuration.ToString("0.00"),
                        "MutexWaitTimeSec", MutexWaitTime.TotalSeconds.ToString("0.00"),
                        "TotalTimeSpentGettingIncludesSec", CPPEnvironment.TotalTimeSpentGettingIncludes.ToString("0.00"),
                        "TotalIncludesRequested", CPPEnvironment.TotalIncludesRequested.ToString(),
                        "DirectIncludeCacheMissesTotalTimeSec", CPPEnvironment.DirectIncludeCacheMissesTotalTime.ToString("0.00"),
                        "TotalDirectIncludeCacheMisses", CPPEnvironment.TotalDirectIncludeCacheMisses.ToString(),
                        "TotalFindIncludedFileCalls", CPPEnvironment.TotalFindIncludedFileCalls.ToString(),
                        "IncludePathSearchAttempts", CPPEnvironment.IncludePathSearchAttempts.ToString(),
                        "TotalFileItemCount", FileItem.TotalFileItemCount.ToString(),
                        "MissingFileItemCount", FileItem.MissingFileItemCount.ToString()
                        );
                }
                catch (Exception Exception)
                {
                    Log.TraceError("STBuildTool Exception: " + Exception);
                    Result = ECompilationResult.OtherCompilationError;
                }

                if (bUseMutex)
                {
                    // Release the mutex to avoid the abandoned mutex timeout.
                    SingleInstanceMutex.ReleaseMutex();
                    SingleInstanceMutex.Dispose();
                    SingleInstanceMutex = null;
                }
            }

            Telemetry.Shutdown();

            // Print some performance info
            Log.TraceVerbose("Execution time: {0}", (DateTime.UtcNow - StartTime - MutexWaitTime).TotalSeconds);

            return (int)Result;
        }
Exemplo n.º 24
0
 public bool IsEnabledForPlatform(STTargetPlatform Platform)
 {
     if (!bEnabled)
     {
         return false;
     }
     if (WhitelistPlatforms.Count > 0 && !WhitelistPlatforms.Contains(Platform))
     {
         return false;
     }
     if (BlacklistPlatforms.Contains(Platform))
     {
         return false;
     }
     return true;
 }
Exemplo n.º 25
0
 // @todo projectfiles: Move this into the ProjectPlatformGeneration class?
 /// <summary>
 /// IsEditorPlatform
 /// </summary>
 /// <param name="InPlatform">The platform of interest</param>
 /// <returns>True if the given platform is a platform that supports the editor.</returns>
 public static bool IsEditorPlatform(STTargetPlatform InPlatform)
 {
     // Windows 64, Linux and Mac are editor platforms.
     return (
         (InPlatform == STTargetPlatform.Win64) ||
         (InPlatform == STTargetPlatform.Linux) ||
         (InPlatform == STTargetPlatform.Mac)
         );
 }
 /**
  *	Return the platform toolset string to write into the project configuration
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *	@param	InConfiguration		The STTargetConfiguration being built
  *
  *	@return	string				The custom configuration section for the project file; Empty string if it doesn't require one
  */
 public virtual string GetVisualStudioPlatformToolsetString(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration, VCProjectFile InProjectFile)
 {
     return "";
 }
Exemplo n.º 27
0
 /// <summary>
 /// Is this a valid platform
 /// Used primarily for Rocket vs non-Rocket
 /// </summary>
 /// <param name="InPlatform"></param>
 /// <returns>true if valid, false if not</returns>
 public static bool IsValidDesktopPlatform(STTargetPlatform InPlatform)
 {
     switch (BuildHostPlatform.Current.Platform)
     {
         case STTargetPlatform.Linux:
             return InPlatform == STTargetPlatform.Linux;
         case STTargetPlatform.Mac:
             return InPlatform == STTargetPlatform.Mac;
         case STTargetPlatform.Win64:
             return ((InPlatform == STTargetPlatform.Win32) || (InPlatform == STTargetPlatform.Win64));
         default:
             throw new BuildException("Invalid RuntimePlatform:" + BuildHostPlatform.Current.Platform);
     }
 }
Exemplo n.º 28
0
 public ProjectConfigAndTargetCombination(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration, string InProjectPlatformName, string InProjectConfigurationName, ProjectTarget InProjectTarget)
 {
     Platform = InPlatform;
     Configuration = InConfiguration;
     ProjectPlatformName = InProjectPlatformName;
     ProjectConfigurationName = InProjectConfigurationName;
     ProjectTarget = InProjectTarget;
 }
Exemplo n.º 29
0
 // @todo projectfiles: Move this into the ProjectPlatformGeneration class?
 /// <summary>
 /// PlatformSupportsCrashReporter
 /// </summary>
 /// <param name="InPlatform">The platform of interest</param>
 /// <returns>True if the given platform supports a crash reporter client (i.e. it can be built for it)</returns>
 public static bool PlatformSupportsCrashReporter(STTargetPlatform InPlatform)
 {
     return (
         (InPlatform == STTargetPlatform.Win64) ||
         (InPlatform == STTargetPlatform.Win32) ||
         (InPlatform == STTargetPlatform.Linux) ||
         (InPlatform == STTargetPlatform.Mac)
         );
 }
 /**
  *	Return the VisualStudio platform name for this build platform
  *
  *	@param	InPlatform			The STTargetPlatform being built
  *	@param	InConfiguration		The STTargetConfiguration being built
  *
  *	@return	string				The name of the platform that VisualStudio recognizes
  */
 public virtual string GetVisualStudioPlatformName(STTargetPlatform InPlatform, STTargetConfiguration InConfiguration)
 {
     // By default, return the platform string
     return InPlatform.ToString();
 }