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