Skip to content

Commit

Permalink
Re-Added Structure Files
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Nguyen committed Jan 25, 2018
1 parent 11d0c9a commit 4834fca
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 0 deletions.
40 changes: 40 additions & 0 deletions clavis_exe_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>gui</headerType>
<jar>/Users/andrew_nguyen/Desktop/Clavis_Wallet_main.jar</jar>
<outfile>/Users/andrew_nguyen/Desktop/Builds/Windows/Clavis Wallet2.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon></icon>
<jre>
<path></path>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>false</bundledJreAsFallback>
<minVersion>1.8.0_144</minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>Clavis Wallet Alpha Release</txtFileVersion>
<fileDescription>Clavis Wallet Alpha</fileDescription>
<copyright>Bitcoin Latina Foundation</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>Clavis Wallet Alpha</txtProductVersion>
<productName>Clavis Wallet</productName>
<companyName></companyName>
<internalName>Clavis Wallet</internalName>
<originalFilename>Clavis Wallet.exe</originalFilename>
<trademarks></trademarks>
<language>ENGLISH_US</language>
</versionInfo>
</launch4jConfig>
95 changes: 95 additions & 0 deletions src/main/java/build_structure/Build.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package build_structure;

import ui.Global;
import utils.Utils;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Build {
private String mainFolder = Global.getPath() + File.separator + "BCL_CL";
//> Windows
//>> Internal Paths
final private String winEthminerBinaryRes = "/binaries/windows/ethminer.exe";
final private String winStaticNodeRes = "/json/static-nodes.json";//=Mac
final private String winGenesisRes = "/json/genesis.json"; //==Mac
final private String winGethBinaryRes = "/binaries/windows/geth.exe";
final private String winStartCommandRes = "/commands/windows/start.cmd";
final private String winGethCommandRes = "/commands/windows/geth.cmd";
final private String winEthMinerCommandRes = "/commands/windows/ethminer.cmd";
//>> External Paths
private String winEthminerBinary = Global.getPath() + File.separator + "ethminer.exe";
private String winGenesis = Global.getPath() + File.separator + "genesis.json";//==Mac
private String winGethBinary = Global.getPath() + File.separator + "geth.exe";
private String winStartCommand = Global.getPath() + File.separator + "start.cmd";
private String winGethCommand = Global.getPath() + File.separator + "geth.cmd";
private String winEthMinerCommand = Global.getPath() + File.separator + "ethminer.cmd";
private String winStaticNode = Global.getPath() + File.separator + "BCL_Node" + File.separator
+ "geth" + File.separator + "static-nodes.json";//=Mac
//> Mac
//>> Commands

//>> Internal Paths
final private String macStaticNodeRes = "/json/static-nodes.json";//=Win
final private String macEthminerBinaryRes = "/binaries/mac/ethminer";
final private String macGenesisRes = "/json/genesis.json"; //==Win
private final String macGethBinaryRes = "/binaries/mac/geth";
private final String macStartCommandRes = "/commands/mac/start.command";
private final String macGethCommandRes = "/commands/mac/geth.command";
private final String macEthMinerCommandRes = "/commands/mac/ethminer.command";
//>> External Paths
private String macEthminerBinary = Global.getPath() + File.separator + "ethminer";
private String macGenesis = Global.getPath() + File.separator + "genesis.json";//==Win
private String macGethBinary = Global.getPath() + File.separator + "geth";
private String macStartCommand = Global.getPath() + File.separator + "start.command";
private String macGethCommand = Global.getPath() + File.separator + "geth.command";
private String macEthMinerCommand = Global.getPath() + File.separator + "ethminer.command";
private String macStaticNode = Global.getPath() + File.separator + "BCL_Node" + File.separator
+ "geth" + File.separator + "static-nodes.json";//=Win

public void BCLFolder() {
try {
Path path = Paths.get(mainFolder);
Files.createDirectories(path);
} catch (IOException e) {
System.out.println("Unable To Create BCL_CL Folder");
e.printStackTrace();
}
}

public void binaries() {
if (Global.getOS().contains("win")) {
Utils.export_resource(winGethBinaryRes, winGethBinary);
Utils.export_resource(winGenesisRes, winGenesis);
Utils.export_resource(winEthminerBinaryRes, winEthminerBinary);
Utils.export_resource(winStaticNodeRes, winStaticNode);
}
if (Global.getOS().contains("mac")) {
Utils.export_resource(macGethBinaryRes, macGethBinary);
Utils.export_resource(macGenesisRes, macGenesis);
Utils.export_resource(macEthminerBinaryRes, macEthminerBinary);
Utils.export_resource(macStaticNodeRes, macStaticNode);
}
}

public void commands() {
if (Global.getOS().contains("win")) {
Utils.export_resource(winStartCommandRes, winStartCommand);
Utils.export_resource(winGethCommandRes, winGethCommand);
Utils.export_resource(winEthMinerCommandRes, winEthMinerCommand);
}
//NOTE: Not else for future linux support
if (Global.getOS().contains("mac")) {
Utils.export_resource(macStartCommandRes, macStartCommand);
Utils.export_resource(macGethCommandRes, macGethCommand);
Utils.export_resource(macEthMinerCommandRes, macEthMinerCommand);
}
}

public void start_command() {

}
}
85 changes: 85 additions & 0 deletions src/main/java/build_structure/Commands.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package build_structure;

