private static Map<String, GModule> getOrderedModules(ApplicationLayout layout) {

		Comparator<GModule> comparator = (module1, module2) -> {
			int nameComparison = module1.getName().compareTo(module2.getName());

			// First handle modules that are external to the Ghidra installation.
			// These should be put at the end of the list.
			boolean external1 = ModuleUtilities.isExternalModule(module1, layout);
			boolean external2 = ModuleUtilities.isExternalModule(module2, layout);
			if (external1 && external2) {
				return nameComparison;
			}
			if (external1 || external2) {
				return Boolean.compare(external1, external2);
			}

			// Now handle modules that are internal to the Ghidra installation.
			// We will primarily order them by "type" and secondarily by name.
			Map<String, Integer> typePriorityMap = new HashMap<>();
			typePriorityMap.put("Framework", 0);
			typePriorityMap.put("Configurations", 1);
			typePriorityMap.put("Features", 2);
			typePriorityMap.put("Debug", 3);
			typePriorityMap.put("Processors", 4);
			typePriorityMap.put("GPL", 5);
			typePriorityMap.put("Extensions", 6);
			typePriorityMap.put("Test", 7);

			String type1 = module1.getModuleRoot().getParentFile().getName();
			String type2 = module2.getModuleRoot().getParentFile().getName();
			int priority1 = typePriorityMap.getOrDefault(type1, typePriorityMap.size());
			int priority2 = typePriorityMap.getOrDefault(type2, typePriorityMap.size());
			if (priority1 != priority2) {
				return Integer.compare(priority1, priority2);
			}
			return nameComparison;
		};

		List<GModule> moduleList = new ArrayList<>(layout.getModules().values());
		Collections.sort(moduleList, comparator);
		Map<String, GModule> moduleMap = new LinkedHashMap<>();
		for (GModule module : moduleList) {
			moduleMap.put(module.getName(), module);
		}
		return moduleMap;
	}
Gets the modules ordered by "class-loader priority".  This ensures that core modules (things 
in Framework/Features/Processors, etc) come before user modules (Extensions).  It also
guarantees a consistent module order from run to run.

@param layout The layout
@return the modules mapped by name, ordered by priority
Ghidra/Framework/Utility/src/main/java/ghidra/GhidraLauncher.java