コード例 #1
0
        /// <summary>
        /// Adds the given project to the OtherProjects list
        /// </summary>
        /// <param name="InProject">The project to add</param>
        /// <returns>True if successful</returns>
        public void AddExistingProjectFile(ProjectFile InProject, bool bNeedsAllPlatformAndConfigurations = false, bool bForceDevelopmentConfiguration = false, bool bProjectDeploys = false, List<STTargetPlatform> InSupportedPlatforms = null, List<STTargetConfiguration> InSupportedConfigurations = null)
        {
            if (InProject.ProjectTargets.Count != 0)
            {
                throw new BuildException("Expecting existing project to not have any ProjectTargets defined yet.");
            }

            var ProjectTarget = new ProjectTarget();
            if (bForceDevelopmentConfiguration)
            {
                ProjectTarget.ForceDevelopmentConfiguration = true;
            }
            ProjectTarget.ProjectDeploys = bProjectDeploys;

            if (bNeedsAllPlatformAndConfigurations)
            {
                // Add all platforms
                var AllPlatforms = Enum.GetValues(typeof(STTargetPlatform));
                foreach (STTargetPlatform CurPlatfrom in AllPlatforms)
                {
                    ProjectTarget.ExtraSupportedPlatforms.Add(CurPlatfrom);
                }

                // Add all configurations
                var AllConfigurations = Enum.GetValues(typeof(STTargetConfiguration));
                foreach (STTargetConfiguration CurConfiguration in AllConfigurations)
                {
                    ProjectTarget.ExtraSupportedConfigurations.Add(CurConfiguration);
                }
            }
            else if (InSupportedPlatforms != null || InSupportedConfigurations != null)
            {
                if (InSupportedPlatforms != null)
                {
                    // Add all explicitly specified platforms
                    foreach (STTargetPlatform CurPlatfrom in InSupportedPlatforms)
                    {
                        ProjectTarget.ExtraSupportedPlatforms.Add(CurPlatfrom);
                    }
                }
                else
                {
                    // Otherwise, add all platforms
                    var AllPlatforms = Enum.GetValues(typeof(STTargetPlatform));
                    foreach (STTargetPlatform CurPlatfrom in AllPlatforms)
                    {
                        ProjectTarget.ExtraSupportedPlatforms.Add(CurPlatfrom);
                    }
                }

                if (InSupportedConfigurations != null)
                {
                    // Add all explicitly specified configurations
                    foreach (STTargetConfiguration CurConfiguration in InSupportedConfigurations)
                    {
                        ProjectTarget.ExtraSupportedConfigurations.Add(CurConfiguration);
                    }
                }
                else
                {
                    // Otherwise, add all configurations
                    var AllConfigurations = Enum.GetValues(typeof(STTargetConfiguration));
                    foreach (STTargetConfiguration CurConfiguration in AllConfigurations)
                    {
                        ProjectTarget.ExtraSupportedConfigurations.Add(CurConfiguration);
                    }
                }
            }
            else
            {
                // For existing project files, just support the default desktop platforms and configurations
                STBuildTool.GetAllDesktopPlatforms(ref ProjectTarget.ExtraSupportedPlatforms, false);
                // Debug and Development only
                ProjectTarget.ExtraSupportedConfigurations.Add(STTargetConfiguration.Debug);
                ProjectTarget.ExtraSupportedConfigurations.Add(STTargetConfiguration.Development);
            }

            InProject.ProjectTargets.Add(ProjectTarget);

            // Existing projects must always have a GUID.  This will throw an exception if one isn't found.
            InProject.LoadGUIDFromExistingProject();

            OtherProjectFiles.Add(InProject);
        }