Fix up logging in sortmods
This commit is contained in:
@@ -790,37 +790,38 @@ class ModList {
|
|||||||
|
|
||||||
// Sort mods based on dependencies and return the sorted list
|
// Sort mods based on dependencies and return the sorted list
|
||||||
List<String> sortMods() {
|
List<String> sortMods() {
|
||||||
print("Building dependency graph...");
|
final logger = Logger.instance;
|
||||||
|
logger.info("Building dependency graph...");
|
||||||
final hardGraph = buildDependencyGraph();
|
final hardGraph = buildDependencyGraph();
|
||||||
|
|
||||||
// Check for cycles in hard dependencies
|
// Check for cycles in hard dependencies
|
||||||
final cycle = detectCycle(hardGraph);
|
final cycle = detectCycle(hardGraph);
|
||||||
if (cycle != null) {
|
if (cycle != null) {
|
||||||
print(
|
logger.warning(
|
||||||
"Warning: Cycle in hard dependencies detected: ${cycle.join(" -> ")}",
|
"Cycle in hard dependencies detected: ${cycle.join(" -> ")}",
|
||||||
);
|
);
|
||||||
print("Will attempt to break cycle to produce a valid load order");
|
logger.info("Will attempt to break cycle to produce a valid load order");
|
||||||
}
|
}
|
||||||
|
|
||||||
print(
|
logger.info(
|
||||||
"Performing topological sort for hard dependencies (prioritizing larger mods)...",
|
"Performing topological sort for hard dependencies (prioritizing larger mods)...",
|
||||||
);
|
);
|
||||||
final hardOrder = topologicalSort(hardGraph);
|
final hardOrder = topologicalSort(hardGraph);
|
||||||
|
|
||||||
print("Adjusting for soft dependencies...");
|
logger.info("Adjusting for soft dependencies...");
|
||||||
final softGraph = buildSoftDependencyGraph();
|
final softGraph = buildSoftDependencyGraph();
|
||||||
final finalOrder = adjustForSoftDependencies(hardOrder, softGraph);
|
final finalOrder = adjustForSoftDependencies(hardOrder, softGraph);
|
||||||
|
|
||||||
// Check for incompatibilities
|
// Check for incompatibilities
|
||||||
final incompatibilities = findIncompatibilities();
|
final incompatibilities = findIncompatibilities();
|
||||||
if (incompatibilities.isNotEmpty) {
|
if (incompatibilities.isNotEmpty) {
|
||||||
print("Warning: Incompatible mods detected:");
|
logger.warning("Incompatible mods detected:");
|
||||||
for (final pair in incompatibilities) {
|
for (final pair in incompatibilities) {
|
||||||
print(" - ${mods[pair[0]]?.name} and ${mods[pair[1]]?.name}");
|
logger.warning(" - ${mods[pair[0]]?.name} and ${mods[pair[1]]?.name}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print(
|
logger.info(
|
||||||
"Sorting complete. Final mod order contains ${finalOrder.length} mods.",
|
"Sorting complete. Final mod order contains ${finalOrder.length} mods.",
|
||||||
);
|
);
|
||||||
return finalOrder;
|
return finalOrder;
|
||||||
|
Reference in New Issue
Block a user