Skip to content

Commit

Permalink
Merge branch 'docs/add_Chinese_translation_for_the_rest_docs_of_api-g…
Browse files Browse the repository at this point in the history
…uides/tools' into 'master'

Docs: provide CN translation for the rest docs of api-guides/tools

Closes DOC-5400

See merge request espressif/esp-idf!24103
  • Loading branch information
suda-morris committed Aug 29, 2023
2 parents f0fba3f + 9684acc commit 7088223
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 66 deletions.
20 changes: 11 additions & 9 deletions docs/en/api-guides/tools/idf-clang-tidy.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
**************
IDF Clang Tidy
**************
******************
ESP-IDF Clang-Tidy
******************

The IDF Clang Tidy is a tool that uses `clang-tidy <https://clang.llvm.org/extra/clang-tidy/>`_ to run static analysis on your current app.
:link_to_translation:`zh_CN:[中文]`

The ESP-IDF Clang Tidy is a tool that uses `clang-tidy <https://clang.llvm.org/extra/clang-tidy/>`__ to run static analysis on your current app.

.. warning::

Expand All @@ -12,22 +14,22 @@ The IDF Clang Tidy is a tool that uses `clang-tidy <https://clang.llvm.org/extra

.. warning::

This tool does not support RISC-V based chips yet. For now, we don't provide clang based toolchain for RISC-V.
This tool does not support RISC-V based chips yet. For now, we do not provide clang based toolchain for RISC-V.

Prerequisites
=============

If you have never run this tool before, take the following steps to get this tool prepared.

#. Run the export scripts (``export.sh`` / ``export.bat`` / ... ) to set up the environment variables.
#. Run the export scripts (``export.sh``, ``export.bat``, or others) to set up the environment variables.
#. Run ``pip install --upgrade pyclang`` to install this plugin. The extra commands would be activated in ``idf.py`` automatically.
#. Run ``idf_tools.py install esp-clang`` to install the clang-tidy required binaries

.. note::

This toolchain is still under development. After the final release, you don't have to install them manually.
This toolchain is still under development. After the final release, you do not have to install them manually.

#. Get file from the `llvm repository <https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py>`_ and add the folder of this script to the ``$PATH``. Or you could pass an optional argument ``--run-clang-tidy-py`` later when you call ``idf.py clang-check``. Please don't forget to make the script executable.
#. Get the file from the `llvm repository <https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py>`__ and add the folder of this script to the ``$PATH``. Or you could pass an optional argument ``--run-clang-tidy-py`` later when you call ``idf.py clang-check``. Please do not forget to make the script executable.

.. note::

Expand All @@ -54,4 +56,4 @@ Run ``idf.py clang-check --help`` to see the full documentation.
Bug Report
==========

This tool is hosted in `espressif/clang-tidy-runner <https://github.com/espressif/clang-tidy-runner>`_. If you faced any bugs or have any feature request, please report them via `github issues <https://github.com/espressif/clang-tidy-runner/issues>`_.
This tool is hosted in `espressif/clang-tidy-runner <https://github.com/espressif/clang-tidy-runner>`__. If you were to face any bugs or have any feature request, please report them via `Github issues <https://github.com/espressif/clang-tidy-runner/issues>`__
64 changes: 33 additions & 31 deletions docs/en/api-guides/tools/idf-component-manager.rst
Original file line number Diff line number Diff line change
@@ -1,59 +1,61 @@
*********************
IDF Component Manager
*********************
*************************
ESP-IDF Component Manager
*************************

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.
:link_to_translation:`zh_CN:[中文]`

A list of components can be found on `<https://components.espressif.com/>`_
The ESP-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.

For detailed information about the IDF Component Manager, see the `IDF Component Manager and ESP Component Registry Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/>`_.
A list of components can be found on `<https://components.espressif.com/>`__.

Using With a Project
For detailed information about the ESP-IDF Component Manager, see the `ESP-IDF Component Manager and ESP Component Registry Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/>`__.

Using with a Project
====================

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 by running ``idf.py create-manifest``. By default, manifest file is created for the main component. You can explicitly either specify the directory where the manifest should be created using ``--path`` option or specify the component in your `components` folder using ``--component=my_component``. The ``create-manifest`` command can be run in the following ways:
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 by running ``idf.py create-manifest``. By default, a manifest file is created for the main component. You can explicitly either specify the directory where the manifest should be created using the ``--path`` option or specify the component in your ``components`` folder using ``--component=my_component``. The ``create-manifest`` command can be run in the following ways:

