1313
1414from azdev .operations .statistics import _create_invoker_and_load_cmds # pylint: disable=protected-access
1515from azdev .utilities import require_azure_cli , display , heading , output , calc_selected_mod_names
16+ from azdev .utilities .path import calc_selected_modules
1617
1718# pylint: disable=no-else-return
1819
@@ -68,8 +69,9 @@ def _handle_custom_breaking_changes(module, command):
6869 """
6970 from azure .cli .core .breaking_change import upcoming_breaking_changes
7071 yield from _handle_custom_breaking_change (module , command , upcoming_breaking_changes .get (command ))
72+ yield from _handle_custom_breaking_change (module , command , upcoming_breaking_changes .get (f'az { command } ' ))
7173 for key in upcoming_breaking_changes :
72- if key .startswith (command + '.' ):
74+ if key .startswith (command + '.' ) or key . startswith ( f'az { command } .' ) :
7375 yield from _handle_custom_breaking_change (module , command , upcoming_breaking_changes [key ])
7476
7577
@@ -249,9 +251,7 @@ def _handle_core(source):
249251 display ('Core finished loaded in {} sec' .format (stop - start ))
250252
251253
252- def _handle_upcoming_breaking_changes (selected_mod_names , source ):
253- command_loader = _load_commands ()
254-
254+ def _handle_upcoming_breaking_changes (command_loader , selected_mod_names , source ):
255255 if 'core' in selected_mod_names or 'azure-cli-core' in selected_mod_names :
256256 yield from _handle_core (source )
257257
@@ -285,13 +285,13 @@ def _filter_breaking_changes(iterator, max_version=None):
285285# pylint: disable=unnecessary-lambda-assignment
286286def _group_breaking_change_items (iterator , group_by_version = False ):
287287 if group_by_version :
288- upcoming_breaking_changes = defaultdict ( # module to command
289- lambda : defaultdict ( # command to version
290- lambda : {'group_ref' : None , 'items' : defaultdict ( # version to list of breaking changes
288+ upcoming_breaking_changes = defaultdict ( # module to command
289+ lambda : defaultdict ( # command to version
290+ lambda : {'group_ref' : None , 'items' : defaultdict ( # version to list of breaking changes
291291 lambda : [])}))
292292 else :
293- upcoming_breaking_changes = defaultdict ( # module to command
294- lambda : defaultdict ( # command to list of breaking changes
293+ upcoming_breaking_changes = defaultdict ( # module to command
294+ lambda : defaultdict ( # command to list of breaking changes
295295 lambda : {'group_ref' : None , 'items' : []}))
296296 for item in iterator :
297297 version = item .target_version if item .target_version else 'Unspecific'
@@ -313,14 +313,24 @@ def collect_upcoming_breaking_changes(modules=None, target_version='NextWindow',
313313
314314 require_azure_cli ()
315315
316- selected_mod_names = calc_selected_mod_names (modules )
316+ selected_modules = calc_selected_modules (modules )
317+ cli_mod_names = list (selected_modules ['core' ].keys ()) + list (selected_modules ['mod' ].keys ())
318+ ext_mod_names = list (selected_modules ['ext' ].keys ())
317319
318- if selected_mod_names :
319- display ('Modules selected: {}\n ' .format (', ' .join (selected_mod_names )))
320+ if cli_mod_names or ext_mod_names :
321+ display ('Modules selected: {}\n ' .format (', ' .join (cli_mod_names + ext_mod_names )))
322+
323+ command_loader = _load_commands ()
320324
321325 heading ('Collecting Breaking Change Pre-announcement' )
322- breaking_changes = _handle_upcoming_breaking_changes (selected_mod_names , source )
323- breaking_changes = _filter_breaking_changes (breaking_changes , target_version )
326+ breaking_changes = []
327+ if cli_mod_names :
328+ cli_breaking_changes = _handle_upcoming_breaking_changes (command_loader , cli_mod_names , source )
329+ cli_breaking_changes = _filter_breaking_changes (cli_breaking_changes , target_version )
330+ breaking_changes .extend (cli_breaking_changes )
331+ if ext_mod_names :
332+ ext_breaking_changes = _handle_upcoming_breaking_changes (command_loader , ext_mod_names , 'pre_announce' )
333+ breaking_changes .extend (ext_breaking_changes )
324334 breaking_changes = _group_breaking_change_items (breaking_changes , group_by_version )
325335 if output_format == 'structure' :
326336 return breaking_changes
0 commit comments