[vcpkg] Fix editable bug (#12910)

This commit is contained in:
ras0219 2020-08-22 01:27:40 -07:00 committed by GitHub
parent 78b66ad5b9
commit 5d331ed553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

View File

@ -67,6 +67,7 @@ namespace vcpkg::Dependencies
std::string displayname() const;
const std::string& public_abi() const;
bool has_package_abi() const;
const Build::PreBuildInfo& pre_build_info(LineInfo linfo) const;
PackageSpec spec;

View File

@ -207,7 +207,7 @@ namespace
for (auto&& action : plan.install_actions)
{
if (action.build_options.editable == Build::Editable::YES) continue;
if (!action.has_package_abi()) continue;
auto& spec = action.spec;
fs.remove_all(paths.package_dir(spec), VCPKG_LINE_INFO);

View File

@ -871,6 +871,7 @@ namespace vcpkg::Build
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);
@ -1019,7 +1020,7 @@ namespace vcpkg::Build
std::error_code ec;
const fs::path abi_package_dir = paths.package_dir(spec) / "share" / spec.name();
const fs::path abi_file_in_package = paths.package_dir(spec) / "share" / spec.name() / "vcpkg_abi_info.txt";
if (action.build_options.editable == Build::Editable::NO)
if (action.has_package_abi())
{
auto restore = binaries_provider.try_restore(paths, action);
if (restore == RestoreResult::build_failed)
@ -1044,7 +1045,7 @@ namespace vcpkg::Build
fs.copy_file(abi_file, abi_file_in_package, fs::copy_options::none, ec);
Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not copy into file: %s", fs::u8string(abi_file_in_package));
if (action.build_options.editable == Build::Editable::NO && result.code == BuildResult::SUCCEEDED)
if (action.has_package_abi() && result.code == BuildResult::SUCCEEDED)
{
binaries_provider.push_success(paths, action);
}

View File

@ -421,6 +421,11 @@ namespace vcpkg::Dependencies
default: Checks::unreachable(VCPKG_LINE_INFO);
}
}
bool InstallPlanAction::has_package_abi() const
{
if (!abi_info) return false;
return !abi_info.get()->package_abi.empty();
}
const Build::PreBuildInfo& InstallPlanAction::pre_build_info(LineInfo linfo) const
{
return *abi_info.value_or_exit(linfo).pre_build_info.get();