Support liteloader snapshots
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher.
|
||||||
|
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hmcl.core.install.liteloader;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.jackhuang.hmcl.core.version.MinecraftLibrary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author huang
|
||||||
|
*/
|
||||||
|
public class LiteLoaderBranch {
|
||||||
|
@SerializedName("libraries")
|
||||||
|
public List<MinecraftLibrary> libraries;
|
||||||
|
|
||||||
|
@SerializedName("com.mumfrey:liteloader")
|
||||||
|
public Map<String, LiteLoaderVersion> liteLoader;
|
||||||
|
}
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
package org.jackhuang.hmcl.core.install.liteloader;
|
package org.jackhuang.hmcl.core.install.liteloader;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -26,6 +25,12 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class LiteLoaderMCVersions {
|
public class LiteLoaderMCVersions {
|
||||||
|
|
||||||
|
@SerializedName("repo")
|
||||||
|
public LiteLoaderRepo repo;
|
||||||
|
|
||||||
@SerializedName("artefacts")
|
@SerializedName("artefacts")
|
||||||
public Map<String, Map<String, LiteLoaderVersion>> artefacts;
|
public LiteLoaderBranch artefacts;
|
||||||
|
|
||||||
|
@SerializedName("snapshots")
|
||||||
|
public LiteLoaderBranch snapshots;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Hello Minecraft! Launcher.
|
||||||
|
* Copyright (C) 2013 huangyuhui <huanghongxun2008@126.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see {http://www.gnu.org/licenses/}.
|
||||||
|
*/
|
||||||
|
package org.jackhuang.hmcl.core.install.liteloader;
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author huang
|
||||||
|
*/
|
||||||
|
public class LiteLoaderRepo {
|
||||||
|
@SerializedName("stream")
|
||||||
|
public String stream;
|
||||||
|
@SerializedName("type")
|
||||||
|
public String type;
|
||||||
|
@SerializedName("url")
|
||||||
|
public String url;
|
||||||
|
@SerializedName("classifier")
|
||||||
|
public String classifier;
|
||||||
|
}
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
package org.jackhuang.hmcl.core.install.liteloader;
|
package org.jackhuang.hmcl.core.install.liteloader;
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import java.util.List;
|
||||||
import org.jackhuang.hmcl.core.version.MinecraftLibrary;
|
import org.jackhuang.hmcl.core.version.MinecraftLibrary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,6 +37,8 @@ public class LiteLoaderVersion {
|
|||||||
public String md5;
|
public String md5;
|
||||||
@SerializedName("timestamp")
|
@SerializedName("timestamp")
|
||||||
public String timestamp;
|
public String timestamp;
|
||||||
|
@SerializedName("lastSuccessfulBuild")
|
||||||
|
public int lastSuccessfulBuild;
|
||||||
@SerializedName("libraries")
|
@SerializedName("libraries")
|
||||||
public MinecraftLibrary[] libraries;
|
public List<MinecraftLibrary> libraries;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,14 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.jackhuang.hmcl.core.download.DownloadType;
|
import org.jackhuang.hmcl.core.download.DownloadType;
|
||||||
import org.jackhuang.hmcl.util.C;
|
import org.jackhuang.hmcl.util.C;
|
||||||
import org.jackhuang.hmcl.core.install.InstallerVersionList;
|
import org.jackhuang.hmcl.core.install.InstallerVersionList;
|
||||||
import org.jackhuang.hmcl.core.install.InstallerVersionNewerComparator;
|
import org.jackhuang.hmcl.core.install.InstallerVersionNewerComparator;
|
||||||
|
import org.jackhuang.hmcl.core.version.MinecraftLibrary;
|
||||||
import org.jackhuang.hmcl.util.StrUtils;
|
import org.jackhuang.hmcl.util.StrUtils;
|
||||||
import org.jackhuang.hmcl.util.task.Task;
|
import org.jackhuang.hmcl.util.task.Task;
|
||||||
import org.jackhuang.hmcl.util.task.TaskInfo;
|
import org.jackhuang.hmcl.util.task.TaskInfo;
|
||||||
@@ -60,6 +63,27 @@ public class LiteLoaderVersionList extends InstallerVersionList {
|
|||||||
return Arrays.asList(task.setTag("Official Liteloader Download Site"));
|
return Arrays.asList(task.setTag("Official Liteloader Download Site"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doBranch(String version, LiteLoaderRepo repo, LiteLoaderBranch branch, List<InstallerVersion> result, boolean snapshot) {
|
||||||
|
if (branch == null || branch.liteLoader == null)
|
||||||
|
return;
|
||||||
|
for (Map.Entry<String, LiteLoaderVersion> entry : branch.liteLoader.entrySet()) {
|
||||||
|
if ("latest".equals(entry.getKey()))
|
||||||
|
continue;
|
||||||
|
LiteLoaderVersion v = entry.getValue();
|
||||||
|
LiteLoaderInstallerVersion iv = new LiteLoaderInstallerVersion(v.version.replace("SNAPSHOT", "SNAPSHOT-" + v.lastSuccessfulBuild), StrUtils.formatVersion(version));
|
||||||
|
if (snapshot)
|
||||||
|
iv.universal = String.format("http://jenkins.liteloader.com/view/%s/job/LiteLoader %s/lastSuccessfulBuild/artifact/build/libs/liteloader-%s-release.jar", version, version, v.version);
|
||||||
|
else
|
||||||
|
iv.universal = DownloadType.getSuggestedDownloadType().getProvider().getParsedDownloadURL(repo.url + "com/mumfrey/liteloader/" + version + "/" + v.file);
|
||||||
|
iv.tweakClass = v.tweakClass;
|
||||||
|
HashSet<MinecraftLibrary> set = new HashSet<>();
|
||||||
|
if (v.libraries != null)
|
||||||
|
set.addAll(v.libraries);
|
||||||
|
iv.libraries = set.toArray(new MinecraftLibrary[set.size()]);
|
||||||
|
result.add(iv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeTask(boolean areDependTasksSucceeded) throws Exception {
|
public void executeTask(boolean areDependTasksSucceeded) throws Exception {
|
||||||
if (!areDependTasksSucceeded)
|
if (!areDependTasksSucceeded)
|
||||||
@@ -74,21 +98,10 @@ public class LiteLoaderVersionList extends InstallerVersionList {
|
|||||||
for (Map.Entry<String, LiteLoaderMCVersions> arr : root.versions.entrySet()) {
|
for (Map.Entry<String, LiteLoaderMCVersions> arr : root.versions.entrySet()) {
|
||||||
ArrayList<InstallerVersion> al = new ArrayList<>();
|
ArrayList<InstallerVersion> al = new ArrayList<>();
|
||||||
LiteLoaderMCVersions mcv = arr.getValue();
|
LiteLoaderMCVersions mcv = arr.getValue();
|
||||||
if (mcv == null || mcv.artefacts == null || mcv.artefacts.get("com.mumfrey:liteloader") == null)
|
doBranch(arr.getKey(), mcv.repo, mcv.artefacts, al, false);
|
||||||
continue;
|
doBranch(arr.getKey(), mcv.repo, mcv.snapshots, al, true);
|
||||||
for (Map.Entry<String, LiteLoaderVersion> entry : mcv.artefacts.get("com.mumfrey:liteloader").entrySet()) {
|
|
||||||
if ("latest".equals(entry.getKey()))
|
|
||||||
continue;
|
|
||||||
LiteLoaderVersion v = entry.getValue();
|
|
||||||
LiteLoaderInstallerVersion iv = new LiteLoaderInstallerVersion(v.version, StrUtils.formatVersion(arr.getKey()));
|
|
||||||
iv.universal = DownloadType.getSuggestedDownloadType().getProvider().getParsedDownloadURL("http://dl.liteloader.com/versions/com/mumfrey/liteloader/" + arr.getKey() + "/" + v.file);
|
|
||||||
iv.tweakClass = v.tweakClass;
|
|
||||||
iv.libraries = Arrays.copyOf(v.libraries, v.libraries.length);
|
|
||||||
iv.installer = "http://dl.liteloader.com/redist/" + iv.mcVersion + "/liteloader-installer-" + iv.selfVersion.replace("_", "-") + ".jar";
|
|
||||||
al.add(iv);
|
|
||||||
versions.add(iv);
|
|
||||||
}
|
|
||||||
Collections.sort(al, new InstallerVersionNewerComparator());
|
Collections.sort(al, new InstallerVersionNewerComparator());
|
||||||
|
versions.addAll(al);
|
||||||
versionMap.put(StrUtils.formatVersion(arr.getKey()), al);
|
versionMap.put(StrUtils.formatVersion(arr.getKey()), al);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user