diff --git a/buildtool/task/compile_smali.py b/buildtool/task/compile_smali.py index b45ec8b..78c3f10 100644 --- a/buildtool/task/compile_smali.py +++ b/buildtool/task/compile_smali.py @@ -1,11 +1,8 @@ import subprocess from .util import * -from . import fileutil import re -from polly.patcher import process_all_patches - # Task dependencies from .patch_smali import patch_smali @@ -32,4 +29,4 @@ def compile_smali(): continue print(f"Compiling {smali_dir.name} => {dest_dex.name}...") - _ = subprocess.run(["java", "-jar", "tools/smali-3.0.5.jar", "a", "-a", "26", smali_dir, "-o", dest_dex]) \ No newline at end of file + _ = subprocess.run([JAVA_BIN, "-jar", SMALI_COMPILER, "a", "-a", "26", smali_dir, "-o", dest_dex]) \ No newline at end of file diff --git a/buildtool/task/extract.py b/buildtool/task/extract.py index 2b6112d..4ec6b68 100644 --- a/buildtool/task/extract.py +++ b/buildtool/task/extract.py @@ -22,4 +22,4 @@ def extract(): # Extract the apk print("Extracting APK...") - _ = subprocess.run(['java', '-jar', './tools/apktool_2.9.3.jar', 'd', str(target_apk.absolute()), '-o', EXTRACTED_DIR]) \ No newline at end of file + _ = subprocess.run([JAVA_BIN, '-jar', APKTOOL, 'd', str(target_apk.absolute()), '-o', EXTRACTED_DIR]) \ No newline at end of file diff --git a/buildtool/task/util.py b/buildtool/task/util.py index d5e2143..63a466a 100644 --- a/buildtool/task/util.py +++ b/buildtool/task/util.py @@ -1,4 +1,14 @@ from pathlib import Path +import platform + +def determine_system(): + if platform.system() == 'Windows': + return 'windows.exe' + elif platform.system() in ['Linux', 'Darwin']: + return "linux" + else: + print(f"Unknown system: {platform.system()}") + exit(-1) SOURCE_APK_DIR = Path("source-apk") @@ -13,4 +23,12 @@ SRC_DIR = Path("src") SRC_RESOURCES_DIR = SRC_DIR / "resources" SRC_SMALI_DIR = SRC_DIR / "smali" SRC_RESOURCE_PATCHES_DIR = SRC_DIR / "patches" / "resource" -SRC_SMALI_PATCHES_DIR = SRC_DIR / "patches" / "smali" \ No newline at end of file +SRC_SMALI_PATCHES_DIR = SRC_DIR / "patches" / "smali" + +# Tools + +JAVA_BIN = "java" +APKTOOL = "tools/apktool_2.9.3.jar" +SMALI_COMPILER = "tools/smali-3.0.5.jar" +APKSIGNER = 'tools/apksigner.jar' +ZIPALIGN = 'tools/zipalign-' + determine_system() \ No newline at end of file diff --git a/tools/zipalign-linux b/tools/zipalign-linux new file mode 100644 index 0000000..54862cb Binary files /dev/null and b/tools/zipalign-linux differ diff --git a/tools/zipalign-windows.exe b/tools/zipalign-windows.exe new file mode 100644 index 0000000..323e95d Binary files /dev/null and b/tools/zipalign-windows.exe differ