@@ -225,14 +225,30 @@ def __init__(self, name, builder_class, **kwargs):
225225 def isUnifiedBuild (self , parts : List [TargetPart ]):
226226 """Checks if the given parts combine into a unified build.
227227
228- Returns the unified group ID (e.g., 'main', 'no-read-client', 'rpc-json')
229- if this is a unified build, or None otherwise .
228+ Returns the unified group ID based on the combination of modifiers present.
229+ The group determines which output directory and build configuration to use .
230230 """
231+ has_unified = False
231232 for part in parts :
232233 if part .build_arguments .get ('unified' , False ):
233- # Return the group ID, defaulting to 'main' for backward compatibility
234- return part .build_arguments .get ('unified_group' , 'main' )
235- return None
234+ has_unified = True
235+ break
236+
237+ if not has_unified :
238+ return None
239+
240+ # Auto-detect unified group based on which other modifiers are present
241+ has_no_read_client = any (part .build_arguments .get ('chip_enable_read_client' , None ) == False
242+ for part in parts )
243+ has_rpc = any (part .build_arguments .get ('enable_rpcs' , False )
244+ for part in parts )
245+
246+ if has_no_read_client :
247+ return 'group2'
248+ elif has_rpc :
249+ return 'group3'
250+ else :
251+ return 'main'
236252
237253 def AppendFixedTargets (self , parts : List [TargetPart ]):
238254 """Append a list of potential targets/variants.
@@ -467,12 +483,17 @@ def Create(self, name: str, runner, repository_path: str, output_prefix: str,
467483 for part in parts :
468484 kargs .update (part .build_arguments )
469485
486+ # Determine unified group before creating builder
487+ unified_group = self .isUnifiedBuild (parts )
488+ if unified_group :
489+ kargs ['unified_group' ] = unified_group
490+
470491 logging .info ("Preparing builder '%s'" % (name ,))
471492
472493 builder = self .builder_class (repository_path , runner = runner , ** kargs )
473494 builder .target = self
474495 builder .identifier = name
475- unified_group = self . isUnifiedBuild ( parts )
496+
476497 if unified_group :
477498 # Use group-specific output directory
478499 # group2 = apps with chip_enable_read_client=false
0 commit comments