Merge pull request #1101 from runelite-extended/gradle

Migrate to Gradle
This commit is contained in:
Tyler Bochard
2019-07-24 01:16:52 -04:00
committed by GitHub
78 changed files with 4061 additions and 2784 deletions

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.client;
import com.google.common.base.Strings;
import com.google.common.escape.Escaper;
import com.google.common.escape.Escapers;
import com.google.inject.Inject;
@@ -102,9 +101,7 @@ public class Notifier
this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png");
// First check if we are running in launcher
this.terminalNotifierAvailable =
!Strings.isNullOrEmpty(RuneLiteProperties.getLauncherVersion())
&& isTerminalNotifierAvailable();
this.terminalNotifierAvailable = true;
storeIcon();
}

View File

@@ -80,7 +80,7 @@ import org.slf4j.LoggerFactory;
@Slf4j
public class RuneLite
{
public static final String RUNELIT_VERSION = "2.0.5-2";
public static final String PLUS_VERSION = "2.1.0.0";
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");

View File

@@ -24,31 +24,17 @@
*/
package net.runelite.client;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.config.RuneLitePlusConfig;
import net.runelite.http.api.RuneLiteAPI;
@Singleton
@Slf4j
public class RuneLiteProperties
{
private static final String RUNELITE_TITLE = "runelite.title";
private static final String RUNELITE_VERSION = "runelite.version";
private static final String RUNELIT_VERSION = "runelit.version";
private static final String RUNESCAPE_VERSION = "runescape.version";
private static final String DISCORD_APP_ID = "runelite.discord.appid";
private static final String DISCORD_APP_ID_PLUS = "runelite.plus.discord.appid";
private static final String DISCORD_INVITE = "runelite.discord.invite";
private static final String GITHUB_LINK = "runelite.github.link";
private static final String WIKI_LINK = "runelite.wiki.link";
private static final String PATREON_LINK = "runelite.patreon.link";
private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version";
private final Properties properties = new Properties();
private final RuneLitePlusConfig runeLitePlusConfig;
@@ -57,33 +43,16 @@ public class RuneLiteProperties
public RuneLiteProperties(final RuneLitePlusConfig runeLiteConfig)
{
this.runeLitePlusConfig = runeLiteConfig;
try (InputStream in = getClass().getResourceAsStream("runelite.properties"))
{
properties.load(in);
}
catch (IOException ex)
{
log.warn("unable to load propertries", ex);
}
}
public RuneLiteProperties()
{
runeLitePlusConfig = null;
try (InputStream in = getClass().getResourceAsStream("runelite.properties"))
{
properties.load(in);
}
catch (IOException ex)
{
log.warn("unable to load propertries", ex);
}
}
public String getTitle()
{
final StringBuilder sb = new StringBuilder(properties.getProperty(RUNELITE_TITLE));
final StringBuilder sb = new StringBuilder("RuneLitePlus");
String proxy;
if ((proxy = System.getProperty("socksProxyHost")) != null)
{
@@ -94,59 +63,41 @@ public class RuneLiteProperties
public String getVersion()
{
return properties.getProperty(RUNELITE_VERSION);
return RuneLiteAPI.getVersion();
}
public String getRunelitVersion()
public String getPlusVersion()
{
return properties.getProperty(RUNELIT_VERSION);
return RuneLite.PLUS_VERSION;
}
public String getRunescapeVersion()
{
return properties.getProperty(RUNESCAPE_VERSION);
return "" + RuneLiteAPI.getRsVersion();
}
public String getDiscordAppId()
{
if (this.runeLitePlusConfig == null)
{
return properties.getProperty(DISCORD_APP_ID);
}
if (this.runeLitePlusConfig.customPresence())
{
return properties.getProperty(DISCORD_APP_ID_PLUS);
}
else
{
return properties.getProperty(DISCORD_APP_ID);
}
return "560644885250572289";
}
public String getDiscordInvite()
{
return properties.getProperty(DISCORD_INVITE);
return "https://discord.gg/HN5gf3m";
}
public String getGithubLink()
{
return properties.getProperty(GITHUB_LINK);
return "https://github.com/runelite-extended/runelite";
}
public String getWikiLink()
{
return properties.getProperty(WIKI_LINK);
return "https://github.com/runelite-extended/runelite/wiki";
}
public String getPatreonLink()
{
return properties.getProperty(PATREON_LINK);
}
@Nullable
public static String getLauncherVersion()
{
return System.getProperty(LAUNCHER_VERSION_PROPERTY);
return "https://www.patreon.com/RuneLitePlus";
}
}

View File

@@ -24,14 +24,10 @@
*/
package net.runelite.client.game;
import net.runelite.api.SpriteID;
public interface SpriteOverride
{
/**
* An ID for a sprite. Negative numbers are used by RuneLite specific sprites
*
* @see SpriteID
*/
int getSpriteId();

View File

@@ -25,7 +25,6 @@
*/
package net.runelite.client.plugins.info;
import com.google.common.base.MoreObjects;
import com.google.inject.Inject;
import java.awt.BorderLayout;
import java.awt.Color;
@@ -123,6 +122,9 @@ public class InfoPanel extends PluginPanel
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion()));
version.setFont(smallFont);
JLabel plusVersion = new JLabel(htmlLabel("RuneLitePlus version: ", runeLiteProperties.getPlusVersion()));
version.setFont(smallFont);
JLabel revision = new JLabel();
revision.setFont(smallFont);
@@ -134,10 +136,6 @@ public class InfoPanel extends PluginPanel
revision.setText(htmlLabel("Oldschool revision: ", engineVer));
JLabel launcher = new JLabel(htmlLabel("Launcher version: ", MoreObjects
.firstNonNull(RuneLiteProperties.getLauncherVersion(), "Unknown")));
launcher.setFont(smallFont);
loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
loggedLabel.setFont(smallFont);
@@ -153,8 +151,8 @@ public class InfoPanel extends PluginPanel
});
versionPanel.add(version);
versionPanel.add(plusVersion);
versionPanel.add(revision);
versionPanel.add(launcher);
versionPanel.add(Box.createGlue());
versionPanel.add(loggedLabel);
versionPanel.add(emailLabel);

