public CoreAssemblyInfoUpdater(GeneratorOptions options, GenerationManifest manifest) { Manifest = manifest; Options = options; session = new Dictionary<string, object> { { "Version", Manifest.CoreVersion }, { "FileVersion", Manifest.CoreFileVersion } }; }
public CoreAssemblyInfoUpdater(GeneratorOptions options, GenerationManifest manifest) { Manifest = manifest; Options = options; session = new Dictionary<string, object> { { "Version", Manifest.CoreVersion }, { "FileVersion", Manifest.CoreFileVersion } }; session["NuGetPreviewFlag"] = manifest.DefaultToPreview ? GeneratorDriver.NuGetPreviewFlag : ""; }
public CoreAssemblyInfoUpdater(GeneratorOptions options, GenerationManifest manifest) { Manifest = manifest; Options = options; session = new Dictionary<string, object> { { "Version", Manifest.CoreVersion }, { "FileVersion", Manifest.CoreFileVersion } }; session["NuGetPreviewFlag"] = manifest.DefaultToPreview ? manifest.PreviewLabel : ""; session["DisablePCLSupport"] = options.DisablePCLSupport; }
public GeneratorDriver(ServiceConfiguration config, GenerationManifest generationManifest, GeneratorOptions options) { GenerationManifest = generationManifest; Configuration = config; ProjectFileConfigurations = GenerationManifest.ProjectFileConfigurations; Options = options; // Base name in the manifest is not a reliable source of info, as if append-service // is set 'Service' gets appended and in the case of IAM then sends us to the wrong folder. // Instead we'll use the namespace and rip off any Amazon. prefix. This also helps us // handle versioned namespaces too. var serviceNameRoot = Configuration.Namespace.StartsWith("Amazon.", StringComparison.Ordinal) ? Configuration.Namespace.Substring(7) : Configuration.Namespace; ServiceFilesRoot = Path.Combine(Options.SdkRootFolder, SourceSubFoldername, ServicesSubFoldername, serviceNameRoot); GeneratedFilesRoot = Path.Combine(ServiceFilesRoot, GeneratedCodeFoldername); TestFilesRoot = Path.Combine(Options.SdkRootFolder, TestsSubFoldername); }
public static void UpdateCodeAnalysisSoltion(GenerationManifest manifest, GeneratorOptions options) { Console.WriteLine("Updating code analysis solution file."); var creator = new CodeAnalysisSolutionCreator { Options = options }; creator.Execute(); }
public static void UpdateSolutionFiles(GenerationManifest manifest, GeneratorOptions options) { Console.WriteLine("Updating solution files."); var solutionFileCreator = new SolutionFileCreator { Options = options, ProjectFileConfigurations = manifest.ProjectFileConfigurations }; solutionFileCreator.Execute(NewlyCreatedProjectFiles); }
public static void GenerateCoreProjects(GenerationManifest generationManifest, GeneratorOptions options) { Console.WriteLine("Updating Core project files."); string coreFilesRoot = Path.Combine(options.SdkRootFolder, "src", "core"); var creator = new ProjectFileCreator(); creator.ExecuteCore(coreFilesRoot, generationManifest.ProjectFileConfigurations); foreach (var newProjectKey in creator.CreatedProjectFiles.Keys) { NewlyCreatedProjectFiles.Add(newProjectKey, creator.CreatedProjectFiles[newProjectKey]); } }
/// <summary> /// Update project references in unit test projects to include any new services. /// </summary> public static void UpdateUnitTestProjectReferences(GeneratorOptions options) { var servicesRoot = Path.Combine(options.SdkRootFolder, "src", "Services"); var testRoot = Path.Combine(options.SdkRootFolder, "test", "UnitTests"); var command = new UnitTestProjectReferenceChecker() { ServiceRoot = servicesRoot, ProjectFilePath = Path.Combine(testRoot, "AWSSDK.UnitTests.Net35.csproj") }; command.Execute(); command.ProjectFilePath = Path.Combine(testRoot, "AWSSDK.UnitTests.Net45.csproj"); command.Execute(); }
public UnitTestProjectFileCreator(GeneratorOptions options, IEnumerable <UnitTestProjectConfiguration> configurations) { _options = options; _configurations = configurations; }
public ProjectFileCreator(GeneratorOptions options) { Options = options; }
public static void UpdateCoreCLRTestDependencies(GenerationManifest manifest, GeneratorOptions options) { var projectJsonPath = Path.Combine(options.SdkRootFolder, "test/CoreCLR/IntegrationTests/project.json"); var originalProjectJson = File.ReadAllText(projectJsonPath); var rootData = JsonMapper.ToObject(originalProjectJson); var dependency = rootData["dependencies"] as JsonData; bool hasChanged = false; foreach (var service in manifest.ServiceConfigurations.OrderBy(x => x.ServiceFolderName)) { if (service.ParentConfig != null) continue; if(service.CoreCLRSupport && dependency[service.ServiceFolderName] == null) { hasChanged = true; dependency[service.ServiceFolderName] = "1.0.0-*"; } } if(hasChanged) { var newContent = new System.Text.StringBuilder(); JsonWriter writer = new JsonWriter(newContent) { PrettyPrint = true }; rootData.ToJson(writer); File.WriteAllText(projectJsonPath, newContent.ToString().Trim()); } }
private CommandArguments() { ParsedOptions = new GeneratorOptions(); }
public UnitTestProjectFileCreator(GeneratorOptions options) { _options = options; }
public static void UpdateAssemblyVersionInfo(GenerationManifest manifest, GeneratorOptions options) { var updater = new CoreAssemblyInfoUpdater(options, manifest); updater.Execute(); }
public static void UpdateNuGetPackagesInReadme(GenerationManifest manifest, GeneratorOptions options) { var nugetPackages = new Dictionary<string, string>(); foreach(var service in manifest.ServiceConfigurations.OrderBy(x => x.BaseName)) { // Service like DynamoDB streams are included in a parent service. if (service.ParentConfig != null) continue; if(string.IsNullOrEmpty(service.Synopsis)) throw new Exception(string.Format("{0} is missing a synopsis in the manifest.", service.BaseName)); var assemblyName = service.Namespace.Replace("Amazon.", "AWSSDK."); nugetPackages[assemblyName] = service.Synopsis; } NuGetPackageReadmeSection generator = new NuGetPackageReadmeSection(); var session = new Dictionary<string, object> { { "NugetPackages", nugetPackages } }; generator.Session = session; var nugetPackagesText = generator.TransformText(); var readmePath = Path.Combine(options.SdkRootFolder, "..", "README.md"); var originalContent = File.ReadAllText(readmePath); int startPos = originalContent.IndexOf('\n', originalContent.IndexOf("### NuGet Packages")) + 1; int endPos = originalContent.IndexOf("### Code Generator"); var newContent = originalContent.Substring(0, startPos); newContent += nugetPackagesText + "\r\n"; newContent += originalContent.Substring(endPos); File.WriteAllText(readmePath, newContent); }
public UnitTestProjectFileCreator(GeneratorOptions options, IEnumerable <ProjectFileConfiguration> configurations) { _options = options; _configurations = configurations; _isLegacyProj = true; }
public static void UpdateSolutionFiles(GeneratorOptions options) { // if no new projects were created and all our expected solution files exist, we // can leave the solutions alone var buildSolutionFiles = NewlyCreatedProjectFiles.Any(); if (!buildSolutionFiles) { var expectedSolutions = new[] { "AWSSDK.sln", "AWSSDK." + SolutionFileCreator.ProjectTypes.Net35 + ".sln", "AWSSDK." + SolutionFileCreator.ProjectTypes.Net45 + ".sln", "AWSSDK." + SolutionFileCreator.ProjectTypes.Portable + ".sln", "AWSSDK." + SolutionFileCreator.ProjectTypes.WinPhone8 + ".sln", "AWSSDK." + SolutionFileCreator.ProjectTypes.WinRt + ".sln" }; if (expectedSolutions.Any(sln => !File.Exists(Path.Combine(options.SdkRootFolder, sln)))) { buildSolutionFiles = true; } if (!buildSolutionFiles) { Console.WriteLine("Expected solution files present and no new projects, no solution updates required."); return; } else Console.WriteLine("One or more solution files missing, updates required."); } else Console.WriteLine("New projects created, solution file updates required."); var solutionFileCreator = new SolutionFileCreator { Options = options }; solutionFileCreator.Execute(NewlyCreatedProjectFiles); }