aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorJohn Spaith <jspaith@windows.microsoft.com>2019-10-10 09:36:18 -0700
committerJohn Spaith <jspaith@windows.microsoft.com>2019-10-10 09:36:18 -0700
commit17c9b6bac8270b9740e5d824c6ebfff6cc7d5ed1 (patch)
tree7baa6f699aa57601dbba4ace876fad45958878fc /toolsrc/src
parent1d4189d1dde0fa8bbcbc6237cc33b85bca0512e1 (diff)
parent2b049c47b5b2e003f8bcfe6707d4b0eaf8d1b569 (diff)
downloadvcpkg-17c9b6bac8270b9740e5d824c6ebfff6cc7d5ed1.tar.gz
vcpkg-17c9b6bac8270b9740e5d824c6ebfff6cc7d5ed1.zip
Merge from master
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/vcpkg/commands.ci.cpp38
-rw-r--r--toolsrc/src/vcpkg/commands.edit.cpp32
2 files changed, 64 insertions, 6 deletions
diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp
index 6e0a71adf..419d65f03 100644
--- a/toolsrc/src/vcpkg/commands.ci.cpp
+++ b/toolsrc/src/vcpkg/commands.ci.cpp
@@ -60,9 +60,10 @@ namespace vcpkg::Commands::CI
void add_test_results(const std::string& spec,
const Build::BuildResult& build_result,
const Chrono::ElapsedTime& elapsed_time,
- const std::string& abi_tag)
+ const std::string& abi_tag,
+ const std::vector<std::string>& features)
{
- m_collections.back().tests.push_back({spec, build_result, elapsed_time, abi_tag});
+ m_collections.back().tests.push_back({spec, build_result, elapsed_time, abi_tag, features});
}
// Starting a new test collection
@@ -98,6 +99,7 @@ namespace vcpkg::Commands::CI
vcpkg::Build::BuildResult result;
vcpkg::Chrono::ElapsedTime time;
std::string abi_tag;
+ std::vector<std::string> features;
};
struct XunitCollection
@@ -166,9 +168,29 @@ namespace vcpkg::Commands::CI
}
std::string traits_block;
- if (test.abi_tag != "") // only adding if there is a known abi tag
+ if (test.abi_tag != "")
{
- traits_block = Strings::format(R"(<traits><trait name="abi_tag" value="%s" /></traits>)", test.abi_tag);
+ traits_block += Strings::format(R"(<trait name="abi_tag" value="%s" />)", test.abi_tag);
+ }
+
+ if (!test.features.empty())
+ {
+ std::string feature_list;
+ for (const auto& feature : test.features)
+ {
+ if (!feature_list.empty())
+ {
+ feature_list += ", ";
+ }
+ feature_list += feature;
+ }
+
+ traits_block += Strings::format(R"(<trait name="features" value="%s" />)", feature_list);
+ }
+
+ if (!traits_block.empty())
+ {
+ traits_block = "<traits>" + traits_block + "</traits>";
}
m_xml += Strings::format(R"( <test name="%s" method="%s" time="%lld" result="%s">%s%s</test>)"
@@ -458,20 +480,24 @@ namespace vcpkg::Commands::CI
// Adding results for ports that were built or pulled from an archive
for (auto&& result : summary.results)
{
+ auto& port_features = split_specs->features[result.spec];
split_specs->known.erase(result.spec);
xunitTestResults.add_test_results(result.spec.to_string(),
result.build_result.code,
result.timing,
- split_specs->abi_tag_map.at(result.spec));
+ split_specs->abi_tag_map.at(result.spec),
+ port_features);
}
// Adding results for ports that were not built because they have known states
for (auto&& port : split_specs->known)
{
+ auto& port_features = split_specs->features[port.first];
xunitTestResults.add_test_results(port.first.to_string(),
port.second,
Chrono::ElapsedTime{},
- split_specs->abi_tag_map.at(port.first));
+ split_specs->abi_tag_map.at(port.first),
+ port_features);
}
all_known_results.emplace_back(std::move(split_specs->known));
diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp
index 6e98f5818..314af1167 100644
--- a/toolsrc/src/vcpkg/commands.edit.cpp
+++ b/toolsrc/src/vcpkg/commands.edit.cpp
@@ -167,6 +167,22 @@ namespace vcpkg::Commands::Edit
const std::vector<fs::path> from_registry = find_from_registry();
candidate_paths.insert(candidate_paths.end(), from_registry.cbegin(), from_registry.cend());
+
+ const auto txt_default = System::get_registry_string(HKEY_CLASSES_ROOT, R"(.txt\ShellNew)", "ItemName");
+ if(const auto entry = txt_default.get())
+ {
+ #ifdef UNICODE
+ LPWSTR dst = new wchar_t[MAX_PATH];
+ ExpandEnvironmentStrings(Strings::to_utf16(*entry).c_str(), dst, MAX_PATH);
+ auto full_path = Strings::to_utf8(dst);
+ #else
+ LPSTR dst = new char[MAX_PATH];
+ ExpandEnvironmentStrings(entry->c_str(), dst, MAX_PATH);
+ auto full_path = std::string(dst);
+ #endif
+ auto begin = full_path.find_first_not_of('@');
+ candidate_paths.push_back(fs::u8path(full_path.substr(begin, full_path.find_first_of(',')-begin)));
+ }
#elif defined(__APPLE__)
candidate_paths.push_back(
fs::path{"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code"});
@@ -174,6 +190,22 @@ namespace vcpkg::Commands::Edit
#elif defined(__linux__)
candidate_paths.push_back(fs::path{"/usr/share/code/bin/code"});
candidate_paths.push_back(fs::path{"/usr/bin/code"});
+
+ if(System::cmd_execute("command -v xdg-mime") == 0)
+ {
+ auto mime_qry = Strings::format(R"(xdg-mime query default text/plain)");
+ auto execute_result = System::cmd_execute_and_capture_output(mime_qry);
+ if(execute_result.exit_code == 0 && !execute_result.output.empty())
+ {
+ mime_qry = Strings::format(R"(command -v %s)", execute_result.output.substr(0, execute_result.output.find('.')));
+ execute_result = System::cmd_execute_and_capture_output(mime_qry);
+ if(execute_result.exit_code == 0 && !execute_result.output.empty())
+ {
+ execute_result.output.erase(std::remove(std::begin(execute_result.output), std::end(execute_result.output), '\n'), std::end(execute_result.output));
+ candidate_paths.push_back(fs::path{execute_result.output});
+ }
+ }
+ }
#endif
const auto it = Util::find_if(candidate_paths, [&](const fs::path& p) { return fs.exists(p); });