diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2016-11-02 14:38:16 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2016-11-02 14:57:18 -0700 |
| commit | 4bf461c9cd136df6aa12a02d7f6ec09b91f8acb7 (patch) | |
| tree | e3f19e607281cf9710edf98231c6b8ab81776619 /toolsrc/src | |
| parent | 658bfff419dafb1030f9eb0c241c54725f08c162 (diff) | |
| download | vcpkg-4bf461c9cd136df6aa12a02d7f6ec09b91f8acb7.tar.gz vcpkg-4bf461c9cd136df6aa12a02d7f6ec09b91f8acb7.zip | |
[post-build-checks] Add check for bin folders in static builds
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/post_build_lint.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/toolsrc/src/post_build_lint.cpp b/toolsrc/src/post_build_lint.cpp index c9b36a0fb..40ddef3bb 100644 --- a/toolsrc/src/post_build_lint.cpp +++ b/toolsrc/src/post_build_lint.cpp @@ -433,6 +433,37 @@ namespace vcpkg return lint_status::SUCCESS; } + static lint_status check_bin_folders_are_not_present_in_static_build(const package_spec& spec, const vcpkg_paths& paths) + { + const fs::path bin = paths.packages / spec.dir() / "bin"; + const fs::path debug_bin = paths.packages / spec.dir() / "debug" / "bin"; + + if (!fs::exists(bin) && !fs::exists(debug_bin)) + { + return lint_status::SUCCESS; + } + + if (fs::exists(bin)) + { + System::println(System::color::warning, R"(There should be no bin\ directory in a static build, but %s is present.)", bin.generic_string()); + } + + if (fs::exists(debug_bin)) + { + System::println(System::color::warning, R"(There should be no debug\bin\ directory in a static build, but %s is present.)", debug_bin.generic_string()); + } + + System::println(System::color::warning, R"(If the creation of bin\ and/or debug\bin\ cannot be disabled, use this in the portfile to remove them)" "\n" + "\n" + R"###( if(VCPKG_LIBRARY_LINKAGE STREQUAL static))###""\n" + R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin))###""\n" + R"###( endif())###" + "\n" + ); + + return lint_status::ERROR_DETECTED; + } + static void operator +=(size_t& left, const lint_status& right) { left += static_cast<size_t>(right); @@ -477,6 +508,7 @@ namespace vcpkg recursive_find_files_with_extension_in_dir(paths.packages / spec.dir(), ".dll", &dlls); error_count += check_no_dlls_present(dlls); + error_count += check_bin_folders_are_not_present_in_static_build(spec, paths); break; } |
