Refactored tool paths to util.py, and added linux version of zipalign
This commit is contained in:
parent
513a4592fe
commit
537f359f11
|
@ -1,11 +1,8 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
from .util import *
|
from .util import *
|
||||||
from . import fileutil
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from polly.patcher import process_all_patches
|
|
||||||
|
|
||||||
# Task dependencies
|
# Task dependencies
|
||||||
from .patch_smali import patch_smali
|
from .patch_smali import patch_smali
|
||||||
|
|
||||||
|
@ -32,4 +29,4 @@ def compile_smali():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print(f"Compiling {smali_dir.name} => {dest_dex.name}...")
|
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])
|
_ = subprocess.run([JAVA_BIN, "-jar", SMALI_COMPILER, "a", "-a", "26", smali_dir, "-o", dest_dex])
|
|
@ -22,4 +22,4 @@ def extract():
|
||||||
|
|
||||||
# Extract the apk
|
# Extract the apk
|
||||||
print("Extracting APK...")
|
print("Extracting APK...")
|
||||||
_ = subprocess.run(['java', '-jar', './tools/apktool_2.9.3.jar', 'd', str(target_apk.absolute()), '-o', EXTRACTED_DIR])
|
_ = subprocess.run([JAVA_BIN, '-jar', APKTOOL, 'd', str(target_apk.absolute()), '-o', EXTRACTED_DIR])
|
|
@ -1,4 +1,14 @@
|
||||||
from pathlib import Path
|
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")
|
SOURCE_APK_DIR = Path("source-apk")
|
||||||
|
|
||||||
|
@ -14,3 +24,11 @@ SRC_RESOURCES_DIR = SRC_DIR / "resources"
|
||||||
SRC_SMALI_DIR = SRC_DIR / "smali"
|
SRC_SMALI_DIR = SRC_DIR / "smali"
|
||||||
SRC_RESOURCE_PATCHES_DIR = SRC_DIR / "patches" / "resource"
|
SRC_RESOURCE_PATCHES_DIR = SRC_DIR / "patches" / "resource"
|
||||||
SRC_SMALI_PATCHES_DIR = SRC_DIR / "patches" / "smali"
|
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()
|
BIN
tools/zipalign-linux
Normal file
BIN
tools/zipalign-linux
Normal file
Binary file not shown.
BIN
tools/zipalign-windows.exe
Normal file
BIN
tools/zipalign-windows.exe
Normal file
Binary file not shown.
Loading…
Reference in a new issue