Example #1
0
        private void ProcessConfigurationPlatformMapping(SolutionProject solutionProject, UnityConfigurationType configType, CompilationPlatformInfo platform, IReadOnlyDictionary <BuildTarget, CompilationPlatformInfo> enabledPlatforms)
        {
            ConfigurationPlatformPair configPair = new ConfigurationPlatformPair(configType, platform.Name);

            solutionProject.ConfigurationPlatformMapping.Add(configPair, new ProjectConfigurationPlatformMapping()
            {
                ConfigurationPlatform = configPair,
                EnabledForBuild       = enabledPlatforms.ContainsKey(platform.BuildTarget)
            });
        }
Example #2
0
        private void ValidateProjectConfiguration()
        {
            foreach (SolutionProject project in Projects.Values)
            {
                ISet <string> configurations = new HashSet <string>(), platforms = new HashSet <string>();

                // Ensure the solution has the configured pair
                foreach (ConfigurationPlatformPair configPlatform in project.ConfigurationPlatformMapping.Keys)
                {
                    configurations.Add(configPlatform.Configuration);
                    platforms.Add(configPlatform.Platform);

                    if (!ConfigurationPlatforms.Contains(configPlatform))
                    {
                        logger?.LogWarning(nameof(TemplatedSolutionExporter), $"Configuration mapping for project '{project.Name}' {configPlatform.Configuration}|{configPlatform.Platform} isn't part of the general solution config map. Adding it.");
                        ConfigurationPlatforms.Add(configPlatform);
                    }
                }

                // Now go through the pairs and ensure we add the appropriate default to the project
                string GetOption(ISet <string> set, string targetItem) => set.Contains(targetItem) ? targetItem : (set.FirstOrDefault() ?? targetItem);

                foreach (ConfigurationPlatformPair configPlatform in ConfigurationPlatforms)
                {
                    if (!project.ConfigurationPlatformMapping.ContainsKey(configPlatform))
                    {
                        ConfigurationPlatformPair projectConfigPlatform = new ConfigurationPlatformPair(GetOption(configurations, configPlatform.Configuration), GetOption(platforms, configPlatform.Platform));
                        project.ConfigurationPlatformMapping.Add(configPlatform, new ProjectConfigurationPlatformMapping()
                        {
                            ConfigurationPlatform = projectConfigPlatform,
                            EnabledForBuild       = false
                        });
                    }
                }
            }
        }
Example #3
0
 private void WriteConfigurationProperty(TemplatedWriter solutionWriter, Guid projectGuid, ConfigurationPlatformPair solutionPair, string property, ConfigurationPlatformPair projectPair)
 {
     solutionWriter.CreateWriterFor(ProjectConfigurationPlatformPropertyTemplate)
     .Write(ProjectConfigurationPlatformPropertyTemplate_ProjectGuidToken, projectGuid)
     .Write(ProjectConfigurationPlatformPropertyTemplate_SolutionConfigurationToken, solutionPair.Configuration)
     .Write(ProjectConfigurationPlatformPropertyTemplate_SolutionPlatformToken, solutionPair.Platform)
     .Write(ProjectConfigurationPlatformPropertyTemplate_PropertyToken, property)
     .Write(ProjectConfigurationPlatformPropertyTemplate_ProjectConfigurationToken, projectPair.Configuration)
     .Write(ProjectConfigurationPlatformPropertyTemplate_ProjectPlatformToken, projectPair.Platform);
 }