Skip to content

Fix available targets #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions server/src/utils/GenerationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ std::optional<fs::path> GenerationUtils::findTarget(const BaseTestGen &baseTestG
LOG_S(INFO) << "Target was not chosen. Using UTBot: Auto target instead.";
return GrpcUtils::UTBOT_AUTO_TARGET_PATH;
}
auto rootTargets = baseTestGen.buildDatabase->getRootTargets();
auto candidates = CollectionUtils::filterOut(rootTargets, [&name](auto const &rootTarget) {
fs::path output = rootTarget->getOutput();
auto allTargets = baseTestGen.buildDatabase->getAllTargets();
auto candidates = CollectionUtils::filterOut(allTargets, [&name](auto const &target) {
fs::path output = target->getOutput();
return !(output == name || output.stem() == name || output.stem() == "lib" + name);
});
if (candidates.empty()) {
LOG_S(WARNING) << "Couldn't find appropriate target. List of available targets:\n";
for (const auto &rootTarget : rootTargets) {
LOG_S(WARNING) << rootTarget->getOutput() << "\n";
for (const auto &target : allTargets) {
LOG_S(WARNING) << target->getOutput() << "\n";
}
LOG_S(WARNING) << "\n";
return std::nullopt;
Expand Down