private void GenerateCoreCLRSolution(string solutionFileName, bool includeTests, ICollection <string> serviceProjectsForPartialBuild = null) { var sdkSourceFolder = Path.Combine(Options.SdkRootFolder, GeneratorDriver.SourceSubFoldername); var session = new Dictionary <string, object>(); var coreProjectsRoot = Path.Combine(sdkSourceFolder, GeneratorDriver.CoreSubFoldername); var coreProjects = new List <Project>() { CoreProjectFromFile(Path.Combine(coreProjectsRoot, "AWSSDK.Core.CoreCLR.xproj")) }; session["CoreProjects"] = coreProjects; session["IncludeTests"] = includeTests; var buildConfigurations = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var solutionProjects = new Dictionary <string, ProjectFileCreator.ProjectConfigurationData>(); var serviceSolutionFolders = new List <ServiceSolutionFolder>(); var serviceProjectsRoot = Path.Combine(sdkSourceFolder, GeneratorDriver.ServicesSubFoldername); foreach (var servicePath in Directory.GetDirectories(serviceProjectsRoot)) { var di = new DirectoryInfo(servicePath); var folder = ServiceSolutionFolderFromPath(di.Name); // If we are generating a partial solution, and the service project has not changed, omit it from the partial solution. bool omitService = serviceProjectsForPartialBuild != null && !serviceProjectsForPartialBuild.Contains(di.Name, StringComparer.InvariantCultureIgnoreCase); if (omitService) { continue; } foreach (var projectFile in Directory.GetFiles(servicePath, "*CoreCLR.xproj", SearchOption.TopDirectoryOnly)) { folder.Projects.Add(ServiceProjectFromFile(di.Name, projectFile)); SelectProjectAndConfigurationsForSolution(projectFile, solutionProjects, buildConfigurations); } if (folder.Projects.Count > 0) { serviceSolutionFolders.Add(folder); } } session["ServiceSolutionFolders"] = serviceSolutionFolders; var generator = new CoreCLRSolutionFile() { Session = session }; var content = generator.TransformText(); GeneratorDriver.WriteFile(Options.SdkRootFolder, null, solutionFileName, content, true, false); }
private void GenerateCoreCLRSolution() { var sdkSourceFolder = Path.Combine(Options.SdkRootFolder, GeneratorDriver.SourceSubFoldername); var session = new Dictionary <string, object>(); var coreProjectsRoot = Path.Combine(sdkSourceFolder, GeneratorDriver.CoreSubFoldername); var coreProjects = new List <Project>() { CoreProjectFromFile(Path.Combine(coreProjectsRoot, "AWSSDK.Core.CoreCLR.xproj")) }; session["CoreProjects"] = coreProjects; var buildConfigurations = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var solutionProjects = new Dictionary <string, ProjectFileCreator.ProjectConfigurationData>(); var serviceSolutionFolders = new List <ServiceSolutionFolder>(); var serviceProjectsRoot = Path.Combine(sdkSourceFolder, GeneratorDriver.ServicesSubFoldername); foreach (var servicePath in Directory.GetDirectories(serviceProjectsRoot)) { var di = new DirectoryInfo(servicePath); var folder = ServiceSolutionFolderFromPath(di.Name); foreach (var projectFile in Directory.GetFiles(servicePath, "*CoreCLR.xproj", SearchOption.TopDirectoryOnly)) { folder.Projects.Add(ServiceProjectFromFile(di.Name, projectFile)); SelectProjectAndConfigurationsForSolution(projectFile, solutionProjects, buildConfigurations); } if (folder.Projects.Count > 0) { serviceSolutionFolders.Add(folder); } } session["ServiceSolutionFolders"] = serviceSolutionFolders; var generator = new CoreCLRSolutionFile() { Session = session }; var content = generator.TransformText(); GeneratorDriver.WriteFile(Options.SdkRootFolder, null, "AWSSDK.CoreCLR.sln", content, true, false); }
private void GenerateVS2017Solution(string solutionFileName, bool includeTests, bool isTravisSolution, IEnumerable <ProjectFileConfiguration> projectFileConfigurations, ICollection <string> serviceProjectsForPartialBuild = null) { // // Since vs2017 .csproj files are not identified by guid, see if we can scan and determine the guid ahead of time to reduce changes // to .sln files if possible. // IDictionary <string, string> projectGuidDictionary = GetItemGuidDictionary(Path.Combine(Options.SdkRootFolder, solutionFileName)); var sdkSourceFolder = Path.Combine(Options.SdkRootFolder, GeneratorDriver.SourceSubFoldername); var session = new Dictionary <string, object>(); var buildConfigurations = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var solutionProjects = new Dictionary <string, ProjectFileCreator.ProjectConfigurationData>(); var serviceSolutionFolders = new List <ServiceSolutionFolder>(); var serviceProjectsRoot = Path.Combine(sdkSourceFolder, GeneratorDriver.ServicesSubFoldername); foreach (var servicePath in Directory.GetDirectories(serviceProjectsRoot)) { var di = new DirectoryInfo(servicePath); var folder = ServiceSolutionFolderFromPath(di.Name); // If we are generating a partial solution, and the service project has not changed, omit it from the partial solution. bool omitService = serviceProjectsForPartialBuild != null && !serviceProjectsForPartialBuild.Contains(di.Name, StringComparer.InvariantCultureIgnoreCase); if (omitService) { continue; } foreach (var configuration in projectFileConfigurations) { string projectFilePattern = string.Format("*.{0}.csproj", configuration.Name); foreach (var projectFile in Directory.GetFiles(servicePath, projectFilePattern, SearchOption.TopDirectoryOnly)) { if (isTravisSolution && projectFile.Contains("AWSSDK.MobileAnalytics")) { continue; } string projectName = Path.GetFileNameWithoutExtension(projectFile); folder.Projects.Add(new Project { Name = projectName, ProjectPath = string.Format(@"src\Services\{0}\{1}", di.Name, Path.GetFileName(projectFile)), ProjectGuid = projectGuidDictionary.ContainsKey(projectName) ? projectGuidDictionary[projectName] : Guid.NewGuid().ToString("B").ToUpper(), }); SelectProjectAndConfigurationsForSolution(projectFile, solutionProjects, buildConfigurations); } } if (folder.Projects.Count > 0) { serviceSolutionFolders.Add(folder); } } IList <Project> coreProjects = new List <Project>(); var coreProjectsRoot = Path.Combine(sdkSourceFolder, GeneratorDriver.CoreSubFoldername); foreach (var configuration in projectFileConfigurations) { string projectFilePattern = string.Format("*.{0}.csproj", configuration.Name); foreach (var projectFile in Directory.GetFiles(coreProjectsRoot, projectFilePattern, SearchOption.TopDirectoryOnly)) { string projectName = Path.GetFileNameWithoutExtension(projectFile); coreProjects.Add(new Project { Name = projectName, ProjectPath = string.Format(@"src\Core\{0}", Path.GetFileName(projectFile)), ProjectGuid = projectGuidDictionary.ContainsKey(projectName) ? projectGuidDictionary[projectName] : Guid.NewGuid().ToString("B").ToUpper(), }); } } IList <Project> testProjects = new List <Project>(); if (includeTests) { var testProjectsRoot = Path.Combine(Options.SdkRootFolder, GeneratorDriver.TestsSubFoldername); foreach (var configuration in projectFileConfigurations) { string projectFilePattern = string.Format("*.{0}.csproj", configuration.Name); foreach (var projectFile in Directory.GetFiles(testProjectsRoot, projectFilePattern, SearchOption.AllDirectories)) { string projectName = Path.GetFileNameWithoutExtension(projectFile); testProjects.Add(new Project { Name = projectName, ProjectPath = CreateRelativePath(Options.SdkRootFolder, projectFile), ProjectGuid = projectGuidDictionary.ContainsKey(projectName) ? projectGuidDictionary[projectName] : Guid.NewGuid().ToString("B").ToUpper(), }); } if (configuration.Name.Equals(ProjectTypes.Net35, StringComparison.Ordinal) || configuration.Name.Equals(ProjectTypes.Net45, StringComparison.Ordinal)) { solutionProjects.Add(GeneratorLibProjectName, GeneratorLibProjectConfig); testProjects.Add(GeneratorLibProject); SelectBuildConfigurationsForProject(GeneratorLibProjectName, buildConfigurations); } } } session["TestProjects"] = testProjects; session["CoreProjects"] = coreProjects; session["ServiceSolutionFolders"] = serviceSolutionFolders; var generator = new CoreCLRSolutionFile() { Session = session }; var content = generator.TransformText(); GeneratorDriver.WriteFile(Options.SdkRootFolder, null, solutionFileName, content, true, false); }