Skip to content

Commit a181b9f

Browse files
[projmgr] Layer detection: skip device requirement if board is already loaded
1 parent e6e6d83 commit a181b9f

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,15 @@ enum class MessageType {
374374
Error
375375
};
376376

377+
/**
378+
* @brief Process Board/Device
379+
*/
380+
enum class BoardOrDevice {
381+
Both,
382+
None,
383+
SkipDevice,
384+
};
385+
377386
/**
378387
* @brief projmgr worker class responsible for processing requests and orchestrating parser and generator calls
379388
*/
@@ -802,10 +811,10 @@ class ProjMgrWorker {
802811
bool GetProjectSetup(ContextItem& context);
803812
bool InitializeTarget(ContextItem& context);
804813
bool SetTargetAttributes(ContextItem& context, std::map<std::string, std::string>& attributes);
805-
bool ProcessPrecedences(ContextItem& context, bool processDevice = false, bool rerun = false);
814+
bool ProcessPrecedences(ContextItem& context, BoardOrDevice process = BoardOrDevice::None, bool rerun = false);
806815
bool ProcessPrecedence(StringCollection& item);
807816
bool ProcessCompilerPrecedence(StringCollection& item, bool acceptRedefinition = false);
808-
bool ProcessDevice(ContextItem& context);
817+
bool ProcessDevice(ContextItem& context, BoardOrDevice process = BoardOrDevice::Both);
809818
bool ProcessDevicePrecedence(StringCollection& item);
810819
bool ProcessBoardPrecedence(StringCollection& item);
811820
bool ProcessToolchain(ContextItem& context);

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,7 +1182,7 @@ ConnectionsValidationResult ProjMgrWorker::ValidateConnections(ConnectionsCollec
11821182
return { result, conflicts, overflows, incompatibles, missedCollections, activeConnectMap };
11831183
}
11841184

1185-
bool ProjMgrWorker::ProcessDevice(ContextItem& context) {
1185+
bool ProjMgrWorker::ProcessDevice(ContextItem& context, BoardOrDevice process) {
11861186
DeviceItem deviceItem;
11871187
GetDeviceItem(context.device, deviceItem);
11881188
if (context.board.empty() && deviceItem.name.empty()) {
@@ -1256,6 +1256,11 @@ bool ProjMgrWorker::ProcessDevice(ContextItem& context) {
12561256
context.targetAttributes["Brevision"] = matchedBoard->GetRevision();
12571257
context.targetAttributes["Bversion"] = matchedBoard->GetRevision(); // deprecated
12581258

1259+
if (matchedBoard && process == BoardOrDevice::SkipDevice) {
1260+
// skip device processing
1261+
return true;
1262+
}
1263+
12591264
// find device from the matched board
12601265
matchedBoard->GetMountedDevices(mountedDevices);
12611266
if (mountedDevices.size() > 1 && deviceItem.name.empty()) {
@@ -2615,7 +2620,7 @@ bool ProjMgrWorker::ProcessCompilerPrecedence(StringCollection& item, bool accep
26152620
}
26162621

26172622

2618-
bool ProjMgrWorker::ProcessPrecedences(ContextItem& context, bool processDevice, bool rerun) {
2623+
bool ProjMgrWorker::ProcessPrecedences(ContextItem& context, BoardOrDevice process, bool rerun) {
26192624
// Notes: defines, includes and misc are additive. All other keywords overwrite previous settings.
26202625
// The target-type and build-type definitions are additive, but an attempt to
26212626
// redefine an already existing type results in an error.
@@ -2726,7 +2731,7 @@ bool ProjMgrWorker::ProcessPrecedences(ContextItem& context, bool processDevice,
27262731
}
27272732

27282733
// Process device and board
2729-
if (processDevice && !ProcessDevice(context)) {
2734+
if (process != BoardOrDevice::None && !ProcessDevice(context, process)) {
27302735
CheckMissingPackRequirements(context.name);
27312736
error |= true;
27322737
}
@@ -3313,7 +3318,7 @@ bool ProjMgrWorker::ProcessSequenceRelative(ContextItem& context, string& item,
33133318
if (!refContext.rteActiveTarget && !LoadPacks(refContext)) {
33143319
return false;
33153320
}
3316-
if (!ProcessPrecedences(refContext, true)) {
3321+
if (!ProcessPrecedences(refContext, BoardOrDevice::Both)) {
33173322
return false;
33183323
}
33193324
}
@@ -3650,7 +3655,7 @@ bool ProjMgrWorker::ProcessContext(ContextItem& context, bool loadGenFiles, bool
36503655
bool ret = true;
36513656
ret &= LoadPacks(context);
36523657
context.rteActiveProject->SetAttribute("update-rte-files", updateRteFiles ? "1" : "0");
3653-
if (!ProcessPrecedences(context, true)) {
3658+
if (!ProcessPrecedences(context, BoardOrDevice::Both)) {
36543659
return false;
36553660
}
36563661
if (!SetTargetAttributes(context, context.targetAttributes)) {
@@ -3880,7 +3885,7 @@ bool ProjMgrWorker::ListComponents(vector<string>& components, const string& fil
38803885
return false;
38813886
}
38823887
if (!selectedContext.empty()) {
3883-
if (!ProcessPrecedences(context, true)) {
3888+
if (!ProcessPrecedences(context, BoardOrDevice::Both)) {
38843889
return false;
38853890
}
38863891
}
@@ -4093,7 +4098,7 @@ bool ProjMgrWorker::ListLayers(vector<string>& layers, const string& clayerSearc
40934098
}
40944099
} else {
40954100
// process precedences and device/board
4096-
if (!ProcessPrecedences(context, true)) {
4101+
if (!ProcessPrecedences(context, BoardOrDevice::SkipDevice)) {
40974102
failedContexts.insert(selectedContext);
40984103
error |= true;
40994104
continue;
@@ -5003,7 +5008,7 @@ bool ProjMgrWorker::ProcessGeneratedLayers(ContextItem& context) {
50035008
return false;
50045009
}
50055010
}
5006-
if (!ProcessPrecedences(context, true, true)) {
5011+
if (!ProcessPrecedences(context, BoardOrDevice::Both, true)) {
50075012
return false;
50085013
}
50095014
if (!ProcessGroups(context)) {

0 commit comments

Comments
 (0)