Fix skipping package build due to failed dependency

Skip package as expected when a dependency failed that was attempted to be
built as last package of the previous batch (and building as far as
possible is enabled).
This commit is contained in:
Martchus 2022-07-01 19:27:39 +02:00
parent 3b94ba4479
commit 1e7e604917
2 changed files with 5 additions and 1 deletions

View File

@ -523,6 +523,7 @@ private:
std::mutex m_mutex;
std::vector<std::vector<std::string>>::iterator m_batchBegin, m_batchIterator, m_batchEnd;
std::vector<std::string>::iterator m_packageIterator, m_packageEnd;
bool m_firstPackageInBatch;
bool m_skipBatchesAfterFailure;
bool m_hasFailuresInPreviousBatches;
std::atomic_bool m_enableStagingInNextBatch;

View File

@ -73,6 +73,7 @@ BatchProcessingSession::BatchProcessingSession(const std::unordered_set<string_v
, m_batchEnd(batches.end())
, m_packageIterator(m_batchIterator != m_batchEnd ? m_batchIterator->begin() : decltype(m_packageIterator)())
, m_packageEnd(m_batchIterator != m_batchEnd ? m_batchIterator->end() : decltype(m_packageEnd)())
, m_firstPackageInBatch(true)
, m_skipBatchesAfterFailure(skipBatchesAfterFailure)
, m_hasFailuresInPreviousBatches(false)
, m_enableStagingInNextBatch(false)
@ -104,7 +105,7 @@ bool BatchProcessingSession::isStagingEnabled() const
*/
bool BatchProcessingSession::hasFailuresInPreviousBatches() const
{
return m_hasFailuresInPreviousBatches;
return m_hasFailuresInPreviousBatches || (m_firstPackageInBatch && !allResponses().empty());
}
/*!
@ -122,6 +123,7 @@ const std::string &BatchProcessingSession::currentPackageName() const
void BatchProcessingSession::selectNextPackage()
{
if (++m_packageIterator != m_packageEnd) {
m_firstPackageInBatch = false;
return; // select the next package within the current batch
}
if ((m_hasFailuresInPreviousBatches = !allResponses().empty()) && m_skipBatchesAfterFailure) {
@ -133,6 +135,7 @@ void BatchProcessingSession::selectNextPackage()
// select the first package within the next batch
m_packageIterator = m_batchIterator->begin();
m_packageEnd = m_batchIterator->end();
m_firstPackageInBatch = true;
m_stagingEnabled = m_stagingEnabled || m_enableStagingInNextBatch;
}