Skip to content

Commit 8388598

Browse files
authored
Wording for warnings (#4139)
1 parent d728eba commit 8388598

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

reference/conanfile/methods/build_requirements.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ The ``test_requires`` is equivalent to ``requires()`` with the following traits:
114114
- ``test=True``. This dependency is a "test" dependency, existing in the "host" context, but not aiming to be part of the final product.
115115
- ``visible=False``. The dependency to a test requirement is not propagated downstream. For example, one package can call ``self.test_requires("gtest/1.13.0")``, but that doesn't mean that the consumer packages also use ``gtest``, they could even use a different test framework, or the same ``gtest`` with a different version, without causing conflicts.
116116

117+
.. warning::
118+
119+
As the ``test_requires`` defines a ``visible=False`` trait,
120+
care must be taken to avoid having transitive dependencies with a normal requirement to the same packages
121+
used in the ``test_requires``. This is because having direct ``visible=False`` requirements
122+
can create conflicts if a transitive dependency has a ``visible=True``
123+
requirement to the same package that the current recipe is requiring as a test dependency.
124+
In these cases where different visibility rules reach the same package, the visible transitive
125+
dependency will be used and propagated downstream.
117126

118127
It is possible to further modify individual traits of ``tool_requires()`` and ``test_requires()`` if necessary, for example:
119128

reference/conanfile/methods/requirements.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@ the same library in the same dependency graph is at least complicated, if not di
8585
violating ODR or causing linking errors. It can be set to ``False`` in advanced scenarios,
8686
when we want to use different versions of the same package during the build.
8787

88+
.. warning::
89+
90+
The ``visible`` trait can create conflicts if a transitive dependency has a ``visible=True``
91+
requirement to the same package that the current recipe is declaring as ``visible=False``.
92+
In these cases where different visibility rules reach the same package, the visible transitive
93+
dependency will be used and propagated downstream.
94+
95+
8896
transitive_headers
8997
~~~~~~~~~~~~~~~~~~
9098

0 commit comments

Comments
 (0)