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

Implement conf that avoids binary skipping in the graph #14466

Merged
merged 8 commits into from
Aug 23, 2023
Merged
2 changes: 1 addition & 1 deletion conans/client/graph/graph_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,5 @@ def _skip_binaries(graph):
required_nodes.add(dep_node)

for node in graph.nodes:
if node not in required_nodes:
if node not in required_nodes and node.conanfile.conf.get("tools.graph:skip_binaries", check_type=bool, default=True):
node.binary = BINARY_SKIP
2 changes: 2 additions & 0 deletions conans/model/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
"tools.deployer:symlinks": "Set to False to disable deployers copying symlinks",
"tools.files.download:retry": "Number of retries in case of failure when downloading",
"tools.files.download:retry_wait": "Seconds to wait between download attempts",
# TODO. Find better name
"tools.graph:skip_binaries": "Lorem Ipsum",
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
"tools.gnu:make_program": "Indicate path to make program",
"tools.gnu:define_libcxx11_abi": "Force definition of GLIBCXX_USE_CXX11_ABI=1 for libstdc++11",
"tools.gnu:pkg_config": "Path to pkg-config executable used by PkgConfig build helper",
Expand Down
29 changes: 29 additions & 0 deletions conans/test/integration/graph/test_skip_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,32 @@ def test_list_skip_printing():
c.run("install app --build=missing")
c.assert_listed_binary({"tool/0.1": ("da39a3ee5e6b4b0d3255bfef95601890afd80709", "Cache")},
build=True)


def test_conf_skip():
client = TestClient()
client.save({"conanfile.py": GenConanfile()})
client.run("create . --name=maths --version=1.0")
client.run("create . --name=ai --version=1.0")

client.save({"conanfile.py": GenConanfile().with_requirement("maths/1.0", visible=False)})
client.run("create . --name=liba --version=1.0")
client.save({"conanfile.py": GenConanfile().with_requirement("ai/1.0", visible=False)})
client.run("create . --name=libb --version=1.0")

client.save({"conanfile.py": GenConanfile().with_requires("liba/1.0", "libb/1.0")})
client.run("create . --name=app --version=0.0 -v")
client.assert_listed_binary({"maths/1.0": (NO_SETTINGS_PACKAGE_ID, "Skip")})
client.assert_listed_binary({"ai/1.0": (NO_SETTINGS_PACKAGE_ID, "Skip")})

client.run("create . --name=app --version=1.0 -v -c *:tools.graph:skip_binaries=False")
client.assert_listed_binary({"maths/1.0": (NO_SETTINGS_PACKAGE_ID, "Cache")})
client.assert_listed_binary({"ai/1.0": (NO_SETTINGS_PACKAGE_ID, "Cache")})

client.run("create . --name=app --version=2.0 -v -c maths/*:tools.graph:skip_binaries=False")
client.assert_listed_binary({"maths/1.0": (NO_SETTINGS_PACKAGE_ID, "Cache")})
client.assert_listed_binary({"ai/1.0": (NO_SETTINGS_PACKAGE_ID, "Skip")})

client.run("create . --name=app --version=3.0 -v -c *:tools.graph:skip_binaries=True")
client.assert_listed_binary({"maths/1.0": (NO_SETTINGS_PACKAGE_ID, "Skip")})
client.assert_listed_binary({"ai/1.0": (NO_SETTINGS_PACKAGE_ID, "Skip")})