-
Notifications
You must be signed in to change notification settings - Fork 289
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
Dont enable default features for host dependencies #177
base: main
Are you sure you want to change the base?
Dont enable default features for host dependencies #177
Conversation
aff1f89
to
1cdabae
Compare
16d5cb9
to
706104b
Compare
I think this is not the correct way to do this; the best way to do this is just ask for |
So I should run |
The function enable_default_features was only called when "core" was not in dep.features, but the function only had an effect when default_features was false, but it is only false when "core" is in dep.features. So the function does nothing at all.
706104b
to
0cdd0d9
Compare
@autoantwort no, I think the best way is to fix the underlying problem: in manifest mode, dependencies of dependencies which don't depend on the default features should not get the default features. |
It is reasonable for this to be some sort of opt in, such as a setting in the manifest file that says "pretend I depended on [core] of every package in my tree". Consider that the consequence of using this with opencv as a transitive dependency would mean that user applications wouldn't actually be able to load any image files. I think a separate setting that specifically affects host dependencies actually makes a lot of sense because those host dependencies can't affect the runtime of the application and so the reasoning behind default features isn't applicable. |
@ras0219-msft hmm. Alright then. I do think I'm not the right person to look at this though; can you take a look at the code and say if it makes sense? |
Yeah this is microsoft/vcpkg#19173, but this PR does not implement this.
Exactly, this is what I proposed in microsoft/vcpkg#19781 and implemented in this PR. But I have not added an option to enable default-features because I don't see a use case where you want default-features for host dependencies. Host dependencies are usually only build tools and generators. |
VersionSchemeInfo& emplace_node(Versions::Scheme scheme, const Versions::Version& ver); | ||
|
||
PackageNode() = default; | ||
PackageNode(bool only_host_dependency) : only_host_dependency(only_host_dependency){}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PackageNode(bool only_host_dependency) : only_host_dependency(only_host_dependency){}; | |
explicit PackageNode(bool only_host_dependency) : only_host_dependency(only_host_dependency){}; |
This should also use an enum class
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I agree, but this would make the implementation very verbose. For Example only_host_dependency && host_dependency
would be ((only_host_dependency == OnlyHostDependency::Yes) && (host_dependency == OnlyHostDependency::Yes)) ? OnlyHostDependency::Yes : OnlyHostDependency::No
which seems very verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strega-nil-ms Any comment?
Co-authored-by: nicole mazzuca <[email protected]>
…encies # Conflicts: # src/vcpkg/build.cpp # src/vcpkg/dependencies.cpp
Can this be moved forward? |
…encies # Conflicts: # include/vcpkg/packagespec.h # src/vcpkg-test/dependencies.cpp # src/vcpkg/dependencies.cpp
1b59f64
to
bdb9a13
Compare
This PR is currently wrong according to #292 iiuc. If I remember correctly A[x] -> B[x] -> C[x] -> D[x], root has a host dependency on A and normal on C and x is always a default feature it currently installs A, B, C[x], D[x] instead of A[x], B[x], C[x], D[x] |
Hm, the focus of #292 was on a port being requested at least twice, with different feature options. This shouldn't drop the default features if at least one port doesn't exclude them. |
Then they should be not enabled if it is a host dependency. This does work. |
If now everything is a [core] dependency (except from root to C), it now installs A, B, C[x], D[x] as expected |
I am in doubt that this approach fixes the root issue. I consider that a library maintainer knows exactly the dependencies of its own library, that can be another library, a header file or just a single feature of a library. It does not make a difference if this is a host or a target dependency. For me the purpose of the default feature set is that a library maintainer can propose a set of feature, that allows the majority of user to use the library it without dealing with features at all. There is no reason the the package maintainer is empowered to override users decision and enable unwanted feature via a default feature set by default.
That does not work, because that are normally two persons. The package maintainer can state "default-features": false but the application developer gets unnecessary dependency in its build, many of them will never notice that.
I think you have such tree in mind: For me it is still obvious that this does not rectify to add something like tiff support to opencv. If the user-app likes to use tiff files directly with openvc it has to state that: If later the maintainer of
I don't see a different in reasoning, we want only required dependencies that is true in the same way for host and target. There are different reasonable defaults though. |
@daschuer It seems your comment here is not related to the host dependencies aspect. Please move it to one of the other places. |
It is an answer to @ras0219-msft post above. |
Ping for re-consideration. It is a significant difference for host utilities from |
Data from x86-windows CI, host x64-windows:
What we want:
|
…encies # Conflicts: # src/vcpkg-test/dependencies.cpp # src/vcpkg/dependencies.cpp
@BillyONeal Any news? :) |
I believe @ras0219-msft still had backcompat concerns about this but not positive... |
Would be nice if he could write them down so that they can be discussed. I would say that the benefits (greatly reduced build times) overwhelms the disadvantages (maybe backcompat(?)). |
@ras0219-msft @JavierMatosD @valeriaconde @vicroms @AugP and I discussed this today and have the following observations. (Most of these were originally pointed out by @ras0219-msft )
@vicroms (and others) do not want (5) @ras0219-msft @vicroms and I really like (4) Since most of us preferred that that's as a dev team what we would ask for, but we are now concerned that we need to sell this stuff internally since it's a meaningful product feature change. (I'm not leaving you with action items because we didn't agree on any that we could conclusively tell you would be a path forward) |
You could declare it as a bug fix like #292. Joke aside I guess this is only relevant if you use a |
Or you explicitly do a major step forward, bundling several major changes. Such a defaulting to x64 on x64 windows hosts. (I'm really tired of all these qt*webengine:host rebuilds when we only need non-gui host qt*tools.) |
I mean we could only enable this change for the ci command |
Fixes microsoft/vcpkg#19781, microsoft/vcpkg#35906