You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/guides/packaging_components.rst
+27-17Lines changed: 27 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,46 +171,56 @@ In CI/CD pipelines, using environment variables to log in is more convenient. Yo
171
171
Filter Component Files
172
172
======================
173
173
174
-
As a component developer, you may want to specify which files from the component directory will be uploaded to the ESP Component Registry. There are two ways to achieve this: either by `using a .gitignore file`_ or by `using manifest filters`_.
174
+
As a component developer, you may want to specify which files from the component directory will be uploaded to the ESP Component Registry. This can be achieved by using `manifest filters`_ and a `.gitignore file`_.
175
175
176
-
.. warning::
176
+
Manifest Filters
177
+
----------------
178
+
179
+
Your ``idf_component.yml`` manifest may have ``files`` section with ``include`` and ``exclude`` filters. For example:
180
+
181
+
.. code:: yaml
182
+
183
+
files:
184
+
exclude:
185
+
- "*.py"# Exclude all Python files
186
+
- "**/*.list"# Exclude `.list` files in all directories
187
+
- "big_dir/**/*"# Exclude `big_dir` directory and its content
188
+
include:
189
+
- "**/.DS_Store"# Include files excluded by default
177
190
178
-
You are not allowed to use both methods simultaneously.
191
+
Files and directories that are excluded by default can be found `here <https://github.com/espressif/idf-component-manager/blob/main/idf_component_tools/file_tools.py#L16>`_.
179
192
180
-
Using a .gitignore File
181
-
-----------------------
193
+
.gitignore File
194
+
---------------
182
195
183
-
First, you need to specify the ``use_gitignore`` option in the ``idf_component.yml`` manifest file.
196
+
If you have a ``.gitignore`` file in your component directory, you can use it to filter files. All you need to do, is to specify the ``use_gitignore`` option in the ``idf_component.yml`` manifest file.
184
197
185
198
.. code:: yaml
186
199
187
200
files:
188
201
use_gitignore: true
189
202
190
-
Then, patterns specified in the ``.gitignore`` file will be automatically excluded before packaging or uploading the component.
203
+
Patterns specified in the ``.gitignore`` file will be automatically excluded before packaging or uploading the component.
191
204
192
205
.. code:: yaml
193
206
194
207
test_dir/ # Exclude files in all `test_dir` directories (including the directories themselves)
195
208
196
-
More information on how ``.gitignore`` works can be found in the `official documentation <https://git-scm.com/docs/gitignore/en>`_.
209
+
More information on how ``.gitignore`` works can be found in the `official documentation <https://git-scm.com/docs/gitignore>`_.
197
210
198
-
Using Manifest Filters
199
-
----------------------
200
-
201
-
In this case, your ``idf_component.yml`` manifest may have ``include`` and ``exclude`` filters. For example:
211
+
You can also use both manifest filters and a ``.gitignore`` file. In this case, the patterns from the ``.gitignore`` file will be applied first. Example:
202
212
203
213
.. code:: yaml
204
214
205
215
files:
216
+
use_gitignore: true
206
217
exclude:
207
-
- "*.py"# Exclude all Python files
208
-
- "**/*.list"# Exclude `.list` files in all directories
209
-
- "big_dir/**/*"# Exclude `big_dir` directory and its content
218
+
- ".env"# Exclude `.env` file
210
219
include:
211
-
- "**/.DS_Store"# Include files excluded by default
220
+
- "test_dir/**/*"# Include all files in `test_dir` directory
221
+
# which were excluded by `.gitignore`
212
222
213
-
Files and directories that are excluded by default can be found `here <https://github.com/espressif/idf-component-manager/blob/main/idf_component_tools/file_tools.py#L16>`_.
223
+
When using ``.gitignore``, files specified `here <https://github.com/espressif/idf-component-manager/blob/main/idf_component_tools/file_tools.py#L16>`_ will not be excluded by default.
0 commit comments