- ``idf.py create-manifest`` creates a manifest file for the main component
- ``idf.py create-manifest --component=my_component`` creates a manifest file for the component *my_component* in the ``components`` directory
- ``idf.py create-manifest --path="../../my_component"`` creates a manifest file for the component *my_component* in the directory ``my_component``
- ``idf.py create-manifest --component=my_component`` creates a manifest file for the component **my_component** in the ``components`` directory
- ``idf.py create-manifest --path="../../my_component"`` creates a manifest file for the component **my_component** in the ``my_component`` directory

When a new manifest is added to one of the components in the project, it is necessary to reconfigure the project manually by running ``idf.py reconfigure``. Then build will then track changes in ``idf_component.yml`` manifests and automatically triggers CMake when necessary.
When a new manifest is added to one of the components in the project, it is necessary to reconfigure the project manually by running ``idf.py reconfigure``. The build will then track changes in ``idf_component.yml`` manifests and automatically trigger CMake when necessary.

To add a dependency to a component (e.g. ``my_component``) in your ESP-IDF project, you can run the command ``idf.py add-dependency DEPENDENCY``. "The ``DEPENDENCY`` argument represents an additional component managed by the IDF Component Manager that ``my_component`` depends on. It is defined in a format ``namespace/name=1.0.0``, where `namespace/name` is the name of the component and `=1.0.0` is a version range of the component (see the `Versioning Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/reference/versioning.html>`_). By default, dependencies are added to the main component. You can either explicitly specify a directory where the manifest is located using ``--path`` option, or specify the component in your `components` folder using ``--component=my_component``. The ``add-dependency`` command can be run in the following ways:
To add a dependency to a component (e.g., ``my_component``) in your ESP-IDF project, you can run the command ``idf.py add-dependency DEPENDENCY``. The ``DEPENDENCY`` argument represents an additional component managed by the ESP-IDF Component Manager that ``my_component`` depends on. It is defined in the format ``namespace/name=1.0.0``, where `namespace/name` is the name of the component and `=1.0.0` is a version range of the component, see the `Versioning Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/reference/versioning.html>`__. By default, dependencies are added to the main component. You can either explicitly specify a directory where the manifest is located using the ``--path`` option, or specify the component in your ``components`` folder using ``--component=my_component``. The ``add-dependency`` command can be run in the following ways:

- ``idf.py add-dependency example/cmp`` adds a dependency on the most recent version of ``example/cmp`` to the main component
- ``idf.py add-dependency --component=my_component example/cmp<=3.3.3`` adds a dependency on the version ``<=3.3.3`` of ``example/cmp`` to the component ``my_component`` in the ``components`` directory
- ``idf.py add-dependency --path="../../my_component" example/cmp^3.3.3`` adds a dependency on the version ``^3.3.3`` of ``example/cmp`` to the component ``my_component`` in the directory ``my_component``
- ``idf.py add-dependency --path="../../my_component" example/cmp^3.3.3`` adds a dependency on the version ``^3.3.3`` of ``example/cmp`` to the component ``my_component`` in the ``my_component`` directory

.. note::

The command ``add-dependency`` adds dependencies to your project explicitly from the `Espressif Component Registry <https://components.espressif.com/>`_.
The command ``add-dependency`` adds dependencies to your project explicitly from the `Espressif Component Registry <https://components.espressif.com/>`__.

To update dependencies of the ESP-IDF project, you can run the command ``idf.py update-dependencies``. You can also specify the path to the project directory using ``--project-dir PATH``.
To update dependencies of the ESP-IDF project, you can run the command ``idf.py update-dependencies``. You can also specify the path to the project directory using ``--project-dir PATH``.

There is an example application: example:`build_system/cmake/component_manager` that uses components installed by the component manager.
There is an example application :example:`build_system/cmake/component_manager` that uses components installed by the component manager.

It's not necessary to have a manifest for components that don't need any managed dependencies.
It is not necessary to have a manifest for components that do not need any managed dependencies.

