diff options
| author | martin-s <webmaster@macside.net> | 2020-01-14 00:31:58 +0000 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2020-01-13 16:31:58 -0800 |
| commit | 299c7c730ca759ef3dee365a2ecd7c3dd39db8a6 (patch) | |
| tree | 2d34f7efe935a0a89c814bb983cb7134f6df5927 /toolsrc/src | |
| parent | bdae0904c41a0ee2c5204d6449038d3b5d551726 (diff) | |
| download | vcpkg-299c7c730ca759ef3dee365a2ecd7c3dd39db8a6.tar.gz vcpkg-299c7c730ca759ef3dee365a2ecd7c3dd39db8a6.zip | |
Introduce new policy to skip post verification of dll exports (#9642)
* - Introduce new policy to skip post verification of dll exports (see issue #9641).
* - Fixed line endings.
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 3 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/postbuildlint.cpp | 10 |
2 files changed, 11 insertions, 2 deletions
diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 451f72445..f13dd2a25 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -129,6 +129,7 @@ namespace vcpkg::Build {
static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
+ static const std::string NAME_DLLS_WITHOUT_EXPORTS = "PolicyDLLsWithoutExports";
static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT";
static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder";
static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt";
@@ -139,6 +140,7 @@ namespace vcpkg::Build {
case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE;
case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS;
+ case BuildPolicy::DLLS_WITHOUT_EXPORTS: return NAME_DLLS_WITHOUT_EXPORTS;
case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT;
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER;
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT;
@@ -152,6 +154,7 @@ namespace vcpkg::Build {
case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE";
case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS";
+ case BuildPolicy::DLLS_WITHOUT_EXPORTS: return "VCPKG_POLICY_DLLS_WITHOUT_EXPORTS";
case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT";
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER";
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT";
diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index a85d879fe..2a13d2786 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -295,8 +295,10 @@ namespace vcpkg::PostBuildLint return LintStatus::SUCCESS; } - static LintStatus check_exports_of_dlls(const std::vector<fs::path>& dlls, const fs::path& dumpbin_exe) + static LintStatus check_exports_of_dlls(const Build::BuildPolicies& policies, const std::vector<fs::path>& dlls, const fs::path& dumpbin_exe) { + if (policies.is_enabled(BuildPolicy::DLLS_WITHOUT_EXPORTS)) return LintStatus::SUCCESS; + std::vector<fs::path> dlls_with_no_exports; for (const fs::path& dll : dlls) { @@ -316,6 +318,10 @@ namespace vcpkg::PostBuildLint System::print2(System::Color::warning, "The following DLLs have no exports:\n"); Files::print_paths(dlls_with_no_exports); System::print2(System::Color::warning, "DLLs without any exports are likely a bug in the build script.\n"); + System::printf(System::Color::warning, + "If this is intended, add the following line in the portfile:\n" + " SET(%s enabled)\n", + to_cmake_variable(BuildPolicy::DLLS_WITHOUT_EXPORTS)); return LintStatus::ERROR_DETECTED; } @@ -809,7 +815,7 @@ namespace vcpkg::PostBuildLint if (!toolset.dumpbin.empty()) { - error_count += check_exports_of_dlls(dlls, toolset.dumpbin); + error_count += check_exports_of_dlls(build_info.policies, dlls, toolset.dumpbin); error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls, toolset.dumpbin); error_count += check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info); |
