Merge lp:~yrke/tapaal/tapaal-newlocateverifytapn into lp:tapaal

Proposed by Kenneth Yrke Jørgensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 552
Merged at revision: 665
Proposed branch: lp:~yrke/tapaal/tapaal-newlocateverifytapn
Merge into: lp:tapaal
Diff against target: 186 lines (+111/-6)
4 files modified
src/dk/aau/cs/verification/UPPAAL/Verifyta.java (+10/-2)
src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPN.java (+32/-2)
src/net/tapaal/TAPAAL.java (+67/-0)
src/pipe/gui/CreateGui.java (+2/-2)
To merge this branch: bzr merge lp:~yrke/tapaal/tapaal-newlocateverifytapn
Reviewer Review Type Date Requested Status
Mathias Andersen (community) Approve
Jiri Srba Approve
Jakob Taankvist Pending
Review via email: mp+94156@code.launchpad.net

Commit message

Merged branch tapaal-newlocateverifytapn

Improved search for verifytapn

Description of the change

Changes the serach order for verifytapn

1) Search for it to be set via env variable
2) Search the "install"/run dir for bin/verifytapn

The chagne assumes that the jar/class files are placed in lib/ and verifytapn is placed in bin
This means the bat script is no longer needed in order to run TAPAAL on windows

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

There is a problem here. The engine can be called verifytapn or verifytapn64, depending on the version. I would like to keep the different names different, so that if a user reports a bug,
we can see (Tools/Verification engines) what version is he/she using. Perhaps you can check
for both variants in the bin directory and prefer the 32 bit version of both are present?

551. By Kenneth Yrke Jørgensen

Verifytapn setup now also searches for 64bit version of verifyta

First tryes 32 bit, then 64 bit

Revision history for this message
Jiri Srba (srba) :
review: Approve
552. By Kenneth Yrke Jørgensen

Fixed problem with UNCs on windows and now searces exe files

