Skip to content

Commit 0693824

Browse files
committed
hotfix
1 parent 6b39d5d commit 0693824

2 files changed

Lines changed: 21 additions & 33 deletions

File tree

de.peeeq.wurstscript/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ dependencies {
105105
compile 'com.github.inwc3:jmpq3:1.7.14'
106106

107107
// Water's wc3 libs
108-
compile 'com.github.inwc3:wc3libs:257fcbd610'
108+
compile 'com.github.inwc3:wc3libs:fd4b2fd5aa'
109109

110110
// The setup tool for wurst.build handling
111111
compile 'com.github.wurstscript:wurstsetup:e038293d07'
Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package tests.wurstscript.tests;
22

3-
import de.peeeq.wurstscript.WLogger;
4-
import org.eclipse.jgit.api.Git;
5-
import org.eclipse.jgit.api.errors.GitAPIException;
6-
import org.eclipse.jgit.lib.Constants;
3+
import de.peeeq.wurstscript.utils.Utils;
74
import org.testng.annotations.Test;
85

96
import java.io.File;
10-
import java.io.IOException;
117

128
/**
139
* Helper class to download the standard library, which is required by some test
@@ -35,52 +31,44 @@ public class StdLib {
3531

3632
@Test
3733
public void download() {
38-
assert(downloadStandardlib());
34+
downloadStandardlib();
3935
}
4036

41-
public synchronized static boolean downloadStandardlib() {
37+
public synchronized static void downloadStandardlib() {
4238
if (isInitialized) {
43-
return true;
39+
return;
4440
}
45-
4641
try {
42+
43+
4744
if (!stdLibFolder.exists()) {
4845
tempFolder.mkdirs();
49-
try (Git git = Git
50-
.cloneRepository()
51-
.setDirectory(stdLibFolder)
52-
.setURI(gitRepo)
53-
.call()) {
54-
git.checkout().setName(Constants.MASTER).call();
55-
};
46+
Utils.exec(tempFolder, "git", "clone", gitRepo, stdLibFolder.getName());
5647
}
5748

58-
try (Git git = Git.open(stdLibFolder)) {
59-
String head = git.getRepository().resolve(Constants.HEAD).getName();
60-
if (!head.equals(version)) {
61-
System.out.println("Wrong version '" + head + "', executing git pull to get '" + version + "'");
62-
63-
git.checkout().setName(Constants.MASTER).call();
64-
git.pull().call();
65-
git.checkout().setName(version).setForceRefUpdate(true).call();
66-
}
49+
String revision = Utils.exec(stdLibFolder, "git", "rev-parse", "HEAD").trim();
50+
if (!revision.equals(version)) {
51+
System.out.println("Wrong version '" + revision + "', executing git pull to get '" + version + "'");
52+
Utils.exec(stdLibFolder, "git", "checkout", "master");
53+
Utils.exec(stdLibFolder, "git", "pull");
54+
Utils.exec(stdLibFolder, "git", "checkout", version, "-f");
6755
}
6856

6957
// reset all possible changes
70-
Git.open(stdLibFolder).clean().setForce(true).setCleanDirectories(true).setIgnore(false).call();
71-
Git.open(stdLibFolder).checkout().setName(version).call();
58+
Utils.exec(stdLibFolder, "git", "clean", "-fdx");
59+
Utils.exec(stdLibFolder, "git", "checkout", ".");
60+
Utils.exec(stdLibFolder, "git", "checkout", version);
7261

7362
isInitialized = true;
74-
} catch (IOException | GitAPIException e) {
75-
WLogger.severe(e.getStackTrace().toString());
76-
return false;
63+
} catch (Exception e) {
64+
throw new RuntimeException(e);
7765
}
78-
79-
return true;
8066
}
8167

8268
public static String getLib() {
8369
downloadStandardlib();
8470
return stdLibFolder.getPath();
8571
}
72+
73+
8674
}

0 commit comments

Comments
 (0)