use of org.absmodels.abs.plugin.debug.model.Debugger.InvalidRandomSeedException in project abstools by abstools.
the class JavaJob method findAndExecuteMain.
/**
* Tries to find the main block in the chosen ABS file or in the
* ABS project, if file is null.
*
* Finally: executes Modulename.Main
*
* @param absFrontendLocation - where to find the absfrontend
* @throws AbsJobException - if no main block found
* @throws IOException - If an I/O error occurs
*/
private void findAndExecuteMain(String absFrontendLocation) throws AbsJobException, IOException {
String info = null;
ModuleDecl module;
if (absUnit) {
module = getModuleByName(ABSTestRunnerGenerator.RUNNER_MAIN);
} else if (runTarget != null) {
module = getModuleByName(runTarget);
} else {
module = searchForMainBlockInCurrentFile();
// Search for the main file if previous searching was not successful
if (module == null) {
List<ModuleDecl> modules = getAllModulesWithMainInCurrentProject();
if (modules.size() == 0) {
throw new AbsJobException("No Module with main block found.");
} else {
module = modules.get(0);
}
if (currentFile != null) {
info = "No main file found for \"" + currentFile.getName() + "\".\nBut there is a main file in the project:";
}
}
}
String moduleName = JavaBackend.getFullJavaNameForMainBlock(module);
try {
debugAbsFiles(absFrontendLocation, javaPath, startSDE, moduleName, info);
} catch (InvalidRandomSeedException e) {
throw new AbsJobException(e);
}
}
Aggregations