File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,19 @@ Should be only filled in the ``package_info()`` method.
96
96
Read here :ref:`the complete reference of self.conf_info <conan_conanfile_model_conf_info>`.
97
97
98
98
99
+ generators_info
100
+ ---------------
101
+
102
+ .. include:: ../../common/experimental_warning.inc
103
+
104
+ Generators to be passed to the dependant recipes.
105
+ Should be only filled in the ``package_info()`` method.
106
+
107
+ .. seealso::
108
+
109
+ See :ref:`an example usage here <reference_commands_custom_generators_tool_requires>`
110
+ and :ref:`the complete reference of self.generators_info <conan_conanfile_model_generators_info>`.
111
+
99
112
deprecated
100
113
----------
101
114
Original file line number Diff line number Diff line change @@ -296,6 +296,33 @@ configuration as:
296
296
Note that this only propagates from the immediate, direct `` tool_requires`` of a recipe.
297
297
298
298
299
+ .. _conan_conanfile_model_generators_info:
300
+
301
+ generators_info
302
+ -------------- -
303
+
304
+ .. include:: ../ ../ ../ common/ experimental_warning.inc
305
+
306
+
307
+ `` tool_requires`` in the build context can inject generators into the recipe,
308
+ by adding them to the `` generators_info`` list inside the `` package_info`` method.
309
+ This is useful to inject custom generators into the recipe, that will be used by the consumers of the package,
310
+ just as if they were declared in their `` generators`` attribute.
311
+
312
+ .. code- block:: python
313
+
314
+ class MyGenerator:
315
+ def __init__ (self , conanfile):
316
+ self ._conanfile = conanfile
317
+
318
+ def generate(self ):
319
+ self .output.info(f " Calling custom generator for { conanfile} " )
320
+
321
+ def package_info(self ):
322
+ self .generators_info.append(MyGenerator)
323
+
324
+ Note that this only propagates from the immediate, direct `` tool_requires`` of a recipe.
325
+
299
326
300
327
.. note::
301
328
Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ argument:
100
100
conan install --requires=zlib/1.2.13 -g MyGenerator
101
101
102
102
103
+ .. _reference_commands_custom_generators_tool_requires :
104
+
103
105
Generators from tool_requires
104
106
-----------------------------
105
107
You can’t perform that action at this time.
0 commit comments