PassOrderingHelper
The goal of this class is to provide ordered passes when invoking the order function.
soft dependencies (DependsOn with
softDependency == true
): all passes registered as soft dependency will be executed before the current pass, if they are registered independentlyhard dependencies (DependsOn with
softDependency == false (default)
): all passes registered as hard dependency will be executed before the current pass (hard dependencies will be registered even if the user did not specifically register them)first pass ExecuteFirst: a pass registered as first pass will be executed in the beginning
last pass ExecuteLast: a pass registered as last pass will be executed at the end
late pass ExecuteLate: a pass that is executed as late as possible without violating any of the other constraints
ExecuteBefore (with soft and hard dependencies): the pass is to be executed before the other pass (soft: if the other pass is also configured)
This class works by
Setup
Iterating through the configured passes and registering them (plus all
hard == true
dependencies) as PassWithDependencies containers:ExecuteFirst and ExecuteLast passes are stored in separate lists to keep the ordering logic simple.
Normal passes are stored in the workingList
ExecuteBefore passes: "
A
execute beforeB
" implies that "B
depends onA
" -> the dependency is stored in the PassWithDependencies.dependenciesRemaining of "B
". This logic is implemented in populateExecuteBeforeDependencies.DependsOn passes: PassWithDependencies.dependenciesRemaining keeps track of these dependencies. populateNormalDependencies implements this logic.
A sanityCheck is performed.
Ordering
firstPassesList passes are moved to the result.
While the workingList is not empty:
All passes ready to be scheduled are moved to the result excluding late passes. If this found at least one pass, then the loop starts again.
Late passes are considered for scheduling as well. If this found at least one pass, then the loop starts again. Otherwise, the dependencies cannot be satisfied.
lastPassesList passes are moved to the result.
Note: whenever a pass is moved to the result:
it is removed from the workingList (and firstPassesList / lastPassesList)
the other pass's PassWithDependencies.dependenciesRemaining are updated.
Constructors
Collects the requested passes provided as passes and populates the internal workingList consisting of pairs of passes and their dependencies. Also, this function adds all hardDependencies