When CMake configures the project (e.g. ``idf.py reconfigure``) component manager does a few things:
When CMake configures the project (e.g., ``idf.py reconfigure``) component manager does a few things:

- Processes ``idf_component.yml`` manifests for every component in the project and recursively solves dependencies
- Creates a ``dependencies.lock`` file in the root of the project with a full list of dependencies
- Downloads all dependencies to the ``managed_components`` directory
- Processes ``idf_component.yml`` manifests for every component in the project and recursively solves dependencies.
- Creates a ``dependencies.lock`` file in the root of the project with a full list of dependencies.
- Downloads all dependencies to the ``managed_components`` directory.

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``
The lock file ``dependencies.lock`` and the content of the ``managed_components`` directory are not supposed to be modified by a user. When the component manager runs, it always makes sure they are up to date. If these files were accidentally modified, it is possible to re-run the component manager by triggering CMake with ``idf.py reconfigure``.

You may set build property ``DEPENDENCIES_LOCK`` to specify the lock-file path in the top-level CMakeLists.txt. For example, adding ``idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})`` before ``project(PROJECT_NAME)`` could help generate different lock files for different targets.
You may set the build property ``DEPENDENCIES_LOCK`` to specify the lock-file path in the top-level CMakeLists.txt. For example, adding ``idf_build_set_property(DEPENDENCIES_LOCK dependencies.lock.${IDF_TARGET})`` before ``project(PROJECT_NAME)`` could help generate different lock files for different targets.

Creating Project From an Example
================================
Creating a Project From an Example
==================================

Some components on the registry contain example projects. To create a new project from an example you can run the command ``idf.py create-project-from-example EXAMPLE``. The ``EXAMPLE`` argument should be in the format ``namespace/name=1.0.0:example`` where `namespace/name` is the name of the component, `=1.0.0` is a version range of the component (see the `Versioning Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/reference/versioning.html>`_) and `example` is the example's name. You can find the list of examples for every component and the command to start a project for it in the `Espressif Component Registry <https://components.espressif.com/>`_.
Some components on the registry contain example projects. To create a new project from an example you can run the command ``idf.py create-project-from-example EXAMPLE``. The ``EXAMPLE`` argument should be in the format ``namespace/name=1.0.0:example`` where `namespace/name` is the name of the component, `=1.0.0` is a version range of the component (see the `Versioning Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/reference/versioning.html>`__) and `example` is the example's name. You can find the list of examples for every component and the command to start a project for it in the `Espressif Component Registry <https://components.espressif.com/>`__.

Defining Dependencies in the Manifest
=====================================

You can easily define dependencies in the manifest file (idf_component.yml) by editing it directly in the text editor. Below are some basic examples that demonstrate how to define dependencies.
You can easily define dependencies in the manifest file ``idf_component.yml`` by editing it directly in the text editor. Below are some basic examples that demonstrate how to define dependencies.

You can define a dependency from the registry by specifying the component name and the version range:

Expand All @@ -63,12 +65,12 @@ You can define a dependency from the registry by specifying the component name a
# Define a dependency from the registry (https://components.espressif.com/component/example/cmp)
example/cmp: ">=1.0.0"
To define a dependency from a git repository, provide the path to the component within the repository and the repository's URL:
To define a dependency from a Git repository, provide the path to the component within the repository and the repository's URL:

.. code-block:: yaml
dependencies:
# Define a dependency from a git repository
# Define a dependency from a Git repository
test_component:
path: test_component
git: ssh://git@gitlab.com/user/components.git
Expand All @@ -82,9 +84,9 @@ During the development of components, you can use components from a local direct
some_local_component:
path: ../../projects/component
For detailed information about the manifest file format, see the `Manifest File Format Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/reference/manifest_file.html>`_.
For detailed information about the manifest file format, see `Manifest File Format Documentation <https://docs.espressif.com/projects/idf-component-manager/en/latest/reference/manifest_file.html>`__.

Disabling the Component Manager
===============================

The component manager can be explicitly disabled by setting ``IDF_COMPONENT_MANAGER`` environment variable to ``0``.
The component manager can be explicitly disabled by setting the ``IDF_COMPONENT_MANAGER`` environment variable to ``0``.
Loading

0 comments on commit 7088223

Please sign in to comment.