Open MichalCermakx opened 1 year ago
This seems somewhat related to another issue I had: https://github.com/conan-io/conan/issues/12274
It seems to be different. Mine is about private+override, the https://github.com/conan-io/conan/issues/12274 is about the combination of a build_requires and requires.
Any update on this issue ?
Hi all,
override
and private
are mutually exclusive:
private
means that it is your direct, private dependency. It is a highly discouraged thing in Conan 1.X, it should only be used as a very last resource.requires
to it, is violating the private
definition, which means exactly "this is my own private thing, nobody else can touch it", so it cannot be overriden by downstream.Both are incompatible in meaning and cannot be used together.
@memsharded Thanks this explains alot, but as a developer you know the internals and hence can answer this here. but official documentation does not states this.
A few questions ( feel free to answer or not )
but official documentation does not states this. I think the only mention about this feature in the docs is this paragraph:
Why is private discouraged ? if this is a feature for developers or users of conan then it should be usable. I always see it is discouraged, doesn't state exactly why ? is it the case that internal implementation is not rock solid around it ?
Yes, too many rough edges. It was a very ancient thing, that couldn't work with the 1.X dependency resolution and the rest of the tooling. It is still there for legacy reasons, because in 1.X it cannot be removed, so the best that can be done is to discourage its usage. Not every feature in the codebase should be usable, many things become legacy and deprecated overtime, very discouraged to be used, but not fully removed.
What would be alternate of private dependency ? lets say I want to combine different packages which are sort of a diamond dependency graph and are built with different compilers e.g. as an archive but using conan so that the graph can be created
Not sure what is the use case. If you have a diamond of static libraries, then private really doesn't make sense, it is not possible at all. Building things with different compilers will also produce binary incompatibilities and linking problems.
Alternate to private dependency in Conan 2.0 ?
requires(..., visible=False)
trait. It will still not allow to override that dependency, if you declare it invisible for your consumers, then your consumers cannot override it. But otherwise it is a way better implementation and management of this trait in 2.0.
What is your question?
Hi!
I have a question about combining private and override. Here is a minimal example:
ad a. - This works perfectly fine and it is printing a warning
ad d. - Finish without error, but uses pkga/1.0.
I have an issue with point d. If I correctly understand the implementation, when you define dependency as private, it is not considered during dependency resolution. But in my use case, I need to hide a particular dependency (Therefore defining this as private), but I want to use it to override dependency. In other words, I need to override to pkga/2.0. Is there any way to achieve this?
Minimal example with logs. Please update PkgD\conanfile.py to check different variants. ConanPrivateOverride.zip
Thanks, Michal
Have you read the CONTRIBUTING guide?