View File

@@ -25,13 +25,9 @@
package net.runelite.client.plugins.itemstats.stats;
import net.runelite.api.Client;
import net.runelite.api.Skill;
/**
* Abstract stat of a player.
* This includes {@link Skill}s and other player variables, such as <code>RUN_ENERGY</code>.
*
* @see Stats
*/
public abstract class Stat
{

View File

@@ -9,7 +9,6 @@
package net.runelite.client.plugins.pvptools;
import com.google.common.base.MoreObjects;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
@@ -21,7 +20,6 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLiteProperties;
import net.runelite.client.plugins.info.JRichTextPane;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.FontManager;
@@ -94,10 +92,6 @@ class PvpToolsPanel extends PluginPanel
revision.setText("Oldschool revision: ");
JLabel launcher = new JLabel(htmlLabel("Launcher version: ", MoreObjects
.firstNonNull(RuneLiteProperties.getLauncherVersion(), "Unknown")));
launcher.setFont(smallFont);
loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
loggedLabel.setFont(smallFont);

View File

@@ -34,7 +34,6 @@ import java.io.Reader;
import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.runelite.api.Client;
class Skybox
{
@@ -43,8 +42,6 @@ class Skybox
{
/**
* Gets the instance template chunk data for the specified point
*
* @see Client#getInstanceTemplateChunks
*/
int getTemplateChunk(int cx, int cy, int plane);
}

View File

@@ -57,11 +57,11 @@ import net.runelite.client.eventbus.EventBus;
import net.runelite.client.input.MouseManager;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import static net.runelite.client.util.MiscUtils.clamp;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import static net.runelite.client.util.MiscUtils.clamp;
import net.runelite.client.util.Text;
@PluginDescriptor(
@@ -87,15 +87,7 @@ public class SpellbookPlugin extends Plugin
private static final WidgetMenuOption RESIZABLE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB);
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
private enum WordFilterMode
{
CONTAINS,
EQUALS,
STARTSWITH,
ENDSWITH
}
private final Map<Integer, Spell> spells = new HashMap<>();
@Inject
private Client client;
@@ -131,19 +123,79 @@ public class SpellbookPlugin extends Plugin
@Getter
private Point draggingLocation;
private final Map<Integer, Spell> spells = new HashMap<>();
private Map<Integer, Spell> tmp = null;
private ImmutableSet<String> notFilteredSpells;
private Spellbook spellbook;
private SpellbookMouseListener mouseListener;
private boolean enableMobile;
private boolean dragSpells;
private boolean scroll;
private int size;
private String filter;
private static boolean isUnfiltered(String spell, Set<String> unfiltereds)
{
for (String str : unfiltereds)
{
WordFilterMode mode = getFilterMode(str);
str = removeFlyingComma(str).toLowerCase();
spell = spell.toLowerCase();
switch (mode)
{
case CONTAINS:
if (spell.contains(str))
{
return true;
}
break;
case STARTSWITH:
if (spell.startsWith(str))
{
return true;
}
break;
case ENDSWITH:
if (spell.endsWith(str))
{
return true;
}
break;
case EQUALS:
if (spell.equals(str))
{
return true;
}
break;
}
}
return false;
}
private static WordFilterMode getFilterMode(String s)
{
if (!s.contains("\""))
{
return WordFilterMode.CONTAINS;
}
if (s.startsWith("\""))
{
return s.endsWith("\"") ? WordFilterMode.EQUALS : WordFilterMode.STARTSWITH;
}
else if (s.endsWith("\""))
{
return WordFilterMode.ENDSWITH;
}
return WordFilterMode.CONTAINS; // but probably null soz
}
private static String removeFlyingComma(String s)
{
return s.replaceAll("\"", "");
}
@Provides
SpellbookConfig getConfig(ConfigManager configManager)
{
@@ -223,46 +275,6 @@ public class SpellbookPlugin extends Plugin
}
}
private static boolean isUnfiltered(String spell, Set<String> unfiltereds)
{
for (String str : unfiltereds)
{
WordFilterMode mode = getFilterMode(str);
str = removeFlyingComma(str).toLowerCase();
spell = spell.toLowerCase();
switch (mode)
{
case CONTAINS:
if (spell.contains(str))
{
return true;
}
break;
case STARTSWITH:
if (spell.startsWith(str))
{
return true;
}
break;
case ENDSWITH:
if (spell.endsWith(str))
{
return true;
}
break;
case EQUALS:
if (spell.equals(str))
{
return true;
}
break;
}
}
return false;
}
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
if (event.getWidget() != WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB
@@ -466,7 +478,9 @@ public class SpellbookPlugin extends Plugin
}
// CHECKSTYLE:OFF
Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>() {}.getType());
Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>()
{
}.getType());
// CHECKSTYLE:ON
gson.stream().filter(Objects::nonNull).forEach(s -> spells.put(s.getWidget(), s));
@@ -509,24 +523,6 @@ public class SpellbookPlugin extends Plugin
);
}
private static WordFilterMode getFilterMode(String s)
{
if (!s.contains("\""))
{
return WordFilterMode.CONTAINS;
}
if (s.startsWith("\""))
{
return s.endsWith("\"") ? WordFilterMode.EQUALS : WordFilterMode.STARTSWITH;
}
else if (s.endsWith("\""))
{
return WordFilterMode.ENDSWITH;
}
return WordFilterMode.CONTAINS; // but probably null soz
}
boolean isNotOnSpellWidget(java.awt.Point point)
{
Widget boundsWidget = client.getWidget(WidgetInfo.SPELLBOOK_FILTERED_BOUNDS);
@@ -712,11 +708,6 @@ public class SpellbookPlugin extends Plugin
runRebuild();
}
private static String removeFlyingComma(String s)
{
return s.replaceAll("\"", "");
}
private int trueSize(Spell s)
{
return s.getSize() * 2 + this.size;
@@ -730,4 +721,12 @@ public class SpellbookPlugin extends Plugin
this.size = config.size();
this.filter = config.filter();
}
private enum WordFilterMode
{
CONTAINS,
EQUALS,
STARTSWITH,
ENDSWITH
}
}

