@@ -207,7 +207,7 @@ protected override void GenerateHelper()
207207
208208 CheckForServicePrefixDuplication ( ) ;
209209
210- if ( ! Options . SkipCmdletGeneration )
210+ if ( ! Options . SkipCmdletGeneration || Options . GenerateReportOnly )
211211 {
212212 //We clean and setup service folders, some services share a folder, project and module, so we use distinct
213213 foreach ( var project in ModelCollection . ConfigModels . Values
@@ -238,7 +238,7 @@ protected override void GenerateHelper()
238238 LoadCurrentService ( CurrentModel ) ;
239239 DocumentationUtils . CacheMemberDocumentationSummary ( CurrentServiceNDoc ) ;
240240
241- if ( ! Options . SkipCmdletGeneration )
241+ if ( ! Options . SkipCmdletGeneration || Options . GenerateReportOnly )
242242 {
243243 GenerateClientAndCmdlets ( ) ;
244244 // if the service contains any hand-maintained cmdlets, scan them to update the
@@ -259,7 +259,11 @@ protected override void GenerateHelper()
259259 var allFoundSdkAssemblies = GenerationSources . SDKFindAssemblyFilenames ( SdkAssembliesFolder , Directory . EnumerateFiles ) ;
260260 VerifyAllAssembliesHaveConfiguration ( SdkVersionsUtils . ReadSdkVersionFile ( SdkAssembliesFolder ) , ModelCollection , allFoundSdkAssemblies ) ;
261261
262- if ( ! Options . SkipCmdletGeneration )
262+ if ( Options . GenerateReportOnly )
263+ {
264+ WriteConfigurationChanges ( ) ;
265+ }
266+ else if ( ! Options . SkipCmdletGeneration )
263267 {
264268 ScanAdvancedCmdletsForCommonModule ( ) ;
265269
@@ -291,6 +295,15 @@ protected override void GenerateHelper()
291295
292296 foreach ( var configModel in ModelCollection . ConfigModels . Values )
293297 {
298+ // if Options.GenerateReportOnly, clear AnalysisErrors at model level and ServiceOperations Level
299+ if ( Options . GenerateReportOnly )
300+ {
301+ configModel . AnalysisErrors . Clear ( ) ;
302+ foreach ( var operation in configModel . ServiceOperationsList )
303+ {
304+ operation . AnalysisErrors . Clear ( ) ;
305+ }
306+ }
294307 foreach ( var error in configModel . AnalysisErrors . Concat (
295308 configModel . ServiceOperationsList
296309 . OrderBy ( so => so . MethodName )
@@ -360,7 +373,7 @@ public static void VerifyAllAssembliesHaveConfiguration(JObject sdkVersionsJson,
360373
361374 private void WriteConfigurationChanges ( )
362375 {
363- XmlReportWriter . SerializeReport ( Options . RootPath , ModelCollection . ConfigModels . Values ) ;
376+ XmlReportWriter . SerializeReport ( Options . RootPath , ModelCollection . ConfigModels . Values , Options . GenerateReportOnly ) ;
364377 }
365378
366379 private void CheckForServicePrefixDuplication ( )
@@ -445,29 +458,32 @@ private void GenerateClientAndCmdlets()
445458
446459 var outputRoot = Path . Combine ( CmdletsOutputPath , CurrentModel . AssemblyName ) ;
447460
448- try
461+ if ( ! Options . GenerateReportOnly )
449462 {
450- using ( var sw = new StringWriter ( ) )
463+ try
451464 {
452- // if the service has operations requiring anonymous access, we'll generate two clients
453- // one for regular authenticated calls and one using anonymous credentials
454- using ( var writer = new IndentedTextWriter ( sw ) )
465+ using ( var sw = new StringWriter ( ) )
455466 {
456- CmdletServiceClientWriter . Write ( writer ,
457- CurrentModel ,
458- CurrentModel . ServiceName ,
459- GetServiceVersion ( CurrentModel . ServiceNamespace , CurrentModel . ServiceClient ) ,
460- awsSignerAttributeTypeValue ) ;
461- }
467+ // if the service has operations requiring anonymous access, we'll generate two clients
468+ // one for regular authenticated calls and one using anonymous credentials
469+ using ( var writer = new IndentedTextWriter ( sw ) )
470+ {
471+ CmdletServiceClientWriter . Write ( writer ,
472+ CurrentModel ,
473+ CurrentModel . ServiceName ,
474+ GetServiceVersion ( CurrentModel . ServiceNamespace , CurrentModel . ServiceClient ) ,
475+ awsSignerAttributeTypeValue ) ;
476+ }
462477
463- var fileContents = sw . ToString ( ) ;
464- var fileName = CurrentModel . GetServiceCmdletClassName ( false ) + "Cmdlet.cs" ;
465- File . WriteAllText ( Path . Combine ( outputRoot , fileName ) , fileContents ) ;
478+ var fileContents = sw . ToString ( ) ;
479+ var fileName = CurrentModel . GetServiceCmdletClassName ( false ) + "Cmdlet.cs" ;
480+ File . WriteAllText ( Path . Combine ( outputRoot , fileName ) , fileContents ) ;
481+ }
482+ }
483+ catch ( Exception e )
484+ {
485+ AnalysisError . ExceptionWhileWritingServiceClientCode ( CurrentModel , e ) ;
466486 }
467- }
468- catch ( Exception e )
469- {
470- AnalysisError . ExceptionWhileWritingServiceClientCode ( CurrentModel , e ) ;
471487 }
472488
473489 // process the methods in order to make debugging more convenient
@@ -631,7 +647,7 @@ private void CreateCmdlet(MethodInfo method, ConfigModel configModel, string aws
631647 AnalysisError . ExceptionWhileAnalyzingSDKLibrary ( CurrentModel , CurrentOperation , e ) ;
632648 }
633649
634- if ( serviceOperation . AnalysisErrors . Count == 0 )
650+ if ( serviceOperation . AnalysisErrors . Count == 0 && ! Options . GenerateReportOnly )
635651 {
636652 // set file name and location
637653 var filePath = Path . Combine ( configModel . AssemblyName , GeneratedCmdletsFoldername , $ "{ serviceOperation . SelectedVerb } -{ serviceOperation . SelectedNoun } -Cmdlet.cs") ;
0 commit comments