Skip to content

Commit

Permalink
Full Compatibility with 1.12.2
Browse files Browse the repository at this point in the history
This Commit Upgrades Dependencies to be more compatible with 1.12.2 as well as replaces any deprecation issues.
  • Loading branch information
CDAGaming committed Jan 11, 2018
1 parent 81d908c commit 1d6728e
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 33 deletions.
22 changes: 11 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ buildscript {
}
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
classpath 'gradle.plugin.edu.sc.seis.gradle:launch4j:1.6.1'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
classpath 'gradle.plugin.edu.sc.seis.gradle:launch4j:2.4.2'
}
}

apply plugin: 'java'
apply plugin: 'edu.sc.seis.launch4j'
apply plugin: 'com.github.johnrengelman.shadow'

// launch4j dependsOn doesn't work
defaultTasks 'prepareManifest', 'build', 'launch4j', 'gather'
// createExe dependsOn doesn't work
defaultTasks 'prepareManifest', 'build', 'createExe', 'gather'


group = 'com.mumfrey'
Expand All @@ -25,16 +25,16 @@ version = "${project.verMajor}.${project.verMinor}${project.revision
ext.mcversion = "${project.verMajor}.${project.verMinor}${project.revision}"
ext.msversion = "${project.verMajor}.${project.verMinor}.${project.verRevision}.${project.verBuild}"
archivesBaseName = 'liteloader-installer'
targetCompatibility = '1.6'
sourceCompatibility = '1.6'
targetCompatibility = '1.8'
sourceCompatibility = '1.8'

repositories {
mavenCentral()
}

dependencies {
compile 'com.google.guava:guava:17.0'
compile 'net.sourceforge.argo:argo:3.7'
compile 'com.google.guava:guava:21.0'
compile 'net.sourceforge.argo:argo:4.6'
}

// resolve problem with shadowJar
Expand Down Expand Up @@ -64,7 +64,7 @@ task prepareManifest(type: Copy) {
)
}

