@@ -407,6 +407,70 @@ macro(idf_build_process target)
407
407
idf_build_set_property(__COMPONENT_REQUIRES_COMMON "" )
408
408
endif ()
409
409
410
+ # Call for component manager to download dependencies for all components
411
+ idf_build_set_property(IDF_COMPONENT_MANAGER "$ENV{IDF_COMPONENT_MANAGER} " )
412
+ idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
413
+ if (idf_component_manager)
414
+ if (idf_component_manager EQUAL "0" )
415
+ message (VERBOSE "IDF Component manager was explicitly disabled by setting IDF_COMPONENT_MANAGER=0" )
416
+ elseif (idf_component_manager EQUAL "1" )
417
+ set (managed_components_list_file ${build_dir} /managed_components_list.temp.cmake)
418
+ set (local_components_list_file ${build_dir} /local_components_list.temp.yml)
419
+
420
+ set (__contents "components:\n " )
421
+ idf_build_get_property(__component_targets __COMPONENT_TARGETS)
422
+ foreach (__component_target ${__component_targets} )
423
+ __component_get_property(__component_name ${__component_target} COMPONENT_NAME)
424
+ __component_get_property(__component_dir ${__component_target} COMPONENT_DIR)
425
+ set (__contents "${__contents} - name: \" ${__component_name} \"\n path: \" ${__component_dir} \"\n " )
426
+ endforeach ()
427
+
428
+ file (WRITE ${local_components_list_file} "${__contents} " )
429
+
430
+ # Call for the component manager to prepare remote dependencies
431
+ execute_process (COMMAND ${PYTHON}
432
+ "-m"
433
+ "idf_component_manager.prepare_components"
434
+ "--project_dir=${project_dir} "
435
+ "prepare_dependencies"
436
+ "--local_components_list_file=${local_components_list_file} "
437
+ "--managed_components_list_file=${managed_components_list_file} "
438
+ RESULT_VARIABLE result
439
+ ERROR_VARIABLE error)
440
+
441
+ if (NOT result EQUAL 0)
442
+ message (FATAL_ERROR "${error} " )
443
+ endif ()
444
+
445
+ include (${managed_components_list_file} )
446
+
447
+ # Add managed components to list of all components
448
+ # `managed_components` contains the list of components installed by the component manager
449
+ # It is defined in the temporary managed_components_list_file file
450
+ set (__COMPONENTS "${__COMPONENTS} ;${managed_components} " )
451
+
452
+ file (REMOVE ${managed_components_list_file} )
453
+ file (REMOVE ${local_components_list_file} )
454
+ else ()
455
+ message (WARNING "IDF_COMPONENT_MANAGER environment variable is set to unknown value "
456
+ "\" ${idf_component_manager} \" . If you want to use component manager set it to 1." )
457
+ endif ()
458
+ else ()
459
+ idf_build_get_property(__component_targets __COMPONENT_TARGETS)
460
+ set (__components_with_manifests "" )
461
+ foreach (__component_target ${__component_targets} )
462
+ __component_get_property(__component_dir ${__component_target} COMPONENT_DIR)
463
+ if (EXISTS "${__component_dir} /idf_component.yml" )
464
+ set (__components_with_manifests "${__components_with_manifests} \t ${__component_dir} \n " )
465
+ endif ()
466
+ endforeach ()
467
+
468
+ if (NOT "${__components_with_manifests} " STREQUAL "" )
469
+ message (WARNING "\" idf_component.yml\" file was found for components:\n ${__components_with_manifests} "
470
+ "However, the component manager is not enabled." )
471
+ endif ()
472
+ endif ()
473
+
410
474
# Perform early expansion of component CMakeLists.txt in CMake scripting mode.
411
475
# It is here we retrieve the public and private requirements of each component.
412
476
# It is also here we add the common component requirements to each component's
0 commit comments