aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorras0219 <533828+ras0219@users.noreply.github.com>2020-10-06 14:34:59 -0700
committerGitHub <noreply@github.com>2020-10-06 14:34:59 -0700
commitd8a4e6369059aeeaa76fdd6d5e53d22fe60d8244 (patch)
tree510e5a7f35306c7b28417ab2d7184540a9b2bd54 /toolsrc/src
parent88edf6f30a2074358e7b3b902e8b6b0ec5708ccb (diff)
downloadvcpkg-d8a4e6369059aeeaa76fdd6d5e53d22fe60d8244.tar.gz
vcpkg-d8a4e6369059aeeaa76fdd6d5e53d22fe60d8244.zip
[vcpkg] Avoid computing triplet ABIs for editable packages (#13446)
* [vcpkg] Avoid computing triplet ABIs for editable packages * [vcpkg] Address PR comments * [vcpkg-end-to-end-tests] Add tests for --no-binarycaching, binarycaching by default, and --editable Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/vcpkg/build.cpp47
1 files changed, 38 insertions, 9 deletions
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp
index da2094cff..92b657c9b 100644
--- a/toolsrc/src/vcpkg/build.cpp
+++ b/toolsrc/src/vcpkg/build.cpp
@@ -850,8 +850,6 @@ namespace vcpkg::Build
static void abi_entries_from_abi_info(const AbiInfo& abi_info, std::vector<AbiEntry>& abi_tag_entries)
{
- abi_tag_entries.emplace_back("triplet", abi_info.triplet_abi.value_or_exit(VCPKG_LINE_INFO));
-
const auto& pre_build_info = *abi_info.pre_build_info;
if (pre_build_info.public_abi_override)
{
@@ -869,6 +867,13 @@ namespace vcpkg::Build
}
}
+ struct AbiTagAndFile
+ {
+ const std::string* triplet_abi;
+ std::string tag;
+ fs::path tag_file;
+ };
+
static Optional<AbiTagAndFile> compute_abi_tag(const VcpkgPaths& paths,
const Dependencies::InstallPlanAction& action,
Span<const AbiEntry> dependency_abis)
@@ -876,9 +881,35 @@ namespace vcpkg::Build
auto& fs = paths.get_filesystem();
Triplet triplet = action.spec.triplet();
+ if (action.build_options.use_head_version == UseHeadVersion::YES)
+ {
+ Debug::print("Binary caching for package ", action.spec, " is disabled due to --head\n");
+ return nullopt;
+ }
+ if (action.build_options.editable == Editable::YES)
+ {
+ Debug::print("Binary caching for package ", action.spec, " is disabled due to --editable\n");
+ return nullopt;
+ }
+ for (auto&& dep_abi : dependency_abis)
+ {
+ if (dep_abi.value.empty())
+ {
+ Debug::print("Binary caching for package ",
+ action.spec,
+ " is disabled due to missing abi info for ",
+ dep_abi.key,
+ '\n');
+ return nullopt;
+ }
+ }
+
std::vector<AbiEntry> abi_tag_entries(dependency_abis.begin(), dependency_abis.end());
- abi_entries_from_abi_info(action.abi_info.value_or_exit(VCPKG_LINE_INFO), abi_tag_entries);
+ const auto& abi_info = action.abi_info.value_or_exit(VCPKG_LINE_INFO);
+ const auto& triplet_abi = paths.get_triplet_info(abi_info);
+ abi_tag_entries.emplace_back("triplet", triplet_abi);
+ abi_entries_from_abi_info(abi_info, abi_tag_entries);
// If there is an unusually large number of files in the port then
// something suspicious is going on. Rather than hash all of them
@@ -926,9 +957,6 @@ namespace vcpkg::Build
Util::sort(sorted_feature_list);
abi_tag_entries.emplace_back("features", Strings::join(";", sorted_feature_list));
- if (action.build_options.use_head_version == UseHeadVersion::YES) abi_tag_entries.emplace_back("head", "");
- if (action.build_options.editable == Editable::YES) abi_tag_entries.emplace_back("editable", "");
-
Util::sort(abi_tag_entries);
const std::string full_abi_info =
@@ -954,7 +982,8 @@ namespace vcpkg::Build
const auto abi_file_path = current_build_tree / (triplet.canonical_name() + ".vcpkg_abi_info.txt");
fs.write_contents(abi_file_path, full_abi_info, VCPKG_LINE_INFO);
- return AbiTagAndFile{Hash::get_file_hash(VCPKG_LINE_INFO, fs, abi_file_path, Hash::Algorithm::Sha1),
+ return AbiTagAndFile{&triplet_abi,
+ Hash::get_file_hash(VCPKG_LINE_INFO, fs, abi_file_path, Hash::Algorithm::Sha1),
abi_file_path};
}
@@ -1013,12 +1042,12 @@ namespace vcpkg::Build
abi_info.pre_build_info = std::make_unique<PreBuildInfo>(
paths, action.spec.triplet(), var_provider.get_tag_vars(action.spec).value_or_exit(VCPKG_LINE_INFO));
abi_info.toolset = paths.get_toolset(*abi_info.pre_build_info);
- abi_info.compiler_info = paths.get_compiler_info(abi_info);
- abi_info.triplet_abi = paths.get_triplet_info(abi_info);
auto maybe_abi_tag_and_file = compute_abi_tag(paths, action, dependency_abis);
if (auto p = maybe_abi_tag_and_file.get())
{
+ abi_info.compiler_info = paths.get_compiler_info(abi_info);
+ abi_info.triplet_abi = *p->triplet_abi;
abi_info.package_abi = std::move(p->tag);
abi_info.abi_tag_file = std::move(p->tag_file);
}