launch4j {
createExe {
copyConfigurable = project.tasks.shadowJar.outputs.files
jar = 'lib/' + project.tasks.shadowJar.archiveName
icon = "${projectDir}/launch4j/liteloader_installer_icon.ico"
Expand All @@ -73,8 +73,8 @@ launch4j {
version = project.msversion
internalName = project.sxsname
productName = "LiteLoader"
description = "LiteLoader Installer for Minecraft ${project.mcversion} release {project.verRelease}"
copyright = "Copyright (C) 2013-15 Adam Mummery-Smith"
fileDescription = "LiteLoader Installer for Minecraft ${project.mcversion} release {project.verRelease}"
copyright = "Copyright (C) 2013-2018 Adam Mummery-Smith"
}

task gather(type: Copy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@

import argo.jdom.JdomParser;
import argo.jdom.JsonNode;
import argo.jdom.JsonRootNode;

public class VersionInfo
{
public static final VersionInfo INSTANCE = new VersionInfo();
public final JsonRootNode versionData;
public final JsonNode versionData;

public VersionInfo()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import argo.jdom.JsonField;
import argo.jdom.JsonNode;
import argo.jdom.JsonNodeFactories;
import argo.jdom.JsonRootNode;
import argo.jdom.JsonStringNode;
import argo.saj.InvalidSyntaxException;

Expand Down Expand Up @@ -246,7 +245,7 @@ public final boolean run(File target, List<InstallationModifier> modifiers, IIns

if (!this.writeVersionFile(modifiers, versionTarget)) return false;

JsonRootNode jsonProfileData = this.readLauncherProfiles(launcherProfiles);
JsonNode jsonProfileData = this.readLauncherProfiles(launcherProfiles);
if (jsonProfileData == null) return false;

HashMap<JsonStringNode, JsonNode> modifiedData = this.modifyProfileData(target, jsonProfileData, modifiers);
Expand Down Expand Up @@ -310,7 +309,7 @@ private File prepareVersionDir(File target) throws HeadlessException
private boolean writeVersionFile(List<InstallationModifier> modifiers, File versionTarget) throws HeadlessException
{
File versionJsonFile = new File(versionTarget, this.getVersion() + ".json");
JsonRootNode versionJson = JsonNodeFactories.object(VersionInfo.getVersionInfo().getFields());
JsonNode versionJson = JsonNodeFactories.object(VersionInfo.getVersionInfo().getFields());

try
{
Expand All @@ -335,10 +334,10 @@ private boolean writeVersionFile(List<InstallationModifier> modifiers, File vers
return true;
}

private JsonRootNode readLauncherProfiles(File launcherProfiles) throws HeadlessException, RuntimeException
private JsonNode readLauncherProfiles(File launcherProfiles) throws HeadlessException, RuntimeException
{
JdomParser parser = new JdomParser();
JsonRootNode jsonProfileData;
JsonNode jsonProfileData;

try
{
Expand All @@ -359,7 +358,7 @@ private JsonRootNode readLauncherProfiles(File launcherProfiles) throws Headless
return jsonProfileData;
}

private HashMap<JsonStringNode, JsonNode> modifyProfileData(File target, JsonRootNode jsonProfileData, List<InstallationModifier> modifiers)
private HashMap<JsonStringNode, JsonNode> modifyProfileData(File target, JsonNode jsonProfileData, List<InstallationModifier> modifiers)
{
Set<String> jvmArgs = new LinkedHashSet<String>();
List<InstallationModifier> allModifiers = Collections.unmodifiableList(modifiers);
Expand Down Expand Up @@ -400,13 +399,13 @@ private HashMap<JsonStringNode, JsonNode> modifyProfileData(File target, JsonRoo
}

profileCopy.put(JsonNodeFactories.string(this.getProfileName()), JsonNodeFactories.object(fields));
JsonRootNode profileJsonCopy = JsonNodeFactories.object(profileCopy);
JsonNode profileJsonCopy = JsonNodeFactories.object(profileCopy);
modifiedData.put(JsonNodeFactories.string("profiles"), profileJsonCopy);

return modifiedData;
}

private boolean writeLauncherProfiles(JsonRootNode jsonProfileData, File launcherProfiles) throws HeadlessException
private boolean writeLauncherProfiles(JsonNode jsonProfileData, File launcherProfiles) throws HeadlessException
{
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import argo.jdom.JsonField;
import argo.jdom.JsonNode;
import argo.jdom.JsonNodeFactories;
import argo.jdom.JsonRootNode;
import argo.jdom.JsonStringNode;

public abstract class CascadeModifier implements ActionModifier
Expand All @@ -35,7 +34,7 @@ public abstract class CascadeModifier implements ActionModifier
protected Map<String, List<JsonNode>> validVersionLibraries = new HashMap<String, List<JsonNode>>();

@Override
public JsonRootNode modifyVersion(JsonRootNode versionJson)
public JsonNode modifyVersion(JsonNode versionJson)
{
String tweakClass = this.getTweakClass();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import java.util.Set;

import argo.jdom.JsonField;
import argo.jdom.JsonRootNode;
import argo.jdom.JsonNode;

public interface InstallationModifier
{
public abstract String getExclusivityKey();

public abstract JsonRootNode modifyVersion(JsonRootNode versionJson);
public abstract JsonNode modifyVersion(JsonNode versionJson);

public abstract void modifyFields(List<JsonField> fields);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import argo.jdom.JdomParser;
import argo.jdom.JsonNode;
import argo.jdom.JsonRootNode;

import com.google.common.base.Throwables;

Expand Down Expand Up @@ -94,7 +93,7 @@ private static Map<String, List<JsonNode>> readVersionLibraries(File targetDir)
try
{
JdomParser parser = new JdomParser();
JsonRootNode json = parser.parse(new FileReader(versionJson));
JsonNode json = parser.parse(new FileReader(versionJson));
List<JsonNode> libraries = json.getArrayNode("libraries");
for (JsonNode library : libraries)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.mumfrey.liteloader.installer.targets;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -13,8 +12,8 @@

import argo.jdom.JdomParser;
import argo.jdom.JsonField;
import argo.jdom.JsonNode;
import argo.jdom.JsonNodeFactories;
import argo.jdom.JsonRootNode;
import argo.jdom.JsonStringNode;
import argo.saj.InvalidSyntaxException;

Expand All @@ -37,7 +36,7 @@ public class TargetVersion implements InstallationModifier
private final ActionModifier modifier;
private String minecraftArguments;

public TargetVersion(File file) throws IllegalArgumentException, FileNotFoundException, IOException, InvalidSyntaxException
public TargetVersion(File file) throws IllegalArgumentException, IOException, InvalidSyntaxException
{
if (!file.isDirectory())
{
Expand All @@ -51,7 +50,7 @@ public TargetVersion(File file) throws IllegalArgumentException, FileNotFoundExc
throw new IllegalArgumentException("Version json file not found reading: " + json.getAbsolutePath());
}

JsonRootNode versionData = new JdomParser().parse(Files.newReader(json, Charsets.UTF_8));
JsonNode versionData = new JdomParser().parse(Files.newReader(json, Charsets.UTF_8));
String versionId = versionData.getStringValue("id");
if (versionId == null || !versionId.equals(name))
{
Expand Down Expand Up @@ -93,7 +92,7 @@ public String getExclusivityKey()
}

@Override
public JsonRootNode modifyVersion(JsonRootNode versionJson)
public JsonNode modifyVersion(JsonNode versionJson)
{
try
{
Expand Down Expand Up @@ -231,7 +230,7 @@ private String guessVersion(Pattern pattern)
* @param versionData
* @return
*/
private static String getMinecraftArguments(JsonRootNode versionData)
private static String getMinecraftArguments(JsonNode versionData)
{
String minecraftArguments = versionData.getStringValue("minecraftArguments");
if (minecraftArguments != null)
Expand Down

0 comments on commit 1d6728e

Please sign in to comment.