Skip to content

Commit

Permalink
fixed problem with transitive build_requires (#5056)
Browse files Browse the repository at this point in the history
* fixed problem with transitive build_requires

* comment fix
  • Loading branch information
memsharded authored and lasote committed Apr 30, 2019
1 parent d645837 commit 92789b1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions conans/client/graph/graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ 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

# If the parent node is a build-require, this new node will be a build-require
# If the requirement is a build-require, this node will also be a build-require
new_node.build_require = node.build_require or require.build_require
# 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

0 comments on commit 92789b1

Please sign in to comment.