Skip to content

Commit 2f24b9e

Browse files
Evgueni DrioukEvgueni Driouk
authored andcommitted
RTE dependency evaluation:
- filter conditions before evaluating dependencies - suggest components only from active bundle if available - improved message by missing component
1 parent 48e7ac9 commit 2f24b9e

7 files changed

Lines changed: 163 additions & 117 deletions

File tree

com.arm.cmsis.pack/src/com/arm/cmsis/pack/CpStrings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public class CpStrings extends NLS {
6969
public static String RteMissingComponentResult_APIDefIsMissingNoPack;
7070
public static String RteMissingComponentResult_IsFoundInPack;
7171
public static String RteMissingComponentResult_NoComponentFoundMatchingDeviceCompiler;
72+
public static String RteMissingComponentResult_orHigherIsRequired;
7273
public static String RtePackIsNotInstalled;
7374
public static String PackIdIsNotAvailable;
7475
public static String IsNotInstalled;

com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/IRteModel.java

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.Collections;
1616
import java.util.Map;
1717

18+
import com.arm.cmsis.pack.data.ICpConditionContext;
1819
import com.arm.cmsis.pack.data.ICpDeviceItem;
1920
import com.arm.cmsis.pack.data.ICpItem;
2021
import com.arm.cmsis.pack.data.ICpPack;
@@ -31,8 +32,8 @@
3132

3233
/**
3334
* Interface responsible for manipulating Run-Time-Configuration of a project for selected device and toolchain.
34-
* It can be considered as a controller that connects CMSIS-Pack items with project model
35-
*
35+
* It can be considered as a controller that connects CMSIS-Pack items with project model
36+
*
3637
*/
3738
public interface IRteModel extends IEvaluationResult {
3839

@@ -48,15 +49,15 @@ public interface IRteModel extends IEvaluationResult {
4849

4950
/**
5051
* Updates the model
51-
* @param flags a combination of COMPONENT__* flags
52+
* @param flags a combination of COMPONENT__* flags
5253
* @see RteConstants
5354
*/
5455
void update(int flags);
55-
56-
56+
57+
5758
/**
58-
* Returns pack filter associated with model
59-
* @return ICpPackFilter
59+
* Returns pack filter associated with model
60+
* @return ICpPackFilter
6061
*/
6162
ICpPackFilter getPackFilter();
6263

@@ -66,9 +67,9 @@ public interface IRteModel extends IEvaluationResult {
6667
* @return true if new filter is not equal to previous one
6768
*/
6869
boolean setPackFilter(ICpPackFilter filter);
69-
70+
7071
/**
71-
* Returns actual device item used by the model
72+
* Returns actual device item used by the model
7273
* @return ICpDeviceItem
7374
*/
7475
ICpDeviceItem getDevice();
@@ -80,66 +81,66 @@ public interface IRteModel extends IEvaluationResult {
8081
ICpDeviceInfo getDeviceInfo();
8182

8283
/**
83-
* Sets device info to be used by the model
84+
* Sets device info to be used by the model
8485
* @param deviceInfo device info to set
8586
*/
8687
void setDeviceInfo(ICpDeviceInfo deviceInfo);
8788

8889
/**
8990
* Returns toolchain information as generic IcpItem with "Tcompiler" and "Toutput" attributes
90-
* @return ICpItem describing toolchain info
91+
* @return ICpItem describing toolchain info
9192
*/
9293
ICpItem getToolchainInfo();
9394

9495
/**
95-
* Returns serializable model object
96+
* Returns serializable model object
9697
* @return ICpConfigurationInfo in its current state
9798
*/
9899
ICpConfigurationInfo getConfigurationInfo();
99-
100-
100+
101+
101102
/**
102103
* Sets configuration data to the model
103104
* @param info ICpConfigurationInfo to set
104105
*/
105106
void setConfigurationInfo(ICpConfigurationInfo info);
106-
107-
107+
108+
108109
/**
109-
* Returns filtered component tree
110-
* @return IRteComponentItem representing component tree root
110+
* Returns filtered component tree
111+
* @return IRteComponentItem representing component tree root
111112
*/
112113
IRteComponentItem getComponents();
113114

114115
/**
115116
* Sets, resets or changes component selection.
116117
* <br>
117-
* If selection state has changed re-evaluates dependencies
118-
* @param component to set, reset or change selection selection
118+
* If selection state has changed re-evaluates dependencies
119+
* @param component to set, reset or change selection selection
119120
* @param nInstances number of instances to select, 0 to reset selection
120121
*/
121122
void selectComponent(IRteComponent component, int nInstances);
122-
123-
123+
124+
124125
/**
125126
* Evaluates dependencies of selected components
126-
* @return dependency evaluation result
127+
* @return dependency evaluation result
127128
*/
128129
EEvaluationResult evaluateComponentDependencies();
129130

130131
/**
131132
* Tries to resolve component dependencies
132-
* @return evaluation result after dependency resolving
133+
* @return evaluation result after dependency resolving
133134
*/
134135
EEvaluationResult resolveComponentDependencies();
135136

136-
137+
137138
/**
138-
* Returns dependency evaluation result for given item (class, group or component)
139-
* @param item IRteComponentItem for which to get result
139+
* Returns dependency evaluation result for given item (class, group or component)
140+
* @param item IRteComponentItem for which to get result
140141
* @return condition result or IGNORED if item has no result
141142
*/
142-
EEvaluationResult getEvaluationResult(IRteComponentItem item);
143+
EEvaluationResult getEvaluationResult(IRteComponentItem item);
143144

144145
/**
145146
* Returns collection of selected components
@@ -152,13 +153,13 @@ public interface IRteModel extends IEvaluationResult {
152153
* @return collection of used components
153154
*/
154155
Collection<IRteComponent> getUsedComponents();
155-
156+
156157
/**
157158
* Returns packs currently used by configuration
158159
* @return map id to ICpPackInfo
159160
*/
160161
Map<String, ICpPackInfo> getUsedPackInfos();
161-
162+
162163
/**
163164
* Returns collection of dependency results (items and dependencies)
164165
* @return collection of dependency results
@@ -171,20 +172,20 @@ public interface IRteModel extends IEvaluationResult {
171172
void updateComponentInfos();
172173

173174
/**
174-
* Returns hierarchical collection of devices available for this target
175-
* @return root of device tree as IRteDeviceItem
175+
* Returns hierarchical collection of devices available for this target
176+
* @return root of device tree as IRteDeviceItem
176177
*/
177178
IRteDeviceItem getDevices();
178179

179180
/**
180-
* Return collection of used generated packs, an entry can be <code>null</code> if a gpdsc is not loaded
181-
* @return map absolute filename -> pack, null or empty if no generated packs used
181+
* Return collection of used generated packs, an entry can be <code>null</code> if a gpdsc is not loaded
182+
* @return map absolute filename -> pack, null or empty if no generated packs used
182183
*/
183184
Map<String, ICpPack> getGeneratedPacks();
184185

185186
/**
186-
* Return collection of used generated pack names
187-
* @return collection of absolute filenames
187+
* Return collection of used generated pack names
188+
* @return collection of absolute filenames
188189
*/
189190
default Collection<String> getGeneratedPackNames(){
190191
Map<String, ICpPack> generatedPacks = getGeneratedPacks();
@@ -194,18 +195,24 @@ default Collection<String> getGeneratedPackNames(){
194195
return Collections.emptySet();
195196
}
196197

197-
198+
198199
/**
199-
* Returns {@link ICpPack} loaded from given gpdsc file
200-
* @param gpdsc absolute gpdsc file name
201-
* @return loaded {@link ICpPack} or null if such file does not exists or load failed
200+
* Returns {@link ICpPack} loaded from given gpdsc file
201+
* @param gpdsc absolute gpdsc file name
202+
* @return loaded {@link ICpPack} or null if such file does not exists or load failed
202203
*/
203204
ICpPack getGeneratedPack(String gpdsc);
204205

205206
/**
206-
* Checks if the model requires given gpdsc file
207-
* @param gpdsc absolute gpdsc file name
208-
* @return true if given gpdsc file is needed
207+
* Checks if the model requires given gpdsc file
208+
* @param gpdsc absolute gpdsc file name
209+
* @return true if given gpdsc file is needed
209210
*/
210211
boolean isGeneratedPackUsed(String gpdsc);
212+
213+
/**
214+
* Returns filter context used by the model
215+
* @return ICpConditionContext
216+
*/
217+
default ICpConditionContext getFilterContext() { return null;}
211218
}

com.arm.cmsis.pack/src/com/arm/cmsis/pack/rte/RteModel.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,13 @@ public void setConfigurationInfo(ICpConfigurationInfo info) {
152152
update();
153153
}
154154

155+
156+
157+
@Override
158+
public ICpConditionContext getFilterContext() {
159+
return fComponentFilter;
160+
}
161+
155162
@Override
156163
public void update(){
157164
update(RteConstants.NONE);
@@ -278,7 +285,7 @@ protected ICpPack resolvePack(ICpPackInfo pi) {
278285
return null;
279286
}
280287
String id = pi.isVersionFixed() ? pi.getId() : pi.getPackFamilyId();
281-
288+
282289
pack = fAllInstalledPacks.getPack(id);
283290
if(pack != null) {
284291
pi.setPack(pack);
@@ -498,7 +505,7 @@ protected void resolveComponentPack(ICpComponentInfo ci) {
498505
ICpPackInfo pi = ci.getPackInfo();
499506
ICpPack pack = resolvePack(pi);
500507
if(pack == null ){
501-
return; // entirely missing
508+
return; // entirely missing
502509
}
503510

504511
if(fPackFilter.isExcluded(pi.getId())) {
@@ -507,7 +514,7 @@ protected void resolveComponentPack(ICpComponentInfo ci) {
507514
ci.setEvaluationResult(EEvaluationResult.UNAVAILABLE);
508515
}
509516
}
510-
517+
511518

512519
@Override
513520
public Map<String, ICpPackInfo> getUsedPackInfos() {

0 commit comments

Comments
 (0)