aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_build_external.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-01-12 17:03:21 -0800
committerAlexander Karatarakis <alkarata@microsoft.com>2017-01-12 17:43:04 -0800
commit6a4ec92a90849e7cc343bbc8673ce0f063ffd939 (patch)
tree7a2090ab904550aefe464b5c2d7f9116a8fa7711 /toolsrc/src/commands_build_external.cpp
parent9072f51d746b857dfda19844cc773181d6d42382 (diff)
downloadvcpkg-6a4ec92a90849e7cc343bbc8673ce0f063ffd939.tar.gz
vcpkg-6a4ec92a90849e7cc343bbc8673ce0f063ffd939.zip
Place build & build_external commands into separate files
Diffstat (limited to 'toolsrc/src/commands_build_external.cpp')
-rw-r--r--toolsrc/src/commands_build_external.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/commands_build_external.cpp
new file mode 100644
index 000000000..d34981e04
--- /dev/null
+++ b/toolsrc/src/commands_build_external.cpp
@@ -0,0 +1,32 @@
+#include "vcpkg_Commands.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Environment.h"
+#include "vcpkg_Input.h"
+#include "vcpkg.h"
+
+namespace vcpkg
+{
+ void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
+ {
+ static const std::string example = create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
+ args.check_exact_arg_count(2, example);
+
+ expected<package_spec> maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet);
+ if (auto spec = maybe_current_spec.get())
+ {
+ Input::check_triplet(spec->target_triplet(), paths);
+ Environment::ensure_utilities_on_path(paths);
+ const fs::path port_dir = args.command_arguments.at(1);
+ const expected<SourceParagraph> maybe_spgh = try_load_port(port_dir);
+ if (auto spgh = maybe_spgh.get())
+ {
+ Commands::details::build_internal(*spgh, *spec, paths, port_dir);
+ exit(EXIT_SUCCESS);
+ }
+ }
+
+ System::println(System::color::error, "Error: %s: %s", maybe_current_spec.error_code().message(), args.command_arguments[0]);
+ print_example(Strings::format("%s zlib:x64-windows", args.command));
+ exit(EXIT_FAILURE);
+ }
+}