Skip to content

Commit

Permalink
Release of version 1.4-stable: added '-compactInstall' as a main feat…
Browse files Browse the repository at this point in the history
…ure, allowing users to install a compact and precompiled version of all required tools
  • Loading branch information
ThisIsLibra committed Jul 28, 2020
1 parent d230c5b commit 7a4b029
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>libra</groupId>
<artifactId>AndroidProjectCreator</artifactId>
<version>1.3.1-stable</version>
<version>1.4-stable</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/apc/ArgumentManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package apc;

import command.Assembler;
import command.CompactInstaller;
import command.Installer;
import command.Decompiler;
import command.Updater;
Expand Down Expand Up @@ -64,6 +65,17 @@ public void execute(ArgumentPackage arguments) {
//Usage is shown after the installation has successfully been completed
showUsage();
break;
case COMPACT_INSTALL:
/**
* Clones all tools into the library folder from a Github
* repository that is occasionally updated. All tools on
* that repository are precompiled, meaning one only has to
* download the files, resulting in a compacter installation
* in both disk space and time.
*/
CompactInstaller compactInstaller = new CompactInstaller();
compactInstaller.install();
break;
case UPDATE:
/**
* Updating the library is done by pulling the repository
Expand Down Expand Up @@ -126,6 +138,9 @@ public void showUsage() {
for (DecompilerType decompilerType : DecompilerType.values()) {
usage.append("\t\t\t" + decompilerType + "\n");
}
usage.append("\t-compactInstall\n");
usage.append("\t\tDownloads precompiled instances of the tools that are listed at \"-install\" from a repository that is mainted by me.\n");
usage.append("\t\tThis is faster than installing it yourself, but the the \"-update\" will not work. Tools will also be a bit older.\n");
usage.append("\t-update\n");
usage.append("\t\tUpdating the library folder is equal to reinstalling the library using the -install function.\n");
usage.append("\t-decompile\n");
Expand Down Expand Up @@ -158,7 +173,7 @@ private void showError(Exception ex) {
* Display the version information
*/
public void showVersion() {
String versionNumber = "1.3.1-stable";
String versionNumber = "1.4-stable";
StringBuilder version = new StringBuilder();
version.append("[+]AndroidProjectCreator " + versionNumber + " [developed by Max 'Libra' Kersten <[email protected]> or @LibraAnalysis on Twitter]\n");
System.out.println(version.toString());
Expand Down
29 changes: 5 additions & 24 deletions src/main/java/apc/ArgumentParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,40 +51,21 @@ public class ArgumentParser {
public ArgumentPackage setArguments(String[] args) {
//Check if the amount of provided arguments equals one, which is also equal to the installation command. Note that both strings are converted to a lowercase variant.
if (args.length == 1 && "-install".toLowerCase().equals(args[0].toLowerCase())) {
return parseInstall();
return new ArgumentPackage(Action.INSTALL);
//Check if the update command is provided (if it is not the installation command).
} else if (args.length == 1 && "-update".toLowerCase().equals(args[0].toLowerCase())) {
return parseUpdate();
return new ArgumentPackage(Action.UPDATE);
//Check if the amount of arguments equals 4 or 5, of which the first equals to the decompile command.
} else if ((args.length == 4 || args.length == 5) && "-decompile".toLowerCase().equals(args[0].toLowerCase())) {
return parseDecompile(args);
//Check if the compact install argument is provided
} else if (args.length == 1 && "-compactInstall".toLowerCase().equals(args[0].toLowerCase())) {
return new ArgumentPackage(Action.COMPACT_INSTALL);
}
//Return error if something went wrong
return new ArgumentPackage(Action.ERROR);
}

/**
* Obtain an argument package to install the tools
*
* @return the argument package which can be sent over to the argument
* manager
*/
private ArgumentPackage parseInstall() {
ArgumentPackage argumentPackage = new ArgumentPackage(Action.INSTALL);
return argumentPackage;
}

/**
* Obtain an argument package to update the embedded tools
*
* @return the argument package which can be sent over to the argument
* manager
*/
private ArgumentPackage parseUpdate() {
ArgumentPackage argumentPackage = new ArgumentPackage(Action.UPDATE);
return argumentPackage;
}

/**
* Obtain an argument package to decompile a given APK with a given
* decompiler. If JEB3 isn't chosen as the decompiler, requesting the JEB3
Expand Down
56 changes: 56 additions & 0 deletions src/main/java/command/CompactInstaller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (C) 2020 Max 'Libra' Kersten
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package command;

import apc.RepositoryManager;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import library.Constants;
import model.Repository;

/**
* Handles the compact installation of all required tools for
* AndroidProjectCreator.
*
* @author Max 'Libra' Kersten
*/
public class CompactInstaller {

/**
* Performs the compact installation of the required tools by cloning a
* repository directly into the library folder
*/
public void install() throws IOException, InterruptedException, Exception {
System.out.println("[+]Starting the installation");
RepositoryManager repositoryManager = new RepositoryManager();
System.out.println("[+]Starting cloning the repositories");
List<Repository> repository = new ArrayList<>();
String name = "CompactInstall version 1.0 (dated 28-07-2020)";
String url = "https://github.com/thisislibra/apc-compact.git";
File directory = new File(Constants.LIBRARY_FOLDER);
String branch = "28-07-2020";
repository.add(new Repository(name, url, directory, branch));
repositoryManager.cloneRepositories(repository);
System.out.println("[+]Cloning finished");
System.out.println("[+]Verifying the toolset");
repositoryManager.verifyInstallation();
System.out.println("[+]Verification succesful!");
System.out.println("[+]Installation complete!");
}
}
1 change: 1 addition & 0 deletions src/main/java/enumeration/Action.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
public enum Action {
INSTALL,
COMPACT_INSTALL,
UPDATE,
DECOMPILE,
ERROR
Expand Down
Binary file not shown.

0 comments on commit 7a4b029

Please sign in to comment.