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

[question] visible=False doesn't work for build requirements? #15346

Closed
1 task
db4 opened this issue Dec 26, 2023 · 4 comments
Closed
1 task

[question] visible=False doesn't work for build requirements? #15346

db4 opened this issue Dec 26, 2023 · 4 comments
Assignees
Milestone

Comments

@db4
Copy link
Contributor

db4 commented Dec 26, 2023

What is your question?

Consider the following test recipes:
pkg1/1.0

from conan import ConanFile


class Pkg1Conan(ConanFile):
    settings = "os", "compiler", "arch", "build_type"

pkg2/1.0

from conan import ConanFile


class Pkg2Conan(ConanFile):
    settings = "os", "arch", "build_type", "compiler"

    def requirements(self):
        self.requires("pkg1/1.0", build=True)

pkg3/1.0

from conan import ConanFile


class Pkg3Conan(ConanFile):
    settings = "os", "arch", "build_type", "compiler"

    def requirements(self):
        self.requires("pkg2/1.0", visible=False)

pkg4/1.0

from conan import ConanFile


class Pkg4Conan(ConanFile):
    settings = "os", "arch", "build_type", "compiler"

    def requirements(self):
        self.requires("pkg3/1.0")

If I create them in sequence, pkg4 requires pkg1 as a build requirement:

pkg4/1.0: Forced build from source
Requirements
    pkg3/1.0#7603eec4a39e35fa51c302be5dc39edf:4f95ed7b4a57821394071c702e54ae2871aa8e91#197e6f60d1dc2e4bc34e15cfeb21e6d4 - Cache
    pkg4/1.0#6b1269936c6af238dac6f28435d83888:c4237a8a579c71a763944d01b215ad8a801871f0 - Build
Build requirements
    pkg1/1.0#9bfaf61a619093fa366d262be46a6b77:2068baaab67a8d1ae925bbe12c37df5b885a6d56#bd38b1b7983e749d27f789e51c8ec4b6 - Cache
Skipped binaries
    pkg2/1.0

Why? Shouldn't visible=True in pkg3/1.0 prevent that?

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Dec 27, 2023
@memsharded
Copy link
Member

Hi @db4

Thanks for the report.
It seems it could be a bug in the propagation of traits down the graph, I am having a look.

@memsharded memsharded added this to the 2.0.17 milestone Dec 27, 2023
@db4
Copy link
Contributor Author

db4 commented Dec 27, 2023

@memsharded Great, thank you! But if you decide to release 2.0.17 with that fix, maybe you also include #15336 there?

@memsharded
Copy link
Member

I am submitting #15357 to fix it.

One observation: Using a requires(..., build=True) should be a very exceptional use case, making a requirement both a "tool-require" in the build context, but also visible=True, which is the default for requires. This makes the build-context requirement to propagate down the graph, which in our experience is difficult to manage and can be problematic. In general it should be avoided and use tool_requires() for most cases.

@memsharded
Copy link
Member

Hi @db4

This has been fixed in #15357, to be released in next 2.0.17. If you want to give it a quick try before the release, it is merged in the release/2.0 branch, that would be great.

Thanks again for reporting, closing the ticket as solved in 2.0.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants