Browse Source

[action] yml file adds the depends parameter (#9627)

hydevcode 8 months ago
parent
commit
65e239d3f1
2 changed files with 122 additions and 14 deletions
  1. 72 7
      bsp/nrf5x/nrf52840/.ci/attachconfig/ci.attachconfig.yml
  2. 50 7
      tools/ci/bsp_buildings.py

+ 72 - 7
bsp/nrf5x/nrf52840/.ci/attachconfig/ci.attachconfig.yml

@@ -1,8 +1,11 @@
+devices.strict:
+    depend_scons_arg:
+      - '--strict'
 devices.gpio:
+    depends:
+      - devices.strict
     kconfig:
       - CONFIG_BSP_USING_GPIO=y
-    scons_arg:
-      - '--strict'
 devices.adc:
     kconfig:
       - CONFIG_BSP_USING_SAADC=y
@@ -12,13 +15,14 @@ devices.flash:
 devices.i2c:
     kconfig:
       - CONFIG_BSP_USING_I2C=y
-devices.spi:    
+devices.spi:
     kconfig:
-      - CONFIG_BSP_USING_SPI=y  
-devices.uart:   
+      - CONFIG_RT_USING_SPI=y
+      - CONFIG_BSP_USING_SPI=y
+devices.uart:
     kconfig:
       - CONFIG_BSP_USING_UART=y
-devices.watchdog: 
+devices.watchdog:
     kconfig:
       - CONFIG_BSP_USING_WDT=y
 devices.qspi_flash:
@@ -33,4 +37,65 @@ devices.rtc:
 devices.hwtimer:
     kconfig:
       - CONFIG_BSP_USING_TIM=y
-      - CONFIG_BSP_USING_TIM0=y
+      - CONFIG_BSP_USING_TIM0=y
+# ------ NimBLE-v1.0.0 CI ------
+nimble:
+    kconfig:
+      - CONFIG_BSP_USING_NIMBLE=y
+      - CONFIG_PKG_USING_NIMBLE_V100=y
+nimble.advertiser:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_ADVERTISER=y
+nimble.beacon:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_BEACON=y
+nimble.blecsc:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_BLECSC=y
+nimble.central:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_CENTRAL=y
+nimble.ext.advertiser:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_EXT_ADVERTISER=y
+      - CONFIG_PKG_NIMBLE_EXT_ADV=y
+nimble.mesh:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_BLEMESH=y
+nimble.per.hr:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_PER_HR=y
+nimble.peripheral:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_PERIPHERAL=y
+nimble.btshell:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_BTSHELL=y
+nimble.uart:
+    depends:
+      - nimble
+    kconfig:
+      - CONFIG_PKG_NIMBLE_SAMPLE_BLEUART=y
+# ------ SEGGER CI ------
+segger:
+    kconfig:
+      - CONFIG_PKG_USING_SEGGER_RTT=y
+      - CONFIG_RT_USING_SERIAL_V2=y

+ 50 - 7
tools/ci/bsp_buildings.py

@@ -100,6 +100,32 @@ def check_scons_args(file_path):
                 args.append(match.group(1).strip())
     return ' '.join(args)
 
+def get_details_and_dependencies(details, projects, seen=None):
+    if seen is None:
+        seen = set()
+    detail_list = []
+    scons_arg_list = []
+    if details is not None:
+        for dep in details:
+            if dep not in seen:
+                dep_details=projects.get(dep)
+                seen.add(dep)
+                if dep_details is not None:
+                    if dep_details.get('depends') is not None:
+                        detail_temp,scons_arg_temp=get_details_and_dependencies(dep_details.get('depends'), projects, seen)
+                        for line in detail_temp:
+                            detail_list.append(line)
+                        for line in scons_arg_temp:
+                            scons_arg_list.append(line)
+                    if dep_details.get('kconfig') is not None:
+                        for line in dep_details.get('kconfig'):
+                            detail_list.append(line)
+                    if dep_details.get('depend_scons_arg') is not None:   
+                        for line in dep_details.get('depend_scons_arg'):
+                            scons_arg_list.append(line)
+            else:
+                print(f"::error::There are some problems with attachconfig depend: {dep}");
+    return detail_list,scons_arg_list
 
 def build_bsp_attachconfig(bsp, attach_file):
     """
@@ -167,9 +193,18 @@ if __name__ == "__main__":
                     if filename.endswith('attachconfig.yml'):
                         file_path = os.path.join(root, filename)
                         if os.path.exists(file_path):
-                            with open(file_path, 'r') as file:
-                                content = yaml.safe_load(file)
-                                yml_files_content.append(content)
+                            try:
+                                with open(file_path, 'r') as file:
+                                    content = yaml.safe_load(file)
+                                    if content is None:
+                                        continue
+                                    yml_files_content.append(content)
+                            except yaml.YAMLError as e:
+                                print(f"::error::Error parsing YAML file: {e}")
+                                continue
+                            except Exception as e:
+                                print(f"::error::Error reading file: {e}")
+                                continue
         
         config_file = os.path.join(rtt_root, 'bsp', bsp, '.config')
 
@@ -179,10 +214,18 @@ if __name__ == "__main__":
                 config_bacakup = config_file+'.origin'
                 shutil.copyfile(config_file, config_bacakup)
                 with open(config_file, 'a') as destination:
-                    for line in details.get('kconfig'):
-                        destination.write(line + '\n')
-                scons_arg = details.get('scons_arg')
-                scons_arg_str = scons_arg[0] if scons_arg else ' '
+                    if(projects.get(name) is not None):
+                        detail_list,scons_arg_list=get_details_and_dependencies([name],projects)
+                        for line in detail_list:
+                            destination.write(line + '\n')
+                scons_arg=[]
+                if details.get('scons_arg') is not None:
+                    for line in details.get('scons_arg'):
+                        scons_arg.append(line)
+                if scons_arg_list is not None:
+                    for line in scons_arg_list:
+                        scons_arg.append(line)
+                scons_arg_str=' '.join(scons_arg) if scons_arg else ' '
                 print(f"::group::\tCompiling yml project: =={count}==={name}=scons_arg={scons_arg_str}==")
                 res = build_bsp(bsp, scons_arg_str)
                 if not res: