Command line options for the AWS SDK code generator.
コード例 #1
0
        public CoreAssemblyInfoUpdater(GeneratorOptions options, GenerationManifest manifest)
        {
            Manifest = manifest;
            Options = options;

            session = new Dictionary<string, object>
            {
                { "Version", Manifest.CoreVersion },
                { "FileVersion", Manifest.CoreFileVersion }
            };
        }
コード例 #2
0
ファイル: CoreUpdater.cs プロジェクト: rajdotnet/aws-sdk-net
        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 : "";
        }
コード例 #3
0
ファイル: CoreUpdater.cs プロジェクト: aws/aws-sdk-net
        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;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public static void UpdateCodeAnalysisSoltion(GenerationManifest manifest, GeneratorOptions options)
 {
     Console.WriteLine("Updating code analysis solution file.");
     var creator = new CodeAnalysisSolutionCreator
     {
         Options = options
     };
     creator.Execute();
 }
コード例 #6
0
 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);
 }
コード例 #7
0
 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]);
     }
 }
コード例 #8
0
        /// <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();
        }
コード例 #9
0
 public UnitTestProjectFileCreator(GeneratorOptions options, IEnumerable <UnitTestProjectConfiguration> configurations)
 {
     _options        = options;
     _configurations = configurations;
 }
コード例 #10
0
 public ProjectFileCreator(GeneratorOptions options)
 {
     Options = options;
 }
コード例 #11
0
ファイル: GeneratorDriver.cs プロジェクト: aws/aws-sdk-net
        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());
            }
        }
コード例 #12
0
 private CommandArguments()
 {
     ParsedOptions = new GeneratorOptions();
 }
コード例 #13
0
ファイル: ProjectFileCreator.cs プロジェクト: aws/aws-sdk-net
 public ProjectFileCreator(GeneratorOptions options)
 {
     Options = options;
 }
コード例 #14
0
 public UnitTestProjectFileCreator(GeneratorOptions options)
 {
     _options = options;
 }
コード例 #15
0
 public static void UpdateAssemblyVersionInfo(GenerationManifest manifest, GeneratorOptions options)
 {
     var updater = new CoreAssemblyInfoUpdater(options, manifest);
     updater.Execute();
 }
コード例 #16
0
        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);
        }
コード例 #17
0
 public UnitTestProjectFileCreator(GeneratorOptions options, IEnumerable <ProjectFileConfiguration> configurations)
 {
     _options        = options;
     _configurations = configurations;
     _isLegacyProj   = true;
 }
コード例 #18
0
ファイル: CommandLineParser.cs プロジェクト: aws/aws-sdk-net
 private CommandArguments()
 {
     ParsedOptions = new GeneratorOptions();
 }
コード例 #19
0
        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);
        }