|
|
|
@ -1,12 +1,18 @@ |
|
|
|
import argparse |
|
|
|
import os |
|
|
|
|
|
|
|
from android_java.compile import CompilerStage |
|
|
|
from android_java.execute import ExecutionStatge |
|
|
|
|
|
|
|
|
|
|
|
def do_compile(args): |
|
|
|
pass |
|
|
|
stage = CompilerStage(os.getcwd()) |
|
|
|
stage.compile(args.source_file) |
|
|
|
|
|
|
|
|
|
|
|
def do_run(args): |
|
|
|
pass |
|
|
|
stage = ExecutionStatge(os.getcwd()) |
|
|
|
stage.execute_main_class(args.main_class) |
|
|
|
|
|
|
|
|
|
|
|
def main(): |
|
|
|
@ -14,15 +20,18 @@ def main(): |
|
|
|
subparsers: argparse._SubParsersAction = parser.add_subparsers(dest="mode") |
|
|
|
compile_parser = subparsers.add_parser("compile", help="Compile source file") |
|
|
|
compile_parser.add_argument( |
|
|
|
"SourceFile.java", help="The source file to compile/create dex for" |
|
|
|
"SourceFile.java", |
|
|
|
dest="source_file", |
|
|
|
help="The source file to compile/create dex for", |
|
|
|
) |
|
|
|
|
|
|
|
java_parser = subparsers.add_parser( |
|
|
|
run_parser = subparsers.add_parser( |
|
|
|
"run", |
|
|
|
help="Run main method of class. Ensure you are in the same directory as the source file", |
|
|
|
) |
|
|
|
java_parser.add_argument("MainClass", help="The class to run.") |
|
|
|
run_parser.add_argument("MainClass", help="The class to run.", dest="main_class") |
|
|
|
args = parser.parse_args() |
|
|
|
|
|
|
|
if args.mode == "compile": |
|
|
|
do_compile(args) |
|
|
|
elif args.mode == "run": |
|
|
|
|