private static CompilerMessageLogger compileAndRemoveModule(ModuleName moduleName, String outerDefnText, BasicCALServices calServices) {
String sourceDefString = "module " + moduleName + ";\n";
sourceDefString += "import " + CAL_Prelude.MODULE_NAME + ";\n";
sourceDefString += outerDefnText;
ModuleSourceDefinition sourceDef = new StringModuleSourceDefinition(moduleName, sourceDefString);
// Get the workspace manager and the logger.
WorkspaceManager workspaceManager = calServices.getWorkspaceManager();
CompilerMessageLogger logger = new MessageLogger();