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

fixed problem with transitive build_requires #5056

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions conans/client/graph/graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def _handle_require(self, name, node, require, dep_graph, check_updates, update,
new_node.inverse_closure.add(node)
node.public_deps[new_node.name] = new_node

new_node.build_require = node.build_require or require.build_require
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to postpone #4738 for 1.16, but please, at least put a comment if the code is new. That is a new corner case that it is impossible for anyone except you to know why. What does it mean that node.build_require is None and why it should take it from require? What is require?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

# New nodes will inherit the private property of its ancestor
new_node.private = node.private or require.private
if require.private or require.build_require:
Expand Down
15 changes: 15 additions & 0 deletions conans/test/functional/build_requires/build_requires_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from conans.paths import CONANFILE
from conans.test.utils.tools import TestClient
from conans.util.files import load
from conans.test.utils.conanfile import TestConanFile

tool_conanfile = """from conans import ConanFile

Expand Down Expand Up @@ -50,6 +51,20 @@ def build_requirements(self):


class BuildRequiresTest(unittest.TestCase):
def test_build_requires_diamond(self):
t = TestClient()
t.save({"conanfile.py": str(TestConanFile("libA", "0.1"))})
t.run("create . libA/0.1@user/testing")

t.save({"conanfile.py": str(TestConanFile("libB", "0.1",
requires=["libA/0.1@user/testing"]))})
t.run("create . libB/0.1@user/testing")

t.save({"conanfile.py": str(TestConanFile("libC", "0.1",
build_requires=["libB/0.1@user/testing",
"libA/0.1@user/testing"]))})
t.run("create . libC/0.1@user/testing")
self.assertIn("libC/0.1@user/testing: Created package", t.out)

def create_with_tests_and_build_requires_test(self):
client = TestClient()
Expand Down
2 changes: 1 addition & 1 deletion conans/test/functional/graph/graph_manager_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def test_dont_conflict_private(self, private_first):
self._check_node(liba2, "liba/0.2@user/testing#123", deps=[], build_deps=[],
dependents=[libc], closure=[])

def consecutive_private(self):
def test_consecutive_private(self):
liba_ref = "liba/0.1@user/testing"
libb_ref = "libb/0.1@user/testing"
libc_ref = "libc/0.1@user/testing"
Expand Down