From 54180ffec9b1eaf8dd0021d8a532e3a9457f8fb9 Mon Sep 17 00:00:00 2001 From: hansen <dominik_hansen@web.de> Date: Tue, 22 Oct 2013 16:20:34 +0200 Subject: [PATCH] c --- build.gradle | 2 +- src/main/java/de/b2tla/B2TLA.java | 27 ++++++++++++++++++--------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 92b4cce..8ba9d6e 100644 --- a/build.gradle +++ b/build.gradle @@ -59,7 +59,7 @@ task b2tla(dependsOn: build) << { from('build/libs/') into('build/b2tla') include('b2tla-'+project.version+'.jar') - rename('(b2tla)-(.+)', 'B2TLA.jar') + rename('b2tla-(.+)', 'B2TLA.jar') } } diff --git a/src/main/java/de/b2tla/B2TLA.java b/src/main/java/de/b2tla/B2TLA.java index 8f05be0..547fe7f 100644 --- a/src/main/java/de/b2tla/B2TLA.java +++ b/src/main/java/de/b2tla/B2TLA.java @@ -56,9 +56,13 @@ public class B2TLA { StopWatch.stop("Translation"); if (B2TLAGlobals.isRunTLC()) { - ArrayList<String> output = TLCRunner.runTLC(b2tla.machineFileNameWithoutFileExtension, - b2tla.path); - b2tla.evalOutput(output, true); + try { + ArrayList<String> output = TLCRunner.runTLC(b2tla.machineFileNameWithoutFileExtension, + b2tla.path); + b2tla.evalOutput(output, true); + } catch (NoClassDefFoundError e) { + } + } } @@ -186,11 +190,17 @@ public class B2TLA { } private void createFiles() { - createFile(path, machineFileNameWithoutFileExtension + ".tla", tlaModule, "TLA+ module '" + File moduleFile = createFile(path, machineFileNameWithoutFileExtension + ".tla", tlaModule, "TLA+ module '" + path + machineFileNameWithoutFileExtension+ ".tla' created.", B2TLAGlobals.isDeleteOnExit()); - createFile(path, machineFileNameWithoutFileExtension + ".cfg", config, "Configuration file '" + if(moduleFile != null){ + System.out.println("TLA+ module '"+ moduleFile.getAbsolutePath() +"' created."); + } + + File configFile = createFile(path, machineFileNameWithoutFileExtension + ".cfg", config, "Configuration file '" + path + machineFileNameWithoutFileExtension+".cfg' created.", B2TLAGlobals.isDeleteOnExit()); - + if(configFile != null){ + System.out.println("Configuration file '"+ configFile.getAbsolutePath() +"' created."); + } createStandardModules(); } @@ -362,19 +372,18 @@ public class B2TLA { return res.toString(); } - public static void createFile(String dir, String fileName, String text, + public static File createFile(String dir, String fileName, String text, String message, boolean deleteOnExit) { File d = new File(dir); d.mkdirs(); File file = new File(dir + File.separator + fileName); - System.out.println("path: " +file.getAbsolutePath()); try { file.createNewFile(); FileWriter fw; fw = new FileWriter(file); fw.write(text); fw.close(); - System.out.println(message); + return file; } catch (IOException e) { e.printStackTrace(); throw new B2TLAIOException(e.getMessage()); -- GitLab