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
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
2 changes: 1 addition & 1 deletion conan/cli/commands/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create(conan_api, parser, *args):
add_common_install_arguments(parser)
parser.add_argument("--build-require", action='store_true', default=False,
help='Whether the package being created is a build-require (to be used'
'as tool_requires() by other packages)')
' as tool_requires() by other packages)')
parser.add_argument("-tf", "--test-folder", action=OnceArgument,
help='Alternative test folder name. By default it is "test_package". '
'Use "" to skip the test stage')
Expand Down
2 changes: 1 addition & 1 deletion conans/client/graph/graph_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,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
1 change: 1 addition & 0 deletions conans/model/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"tools.files.download:retry": "Number of retries in case of failure when downloading",
"tools.files.download:retry_wait": "Seconds to wait between download attempts",
"tools.files.download:verify": "If set, overrides recipes on whether to perform SSL verification for their downloaded files. Only recommended to be set while testing",
"tools.graph:skip_binaries": "Allow the graph to skip binaries not needed in the current configuration (True by default)",
"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")})