-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best way to handle components selection/removal in a project #466
Comments
@fred-r thanks a lot for raising this issue under devtools and the excellent summary. |
Agree, I will clarify it in the summary. |
What if we start to separate 3 types of selected components:
|
@fred-r @jkrech |
One challenge I see today is that in a project we have files (header and modules without meta information) and components (with meta information e.g. about dependencies). |
Thanks @fred-r your description, it highlights some of the challenges we are facing in building an IDE to help with component management. How to select components, display and add dependencies is something that we have a good handle on, but there doesn't seem to be a good way to automatically manage the removal of components. Part of this has already been mentioned, but so far I have identified three areas where we are missing information in the current format:
If these three things were available, when a "required" component is removed, it will be possible to safely clean up the component list, removing all unused dependencies and packs. This has been briefly discussed while considering the format of a lock file and I suggested a possible schema to address these issues #119 (comment). However, the actual data model used is not important, but rather that the relationships are captured and maintained automatically. One last point, it is essential that any component management tool does not need to look into the project code to determine which components should or should not be part of the project. |
Seeing the comments, I think that we all agree there is a need to address this project composition user experience. My feeling is that at the moment the pdsc focuses on build dependencies only, not functional dependencies. With respect to this, I understand there are additional points from @madchutney:
Point #2 is an objective to me, but prevents to cover the use-case from @jkrech : "out of component code" added in the project.
If we want to address (2), then I guess there are only 2 options: I am more in favor of 2B because basically we do not force the customer to create components he does not need, but:
This would mean that in the project definition we would have:
That's extra complexity... Regarding the clean-up of the packs : to me this does not really impact project composition but more packs management. |
I think generally this is the case. However, there is a nuance/edge case where this could impact project composition. When resolving component references, the packs listed in the solution can be used to filter the available resolution options. The more packs in the solution the increased chance that the resolution would match multiple components. |
I disagree. We have agreed that csolution would need to ask for user input, if more than one component resolves a dependency - effectively the component ID specified in the yml file needs to be refined to become unique. |
@jkrech I understood it was possible for a component ID to resolve to components in different packs, even when fully specified as it does not include any reference to a pack (ComponentType)? If this is not the case then please disregard. If I have understood correctly, then removing a pack (from the solution definition) could mean that a component could be resolved, while it couldn't if the pack which also contained the component was left in the list. I don't think the clean up can be done automatically in this case. |
@madchutney while it is technically possible even for a fully specified component (Cvendor is set) to be resolved to components in different packs, it is the vendor's responsibility to prevent this from happening. If there is strong reason for doing so, it is the vendor's responsibility to ensure that the description and content of these components are identical such that it would become irrelevant from which pack the component is actually taken. I think the worst case scenario would be that the tool would keep both packs in the list. Therefore I believe it is safe to disregard this scenario. |
I think it is hard to distinguish user-assisted and automated component selection for dependency resolution. An automatically selected component can still be changed by user, e.g. another variant or version. My proposal is instead of marking components as auto, allow the users to define primary components they believe are essential for the project/solution/layer. The corresponding property should be stored in csolution/cproject/clayer files. Then we can introduce a “Clean Dependencies” command that will remove redundant components, but only those that are not marked as primary. |
During our dedicated session for this topic on Friday 2022-10-28 we concluded that there is three types of selected components we see In order to support implementations without "automatic dependency resolution" it remains mandatory to explicitly list all three types of components in .cproject/.clayer.yml.
Regarding automatically updating the list of packs used/required by the solution, we concluded that we are not missing any meta information which would link components to their origin packs. |
Agree with this refinement of the initial statement. To me, this means that as soon as the packs perimeter evolves, then all conditions need to be recomputed. |
Regarding the "memorization" of (a), (b) or (c), I think it is worthwhile to maintain a single and "complete" source of truth. So I am not in favor of solutions like:
Rationale: one of the reason for choosing YAML is the human-readability. Therefore, we should not hinder the possibility for a developer to find his complete set of components easily. I am more in favor of adding a kind of "injection-type" or "origin" attribute to the component element in the YML file. Rationale:
|
I think all components need to be listed in cproject.yml. |
From a user point of view, I'm afraid it will lead to some questions he'll possibly have to answer each time he opens a project after having installed some new packs. |
@mdortel-stm : agree with you, we should probably not fall in this pitfall :-) But, here I see it more an implementation issue : provide the way to "lock" the project environment. Otherwise, as an end-user, I may be interested in:
Also, I may have resolved a dependency with a specific set of files (dev mode). So, as usual, let's avoid over-engineering, I agree. |
The one thing that has changed in the meanwhile is the introduction of the lock file: Summary:
We agree on the definition of "Trivial dependency resolution" and "User selected dependency resolution". We have not agreed whether components selected by the trivial dependency resolution should be
|
In terms of backwards compatibility, I would propose these answers:
Also, implementation in cproject/clayer can be done in two primary ways:
project:
components:
- component: Vendor::Cclass:Cgroup1
reason: top # If not specified, reason is "top" by default
- component: Vendor::Cclass:Cgroup2
reason: choice # Due to some top level component, I've been forced to make a choice to solve ambiguity
- component: Vendor::Cclass:Cgroup3
reason: auto # Trivially added dependency
project:
components:
- component: Vendor::Cclass:Cgroup1
components-choice
- component: Vendor::Cclass:Cgroup2
components-auto:
- component: Vendor::Cclass:Cgroup3 The benefit of Variant1 in this case is that it should be fully backwards compatible, since the Still, variant1 is the less breaking of the two. |
I believe this should be supported somewhat by the compiler. Compilers identify already when functions are unused. My proposal is to park this request for now and revisit it once we explore static code analysis. |
Sorry, I did not mean to reopen the discussion here but wanted to get confirmation on having captured the latest state. |
Requirement we want to address
As an end-user, I want the tool to ease the project composition and maintenance, so that I do not waste lots of time reviewing my components list.
Separation of concerns
I believe that:
Trivial Resolution
We need to define the concept of "trivial resolution".
In the PDSC we can only say that component A requires or accepts something to sustain its needs.
So, depending on the packs installed on the user's machine, there can be 1 or several options to resolve a condition.
Hence, "trivial resolution" concerns only conditions where only 1 component can match the conditions.
[Cvendor::] Cclass [&Cbundle] :Cgroup [:Csub] [&Cvariant] [@[~ | >=]Cversion] must be defined in a way that 1 and only 1 element can match the condition.
Automatic Selection/Removal
These concepts mean that the tool resolving the conditions can make automatic decisions on behalf of the end-user when it comes to "trivial resolution":
then this component may be automatically removed from the project.
This automatic selection/removal:
We can talk about: automatic management of a component
Possibilities
A first approach could be to say that csolution/cproject.yml files contain only "non-trivially resolved components" so components explicitly added to the project by the end-user:
In this case, all "automatically selected" components would go in the lock file only.
Consequences:
Another approach could be to add an "auto" attribute to the components listed in csolution/cproject.yml files.
This field would have only 2 possible values:
Project grooming
When it comes to project maintenance:
Scope
I think it is clear that the concept of "trivial resolution" (and therefore of automatically managed component) cannot be determined at PDSC level as we do not have any information on other packs available when dealing with the project.
Therefore, this concept is to be defined at tool level:
The text was updated successfully, but these errors were encountered: