-
Notifications
You must be signed in to change notification settings - Fork 6.6k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
default-features of port always used in another port dependency #20925
Comments
It is |
Sorry, i made a typo error when creating example json to demonstrate my issue. |
So you want something like #19173. Default features are always installed (because they are default) |
Isn't this a contradiction to the explicit " |
No, default-features: false is for end users. Als an end user you can say that you don't want default features. For ports in manifest mode default-features: false has no effect, that is the default. So the port only depends on core of the other port, but by default default features are instelled. You have to set in the users vcpkg.json default-features: false to disable them really |
TBH this is really irritating, even after reading twice #11602 (linked in #19173).
So you are saying that setting It seems to be against the Principle of least surprise. A key argument in #11602 is "to reduce the likelihood of needing to rebuild the world if someone adds dependencies incrementally". This argument does make sense from a vcpkg CI point of view (in particular given its current cache-drivenness). But |
I'm agree with @dg0yt, default features are activated by default when In this given example, myapp doesn't specify that it wants to use foo library with protobuf supports because it will not use it so why foo library has to be fetched with protobuf feature ? I think it's more logical in this case that user has to activate more features than minimal if he need them. |
That is also the argument for end user:
No. If a normal end user normally don't want the default feature, then that shouldn't be a default feature, but default-features should be installed by default. For example curl has a default feature |
This is what I call surprising, in particular when you deal with both ports and projects. It is also not very intuitive that the user needs to add direct dependencies on ports where we only wants trim features. There seem to be some good arguments, but I don't think it is sufficiently explained in documentation. |
From what I understand from the description, this issue is about Just to give more context, I'll rewrite the description of the issue in a different way. Let's say we have a communication library: {
"name": "communication",
"version": "1.0.0",
"default-features": [ "curl" ],
"features": {
"curl": {
"dependencies": [ "curl" ]
}
}
}
{
"name": "fastinterprocesscommunication",
"version": "2.0.0",
"dependencies": [
{
"name": "communication",
"default-features": false
}
]
} The authors of {
"name": "myapp",
"version": "3.0.0",
"dependencies": [ "fastinterprocesscommunication" ]
} When I run Of course, I can dig. One day, I could see in my There's also a stability to change problem. What if I add a dependency to Regarding these two significant problems, I wonder: What are the advantages of making |
I think in this example But you are probably interested in microsoft/vcpkg-tool#295 |
In my example, the author of |
Found out about this today, when I noticed that my test package build takes 3x as long as building it's only dependency directly, due to the default-features fiasco. I have multiple issues with this
|
I'm still in the dark regarding this. In other words, the question I asked yesterday remains: What are the advantages of making "default-features": false not transitive? I guess there is some advantages (even thought I can't think of them now). As I mentioned already, the only advantage I read in this discussion, "the user expect transitive dependencies to be built with their default features even if they've been disabled by another dependency in the chain", doesn't work. In a chain of dependency |
@klalumiere My understanding is that the behaviour in manifest mode comes from the behaviour in legacy mode, where it barely made some sense. For context, legacy mode is doing |
The situation is that I now need to explain reviewers why I add |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the bug
I have a port with default-features :
I have another port that will use this port but only a specific feature :
When i want to fetch bar library, vcpkg fetch foo library with default-features (json and protobuf).
It's not correct because i specified that i don't want default features of foo library.
vcpkg output:
The following packages will be rebuilt:
jsoncpp[core]:x64-linux-dynamic -> XXX -- /home/azrod/.cache/XXX
protobuf[core]:x64-linux-dynamic -> XXX -- /home/azrod/.cache/XXX
foo[core, json, protobuf]:x64-linux-dynamic -> 1.1.2.2 -- /home/azrod/.cache/XXX
bar[core, foo]:x64-linux-dynamic -> 13.4.0.1 -- /home/azrod/.cache/XXX
Environment
To Reproduce
Steps to reproduce the behavior:
With all ports defined in a local registry :
output:
protobuf[core]:x64-linux-dynamic -> XXX -- /home/azrod/.cache/XXX
foo[core, json, protobuf]:x64-linux-dynamic -> 1.1.2.2 -- /home/azrod/.cache/XXX
protobuf feature of foo library is activate but bar library explicitly set default-features: off when fetching foo port
Expected behavior
Only json feature of foo library is activated when fetching bar port
Failure logs
We don't have error logs but it fetch unused port
Additional context
I use vcpkg with Cmake integration so i use cmake toolchain to be plugged in directly in cmake
The text was updated successfully, but these errors were encountered: