idf-component-manager.rst 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. *********************
  2. IDF Component Manager
  3. *********************
  4. The IDF Component manager is a tool that downloads dependencies for any ESP-IDF CMake project. The download happens automatically during a run of CMake. It can source components either from `the component registry <https://components.espressif.com>`_ or from a git repository.
  5. A list of components can be found on `<https://components.espressif.com/>`_
  6. Using with a project
  7. ====================
  8. Dependencies for each component in the project are defined in a separate manifest file named ``idf_component.yml`` placed in the root of the component. The manifest file template can be created for a component by running ``idf.py create-manifest --component=my_component``. When a new manifest is added to one of the components in the project it's necessary to reconfigure it manually by running ``idf.py reconfigure``. Then build will track changes in ``idf_component.yml`` manifests and automatically triggers CMake when necessary.
  9. There is an example application: example:`build_system/cmake/component_manager` that uses components installed by the component manager.
  10. It's not necessary to have a manifest for components that don't need any managed dependencies.
  11. When CMake configures the project (e.g. ``idf.py reconfigure``) component manager does a few things:
  12. - Processes ``idf_component.yml`` manifests for every component in the project and recursively solves dependencies
  13. - Creates a ``dependencies.lock`` file in the root of the project with a full list of dependencies
  14. - Downloads all dependencies to the ``managed_components`` directory
  15. The lock-file ``dependencies.lock`` and content of ``managed_components`` directory is not supposed to be modified by a user. When the component manager runs it always make sure they are up to date. If these files were accidentally modified it's possible to re-run the component manager by triggering CMake with ``idf.py reconfigure``
  16. Defining dependencies in the manifest
  17. =====================================
  18. .. code-block:: yaml
  19. dependencies:
  20. # Required IDF version
  21. idf: ">=4.1"
  22. # Defining a dependency from the registry:
  23. # https://components.espressif.com/component/example/cmp
  24. example/cmp: ">=1.0.0"
  25. # # Other ways to define dependencies
  26. #
  27. # # For components maintained by Espressif only name can be used.
  28. # # Same as `espressif/cmp`
  29. # component: "~1.0.0"
  30. #
  31. # # Or in a longer form with extra parameters
  32. # component2:
  33. # version: ">=2.0.0"
  34. #
  35. # # For transient dependencies `public` flag can be set.
  36. # # `public` flag doesn't affect the `main` component.
  37. # # All dependencies of `main` are public by default.
  38. # public: true
  39. #
  40. # # For components hosted on non-default registry:
  41. # service_url: "https://componentregistry.company.com"
  42. #
  43. # # For components in git repository:
  44. # test_component:
  45. # path: test_component
  46. # git: ssh://git@gitlab.com/user/components.git
  47. #
  48. # # For test projects during component development
  49. # # components can be used from a local directory
  50. # # with relative or absolute path
  51. # some_local_component:
  52. # path: ../../projects/component
  53. Disabling the Component Manager
  54. ===============================
  55. The component manager can be explicitly disabled by setting ``IDF_COMPONENT_MANAGER`` environment variable to ``0``.