Skip to content
This repository has been archived by the owner on Mar 14, 2018. It is now read-only.

Commit

Permalink
preparing final 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RaiMan authored and RaiMan committed Oct 6, 2015
1 parent a87c5ac commit f726e97
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions Setup/src/main/java/org/sikuli/setup/RunSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ public class RunSetup {

static Map <String, String> downloadsLookfor = new HashMap<String, String>();
static Map <String, File> downloadsFound = new HashMap<String, File>();

private static File fSetupStuff = null;
private static boolean hasAPI = true;
private static String[] jarsList = new String[]{
null, // ide
null, // api
null, // tess
null, // jython
null, // jruby
null, // jruby+
null, // libwin
null, // libmac
null // liblux
};


//<editor-fold defaultstate="collapsed" desc="new logging concept">
private static void logp(String message, Object... args) {
Expand Down Expand Up @@ -364,7 +379,7 @@ public static void main(String[] args) throws IOException {
fDownloadsObsolete = new File(fWorkDir, "Downloads");
workDir = fWorkDir.getAbsolutePath();

File fSetupStuff = new File(fWorkDir, "SetupStuff");
fSetupStuff = new File(fWorkDir, "SetupStuff");
FileManager.resetFolder(fSetupStuff);

osarch = "" + runTime.javaArch;
Expand Down Expand Up @@ -642,17 +657,6 @@ public void propertyChange(PropertyChangeEvent pce) {
//</editor-fold>

String localTemp = "sikulixtemp.jar";
String[] jarsList = new String[]{
null, // ide
null, // api
null, // tess
null, // jython
null, // jruby
null, // jruby+
null, // libwin
null, // libmac
null // liblux
};
localJar = null;
File fTargetJar;
String targetJar;
Expand Down Expand Up @@ -972,7 +976,9 @@ public boolean accept(ZipEntry entry, String jarname) {

splash = showSplash("Now creating jars, application and commandfiles", "please wait - may take some seconds ...");

jarsList[1] = (new File(workDir, localAPI)).getAbsolutePath();
File fAPI = new File(workDir, localAPI);
jarsList[1] = fAPI.getAbsolutePath();
hasAPI = fAPI.exists();

if (getTess) {
jarsList[2] = (new File(workDir, localTess)).getAbsolutePath();
Expand Down Expand Up @@ -1028,11 +1034,6 @@ public boolean accept(ZipEntry entry, String jarname) {
}
}

for (int i = (getAPI ? 2 : 1); i < jarsList.length; i++) {
if (jarsList[i] != null) {
new File(jarsList[i]).delete();
}
}
closeSplash(splash);

if (success && getIDE) {
Expand All @@ -1059,8 +1060,6 @@ public boolean accept(ZipEntry entry, String jarname) {
log(lvl, "Running headless --- skipping tests");
}

FileManager.deleteFileOrFolder(fSetupStuff);

//<editor-fold defaultstate="collapsed" desc="api test">
boolean runAPITest = false;
if (getAPI && !notests && !runTime.isHeadless()) {
Expand Down Expand Up @@ -1188,9 +1187,21 @@ public boolean accept(ZipEntry entry, String jarname) {

log(lvl,
"... SikuliX Setup seems to have ended successfully ;-)");

finalCleanup();

System.exit(RunTime.testing ? 1 : 0);
}

private static void finalCleanup() {
if (hasAPI) jarsList[1] = null;
for (int i = (getAPI ? 2 : 1); i < jarsList.length; i++) {
if (jarsList[i] != null) {
new File(jarsList[i]).delete();
}
}
FileManager.deleteFileOrFolder(fSetupStuff);
}

private static void runScriptTest(String[] testargs) {
try {
Expand Down Expand Up @@ -1753,6 +1764,7 @@ private static void prepTerminate(String msg) {
logPlus(-1, "... terminated abnormally :-(");
popError("Something serious happened! Sikuli not useable!\n"
+ "Check the error log at " + (logfile == null ? "printout" : logfile));
finalCleanup();
}

private static void terminate(String msg) {
Expand Down

0 comments on commit f726e97

Please sign in to comment.