From df2a05e8546281135c6ea12430734d74371bcf46 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 17:35:33 -0800 Subject: Introduce Command namespace. Refactoring --- toolsrc/src/commands_create.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index ad00cd676..2fcd85dba 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -4,11 +4,11 @@ #include "vcpkg_Files.h" #include "vcpkg_Input.h" -namespace vcpkg +namespace vcpkg::Commands { void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { - static const std::string example = create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); + static const std::string example = Commands::Helpers::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); args.check_max_arg_count(3, example); args.check_min_arg_count(2, example); -- cgit v1.2.3 From cc8851144a871931b93d84bd962364159ad1c424 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 12 Jan 2017 22:03:57 -0800 Subject: Reorganize commands, each in its own namespace Additionally, functions related to a command can now live in the same namespace --- toolsrc/src/commands_create.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index 2fcd85dba..d842d3fab 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -4,11 +4,11 @@ #include "vcpkg_Files.h" #include "vcpkg_Input.h" -namespace vcpkg::Commands +namespace vcpkg::Commands::Create { - void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) + void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { - static const std::string example = Commands::Helpers::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); + static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); args.check_max_arg_count(3, example); args.check_min_arg_count(2, example); -- cgit v1.2.3 From 050e4a0f7a8156bd862f95c06ea298ab6697e147 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 27 Jan 2017 12:49:09 -0800 Subject: Introduce precompiled headers --- toolsrc/src/commands_create.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index d842d3fab..5042ab97b 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -1,3 +1,4 @@ +#include "pch.h" #include "vcpkg_Commands.h" #include "vcpkg_System.h" #include "vcpkg_Environment.h" -- cgit v1.2.3 From 21729d3d43a1369014b60e2af368a3e48ae5c82f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:33:14 -0800 Subject: `create`/`edit`: check for --options --- toolsrc/src/commands_create.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index 5042ab97b..494c2aa08 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -12,8 +12,9 @@ namespace vcpkg::Commands::Create static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); args.check_max_arg_count(3, example); args.check_min_arg_count(2, example); - + args.check_and_get_optional_command_arguments({}); const std::string port_name = args.command_arguments.at(0); + Environment::ensure_utilities_on_path(paths); // Space OR define the FILENAME with proper spacing -- cgit v1.2.3 From 9ca839390e8ada8080a25ac92435a11c52ae41e6 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Mar 2017 16:41:50 -0800 Subject: `create`: Use make_cmake_cmd() and paths.get_cmake_exe() --- toolsrc/src/commands_create.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index 494c2aa08..fc795c621 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -4,36 +4,38 @@ #include "vcpkg_Environment.h" #include "vcpkg_Files.h" #include "vcpkg_Input.h" +#include "vcpkglib.h" namespace vcpkg::Commands::Create { void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) { - static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); + static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###"); args.check_max_arg_count(3, example); args.check_min_arg_count(2, example); args.check_and_get_optional_command_arguments({}); const std::string port_name = args.command_arguments.at(0); + const std::string url = args.command_arguments.at(1); - Environment::ensure_utilities_on_path(paths); + const fs::path& cmake_exe = paths.get_cmake_exe(); + + std::vector cmake_args + { + { L"CMD", L"CREATE" }, + { L"PORT", port_name }, + { L"URL", url } + }; - // Space OR define the FILENAME with proper spacing - std::wstring custom_filename = L" "; if (args.command_arguments.size() >= 3) { const std::string& zip_file_name = args.command_arguments.at(2); Checks::check_exit(!Files::has_invalid_chars_for_filesystem(zip_file_name), - R"(Filename cannot contain invalid chars %s, but was %s)", - Files::FILESYSTEM_INVALID_CHARACTERS, zip_file_name); - custom_filename = Strings::wformat(LR"( -DFILENAME="%s" )", Strings::utf8_to_utf16(zip_file_name)); + R"(Filename cannot contain invalid chars %s, but was %s)", + Files::FILESYSTEM_INVALID_CHARACTERS, zip_file_name); + cmake_args.push_back({ L"FILENAME", zip_file_name }); } - const std::wstring cmdline = Strings::wformat(LR"(cmake -DCMD=CREATE -DPORT=%s -DURL=%s%s-P "%s")", - Strings::utf8_to_utf16(port_name), - Strings::utf8_to_utf16(args.command_arguments.at(1)), - custom_filename, - paths.ports_cmake.generic_wstring()); - - exit(System::cmd_execute(cmdline)); + const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe, paths.ports_cmake, cmake_args); + exit(System::cmd_execute(cmd_launch_cmake)); } } -- cgit v1.2.3 From ea52c29e9af701c4a2e070f836bb1ffb7e092760 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 10 Mar 2017 17:03:47 -0800 Subject: Use System::cmd_execute_clean() for `build`, `create`, `portsdiff` --- toolsrc/src/commands_create.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'toolsrc/src/commands_create.cpp') diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/commands_create.cpp index fc795c621..b74693ed5 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/commands_create.cpp @@ -30,12 +30,12 @@ namespace vcpkg::Commands::Create { const std::string& zip_file_name = args.command_arguments.at(2); Checks::check_exit(!Files::has_invalid_chars_for_filesystem(zip_file_name), - R"(Filename cannot contain invalid chars %s, but was %s)", - Files::FILESYSTEM_INVALID_CHARACTERS, zip_file_name); + R"(Filename cannot contain invalid chars %s, but was %s)", + Files::FILESYSTEM_INVALID_CHARACTERS, zip_file_name); cmake_args.push_back({ L"FILENAME", zip_file_name }); } const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe, paths.ports_cmake, cmake_args); - exit(System::cmd_execute(cmd_launch_cmake)); + exit(System::cmd_execute_clean(cmd_launch_cmake)); } } -- cgit v1.2.3