@@ -423,10 +423,34 @@ def copy_essential_paths(RTT_ROOT, rtt_dir_path, copied_files=None):
423
423
424
424
return copied_files
425
425
426
+ def copy_components_kconfig (RTT_ROOT , rtt_dir_path ):
427
+ """Copy all Kconfig files under components directory"""
428
+ components_dir = os .path .join (RTT_ROOT , 'components' )
429
+ print ('=> copying components Kconfig files' )
430
+
431
+ # Walk through all directories under components
432
+ for root , dirs , files in os .walk (components_dir ):
433
+ if 'Kconfig' in files :
434
+ # Get relative path from components directory
435
+ rel_path = os .path .relpath (root , RTT_ROOT )
436
+ src_file = os .path .join (root , 'Kconfig' )
437
+ dst_file = os .path .join (rtt_dir_path , rel_path , 'Kconfig' )
438
+
439
+ # Create destination directory if not exists
440
+ dst_dir = os .path .dirname (dst_file )
441
+ if not os .path .exists (dst_dir ):
442
+ os .makedirs (dst_dir )
443
+
444
+ do_copy_file (src_file , dst_file )
445
+ print (f' => copying Kconfig from { rel_path } ' )
446
+
426
447
def components_copy_files (RTT_ROOT , rtt_dir_path , config_file ):
427
448
"""Copy components based on configuration"""
428
449
print ('=> components (selective copy)' )
429
450
451
+ # Copy all Kconfig files first
452
+ copy_components_kconfig (RTT_ROOT , rtt_dir_path )
453
+
430
454
# Track copied build files to avoid duplication
431
455
copied_files = set ()
432
456
@@ -530,4 +554,19 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env, project_name, project_path):
530
554
# Generate documentation
531
555
generate_dist_doc (dist_dir , enabled_components , project_name + '-dist' , BSP_ROOT , RTT_ROOT )
532
556
557
+ target_project_type = GetOption ('target' )
558
+ if target_project_type :
559
+ child = subprocess .Popen ('scons --target={} --project-name="{}"' .format (target_project_type , project_name ), cwd = dist_dir , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
560
+ stdout , stderr = child .communicate ()
561
+ if child .returncode == 0 :
562
+ print (stdout )
563
+ else :
564
+ print (stderr )
565
+ else :
566
+ print ('suggest to use command scons --dist [--target=xxx] [--project-name="xxx"] [--project-path="xxx"]' )
567
+
568
+ # make zip package
569
+ if project_path == None :
570
+ zip_dist (dist_dir , project_name )
571
+
533
572
print ('dist project successfully!' )
0 commit comments