import ui.Global;

import java.io.File;
import java.io.IOException;

public class Commands {
//Mac Commands
final static private String macStartCommand = "open " + Global.getPath() + File.separator + "start.command";
final static private String macGethCommand = "open " + Global.getPath() + File.separator + "geth.command";
final static private String macMineCommand = "open " + Global.getPath() + File.separator + "ethminer.command";
//Win Commands
final static private String winStartCommand = "cmd.exe /k start " + Global.getPath() + File.separator + "start.cmd";
final static private String winGethCommand = "cmd.exe /k start " + Global.getPath() + File.separator + "geth.cmd";
final static private String winMineCommand = "cmd.exe /k start " + Global.getPath() + File.separator + "ethminer.cmd";
final static private String winKillAll = "taskkill /IM geth.exe /F";
Process p = null;

public void start() {
try {
if (Global.getOS().contains("mac")) {
p = Runtime.getRuntime().exec(macStartCommand);
} else if (Global.getOS().contains("win")) {
p = Runtime.getRuntime().exec(winStartCommand);
}
Global.getAppProcesses().add(p);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}

public void geth() {
try {
if (Global.getOS().contains("mac")) {
p = Runtime.getRuntime().exec(macGethCommand);
} else if (Global.getOS().contains("win")) {
p = Runtime.getRuntime().exec(winGethCommand);
}
Global.getAppProcesses().add(p);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}

public void mine() {
try {
switch (Global.getOS()) {
case "mac":
p = Runtime.getRuntime().exec(macMineCommand);
break;
case "windows":
p = Runtime.getRuntime().exec(winMineCommand);
break;
}
Global.getAppProcesses().add(p);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}

public static void kill_geth() {
try {
if (Global.getOS().contains("mac")) {
Process p = Runtime.getRuntime().exec("killall geth");
synchronized (p) {
p.waitFor();
}
} else if (Global.getOS().contains("win")) {
Process p = Runtime.getRuntime().exec(winKillAll);
synchronized (p) {
p.waitFor();
}
}
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
33 changes: 33 additions & 0 deletions src/main/java/build_structure/Permission_Commands.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package build_structure;

import ui.Global;

import java.io.File;
import java.io.IOException;

public class Permission_Commands {
final static String macPerm = "chmod -R 777 " + System.getProperty("user.home") + File.separator + "BCL_CL";
final static String winPerm = "icacls " + Global.getPath() + "/grant Users:F";

public static void permission() {
try {
if (Global.getOS().contains("mac")) {
Process p = Runtime.getRuntime().exec(macPerm);
synchronized (p) {
p.waitFor();
}
Global.getAppProcesses().add(p);
} else if (Global.getOS().contains("win")) {//Should grant permissions for whole folder
Process p = Runtime.getRuntime().exec(winPerm);
synchronized (p) {
p.waitFor();
}
}
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

0 comments on commit 4834fca

Please sign in to comment.