Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
set(ABI_FILE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}.vcpkg_abi_info.txt")
file(STRINGS "${ABI_FILE}" lines)
list(GET lines 0 first_line)

set(expected "additional_file_0 61ba0c7fc1f696e28c1b7aa9460980a571025ff8c97bb90a57e990463aa25660")

if(first_line STREQUAL "${expected}")
message(STATUS "Test successful!")
else()
message(FATAL_ERROR "First line in abi info ( ${ABI_FILE} ) is not the additional file to be hashed but:\n first_line: '${first_line}'\n expected: '${expected}' ")
endif()

set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
set(ABI_FILE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}.vcpkg_abi_info.txt")
file(STRINGS "${ABI_FILE}" lines)
list(FILTER lines INCLUDE REGEX "additional_file_.+")

if(lines STREQUAL "additional_file_0 61ba0c7fc1f696e28c1b7aa9460980a571025ff8c97bb90a57e990463aa25660")
message(STATUS "Test successful!")
else()
list(JOIN lines "\n " lines)
message(FATAL_ERROR "Expected exactly one expected additional file in ${ABI_FILE} but got:\n ${lines}")
endif()

set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
6 changes: 3 additions & 3 deletions include/vcpkg/commands.build.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ namespace vcpkg

// The parts of AbiInfo which depend only on the port directory and thus can be reused across multiple feature
// builds
struct PortDirAbiInfoCacheEntry
struct SpecAbiInfoCacheEntry
{
std::vector<AbiEntry> abi_entries;
std::vector<Path> files;
std::vector<std::string> hashes;
Json::Object heuristic_resources;
};

using PortDirAbiInfoCache = Cache<Path, PortDirAbiInfoCacheEntry>;
using SpecAbiInfoCache = Cache<PackageSpec, SpecAbiInfoCacheEntry>;

struct CompilerInfo
{
Expand Down Expand Up @@ -313,7 +313,7 @@ namespace vcpkg
ActionPlan& action_plan,
const CMakeVars::CMakeVarProvider& var_provider,
const StatusParagraphs& status_db,
PortDirAbiInfoCache& port_dir_cache);
SpecAbiInfoCache& port_dir_cache);

struct EnvCache
{
Expand Down
32 changes: 7 additions & 25 deletions src/vcpkg/commands.build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,7 @@ namespace vcpkg
InstallPlanAction& action,
std::unique_ptr<PreBuildInfo>&& proto_pre_build_info,
Span<const AbiEntry> dependency_abis,
PortDirAbiInfoCache& port_dir_cache,
SpecAbiInfoCache& spec_abi_cache,
Cache<Path, Optional<std::string>>& grdk_cache)
{
Checks::check_exit(VCPKG_LINE_INFO, static_cast<bool>(proto_pre_build_info));
Expand Down Expand Up @@ -1399,8 +1399,8 @@ namespace vcpkg
abi_entries_from_pre_build_info(fs, grdk_cache, pre_build_info, abi_tag_entries);

auto&& port_dir = action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO).port_directory();
const auto& port_dir_cache_entry = port_dir_cache.get_lazy(port_dir, [&]() {
PortDirAbiInfoCacheEntry port_dir_cache_entry;
const auto& port_dir_cache_entry = spec_abi_cache.get_lazy(action.spec, [&]() {
SpecAbiInfoCacheEntry port_dir_cache_entry;

std::string portfile_cmake_contents;
{
Expand All @@ -1419,8 +1419,6 @@ namespace vcpkg
port_dir_cache_entry.files = std::move(rel_port_files);
}
const auto& rel_port_files = port_dir_cache_entry.files;
// Technically the pre_build_info is not part of the port_dir cache key, but a given port_dir is only going
// to be associated with 1 port
for (size_t i = 0; i < abi_info.pre_build_info->hash_additional_files.size(); ++i)
{
const auto& file = abi_info.pre_build_info->hash_additional_files[i];
Expand Down Expand Up @@ -1471,22 +1469,6 @@ namespace vcpkg

Util::Vectors::append(abi_tag_entries, port_dir_cache_entry.abi_entries);

{
size_t i = 0;
for (auto& filestr : abi_info.pre_build_info->hash_additional_files)
{
Path file(filestr);
if (file.is_relative() || !fs.is_regular_file(file))
{
Checks::msg_exit_with_message(
VCPKG_LINE_INFO, msgInvalidValueHashAdditionalFiles, msg::path = file);
}
const auto hash =
vcpkg::Hash::get_file_hash(fs, file, Hash::Algorithm::Sha256).value_or_exit(VCPKG_LINE_INFO);
abi_tag_entries.emplace_back(fmt::format("additional_file_{}", i++), hash);
}
}

for (size_t i = 0; i < abi_info.pre_build_info->post_portfile_includes.size(); ++i)
{
auto& file = abi_info.pre_build_info->post_portfile_includes[i];
Expand Down Expand Up @@ -1567,15 +1549,15 @@ namespace vcpkg
const CMakeVars::CMakeVarProvider& var_provider,
const StatusParagraphs& status_db)
{
PortDirAbiInfoCache port_dir_cache;
compute_all_abis(paths, action_plan, var_provider, status_db, port_dir_cache);
SpecAbiInfoCache spec_abi_cache;
compute_all_abis(paths, action_plan, var_provider, status_db, spec_abi_cache);
}

void compute_all_abis(const VcpkgPaths& paths,
ActionPlan& action_plan,
const CMakeVars::CMakeVarProvider& var_provider,
const StatusParagraphs& status_db,
PortDirAbiInfoCache& port_dir_cache)
SpecAbiInfoCache& spec_abi_cache)
{
Cache<Path, Optional<std::string>> grdk_cache;
for (auto it = action_plan.install_actions.begin(); it != action_plan.install_actions.end(); ++it)
Expand Down Expand Up @@ -1622,7 +1604,7 @@ namespace vcpkg
action.spec.triplet(),
var_provider.get_tag_vars(action.spec).value_or_exit(VCPKG_LINE_INFO)),
dependency_abis,
port_dir_cache,
spec_abi_cache,
grdk_cache);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/vcpkg/commands.test-features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ namespace vcpkg
KeepGoing::Yes,
};
StatusParagraphs status_db = database_load_collapse(fs, paths.installed());
PortDirAbiInfoCache port_dir_abi_info_cache;
SpecAbiInfoCache spec_abi_info_cache;

// check what should be tested
std::vector<SpecToTest> specs_to_test;
Expand Down Expand Up @@ -708,7 +708,7 @@ namespace vcpkg
{
if (test_spec.plan.unsupported_features.empty())
{
compute_all_abis(paths, test_spec.plan, var_provider, empty_status_db, port_dir_abi_info_cache);
compute_all_abis(paths, test_spec.plan, var_provider, empty_status_db, spec_abi_info_cache);
}
}

Expand Down
Loading