From 81fe80e449d253218125ca13a66f242a2a5c3218 Mon Sep 17 00:00:00 2001 From: memsharded Date: Tue, 29 Oct 2024 00:52:36 +0100 Subject: [PATCH 1/2] new skip confs --- reference/conanfile/methods/build_requirements.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reference/conanfile/methods/build_requirements.rst b/reference/conanfile/methods/build_requirements.rst index 8cadace8cc48..dfd30ab9cacc 100644 --- a/reference/conanfile/methods/build_requirements.rst +++ b/reference/conanfile/methods/build_requirements.rst @@ -16,6 +16,14 @@ For simple cases the attribute syntax can be enough, like ``tool_requires = "cma The ``tool_requires`` and ``test_requires`` methods are just a specialized instance of ``requires`` with some predefined trait values. See the :ref:`requires() reference` for more information about traits. +There are 2 **experimental** ``confs`` that can be used to avoid the expansion of these type of requirements: + +- ``tools.graph:skip_build`` allows to skip ``tool_requires`` dependencies completely. This can be done if two conditions are met: the packages requiring these tools do not need to be built from sources, and the tool requirements do not affect the consumers ``package_id``. If this happens, Conan will raise an error. +- ``tools.graph:skip_test`` allows to skip ``test_requires`` dependencies completely. If these dependencies are skipped, but then some package needs to be built from source and ``tools.build:skip_test`` was not activated, it will fail to locate the ``test_requires``. So in most cases, the ``tools.build:skip_test`` should also be defined. + +Note that if tool and/or test requirements are skipped they will not be part of the dependency graph, and they will not become part of possible generated lockfiles or package lists, with a potential impact on future reproducibility. Also, in most cases, Conan is able to mark tool and test requirements as unnecessary (``Skip``), avoiding the download of the heavy binaries, just downloading the recipe which is usually very fast. That means that in most cases these ``confs`` are not necessary and the Conan defaults are good, please use them being aware of the tradeoffs. + + .. _reference_conanfile_methods_build_requirements_tool_requires: tool_requires() From 5db6e14bee54bf47b07fe79d4e204b4d1d58c5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Tue, 29 Oct 2024 11:52:14 +0100 Subject: [PATCH 2/2] Update reference/conanfile/methods/build_requirements.rst --- reference/conanfile/methods/build_requirements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/conanfile/methods/build_requirements.rst b/reference/conanfile/methods/build_requirements.rst index dfd30ab9cacc..34ac7481106b 100644 --- a/reference/conanfile/methods/build_requirements.rst +++ b/reference/conanfile/methods/build_requirements.rst @@ -16,7 +16,7 @@ For simple cases the attribute syntax can be enough, like ``tool_requires = "cma The ``tool_requires`` and ``test_requires`` methods are just a specialized instance of ``requires`` with some predefined trait values. See the :ref:`requires() reference` for more information about traits. -There are 2 **experimental** ``confs`` that can be used to avoid the expansion of these type of requirements: +There are 2 **experimental** ``confs`` that can be used to avoid the expansion of these types of requirements: - ``tools.graph:skip_build`` allows to skip ``tool_requires`` dependencies completely. This can be done if two conditions are met: the packages requiring these tools do not need to be built from sources, and the tool requirements do not affect the consumers ``package_id``. If this happens, Conan will raise an error. - ``tools.graph:skip_test`` allows to skip ``test_requires`` dependencies completely. If these dependencies are skipped, but then some package needs to be built from source and ``tools.build:skip_test`` was not activated, it will fail to locate the ``test_requires``. So in most cases, the ``tools.build:skip_test`` should also be defined.