aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-05 14:20:49 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-05 14:20:49 -0700
commit84ed16743988051b2e41cb5c66409370e6a6d5fe (patch)
tree21786223238b20b159ecce8d866dfb76ab91348b
parentcf44582b9f234df47f0fc6347d06d0302a3f65da (diff)
downloadvcpkg-84ed16743988051b2e41cb5c66409370e6a6d5fe.tar.gz
vcpkg-84ed16743988051b2e41cb5c66409370e6a6d5fe.zip
Introduce `vcpkg depend-info` command
-rw-r--r--toolsrc/include/vcpkg_Commands.h5
-rw-r--r--toolsrc/src/commands_available_commands.cpp1
-rw-r--r--toolsrc/src/commands_depends.cpp25
-rw-r--r--toolsrc/vcpkglib/vcpkglib.vcxproj1
-rw-r--r--toolsrc/vcpkglib/vcpkglib.vcxproj.filters3
5 files changed, 35 insertions, 0 deletions
diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h
index 227c44379..db15a10fd 100644
--- a/toolsrc/include/vcpkg_Commands.h
+++ b/toolsrc/include/vcpkg_Commands.h
@@ -86,6 +86,11 @@ namespace vcpkg::Commands
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
+ namespace DependInfo
+ {
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
+ }
+
namespace Search
{
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
diff --git a/toolsrc/src/commands_available_commands.cpp b/toolsrc/src/commands_available_commands.cpp
index 1af82eb8a..37d3321f8 100644
--- a/toolsrc/src/commands_available_commands.cpp
+++ b/toolsrc/src/commands_available_commands.cpp
@@ -26,6 +26,7 @@ namespace vcpkg::Commands
{"integrate", &Integrate::perform_and_exit},
{"owns", &Owns::perform_and_exit},
{"update", &Update::perform_and_exit},
+ {"depend-info", &DependInfo::perform_and_exit},
{"edit", &Edit::perform_and_exit},
{"create", &Create::perform_and_exit},
{"import", &Import::perform_and_exit},
diff --git a/toolsrc/src/commands_depends.cpp b/toolsrc/src/commands_depends.cpp
new file mode 100644
index 000000000..a61ac534e
--- /dev/null
+++ b/toolsrc/src/commands_depends.cpp
@@ -0,0 +1,25 @@
+#include "pch.h"
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+#include "Paragraphs.h"
+#include "vcpkg_Strings.h"
+
+namespace vcpkg::Commands::DependInfo
+{
+ void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
+ {
+ static const std::string example = Commands::Help::create_example_string(R"###(depend-info)###");
+ args.check_exact_arg_count(0, example);
+ args.check_and_get_optional_command_arguments({});
+
+ const std::vector<SourceParagraph> source_paragraphs = Paragraphs::load_all_ports(paths.ports);
+
+ for (const SourceParagraph& source_paragraph : source_paragraphs)
+ {
+ auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name; });
+ System::println("%s: %s", source_paragraph.name, s);
+ }
+
+ Checks::exit_success(VCPKG_LINE_INFO);
+ }
+}
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj
index de1f05ad9..1a8dd975b 100644
--- a/toolsrc/vcpkglib/vcpkglib.vcxproj
+++ b/toolsrc/vcpkglib/vcpkglib.vcxproj
@@ -185,6 +185,7 @@
<ClCompile Include="..\include\VersionT.cpp" />
<ClCompile Include="..\src\BinaryParagraph.cpp" />
<ClCompile Include="..\src\commands_ci.cpp" />
+ <ClCompile Include="..\src\commands_depends.cpp" />
<ClCompile Include="..\src\commands_env.cpp" />
<ClCompile Include="..\src\LineInfo.cpp" />
<ClCompile Include="..\src\ParagraphParseResult.cpp" />
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
index 909681fd5..b51958c57 100644
--- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
+++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters
@@ -180,6 +180,9 @@
<ClCompile Include="..\src\VcpkgPaths.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\commands_depends.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\SourceParagraph.h">