mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2024-11-27 06:10:08 +08:00
The version will automatically use the BUILD_NUMBER now!
This commit is contained in:
parent
0e4c38d99e
commit
fc0c99b436
@ -26,10 +26,10 @@ if (!hasProperty('mainClass')) {
|
||||
ext.mainClass = 'org.jackhuang.hellominecraft.launcher.Main'
|
||||
}
|
||||
|
||||
def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".9" : "."+System.getenv("BUILD_NUMBER")
|
||||
def buildnumber = System.getenv("BUILD_NUMBER") == null ? ".10" : "."+System.getenv("BUILD_NUMBER")
|
||||
|
||||
String mavenGroupId = 'HMCL'
|
||||
String mavenVersion = '2.3.5' + buildnumber
|
||||
String mavenVersion = '2.4.0' + buildnumber
|
||||
String bundleName = "Hello Minecraft! Launcher"
|
||||
|
||||
group = mavenGroupId
|
||||
@ -37,6 +37,16 @@ version = mavenVersion
|
||||
|
||||
String mavenArtifactId = name
|
||||
|
||||
task generateSources(type: Copy) {
|
||||
from 'src/main/java'
|
||||
into "$buildDir/generated-src"
|
||||
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
|
||||
'HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING': mavenVersion
|
||||
])
|
||||
}
|
||||
compileJava.setSource "$buildDir/generated-src"
|
||||
compileJava.dependsOn generateSources
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral();
|
||||
|
@ -21,8 +21,6 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.Authenticator;
|
||||
import java.net.PasswordAuthentication;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
@ -36,7 +34,6 @@ import org.jackhuang.hellominecraft.util.ui.LogWindow;
|
||||
import org.jackhuang.hellominecraft.launcher.util.MinecraftCrashAdvicer;
|
||||
import org.jackhuang.hellominecraft.util.DoubleOutputStream;
|
||||
import org.jackhuang.hellominecraft.util.LauncherPrintStream;
|
||||
import org.jackhuang.hellominecraft.util.MathUtils;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.Utils;
|
||||
|
||||
@ -48,7 +45,8 @@ public final class Launcher {
|
||||
|
||||
static final Logger LOGGER = Logger.getLogger(Launcher.class.getName());
|
||||
|
||||
static String classPath = "", proxyHost = "", proxyPort = "", proxyUsername = "", proxyPassword = "";
|
||||
static String classPath = "";
|
||||
//state String proxyHost = "", proxyPort = "", proxyUsername = "", proxyPassword = "";
|
||||
|
||||
public static void main(String[] args) {
|
||||
LOGGER.log(Level.INFO, "*** {0} ***", Main.makeTitle());
|
||||
@ -63,14 +61,14 @@ public final class Launcher {
|
||||
classPath = classPath.concat(s.substring("-cp=".length()));
|
||||
else if (s.startsWith("-mainClass="))
|
||||
mainClass = s.substring("-mainClass=".length());
|
||||
else if (s.startsWith("-proxyHost="))
|
||||
/*else if (s.startsWith("-proxyHost="))
|
||||
proxyHost = s.substring("-proxyHost=".length());
|
||||
else if (s.startsWith("-proxyPort="))
|
||||
proxyPort = s.substring("-proxyPort=".length());
|
||||
else if (s.startsWith("-proxyUsername="))
|
||||
proxyUsername = s.substring("-proxyUsername=".length());
|
||||
else if (s.startsWith("-proxyPassword="))
|
||||
proxyPassword = s.substring("-proxyPassword=".length());
|
||||
proxyPassword = s.substring("-proxyPassword=".length());*/
|
||||
else if (s.equals("-debug"))
|
||||
showInfo = true;
|
||||
else
|
||||
@ -108,7 +106,7 @@ public final class Launcher {
|
||||
LOGGER.log(Level.INFO, "Class Path: '{'\n{0}\n'}'", StrUtils.parseParams(" ", tokenized, "\n"));
|
||||
SwingUtilities.invokeLater(() -> LogWindow.INSTANCE.setVisible(true));
|
||||
}
|
||||
|
||||
/*
|
||||
if (StrUtils.isNotBlank(proxyHost) && StrUtils.isNotBlank(proxyPort) && MathUtils.canParseInt(proxyPort)) {
|
||||
HMCLog.log("Initializing customized proxy");
|
||||
System.setProperty("http.proxyHost", proxyHost);
|
||||
@ -123,7 +121,7 @@ public final class Launcher {
|
||||
//PROXY = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Settings.getInstance().getProxyHost(), Integer.parseInt(Settings.getInstance().getProxyPort())));
|
||||
} else {
|
||||
//PROXY = Proxy.NO_PROXY;
|
||||
}
|
||||
}*/
|
||||
|
||||
URL[] urls = new URL[len];
|
||||
|
||||
|
20
HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Main.java
Executable file → Normal file
20
HMCL/src/main/java/org/jackhuang/hellominecraft/launcher/Main.java
Executable file → Normal file
@ -90,17 +90,11 @@ public final class Main implements Runnable {
|
||||
}
|
||||
|
||||
public static final String LAUNCHER_NAME = "Hello Minecraft! Launcher";
|
||||
public static final byte VERSION_FIRST = 2, VERSION_SECOND = 3, VERSION_THIRD = 5, VERSION_FORTH = 9;
|
||||
public static final String LAUNCHER_VERSION = "@HELLO_MINECRAFT_LAUNCHER_VERSION_FOR_GRADLE_REPLACING@";
|
||||
public static final int MINIMUM_LAUNCHER_VERSION = 16;
|
||||
//public static Proxy PROXY;
|
||||
|
||||
/**
|
||||
* Make the version of HMCL.
|
||||
*
|
||||
* @return the version: firstVer.secondVer.thirdVer
|
||||
*/
|
||||
public static String makeVersion() {
|
||||
return "" + VERSION_FIRST + '.' + VERSION_SECOND + '.' + VERSION_THIRD + '.' + VERSION_FORTH;
|
||||
public static VersionNumber getVersionNumber() {
|
||||
return VersionNumber.check(LAUNCHER_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,7 +103,11 @@ public final class Main implements Runnable {
|
||||
* @return the MainWindow title.
|
||||
*/
|
||||
public static String makeTitle() {
|
||||
return LAUNCHER_NAME + ' ' + makeVersion();
|
||||
return LAUNCHER_NAME + ' ' + LAUNCHER_VERSION;
|
||||
}
|
||||
|
||||
public static String shortTitle() {
|
||||
return "HMCL" + ' ' + LAUNCHER_VERSION;
|
||||
}
|
||||
|
||||
public static final Main INSTANCE = new Main();
|
||||
@ -122,7 +120,7 @@ public final class Main implements Runnable {
|
||||
{
|
||||
//PluginManager.getServerPlugin();
|
||||
|
||||
if (IUpgrader.NOW_UPGRADER.parseArguments(new VersionNumber(VERSION_FIRST, VERSION_SECOND, VERSION_THIRD), args))
|
||||
if (IUpgrader.NOW_UPGRADER.parseArguments(getVersionNumber(), args))
|
||||
return;
|
||||
|
||||
System.setProperty("sun.java2d.noddraw", "true");
|
||||
|
@ -165,11 +165,15 @@ public abstract class AbstractMinecraftLoader implements IMinecraftLoader {
|
||||
res.add("-debug");
|
||||
|
||||
if (StrUtils.isNotBlank(options.getProxyHost()) && StrUtils.isNotBlank(options.getProxyPort()) && MathUtils.canParseInt(options.getProxyPort())) {
|
||||
res.add("-proxyHost=" + options.getProxyHost());
|
||||
res.add("-proxyPort=" + options.getProxyPort());
|
||||
res.add("--proxyHost");
|
||||
res.add(options.getProxyHost());
|
||||
res.add("--proxyPort");
|
||||
res.add(options.getProxyPort());
|
||||
if (StrUtils.isNotBlank(options.getProxyUser()) && StrUtils.isNotBlank(options.getProxyPass())) {
|
||||
res.add("-proxyUsername=" + options.getProxyUser());
|
||||
res.add("-proxyPassword=" + options.getProxyPass());
|
||||
res.add("--proxyUser");
|
||||
res.add(options.getProxyUser());
|
||||
res.add("-=proxyPass");
|
||||
res.add(options.getProxyPass());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ import org.jackhuang.hellominecraft.util.system.FileUtils;
|
||||
import org.jackhuang.hellominecraft.util.system.IOUtils;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
import org.jackhuang.hellominecraft.util.UpdateChecker;
|
||||
import org.jackhuang.hellominecraft.util.VersionNumber;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -44,8 +43,7 @@ public final class Settings {
|
||||
public static final File SETTINGS_FILE = new File(IOUtils.currentDir(), "hmcl.json");
|
||||
|
||||
private static final Config SETTINGS;
|
||||
public static final UpdateChecker UPDATE_CHECKER = new UpdateChecker(new VersionNumber(Main.VERSION_FIRST, Main.VERSION_SECOND, Main.VERSION_THIRD),
|
||||
"hmcl");
|
||||
public static final UpdateChecker UPDATE_CHECKER = new UpdateChecker(Main.getVersionNumber(), "hmcl");
|
||||
|
||||
public static Config getInstance() {
|
||||
return SETTINGS;
|
||||
|
@ -286,8 +286,9 @@ public class VersionSetting {
|
||||
x.setLaunchVersion(id);
|
||||
x.setMaxMemory(getMaxMemory());
|
||||
x.setMinecraftArgs(getMinecraftArgs());
|
||||
x.setName(Main.makeTitle());
|
||||
x.setType(Main.makeTitle());
|
||||
x.setName(Main.shortTitle());
|
||||
x.setType(Main.shortTitle());
|
||||
x.setVersionName(Main.shortTitle());
|
||||
x.setNoJVMArgs(isNoJVMArgs());
|
||||
x.setPermSize(getPermSize());
|
||||
x.setPrecalledCommand(getPrecalledCommand());
|
||||
@ -296,7 +297,6 @@ public class VersionSetting {
|
||||
x.setProxyUser(Settings.getInstance().getProxyUserName());
|
||||
x.setProxyPass(Settings.getInstance().getProxyPassword());
|
||||
x.setServerIp(getServerIp());
|
||||
x.setVersionName(Main.makeTitle());
|
||||
x.setWidth(getWidth());
|
||||
|
||||
String str = getJavaDir();
|
||||
|
@ -27,7 +27,7 @@ import java.util.logging.Logger;
|
||||
import javax.swing.SwingUtilities;
|
||||
import org.jackhuang.hellominecraft.util.C;
|
||||
import org.jackhuang.hellominecraft.util.logging.HMCLog;
|
||||
import org.jackhuang.hellominecraft.launcher.Main;
|
||||
import static org.jackhuang.hellominecraft.launcher.Main.LAUNCHER_VERSION;
|
||||
import org.jackhuang.hellominecraft.launcher.setting.Settings;
|
||||
import org.jackhuang.hellominecraft.util.NetUtils;
|
||||
import org.jackhuang.hellominecraft.util.MessageBox;
|
||||
@ -95,7 +95,7 @@ public class CrashReporter implements Thread.UncaughtExceptionHandler {
|
||||
return;
|
||||
try {
|
||||
String text = "\n---- Hello Minecraft! Crash Report ----\n";
|
||||
text += " Version: " + Main.makeVersion() + "\n";
|
||||
text += " Version: " + LAUNCHER_VERSION + "\n";
|
||||
text += " Time: " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n";
|
||||
text += " Thread: " + t.toString() + "\n";
|
||||
text += "\n Content: \n ";
|
||||
|
@ -39,6 +39,11 @@ public final class VersionNumber implements Comparable<VersionNumber> {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "" + firstVer + '.' + secondVer + '.' + thirdVer;
|
||||
}
|
||||
|
||||
public static VersionNumber check(String data) {
|
||||
while (!data.isEmpty() && ((data.charAt(0) < '0' || data.charAt(0) > '9') && data.charAt(0) != '.'))
|
||||
data = data.substring(1);
|
||||
@ -46,7 +51,7 @@ public final class VersionNumber implements Comparable<VersionNumber> {
|
||||
return null;
|
||||
VersionNumber ur;
|
||||
String[] ver = data.split("\\.");
|
||||
if (ver.length == 3) {
|
||||
if (ver.length >= 3) {
|
||||
byte v1, v2, v3;
|
||||
try {
|
||||
v1 = Byte.parseByte(ver[0]);
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'findbugs'
|
||||
|
||||
//sourceCompatibility = '1.7'
|
||||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
Loading…
Reference in New Issue
Block a user