mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fix group cyclic interactions
Skip adding an edge between a pair of plugins if all the following conditions are met: - the edge is to be added due to group membership - adding the edge would introduce a cycle in the absence of any other group membership edges.
This commit is contained in:
@@ -26,7 +26,7 @@ Create plugin graph vertices
|
||||
Once loaded, a directed graph is created and the plugins are added to it in
|
||||
lexicographical order as vertices. Any metadata a plugin has in the masterlist
|
||||
and userlist are then merged into its vertex's data store. Plugin group
|
||||
dependencies are also resolved and added as additional load after plugins.
|
||||
dependencies are also resolved and added as group-derived plugins.
|
||||
|
||||
Create plugin graph edges
|
||||
==============================
|
||||
@@ -46,6 +46,12 @@ For each plugin:
|
||||
4. Add edges coming from all the plugin's load after files that are installed
|
||||
plugins.
|
||||
|
||||
Group-derived interdependencies are then evaluated. Each plugin's group-derived
|
||||
plugins are iterated over and individually checked to see if adding an edge from
|
||||
the group-derived plugin to the plugin would cause a cycle, and if not the edge
|
||||
is recorded. Once all potential edges have been checked, the recorded edges are
|
||||
added to the graph.
|
||||
|
||||
At this point, all explicit interdependencies have been graphed. Plugin priority
|
||||
metadata values must now be propagated down the dependency trees to ensure that
|
||||
priority edges are added correctly later in the process. To do this:
|
||||
|
||||
@@ -19,8 +19,12 @@ This structure can be used to hold group definitions. It is a key-value map.
|
||||
The names of groups that this group loads after. Group names are
|
||||
case-sensitive. If undefined, the set is empty. The named groups must be
|
||||
defined when LOOT sorts plugins, but they don't need to be defined in the same
|
||||
metadata file. If at sort time a group is defined to load after a group that
|
||||
does not exist, a sorting error will occur.
|
||||
metadata file.
|
||||
|
||||
Sorting errors will occur if:
|
||||
|
||||
- A group loads after another group that does not exist.
|
||||
- Group loading is cyclic (e.g. A loads after B and B loads after A).
|
||||
|
||||
Merging Groups
|
||||
--------------
|
||||
|
||||
@@ -25,10 +25,33 @@ This is the structure that brings all the others together, and forms the main co
|
||||
be defined in the same metadata file. If at sort time the group does not
|
||||
exist, a sorting error will occur.
|
||||
|
||||
A plugin must load after all the plugins in the groups its group is defined to
|
||||
load after. Group loading is resolved recursively. For example, if group C
|
||||
loads after group B, and group B loads after group A, a plugin in C must load
|
||||
after all the plugins in A even if no plugins in B are installed.
|
||||
The plugin must load after all the plugins in the groups its group is defined
|
||||
to load after, resolving them recursively. An exception exists if doing so
|
||||
would introduce a cyclic dependency between two plugins without any other
|
||||
group loading rules applied.
|
||||
|
||||
For example, if for plugins A.esp, B.esp, C.esp and D.esp:
|
||||
|
||||
- B.esp has A.esp as a master
|
||||
- A.esp is in group A
|
||||
- B.esp and C.esp are in the default group
|
||||
- D.esp is in group D
|
||||
- group A loads after the default group
|
||||
- the default group loads after group D
|
||||
|
||||
Then the load order must be D.esp, C.esp, A.esp, B.esp. Although A.esp's group
|
||||
must load after B.esp's group, this would cause a cycle between A.esp and
|
||||
B.esp, so the requirement is ignored for that pair of plugins.
|
||||
|
||||
However, if for plugins A.esp, B.esp and C.esp in groups of the same names:
|
||||
|
||||
1. group B loads after group A
|
||||
2. group C loads after group B
|
||||
3. A.esp has C.esp as a master
|
||||
|
||||
This will cause a sorting error, as neither group rule introduces a cyclic
|
||||
dependency when combined in isolation with the third rule, but having all
|
||||
three rules applied causes a cycle.
|
||||
|
||||
.. describe:: priority
|
||||
|
||||
|
||||
Reference in New Issue
Block a user