@@ -526,8 +526,10 @@ bool ProjMgrWorker::LoadAllRelevantPacks() {
526526 m_loadedPacks.clear (); // the list will be updated, it should not contain dangling pointers
527527 // Get required pdsc files
528528 std::list<std::string> pdscFiles;
529+ bool noPackRequirements = true ;
529530 for (const auto & context : m_selectedContexts) {
530531 auto & contextItem = m_contexts.at (context);
532+ noPackRequirements &= contextItem.packRequirements .empty ();
531533 for (const auto & [pdscFile, pathVer] : contextItem.pdscFiles ) {
532534 const string& path = pathVer.first ;
533535 if (!path.empty ()) {
@@ -543,12 +545,12 @@ bool ProjMgrWorker::LoadAllRelevantPacks() {
543545 }
544546 }
545547 // Check load packs policy
546- if (pdscFiles. empty () && (m_loadPacksPolicy == LoadPacksPolicy::REQUIRED )) {
548+ if (noPackRequirements && (m_loadPacksPolicy == LoadPacksPolicy::REQUIRED )) {
547549 ProjMgrLogger::Get ().Error (" required packs must be specified" );
548550 return false ;
549551 }
550552 // Get installed packs
551- if (pdscFiles. empty () || (m_loadPacksPolicy == LoadPacksPolicy::ALL ) || (m_loadPacksPolicy == LoadPacksPolicy::LATEST )) {
553+ if (noPackRequirements || (m_loadPacksPolicy == LoadPacksPolicy::ALL ) || (m_loadPacksPolicy == LoadPacksPolicy::LATEST )) {
552554 const bool latest = (m_loadPacksPolicy == LoadPacksPolicy::LATEST ) || (m_loadPacksPolicy == LoadPacksPolicy::DEFAULT );
553555 if (!m_kernel->GetEffectivePdscFiles (pdscFiles, latest)) {
554556 ProjMgrLogger::Get ().Error (" parsing installed packs failed" );
@@ -585,16 +587,15 @@ bool ProjMgrWorker::LoadPacks(ContextItem& context) {
585587 if (!InitializeTarget (context)) {
586588 return false ;
587589 }
590+ bool deferredFail = false ;
588591 if (!CollectAllRequiredPdscFiles ()) {
589592 PrintContextErrors (context.name );
590- if (!m_rpcMode) {
591- return false ;
592- }
593+ // defer return due to pdsc collection failure
594+ deferredFail = true ;
593595 }
594596 if ((m_loadedPacks.empty () || m_rpcMode) && !LoadAllRelevantPacks ()) {
595- if (!m_rpcMode) {
596- return false ;
597- }
597+ // defer return due to pack loading failure
598+ deferredFail = true ;
598599 }
599600 // Filter context specific packs
600601 set<string> selectedPacks;
@@ -624,6 +625,10 @@ bool ProjMgrWorker::LoadPacks(ContextItem& context) {
624625 filter.SetSelectedPackages (selectedPacks);
625626 context.rteActiveTarget ->SetPackageFilter (filter);
626627 context.rteActiveTarget ->UpdateFilterModel ();
628+ // report deferred failure; in rpc mode continue processing despite it
629+ if (!m_rpcMode && deferredFail) {
630+ return false ;
631+ }
627632 return CheckRteErrors ();
628633}
629634
@@ -4807,12 +4812,12 @@ bool ProjMgrWorker::ListGenerators(vector<string>& generators) {
48074812 set<string> generatorsSet;
48084813 map <string, map<string, map<string, StrVec>>> sortedGeneratorsMap;
48094814 StrMap generatorsDescription;
4815+ bool deferredFail = false ;
48104816 // classic generators
48114817 for (const auto & selectedContext : m_selectedContexts) {
48124818 ContextItem& context = m_contexts[selectedContext];
4813- if (!ProcessContext (context, false , true , false )) {
4814- return false ;
4815- }
4819+ // defer failure report
4820+ deferredFail |= !ProcessContext (context, false , true , false );
48164821 for (const auto & [id, generator] : context.generators ) {
48174822 for (const auto & [gpdsc, item] : context.gpdscs ) {
48184823 if (item.generator == id) {
@@ -4827,6 +4832,11 @@ bool ProjMgrWorker::ListGenerators(vector<string>& generators) {
48274832 }
48284833 }
48294834 }
4835+ if (deferredFail) {
4836+ // report deferred failure
4837+ return false ;
4838+ }
4839+
48304840 // global generators
48314841 for (const auto & [options, contexts] : m_extGenerator->GetUsedGenerators ()) {
48324842 sortedGeneratorsMap.insert ({ options.id , {} });
@@ -5678,22 +5688,31 @@ std::string ProjMgrWorker::GetSelectedToochain(void) {
56785688bool ProjMgrWorker::ProcessGlobalGenerators (ContextItem* selectedContext, const string& generatorId,
56795689 string& projectType, StrVec& siblings) {
56805690
5681- // iterate over contexts with same build and target types
5682- m_selectedContexts. clear ();
5683- for ( auto & [_, context] : m_contexts) {
5684- if (( context. type . build != selectedContext-> type . build ) ||
5685- ( context.type .target != selectedContext->type .target )) {
5686- continue ;
5687- }
5688- if (! ParseContextLayers (context)) {
5689- return false ;
5691+ if (m_activeTargetType. empty ()) {
5692+ // if active target type is not given, select all contexts with same build and target types
5693+ m_selectedContexts. clear ();
5694+ for ( auto & [_, context] : m_contexts) {
5695+ if (( context.type .build != selectedContext->type .build ) ||
5696+ (context. type . target != selectedContext-> type . target )) {
5697+ continue ;
5698+ }
5699+ m_selectedContexts. push_back (context. name ) ;
56905700 }
5691- m_selectedContexts.push_back (context.name );
56925701 }
5693- for (auto & context : m_selectedContexts) {
5694- if (!ProcessContext (m_contexts.at (context), false , true , false )) {
5695- return false ;
5702+ // parse layers and process selected contexts
5703+ bool deferredFail = false ;
5704+ for (auto & contextName : m_selectedContexts) {
5705+ if (!ParseContextLayers (m_contexts.at (contextName))) {
5706+ // defer failure report due to layers parsing
5707+ deferredFail = true ;
5708+ continue ;
56965709 }
5710+ // defer failure report due to context processing
5711+ deferredFail |= !ProcessContext (m_contexts.at (contextName), false , true , false );
5712+ }
5713+ // report deferred failure
5714+ if (deferredFail) {
5715+ return false ;
56975716 }
56985717 StrVec contextVec;
56995718 const string& genDir = selectedContext->extGen [generatorId].path ;
@@ -6147,7 +6166,8 @@ void ProjMgrWorker::CollectUnusedPacks() {
61476166 continue ;
61486167 }
61496168 context.unusedPacks .clear ();
6150- for (const auto & [packId, _] : context.rteFilteredModel ->GetPackages ()) {
6169+ for (const auto & [_, packItem] : context.rteFilteredModel ->GetPackages ()) {
6170+ const auto packId = packItem->GetPackageID ();
61516171 if (context.packages .find (packId) == context.packages .end ()) {
61526172 CollectionUtils::PushBackUniquely (context.unusedPacks , packId);
61536173 }
0 commit comments