Skip to content

Commit

Permalink
add methods order for conan create (#3682)
Browse files Browse the repository at this point in the history
* methods execution order

* conan2-create

* add test-package steps and correct missings

* Typo

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>

* Typo

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>

* Update reference/commands/create.rst

---------

Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
Co-authored-by: Carlos Zoido <mrgalleta@gmail.com>
  • Loading branch information
3 people committed May 8, 2024
1 parent bd8de78 commit 79382d4
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions reference/commands/create.rst
Expand Up @@ -64,6 +64,82 @@ The same happens for lockfiles created with ``--lockfile-out`` argument. The loc
dependencies, you can control their build using the ``--build-test`` argument.


Methods execution order
-----------------------

The ``conan create`` executes :ref:`methods <reference_conanfile_methods>` of a *conanfile.py* in the following order:

#. Export recipe to the cache
#. ``init()``
#. ``set_name()``
#. ``set_version()``
#. ``export()``
#. ``export_sources()``
#. Compute dependency graph
#. ``ìnit()``
#. ``config_options()``
#. ``configure()``
#. ``requirements()``
#. ``build_requirements()``
#. Compute necessary packages
#. ``validate_build()``
#. ``validate()``
#. ``package_id()``
#. ``layout()``
#. ``system_requirements()``
#. Install packages
#. ``source()``
#. ``build_id()``
#. ``generate()``
#. ``build()``
#. ``package()``
#. ``package_info()``

Steps ``generate()``, ``build()``, ``package()`` from *Install packages* step will not be called if the package
is not being built from sources.

After that, if you have a folder named *test_package* in your project or you call the ``conan create`` command with the
``--test-folder`` flag, the command will invoke the methods of the *conanfile.py* file inside the folder in the following order:

#. Launch test_package
#. (test package) ``init()``
#. (test package) ``set_name()``
#. (test package) ``set_version()``
#. Compute dependency graph
#. (test package) ``config_options()``
#. (test package) ``configure()``
#. (test package) ``requirements()``
#. (test package) ``build_requirements()``
#. ``ìnit()``
#. ``config_options()``
#. ``configure()``
#. ``requirements()``
#. ``build_requirements()``
#. Compute necessary packages
#. ``validate_build()``
#. ``validate()``
#. ``package_id()``
#. ``layout()``
#. (test package) ``validate_build()``
#. (test package) ``validate()``
#. (test package) ``package_id()``
#. (test package) ``layout()``
#. ``system_requirements()``
#. (test package) ``system_requirements()``
#. Install packages
#. ``build_id()``
#. ``generate()``
#. ``build()``
#. ``package_info()``
#. Test the package
#. (test package) ``build()``
#. (test package) ``test()``

The functions with *(test package)* belong to the *conanfile.py* in the *test_package* folder. The steps
``build_id()``, ``generate()``, ``build()`` inside the *Install packages* step will be skipped if the project is
already installed. Typically, it should be installed just as it was installed in the previous "install packages" step.


.. seealso::

- Read more about creating packages in the :ref:`dedicated
Expand Down

0 comments on commit 79382d4

Please sign in to comment.