Skip to content

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
  • Loading branch information
Moudoux committed May 11, 2018
1 parent c649eba commit 78bd86a
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 5 deletions.
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,28 @@ repositories {
mavenCentral()
}

configurations {
extraLibs
}

dependencies {
compile 'com.intellij:forms_rt:7.0.3'
compile group: 'com.google.code.gson', name: 'gson', version: '2.7'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
extraLibs group: 'com.google.code.gson', name: 'gson', version: '2.7'
extraLibs group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
extraLibs 'com.intellij:forms_rt:7.0.3'
testCompile group: 'junit', name: 'junit', version: '4.12'
}

jar {
from {
configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest.attributes(
"Main-Class": "me.deftware.emc.installer.Main",
"Manifest-Version": 1.0
)
}


53 changes: 52 additions & 1 deletion src/main/java/me/deftware/emc/installer/ui/DialogUI.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package me.deftware.emc.installer.ui;

import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;

import javax.swing.*;
import java.awt.*;
import java.awt.event.WindowAdapter;
Expand All @@ -21,7 +25,7 @@ public DialogUI(String text, String title, boolean continueButton, DialogCallbac
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
onContinue();
onContinue();
}
});
buttonOK.setVisible(continueButton);
Expand All @@ -39,6 +43,53 @@ public void onContinue() {
dispose();
}

{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}

/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
contentPane = new JPanel();
contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
buttonOK = new JButton();
buttonOK.setText("Continue");
panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
modalText = new JLabel();
modalText.setText("Label");
panel3.add(modalText, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
panel3.add(spacer2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final Spacer spacer3 = new Spacer();
panel3.add(spacer3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPane;
}

@FunctionalInterface
public interface DialogCallback {

Expand Down
68 changes: 64 additions & 4 deletions src/main/java/me/deftware/emc/installer/ui/InstallerUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class InstallerUI {
public InstallerUI(JsonObject json, JFrame frame) {
try {
String line;
InputStream in = Main.class.getResourceAsStream("/EMC.json");
InputStream in = Main.class.getResourceAsStream("/emc.json");
StringBuilder result = new StringBuilder("");
while ((line = new BufferedReader(new InputStreamReader(in)).readLine()) != null) {
result.append(line);
Expand Down Expand Up @@ -73,7 +73,7 @@ private void install() {
String mcVersion = comboBox1.getSelectedItem().toString();
String[] jsonValue = json.get(mcVersion).getAsString().split(",");
String optifineVersion = jsonValue[1], emcVersion = jsonValue[0];
DialogUI dialog = new DialogUI("Installing " + clientName + ", please wait...","",false, () -> {
DialogUI dialog = new DialogUI("Installing " + clientName + ", please wait...", "", false, () -> {
new DialogUI("Install complete, the installer will now exit", "Done", true, () -> System.exit(0)).setVisible(true);
});
new Thread(() -> {
Expand Down Expand Up @@ -108,11 +108,11 @@ private void install() {
JsonObject json = JSONGenerator.generateClientJSON(clientName, mcVersion, emcVersion, withOptiFineRadioButton.isSelected() ? optifineVersion : "");
File clientDir = new File(Utils.getMinecraftRoot() + "versions" + File.separator + mcVersion + "-" + clientName + File.separator);
clientDir.mkdirs();
try (Writer writer = new FileWriter(new File(clientDir.getAbsolutePath() + File.separator + mcVersion + "-" + clientName + ".json"))) {
try (Writer writer = new FileWriter(new File(clientDir.getAbsolutePath() + File.separator + mcVersion + "-" + clientName + ".json"))) {
new GsonBuilder().setPrettyPrinting().create().toJson(json, writer);
}
// Install launcher profile
File profiles_json = new File(Utils.getMinecraftRoot() + "launcher_profiles.json");
File profiles_json = new File(Utils.getMinecraftRoot() + "launcher_profiles.json");
JsonObject launcherJson = new JsonParser().parse(Files.newBufferedReader(profiles_json.toPath())).getAsJsonObject();
JsonObject profiles = launcherJson.get("profiles").getAsJsonObject();
if (!profiles.has(mcVersion + "-" + clientName)) {
Expand Down Expand Up @@ -142,4 +142,64 @@ private void install() {
}).start();
}

{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}

/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
mainPanel = new JPanel();
mainPanel.setLayout(new com.intellij.uiDesigner.core.GridLayoutManager(12, 2, new Insets(0, 0, 0, 0), -1, -1));
installButton = new JButton();
installButton.setEnabled(true);
installButton.setText("Install");
mainPanel.add(installButton, new com.intellij.uiDesigner.core.GridConstraints(9, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cancelButton = new JButton();
cancelButton.setEnabled(true);
cancelButton.setText("Cancel");
mainPanel.add(cancelButton, new com.intellij.uiDesigner.core.GridConstraints(9, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
comboBox1 = new JComboBox();
final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
comboBox1.setModel(defaultComboBoxModel1);
mainPanel.add(comboBox1, new com.intellij.uiDesigner.core.GridConstraints(1, 0, 5, 2, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
withOptiFineRadioButton = new JRadioButton();
withOptiFineRadioButton.setSelected(false);
withOptiFineRadioButton.setText("With OptiFine");
mainPanel.add(withOptiFineRadioButton, new com.intellij.uiDesigner.core.GridConstraints(8, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
forForgeRadioButton = new JRadioButton();
forForgeRadioButton.setText("For Forge");
mainPanel.add(forForgeRadioButton, new com.intellij.uiDesigner.core.GridConstraints(8, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_SHRINK | com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_CAN_GROW, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer1 = new com.intellij.uiDesigner.core.Spacer();
mainPanel.add(spacer1, new com.intellij.uiDesigner.core.GridConstraints(10, 1, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JLabel label1 = new JLabel();
label1.setText("Select below if you want to install for Forge or OptiFine. ");
mainPanel.add(label1, new com.intellij.uiDesigner.core.GridConstraints(6, 0, 1, 2, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final com.intellij.uiDesigner.core.Spacer spacer2 = new com.intellij.uiDesigner.core.Spacer();
mainPanel.add(spacer2, new com.intellij.uiDesigner.core.GridConstraints(10, 0, 1, 1, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_CENTER, com.intellij.uiDesigner.core.GridConstraints.FILL_HORIZONTAL, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JLabel label2 = new JLabel();
label2.setText("Leave blank if you wish to use Aristois without Forge/OptiFine");
mainPanel.add(label2, new com.intellij.uiDesigner.core.GridConstraints(7, 0, 1, 2, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label3 = new JLabel();
label3.setText("Select which Minecraft version you want to install for:");
mainPanel.add(label3, new com.intellij.uiDesigner.core.GridConstraints(0, 0, 1, 2, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label4 = new JLabel();
label4.setText("Made by https://deftware.me/");
mainPanel.add(label4, new com.intellij.uiDesigner.core.GridConstraints(11, 0, 1, 2, com.intellij.uiDesigner.core.GridConstraints.ANCHOR_WEST, com.intellij.uiDesigner.core.GridConstraints.FILL_NONE, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, com.intellij.uiDesigner.core.GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return mainPanel;
}
}

0 comments on commit 78bd86a

Please sign in to comment.