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

Enable multi-package depend-info, track triplets #1370

Merged
merged 3 commits into from
Mar 28, 2024

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Mar 24, 2024

Enables feature control for dependencies, as in

$ vcpkg depend-info proj[core,tiff] tiff[core]
vcpkg-cmake: 
vcpkg-cmake-config: 
liblzma: vcpkg-cmake, vcpkg-cmake-config
zlib: vcpkg-cmake
nlohmann-json: vcpkg-cmake, vcpkg-cmake-config
sqlite3[json1, tool]: vcpkg-cmake, vcpkg-cmake-config
tiff[zip, lzma]: liblzma, vcpkg-cmake, vcpkg-cmake-config, zlib
proj[tiff]: nlohmann-json, sqlite3, tiff, vcpkg-cmake, vcpkg-cmake-config

Fixes microsoft/vcpkg#36604.

For this to work reasonably, it is necessary to make depend-info triplet-aware, so this is included in this PR in the following way.

  • To retain current output for native targets, the default triplet is never appended.
  • For non-native targets, host packages are generically labeled :host (instead of using the actual host triplet), to limit variation in output and to simplify recognizing host packages.
  • For non-default, non-host packages, the actual triplet is append to the package name.

Examples:

$ vcpkg depend-info zlib
vcpkg-cmake: 
zlib: vcpkg-cmake
$ vcpkg depend-info zlib:arm64-linux
vcpkg-cmake: 
zlib:arm64-linux: vcpkg-cmake
$ vcpkg depend-info zlib:arm64-linux zlib --triplet x64-linux --host-triplet x64-linux-dynamic
vcpkg-cmake:host: 
zlib:arm64-linux: vcpkg-cmake:host
zlib: vcpkg-cmake:host

For valid dot format output, this PR depends on #1369.

Comment on lines +467 to +470
if (strategy.show_depth)
{
msg::write_unlocalized_text(Color::error, "(0)"); // legacy
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entirely pointless, but kept for compatibility: output depth at top level tree (actually digraph now) nodes.
(Suggesting removal.)


std::unordered_set<std::string> features{install_action.feature_list.begin(),
install_action.feature_list.end()};
features.erase(FeatureNameCore.to_string());

auto& port_name = install_action.spec.name();
out.push_back({decorated_name(install_action.spec), 0, std::move(features), std::move(dependencies)});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using emplace_back here would allow us to get rid of the calls to back below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is good enough.

@dg0yt dg0yt marked this pull request as ready for review March 25, 2024 19:19
Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approval is subject to the documentation being updated to reflect the interface change: https://learn.microsoft.com/vcpkg/commands/depend-info
https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/commands/depend-info.md
done

Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and an e2e test added using the new feature

I thought there was already an e2e test for this, sorry.

@BillyONeal BillyONeal merged commit af2d85b into microsoft:main Mar 28, 2024
5 checks passed
@BillyONeal
Copy link
Member

Thanks for the awesome new feature!

@dg0yt dg0yt deleted the depend-info branch March 28, 2024 04:53
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

Successfully merging this pull request may close these issues.

vcpkg depend-info always uses default-features even default-features: false
3 participants