Skip to content

Commit

Permalink
[vcpkg] Fix editable bug (microsoft#12910)
Browse files Browse the repository at this point in the history
  • Loading branch information
ras0219 authored and remz1337 committed Aug 23, 2020
1 parent dfdb22b commit 41f5fd6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions toolsrc/include/vcpkg/dependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion toolsrc/src/vcpkg/binarycaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions toolsrc/src/vcpkg/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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)
Expand All @@ -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);
}
Expand Down
5 changes: 5 additions & 0 deletions toolsrc/src/vcpkg/dependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 41f5fd6

Please sign in to comment.