[vcpkg] Revert accidental removal of powershell-core usage in bb3a9ddb6e

This commit is contained in:
Robert Schumacher 2019-07-23 01:46:36 -07:00 committed by nicole mazzuca
parent 743e168ef5
commit 14c792441d
4 changed files with 36 additions and 34 deletions

View File

@ -1,4 +1,4 @@
Source: jsonnet
Version: 2019-05-08
Version: 2019-05-08-1
Homepage: https://github.com/google/jsonnet
Description: Jsonnet - The data templating language

View File

@ -11,12 +11,12 @@ vcpkg_from_github(
SHA512 d9f84c39929e9e80272e2b834f68a13b48c1cb4d64b70f5b6fa16e677555d947f7cf57372453e23066a330faa6a429b9aa750271b46f763581977a223d238785
HEAD_REF master
PATCHES
001-enable-msvc.patch
001-enable-msvc.patch
)
if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
vcpkg_execute_required_process(
COMMAND Powershell -Command "((Get-Content -Encoding Byte \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' > \"${SOURCE_PATH}/core/std.jsonnet.h\""
COMMAND Powershell -Command "((Get-Content -AsByteStream \"${SOURCE_PATH}/stdlib/std.jsonnet\") -join ',') + ',0' | Out-File -Encoding Ascii \"${SOURCE_PATH}/core/std.jsonnet.h\""
WORKING_DIRECTORY "${SOURCE_PATH}"
LOGNAME "std.jsonnet"
)
@ -31,7 +31,7 @@ endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DBUILD_JSONNET=OFF -DBUILD_TESTS=OFF
OPTIONS -DBUILD_JSONNET=OFF -DBUILD_JSONNETFMT=OFF -DBUILD_TESTS=OFF
)
vcpkg_install_cmake()

View File

@ -499,6 +499,14 @@ namespace vcpkg::Build
const BuildPackageConfig& config)
{
auto& fs = paths.get_filesystem();
#if defined(_WIN32)
const fs::path& powershell_exe_path = paths.get_tool_exe("powershell-core");
if (!fs.exists(powershell_exe_path.parent_path() / "powershell.exe"))
{
fs.copy(powershell_exe_path, powershell_exe_path.parent_path() / "powershell.exe", fs::copy_options::none);
}
#endif
const Triplet& triplet = spec.triplet();
const auto& triplet_file_path = paths.get_triplet_file_path(spec.triplet()).u8string();
@ -516,8 +524,12 @@ namespace vcpkg::Build
std::string command = make_build_cmd(paths, pre_build_info, config, triplet);
std::unordered_map<std::string, std::string> env = make_env_passthrough(pre_build_info);
#if defined(_WIN32)
const int return_code =
System::cmd_execute_clean(command, env, powershell_exe_path.parent_path().u8string() + ";");
#else
const int return_code = System::cmd_execute_clean(command, env);
#endif
const auto buildtimeus = timer.microseconds();
const auto spec_string = spec.to_string();
@ -597,6 +609,9 @@ namespace vcpkg::Build
std::vector<AbiEntry> abi_tag_entries(dependency_abis.begin(), dependency_abis.end());
#if defined(_WIN32)
abi_tag_entries.emplace_back(AbiEntry{"powershell", paths.get_tool_version("powershell-core")});
#endif
abi_tag_entries.emplace_back(AbiEntry{"cmake", paths.get_tool_version(Tools::CMAKE)});
// If there is an unusually large number of files in the port then

View File

@ -294,20 +294,6 @@ CMake suite maintained and supported by Kitware (kitware.com/cmake).
}
};
static fs::path get_7za_path(const VcpkgPaths& paths)
{
#if defined(_WIN32)
static const ToolData TOOL_DATA = parse_tool_data_from_xml(paths, "7zip").value_or_exit(VCPKG_LINE_INFO);
if (!paths.get_filesystem().exists(TOOL_DATA.exe_path))
{
return fetch_tool(paths, "7zip", TOOL_DATA);
}
return TOOL_DATA.exe_path;
#else
Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot download 7zip for non-Windows platforms.");
#endif
}
struct NinjaProvider : ToolProvider
{
std::string m_exe = "ninja";
@ -443,31 +429,21 @@ git version 2.17.1.windows.2
virtual const fs::path& get_tool_path(const VcpkgPaths& paths, const std::string& tool) const override
{
return path_only_cache.get_lazy(tool, [&]() {
// First deal with specially handled tools.
// For these we may look in locations like Program Files, the PATH etc as well as the auto-downloaded
// location.
if (tool == Tools::SEVEN_ZIP) return get_7za_path(paths);
if (tool == Tools::CMAKE || tool == Tools::GIT || tool == Tools::NINJA || tool == Tools::NUGET ||
tool == Tools::IFW_INSTALLER_BASE)
return get_tool_pathversion(paths, tool).path;
if (tool == Tools::IFW_BINARYCREATOR)
return get_tool_path(paths, Tools::IFW_INSTALLER_BASE).parent_path() / "binarycreator.exe";
if (tool == Tools::IFW_REPOGEN)
return get_tool_path(paths, Tools::IFW_INSTALLER_BASE).parent_path() / "repogen.exe";
// For other tools, we simply always auto-download them.
const ToolData tool_data = parse_tool_data_from_xml(paths, tool).value_or_exit(VCPKG_LINE_INFO);
if (paths.get_filesystem().exists(tool_data.exe_path))
{
return tool_data.exe_path;
}
return fetch_tool(paths, tool, tool_data);
return get_tool_pathversion(paths, tool).path;
});
}
const PathAndVersion& get_tool_pathversion(const VcpkgPaths& paths, const std::string& tool) const
{
return path_version_cache.get_lazy(tool, [&]() -> PathAndVersion {
// First deal with specially handled tools.
// For these we may look in locations like Program Files, the PATH etc as well as the auto-downloaded
// location.
if (tool == Tools::CMAKE)
{
if (System::get_environment_variable("VCPKG_FORCE_SYSTEM_BINARIES").has_value())
@ -495,7 +471,18 @@ git version 2.17.1.windows.2
if (tool == Tools::NUGET) return get_path(paths, NuGetProvider());
if (tool == Tools::IFW_INSTALLER_BASE) return get_path(paths, IfwInstallerBaseProvider());
Checks::exit_with_message(VCPKG_LINE_INFO, "Finding version for %s is not implemented yet.", tool);
// For other tools, we simply always auto-download them.
auto maybe_tool_data = parse_tool_data_from_xml(paths, tool);
if (auto p_tool_data = maybe_tool_data.get())
{
if (paths.get_filesystem().exists(p_tool_data->exe_path))
{
return {p_tool_data->exe_path, p_tool_data->sha512};
}
return {fetch_tool(paths, tool, *p_tool_data), p_tool_data->sha512};
}
Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown or unavailable tool: %s", tool);
});
}