public static CompileServiceCustomizations ( string modelsPath ) : void | ||
modelsPath | string | The path the to customization models to be compiled |
Результат | void |
static int Main(string[] args) { var commandArguments = CommandArguments.Parse(args); if (!string.IsNullOrEmpty(commandArguments.Error)) { Console.WriteLine(commandArguments.Error); return(-1); } var returnCode = 0; var options = commandArguments.ParsedOptions; var modelsToProcess = new HashSet <string>(StringComparer.OrdinalIgnoreCase); if (!string.IsNullOrEmpty(options.ServiceModels)) { foreach (var s in options.ServiceModels.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { modelsToProcess.Add(s); } } try { if (options.CompileCustomizations) // Compile all servicename.customizations*.json files into one json file in bin { CustomizationCompiler.CompileServiceCustomizations(options.ModelsFolder); } var generationManifest = GenerationManifest.Load(options.Manifest, options.Versions, options.ModelsFolder); if (string.IsNullOrEmpty(options.SelfServiceModel)) { HashSet <string> generatedFiles = new HashSet <string>(); GeneratorDriver.GenerateCoreProjects(generationManifest, options); foreach (var serviceConfig in generationManifest.ServiceConfigurations) { if (modelsToProcess.Any() && !modelsToProcess.Contains(serviceConfig.ModelName)) { Console.WriteLine("Skipping model (not in -servicemodels set to process): {0} ({1})", serviceConfig.ModelName, serviceConfig.ModelPath); continue; } Console.WriteLine("Processing model: {0} ({1})", serviceConfig.ModelName, serviceConfig.ModelPath); var driver = new GeneratorDriver(serviceConfig, generationManifest, options); driver.Execute(); foreach (var file in driver.FilesWrittenToGeneratorFolder) { generatedFiles.Add(file); } } GeneratorDriver.RemoveOrphanedShapes(generatedFiles, Path.Combine(options.SdkRootFolder, @"src\Services")); GeneratorDriver.UpdateUnitTestProjects(generationManifest, options); GeneratorDriver.UpdateSolutionFiles(generationManifest, options); GeneratorDriver.UpdateAssemblyVersionInfo(generationManifest, options); GeneratorDriver.UpdateNuGetPackagesInReadme(generationManifest, options); GeneratorDriver.UpdateCoreCLRTestDependencies(generationManifest, options); GeneratorDriver.UpdateCodeAnalysisSoltion(generationManifest, options); } else { var serviceConfig = new ServiceConfiguration { ModelPath = options.SelfServiceModel, ServiceFileVersion = "3.1.0.0" }; serviceConfig.ModelName = Path.GetFileName(serviceConfig.ModelPath); serviceConfig.ServiceDependencies = new Dictionary <string, string> { { "Core", "3.1.0.0" } }; serviceConfig.GenerateConstructors = true; var relativePathToCustomizations = Path.Combine("customizations", string.Format("{0}.customizations.json", options.SelfServiceBaseName.ToLowerInvariant())); if (File.Exists(relativePathToCustomizations)) { serviceConfig.CustomizationsPath = Path.GetFullPath(relativePathToCustomizations); Console.WriteLine("Using customization file: {0}", serviceConfig.CustomizationsPath); } Console.WriteLine("Processing self service {0} with model {1}.", options.SelfServiceBaseName, options.SelfServiceModel); var driver = new GeneratorDriver(serviceConfig, generationManifest, options); driver.Execute(); // Skip orphan clean for DynamoDB because of the complex nature of DynamDB and DynamoDB Streams if (!serviceConfig.ClassName.StartsWith("DynamoDB")) { GeneratorDriver.RemoveOrphanedShapes(driver.FilesWrittenToGeneratorFolder, driver.GeneratedFilesRoot); } } } catch (Exception e) { if (options.WaitOnExit) { Console.Error.WriteLine("Error running generator: " + e.Message); Console.Error.WriteLine(e.StackTrace); returnCode = -1; } else { throw; } } if (options.WaitOnExit) { Console.WriteLine(); Console.WriteLine("Generation complete. Press a key to exit."); Console.ReadLine(); } return(returnCode); }
static int Main(string[] args) { string outputDir, outputDir45, outputDirRT, outputDirPortable; string manifestPath; string modelsFolder; string testsFolder; string servicesList = null; var servicesToProcess = new HashSet <string>(StringComparer.OrdinalIgnoreCase); var compileCustomizations = true; if (args.Length < 7) { manifestPath = @"..\..\..\_manifest.json"; modelsFolder = @"..\..\..\ServiceModels"; outputDir = @"..\..\..\AWSSDK_DotNet35"; outputDir45 = @"..\..\..\AWSSDK_DotNet45"; outputDirRT = @"..\..\..\AWSSDK_WinRT"; outputDirPortable = @"..\..\..\AWSSDK_Portable"; testsFolder = @"..\..\..\AWSSDK_DotNet.UnitTests"; // last argument is the set of ;-delimited service basenames to process if (args.Length != 0) { servicesList = args[0]; } } else { manifestPath = args[0]; modelsFolder = args[1]; outputDir = args[2]; outputDir45 = args[3]; outputDirRT = args[4]; outputDirPortable = args[5]; testsFolder = args[6]; // last argument is the set of ;-delimited service basenames to process if (args.Length == 8) { servicesList = args[7]; } } if (!string.IsNullOrEmpty(servicesList)) { foreach (var s in servicesList.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { servicesToProcess.Add(s); } } try { if (compileCustomizations) // Compile all servicename.customizations*.json files into one json file in bin { CustomizationCompiler.CompileServiceCustomizations(modelsFolder); } foreach (var config in LoadGeneratorConfigs(manifestPath, modelsFolder)) { if (servicesToProcess.Any() && !servicesToProcess.Contains(config.BaseName)) { Console.WriteLine("Skipping Model (not in arg list to process): {0}", config.ModelPath); continue; } Console.WriteLine("Processing Model: {0}", config.ModelPath); var driver = new GeneratorDriver(config, outputDir, outputDir45, outputDirRT, outputDirPortable, testsFolder); driver.Execute(); } } catch (Exception e) { Console.Error.WriteLine("Error running generator: " + e.Message); Console.Error.WriteLine(e.StackTrace); return(-1); } return(0); }