@@ -441,6 +441,35 @@ def common_args(extra_args):
441441 components = esp_args .components
442442 user_c_modules = esp_args .user_c_modules
443443
444+ for i , c_module in enumerate (user_c_modules ):
445+ if c_module .startswith ('http' ):
446+ git_address , c_module = c_module .rsplit (':' , 1 )
447+ if '@' in git_address :
448+ git_address , checkout = git_address .split ('@' , 1 )
449+ else :
450+ checkout = None
451+
452+ c_module_name = os .path .split (git_address )[- 1 ]
453+
454+ c_module = os .path .join (SCRIPT_DIR , 'ext_mod' , c_module_name , c_module )
455+ user_c_modules [i ] = c_module
456+
457+ cmds = [
458+ ['cd' , f'ext_mod' ]
459+ ['git' , 'clone' , git_address ],
460+ ['cd' , c_module_name ]
461+ ]
462+
463+ if checkout is not None :
464+ cmds .append (['git' , 'checkout' , checkout ])
465+
466+ cmds .append (['git' , 'submodule' , 'init' ])
467+
468+ exit_code , data = spawn (cmds , out_to_screen = False , spinner = True )
469+ if exit_code :
470+ print (data )
471+ sys .exit (exit_code )
472+
444473 if custom_board_path is None :
445474 skip_partition_resize = esp_args .skip_partition_resize
446475 partition_size = esp_args .partition_size
0 commit comments