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

fix wrong propagation over visible=True when dependency is header-only #15564

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions conans/model/requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ def transform_downstream(self, pkg_type, require, dep_pkg_type):
if self.transitive_libs is not None:
downstream_require.transitive_libs = self.transitive_libs

if self.visible is False:
downstream_require.visible = False

if pkg_type is not PackageType.HEADER: # These rules are not valid for header-only
# If non-default, then the consumer requires has priority
if self.visible is False:
downstream_require.visible = False

if self.headers is False:
downstream_require.headers = False

Expand Down
34 changes: 34 additions & 0 deletions conans/test/integration/graph/core/graph_manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,40 @@ def test_diamond_transitive_private(self):
_check_transitive(libc, [(libb, True, True, False, False),
(liba, True, True, False, False)])

def test_private_transitive_headers_no_conflict(self):
# https://github.com/conan-io/conan/issues/15559
# app -->liba/0.1 -(private)-> spdlog/0.1(header-only) -> fmt/0.1 (header-only)
# \ --------------------------------------------------> fmt/0.2
self.recipe_conanfile("fmt/0.1",
GenConanfile("fmt", "0.1").with_package_type("header-library"))
self.recipe_conanfile("fmt/0.2", GenConanfile("fmt", "0.2"))
self.recipe_conanfile("spdlog/0.1",
GenConanfile("spdlog", "0.1").with_package_type("header-library")
.with_requires("fmt/0.1"))
self.recipe_conanfile("liba/0.1",
GenConanfile("liba", "0.2").with_requirement("spdlog/0.1",
visible=False))
consumer = self.consumer_conanfile(GenConanfile("app", "0.1")
.with_requires("liba/0.1", "fmt/0.2"))
deps_graph = self.build_consumer(consumer)

self.assertEqual(5, len(deps_graph.nodes))
app = deps_graph.root
liba = app.dependencies[0].dst
spdlog = liba.dependencies[0].dst
fmt01 = spdlog.dependencies[0].dst
fmt02 = app.dependencies[1].dst

self._check_node(app, "app/0.1", deps=[liba, fmt02])
self._check_node(liba, "liba/0.1#123", deps=[spdlog], dependents=[app])
self._check_node(spdlog, "spdlog/0.1#123", deps=[fmt01], dependents=[liba])
self._check_node(fmt01, "fmt/0.1#123", deps=[], dependents=[spdlog])
self._check_node(fmt02, "fmt/0.2#123", dependents=[app])

# node, headers, lib, build, run
_check_transitive(app, [(liba, True, True, False, False),
(fmt02, True, True, False, False)])


class TestDiamondMultiple(GraphManagerTest):

Expand Down