Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add methods order for conan create #3682

Merged
merged 6 commits into from May 8, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 76 additions & 0 deletions reference/commands/create.rst
Expand Up @@ -59,6 +59,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:
RubenRBS marked this conversation as resolved.
Show resolved Hide resolved

#. 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()``
RubenRBS marked this conversation as resolved.
Show resolved Hide resolved
#. ``generate()``
#. ``build()``
#. ``package()``
RubenRBS marked this conversation as resolved.
Show resolved Hide resolved
#. ``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 call the *conanfile.py* file inside the folder in the following order:
czoido marked this conversation as resolved.
Show resolved Hide resolved

#. 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