View File

@@ -128,7 +128,7 @@ public class RuneLiteSplashScreen
panel.add(version, versionConstraints);
// version
final JLabel litVersion = new JLabel("Plus Version : " + RuneLite.RUNELIT_VERSION);
final JLabel litVersion = new JLabel("Plus Version : " + RuneLite.PLUS_VERSION);
litVersion.setForeground(Color.GREEN);
litVersion.setFont(FontManager.getRunescapeSmallFont());
litVersion.setForeground(litVersion.getForeground().darker());

View File

@@ -318,29 +318,29 @@ public class Bootstrap
//Dynamic artifacts
artifacts[3] = new Artifact();
artifacts[3].name = "client-" + RuneLiteAPI.getVersion() + ".jar";
artifacts[3].hash = getChecksumFile("./runelite-client/target/" + artifacts[3].name);
artifacts[3].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[3].name;
artifacts[3].hash = getChecksumFile("./runelite-client/build/libs/" + artifacts[3].name);
artifacts[3].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master" + Bootstrapper.remoteLocation + artifacts[3].name;
artifacts[3].size = Long.toString(getFileSize("./runelite-client/target/" + artifacts[3].name));
copyTodir("./runelite-client/target/" + artifacts[3].name, "./live/");
copyTodir("./runelite-client/build/libs/" + artifacts[3].name, Bootstrapper.localLocation);
artifacts[35] = new Artifact();
artifacts[35].name = "runelite-api-" + RuneLiteAPI.getVersion() + ".jar";
artifacts[35].hash = getChecksumFile("./runelite-api/target/" + artifacts[35].name);
artifacts[35].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[35].name;
artifacts[35].hash = getChecksumFile("./runelite-api/build/libs/" + artifacts[35].name);
artifacts[35].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/" + Bootstrapper.remoteLocation + artifacts[35].name;
artifacts[35].size = Long.toString(getFileSize("./runelite-api/target/" + artifacts[35].name));
copyTodir("./runelite-api/target/" + artifacts[35].name, "./live/");
copyTodir("./runelite-api/build/libs/" + artifacts[35].name, Bootstrapper.localLocation);
artifacts[36] = new Artifact();
artifacts[36].name = "runescape-api-" + RuneLiteAPI.getVersion() + ".jar";
artifacts[36].hash = getChecksumFile("./runescape-api/target/" + artifacts[36].name);
artifacts[36].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[36].name;
artifacts[36].hash = getChecksumFile("./runescape-api/build/libs/" + artifacts[36].name);
artifacts[36].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/" + Bootstrapper.remoteLocation + artifacts[36].name;
artifacts[36].size = Long.toString(getFileSize("./runescape-api/target/" + artifacts[36].name));
copyTodir("./runescape-api/target/" + artifacts[36].name, "./live/");
copyTodir("./runescape-api/build/libs/" + artifacts[36].name, Bootstrapper.localLocation);
artifacts[37] = new Artifact();
artifacts[37].name = "http-api-" + RuneLiteAPI.getVersion() + ".jar";
artifacts[37].hash = getChecksumFile("./http-api/target/" + artifacts[37].name);
artifacts[37].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[37].name;
artifacts[37].hash = getChecksumFile("./http-api/build/libs/" + artifacts[37].name);
artifacts[37].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/" + Bootstrapper.remoteLocation + artifacts[37].name;
artifacts[37].size = Long.toString(getFileSize("./http-api/target/" + artifacts[37].name));
copyTodir("./http-api/target/" + artifacts[37].name, "./live/");
copyTodir("./injected-client/target/injected-client-" + RuneLiteAPI.getVersion() + ".jar", "./live/");
copyTodir("./http-api/build/libs/" + artifacts[37].name, Bootstrapper.localLocation);
copyTodir("./injected-client/build/libs/injected-client-" + RuneLiteAPI.getVersion() + ".jar", Bootstrapper.localLocation);
}
catch (IOException | NoSuchAlgorithmException e)
{

View File

@@ -2,26 +2,49 @@ package net.runelite.client.util.bootstrap;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.File;
import java.io.FileWriter;
public class Bootstrapper
{
public static String remoteLocation;
public static String localLocation;
public static void main(String[] args)
{
Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
File dir = new File("./live/");
dir.mkdir();
try (FileWriter fw = new FileWriter("./live/bootstrap.json"))
{
gson.toJson(new Bootstrap(), fw);
}
catch (Exception e)
{
e.printStackTrace();
}
if (args.length > 0)
{
remoteLocation = "/staging/";
localLocation = "./staging/";
Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
File dir = new File("./staging/");
dir.mkdir();
try (FileWriter fw = new FileWriter("./staging/bootstrap-staging.json"))
{
gson.toJson(new Bootstrap(), fw);
}
catch (Exception e)
{
e.printStackTrace();
}
}
else
{
remoteLocation = "/live/";
localLocation = "./live/";
Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
File dir = new File("./live/");
dir.mkdir();
try (FileWriter fw = new FileWriter("./live/bootstrap.json"))
{
gson.toJson(new Bootstrap(), fw);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}