first pass at abi additional files

This commit is contained in:
Curtis.Bezault 2019-07-17 10:10:36 -07:00
parent 7d9d457f58
commit d4ab567609
3 changed files with 36 additions and 0 deletions

View File

@ -13,3 +13,4 @@ message("VCPKG_VISUAL_STUDIO_PATH=${VCPKG_VISUAL_STUDIO_PATH}")
message("VCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
message("VCPKG_BUILD_TYPE=${VCPKG_BUILD_TYPE}")
message("VCPKG_ENV_PASSTHROUGH=${VCPKG_ENV_PASSTHROUGH}")
message("VCPKG_ABI_ADDITIONAL_FILES=${VCPKG_ABI_ADDITIONAL_FILES}")

View File

@ -138,6 +138,7 @@ namespace vcpkg::Build
Optional<std::string> external_toolchain_file;
Optional<ConfigurationType> build_type;
std::vector<std::string> passthrough_env_vars;
std::vector<fs::path> additional_files;
};
std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset);
@ -152,6 +153,7 @@ namespace vcpkg::Build
CHAINLOAD_TOOLCHAIN_FILE,
BUILD_TYPE,
ENV_PASSTHROUGH,
ABI_ADDITIONAL_FILES,
};
const std::unordered_map<std::string, VcpkgTripletVar> VCPKG_OPTIONS = {
@ -163,6 +165,7 @@ namespace vcpkg::Build
{"VCPKG_CHAINLOAD_TOOLCHAIN_FILE", VcpkgTripletVar::CHAINLOAD_TOOLCHAIN_FILE},
{"VCPKG_BUILD_TYPE", VcpkgTripletVar::BUILD_TYPE},
{"VCPKG_ENV_PASSTHROUGH", VcpkgTripletVar::ENV_PASSTHROUGH},
{"VCPKG_ABI_ADDITIONAL_FILES", VcpkgTripletVar::ABI_ADDITIONAL_FILES},
};
struct ExtendedBuildResult

View File

@ -496,6 +496,31 @@ namespace vcpkg::Build
s_hash_cache.emplace(triplet_file_path, hash);
}
for (const fs::path& additional_file : pre_build_info.additional_files)
{
it_hash = s_hash_cache.find(additional_file);
if (it_hash != s_hash_cache.end())
{
hash += "-";
hash += it_hash->second;
}
else if (fs.is_regular_file(additional_file))
{
std::string tmp_hash = Hash::get_file_hash(fs, additional_file, "SHA1");
hash += "-";
hash += tmp_hash;
s_hash_cache.emplace(additional_file, tmp_hash);
}
else
{
Checks::exit_with_message(
VCPKG_LINE_INFO,
additional_file + " was listed as an additional file for calculating the abi, but was not found.");
}
}
return hash;
}
@ -1087,6 +1112,13 @@ namespace vcpkg::Build
case VcpkgTripletVar::ENV_PASSTHROUGH :
pre_build_info.passthrough_env_vars = Strings::split(variable_value, ";");
break;
case VcpkgTripletVar::ABI_ADDITIONAL_FILES :
pre_build_info.additional_files = Util::fmap(Strings::split(variable_value, ";"),
[](const std::string& path)
{
return fs::path{path};
});
break;
}
}
else