Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,34 @@ 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:4.0.2'
classpath 'gradle.plugin.edu.sc.seis.gradle:launch4j:2.4.4'
}
}

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'
defaultTasks 'prepareManifest', 'build', 'createExe', 'gather'


group = 'com.mumfrey'
ext.revision = project.verRevision == "0" ? "" : ".${project.verRevision}"
version = "${project.verMajor}.${project.verMinor}${project.revision}${project.verRelease}"
version = "${project.verMajor}.${project.verMinor}${project.revision}-${project.verRelease}"
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 = JavaVersion.VERSION_1_6
sourceCompatibility = JavaVersion.VERSION_1_6

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 All @@ -56,30 +55,32 @@ shadowJar {
}

task prepareManifest(type: Copy) {
from 'launch4j/liteloader_installer_manifest.xml'
into tasks.launch4j.temporaryDir
from 'createExe/liteloader_installer_manifest.xml'
into tasks.createExe.temporaryDir
expand(
artefact: project.sxsname,
msversion: project.msversion
)
}

launch4j {
createExe {
Comment thread
CDAGaming marked this conversation as resolved.
dependsOn 'prepareManifest'

copyConfigurable = project.tasks.shadowJar.outputs.files
jar = 'lib/' + project.tasks.shadowJar.archiveName
icon = "${projectDir}/launch4j/liteloader_installer_icon.ico"
manifest = "${tasks.launch4j.temporaryDir}/liteloader_installer_manifest.xml"
jar = "lib/${project.tasks.shadowJar.archiveName}"
icon = "${projectDir}/createExe/liteloader_installer_icon.ico"
manifest = "${tasks.createExe.temporaryDir}/liteloader_installer_manifest.xml"
outfile = tasks.shadowJar.archiveName - ".jar" + ".exe"
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) {
dependsOn 'launch4j'
from 'build/launch4j/' + launch4j.outfile
dependsOn 'createExe'
from "build/launch4j/${createExe.outfile}"
into 'build/libs/'
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ organization=Mumfrey
verMajor=1
verMinor=12
verRevision=2
verRelease=-00
verRelease=00
verBuild=0
upstreamJar="${x.projectDir}/../LiteLoader/build/libs/liteloader-${x.mcversion}-SNAPSHOT-release.jar"
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 @@ -82,8 +82,7 @@ protected boolean extractLibraries(File target, IInstallerMonitor monitor) throw
{
File libraries = new File(target, "libraries");
File targetLibraryFile = VersionInfo.getLibraryPath(libraries);
if (!this.extractLibrary(targetLibraryFile, VersionInfo.getContainedFile())) return false;
return true;
return this.extractLibrary(targetLibraryFile, VersionInfo.getContainedFile());
}

protected final boolean extractLibrary(File targetLibraryFile, String containedFile) throws HeadlessException
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 RuntimeException
{
JdomParser parser = new JdomParser();
JsonRootNode jsonProfileData;
JsonNode jsonProfileData;

try
{
Expand All @@ -354,12 +353,12 @@ private JsonRootNode readLauncherProfiles(File launcherProfiles) throws Headless
}
catch (Exception e)
{
throw Throwables.propagate(e);
throw new RuntimeException(e);
}
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