Add warnings about missing DLLs to the build action's result
This commit is contained in:
parent
2ad4a39aea
commit
1cc8a3d6db
|
@ -300,7 +300,7 @@ struct LIBPKG_EXPORT Package : public ReflectiveRapidJSON::JsonSerializable<Pack
|
|||
void addDepsAndProvidesFromContainedDirectory(const std::string &directoryPath);
|
||||
void addDepsAndProvidesFromContainedFile(const ArchiveFile &file, std::set<std::string> &dllsReferencedByImportLibs);
|
||||
void addDepsAndProvidesFromContents(const FileMap &contents);
|
||||
void processDllsReferencedByImportLibs(std::set<std::string> &&dllsReferencedByImportLibs);
|
||||
std::vector<std::string> processDllsReferencedByImportLibs(std::set<std::string> &&dllsReferencedByImportLibs);
|
||||
bool addDepsAndProvidesFromOtherPackage(const Package &otherPackage, bool force = false);
|
||||
bool isArchAny() const;
|
||||
|
||||
|
|
|
@ -785,23 +785,29 @@ void Package::addDepsAndProvidesFromContainedFile(const ArchiveFile &file, std::
|
|||
}
|
||||
}
|
||||
|
||||
void Package::processDllsReferencedByImportLibs(std::set<string> &&dllsReferencedByImportLibs)
|
||||
std::vector<std::string> Package::processDllsReferencedByImportLibs(std::set<string> &&dllsReferencedByImportLibs)
|
||||
{
|
||||
// check whether all DLLs referenced by import libraries are actually part of the package
|
||||
auto issues = std::vector<std::string>();
|
||||
if (dllsReferencedByImportLibs.empty()) {
|
||||
return;
|
||||
return issues;
|
||||
} else if (name == "mingw-w64-crt") {
|
||||
// assume the CRT references DLLs provided by Windows itself
|
||||
libprovides = move(dllsReferencedByImportLibs);
|
||||
}
|
||||
for (const auto &referencedDLL : dllsReferencedByImportLibs) {
|
||||
// TODO: report these errors in a better way
|
||||
if (libprovides.find(referencedDLL) == libprovides.end()) {
|
||||
cerr << Phrases::SubMessage << "DLL " << referencedDLL << " is missing in " << name << Phrases::End;
|
||||
issues.emplace_back("DLL " % referencedDLL % " is missing in " + name);
|
||||
}
|
||||
}
|
||||
return issues;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Adds dependencies and provides from the specified \a contents.
|
||||
* \deprecated This function is not actually used anymore because ReloadLibraryDependencies does this in a better way
|
||||
* using LibPkg::walkThroughArchive().
|
||||
*/
|
||||
void Package::addDepsAndProvidesFromContents(const FileMap &contents)
|
||||
{
|
||||
std::set<std::string> dllsReferencedByImportLibs;
|
||||
|
|
|
@ -249,11 +249,11 @@ void ReloadLibraryDependencies::loadPackageInfoFromContents()
|
|||
}
|
||||
|
||||
// load info from package contents utilizing hardware concurrency
|
||||
std::mutex nextPackageMutex, submitErrorMutex;
|
||||
std::mutex nextPackageMutex, submitErrorMutex, submitWarningMutex;
|
||||
auto dbIterator = m_relevantPackagesByDatabase.begin(), dbEnd = m_relevantPackagesByDatabase.end();
|
||||
auto pkgIterator = dbIterator->packages.begin(), pkgEnd = dbIterator->packages.end();
|
||||
m_buildAction->appendOutput(Phrases::SuccessMessage, "Parsing ", m_remainingPackages.load(), " binary packages ...\n");
|
||||
const auto processPackage = [this, &dbIterator, &dbEnd, &pkgIterator, &pkgEnd, &nextPackageMutex, &submitErrorMutex] {
|
||||
const auto processPackage = [this, &dbIterator, &dbEnd, &pkgIterator, &pkgEnd, &nextPackageMutex, &submitErrorMutex, &submitWarningMutex] {
|
||||
for (; !m_buildAction->isAborted();) {
|
||||
// get the next package
|
||||
std::unique_lock<std::mutex> nextPackagelock(nextPackageMutex);
|
||||
|
@ -307,7 +307,12 @@ void ReloadLibraryDependencies::loadPackageInfoFromContents()
|
|||
}
|
||||
currentPkg.info.addDepsAndProvidesFromContainedDirectory(directoryPath);
|
||||
});
|
||||
currentPkg.info.processDllsReferencedByImportLibs(std::move(dllsReferencedByImportLibs));
|
||||
if (auto dllIssues = currentPkg.info.processDllsReferencedByImportLibs(std::move(dllsReferencedByImportLibs)); !dllIssues.empty()) {
|
||||
std::unique_lock<std::mutex> submitWarningLock(submitWarningMutex);
|
||||
for (auto &issue : dllIssues) {
|
||||
m_messages.warnings.emplace_back(std::move(issue));
|
||||
}
|
||||
}
|
||||
currentPkg.info.origin = LibPkg::PackageOrigin::PackageContents;
|
||||
} catch (const std::runtime_error &e) {
|
||||
std::unique_lock<std::mutex> submitErrorLock(submitErrorMutex);
|
||||
|
|
Loading…
Reference in New Issue