3
0

Add support for updating backports correctly

This commit is contained in:
Prototik 2015-06-03 21:50:46 +07:00
parent 5a9c5f6f72
commit 27d13cce59
5 changed files with 48 additions and 21 deletions

View File

@ -72,7 +72,7 @@ def gitInfo(String key) {
gitInfoCached = [
hash : ['git', 'log', "--format=%h", '-n', '1'].execute().text.trim(),
fullHash: ['git', 'log', "--format=%H", '-n', '1'].execute().text.trim(),
branch : ['git', 'symbolic-ref', '--short', 'HEAD'].execute().text.trim(),
branch : System.getenv("CI_BUILD_REF_NAME") ?: ['git', 'symbolic-ref', '--short', 'HEAD'].execute().text.trim(),
message : ['git', 'log', "--format=%B", '-n', '1'].execute().text.trim()
]
} else {
@ -103,8 +103,9 @@ tasks.packageUniversal {
'KCauldron-Git-Branch' : gitInfo('branch'),
'KCauldron-Git-Hash' : gitInfo('fullHash'),
'KCauldron-Version' : project.version,
'KCauldron-Channel' : project.name,
'Implementation-Vendor' : 'Prototik',
'Implementation-Title' : 'KCauldron',
'Implementation-Title' : project.name,
'Implementation-Version': project.version,
'Forge-Version' : '10.13.3.1420',
'Specification-Vendor' : 'Bukkit Team',

View File

@ -8,10 +8,9 @@
+ try
{
- try
- {
- if (!this.running)
+ while (true)
+ {
{
- if (!this.running)
+ if (!this.running || clientSocket == null)
{
break;
@ -28,12 +27,11 @@
return;
}
@@ -109,27 +110,24 @@
continue;
@@ -110,26 +111,23 @@
}
}
+ }
}
+ }
catch (SocketTimeoutException sockettimeoutexception)
{
- break;

View File

@ -7,11 +7,12 @@ import java.util.Enumeration;
import java.util.Properties;
public class KCauldron {
private static String sCurrentVersion;
private static boolean sManifestParsed = false;
private static void parseManifest() {
if (sManifestParsed) return;
sManifestParsed = true;
public static String getCurrentVersion() {
if (sCurrentVersion != null)
return sCurrentVersion;
try {
Enumeration<URL> resources = KCauldron.class.getClassLoader()
.getResources("META-INF/MANIFEST.MF");
@ -25,23 +26,47 @@ public class KCauldron {
String jarFilePath = path.substring(path.indexOf(":") + 1, path.indexOf("!"));
jarFilePath = URLDecoder.decode(jarFilePath, "UTF-8");
sServerLocation = new File(jarFilePath);
return sCurrentVersion = version;
sCurrentVersion = version;
sBranch = manifest.getProperty("KCauldron-Branch");
sChannel = manifest.getProperty("KCauldron-Channel");
}
manifest.clear();
}
} catch (Exception e) {
e.printStackTrace();
}
return sCurrentVersion = "UNKNOWN";
}
private static String sCurrentVersion;
public static String getCurrentVersion() {
parseManifest();
return sCurrentVersion;
}
private static File sServerLocation;
public static File getServerLocation() {
getCurrentVersion();
parseManifest();
return sServerLocation;
}
private static String sBranch;
public static String getBranch() {
parseManifest();
return sBranch;
}
private static String sChannel;
public static String getChannel() {
parseManifest();
return sChannel;
}
public static File sNewServerLocation;
public static String sNewServerVersion;
public static boolean sUpdateInProgress;

View File

@ -117,8 +117,9 @@ public class KCauldronUpdater implements Runnable {
}
HttpUriRequest request = RequestBuilder
.get()
.setUri("https://prok.pw/repo/pw/prok/KCauldron/"
+ mVersion + "/" + filename)
.setUri("https://prok.pw/repo/pw/prok/"
+ KCauldron.getChannel() + "/" + mVersion + "/"
+ filename)
.addParameter("hostname", server.getHostname())
.addParameter("port", "" + server.getPort()).build();
HttpResponse response = HttpClientBuilder.create()

View File

@ -71,8 +71,10 @@ public class KVersionRetriever implements Runnable, UncaughtExceptionHandler {
if (DEBUG)
sLogger.info("Requesting for new version...");
try {
HttpUriRequest request = RequestBuilder.get()
.setUri("https://prok.pw/version/pw.prok/KCauldron")
HttpUriRequest request = RequestBuilder
.get()
.setUri("https://prok.pw/version/pw.prok/"
+ KCauldron.getChannel())
.addParameter("hostname", sServer.getHostname())
.addParameter("port", "" + sServer.getPort()).build();
HttpResponse response = HttpClientBuilder.create()