Revision history for this message
Jiri Srba (srba) :
review: Approve
Revision history for this message
Mathias Andersen (mande09) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/dk/aau/cs/verification/UPPAAL/Verifyta.java'
2--- src/dk/aau/cs/verification/UPPAAL/Verifyta.java 2012-02-10 15:55:28 +0000
3+++ src/dk/aau/cs/verification/UPPAAL/Verifyta.java 2012-02-23 15:52:19 +0000
4@@ -173,12 +173,20 @@
5 return result;
6 }
7
8- public static boolean trySetupFromEnvironmentVariable() {
9- String verifyta = System.getenv("verifyta");
10+ public static boolean trySetup() {
11+
12+ String verifyta = null;
13+
14+ //Get from evn (overwrite other values)
15+ verifyta = System.getenv("verifyta");
16 if (verifyta != null && !verifyta.equals("")) {
17 verifytapath = verifyta;
18 return true;
19 }
20+
21+ //If a value is saved in conf
22+ //TODO: kyrke
23+
24 return false;
25 }
26
27
28=== modified file 'src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPN.java'
29--- src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPN.java 2012-02-10 15:55:28 +0000
30+++ src/dk/aau/cs/verification/VerifyTAPN/VerifyTAPN.java 2012-02-23 15:52:19 +0000
31@@ -6,11 +6,16 @@
32 import java.io.InputStream;
33 import java.io.InputStreamReader;
34 import java.io.StringReader;
35+import java.net.MalformedURLException;
36+import java.net.URISyntaxException;
37+import java.net.URL;
38 import java.util.ArrayList;
39 import java.util.List;
40 import java.util.regex.Matcher;
41 import java.util.regex.Pattern;
42
43+import net.tapaal.TAPAAL;
44+
45 import pipe.dataLayer.TAPNQuery.TraceOption;
46 import pipe.gui.FileFinder;
47 import pipe.gui.widgets.InclusionPlaces;
48@@ -180,12 +185,37 @@
49 return verifytapnpath == null || verifytapnpath.equals("");
50 }
51
52- public static boolean trySetupFromEnvironmentVariable() {
53- String verifytapn = System.getenv("verifytapn");
54+ public static boolean trySetup() {
55+
56+ String verifytapn = null;
57+
58+ //If env is set, it overwrites the value
59+ verifytapn = System.getenv("verifytapn");
60 if (verifytapn != null && !verifytapn.isEmpty()) {
61 verifytapnpath = verifytapn;
62 return true;
63 }
64+
65+ //If a value is saved in conf
66+ //TODO: kyrke
67+
68+ //Search the installdir for verifytapn
69+ File installdir = TAPAAL.getInstallDir();
70+
71+ String[] paths = {"/bin/verifytapn", "/bin/verifytapn64", "/bin/verifytapn.exe", "/bin/verifytapn64.exe"};
72+ for (String s : paths) {
73+ File verifytapnfile = new File(installdir + s);
74+
75+ if (verifytapnfile.exists()){
76+
77+ verifytapnpath = verifytapnfile.getAbsolutePath();
78+ return true;
79+
80+ }
81+ }
82+
83+
84+
85 return false;
86 }
87
88
89=== modified file 'src/net/tapaal/TAPAAL.java'
90--- src/net/tapaal/TAPAAL.java 2011-09-23 20:39:42 +0000
91+++ src/net/tapaal/TAPAAL.java 2012-02-23 15:52:19 +0000
92@@ -1,6 +1,10 @@
93 package net.tapaal;
94
95 import java.io.File;
96+import java.net.MalformedURLException;
97+import java.net.URI;
98+import java.net.URISyntaxException;
99+import java.net.URL;
100
101 import org.apache.commons.cli.CommandLine;
102 import org.apache.commons.cli.CommandLineParser;
103@@ -74,5 +78,68 @@
104 }
105
106 }
107+
108+ public static File getInstallDir() {
109+
110+ String str = ClassLoader.getSystemResource("TAPAAL.class").getPath();
111+
112+ int placeOfJarSeperator = str.lastIndexOf('!');
113+
114+ if (placeOfJarSeperator != -1){
115+ // Its a jar file, lets strip the jar ending.
116+ str = str.substring(0, placeOfJarSeperator);
117+
118+ //Remove the name of the jar file
119+ str = str.substring(0, str.lastIndexOf("/")); //Keep the last /
120+
121+ } else {
122+ // Its a class file, stip the name
123+ str = str.replace("TAPAAL.class", "");
124+ }
125+
126+ try {
127+
128+ //Fix as ubuntu (at least) does not set file:// from ClassLoader
129+ if (!str.contains("file:/")) {
130+ str = "file://" + str;
131+ }
132+
133+
134+ //Some magic to remove file:// and get the right seperators
135+ URL url = new URL(str);
136+ URI uri = url.toURI();
137+
138+ // Workaround for the following bug:
139+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5086147
140+ // Remove extra slashes after the scheme part.
141+
142+ if ( uri.getAuthority() != null ){
143+ try {
144+ uri = new URI( uri.toString().replace("file://", "file:////" ) );
145+ } catch ( URISyntaxException e ) {
146+ throw new IllegalArgumentException( "The specified " +
147+ "URI contains an authority, but could not be " +
148+ "normalized.", e );
149+ }
150+ }
151+
152+ File f = new File(uri);
153+ str = f.getAbsolutePath();
154+
155+ // Stip to base dir (exit bin dir)
156+ File installdir = new File(str);
157+ installdir = installdir.getParentFile();
158+
159+ return installdir;
160+
161+ } catch (MalformedURLException e) {
162+ e.printStackTrace();
163+ } catch (URISyntaxException e) {
164+ e.printStackTrace();
165+ }
166+ return null;
167+
168+ }
169+
170
171 }
172
173=== modified file 'src/pipe/gui/CreateGui.java'
174--- src/pipe/gui/CreateGui.java 2012-02-17 19:51:28 +0000
175+++ src/pipe/gui/CreateGui.java 2012-02-23 15:52:19 +0000
176@@ -52,8 +52,8 @@
177
178 appGui.setVisible(true);
179 appGui.activateSelectAction();
180- Verifyta.trySetupFromEnvironmentVariable();
181- VerifyTAPN.trySetupFromEnvironmentVariable();
182+ Verifyta.trySetup();
183+ VerifyTAPN.trySetup();
184
185 VersionChecker versionChecker = new VersionChecker();
186 if (versionChecker.checkForNewVersion()) {

Subscribers

People subscribed via source and target branches